Chapter - 7: Data Types Revisited

State whether the following statements are True or False:


C
Sections
1
Exercises

(a) Storage for a register storage class variable is allocated each time the control reaches the block in which it is present.

True.

 

(b) An extern storage class variable is not available to the functions that precede its definition unless the variable is explicitly declared in these functions.

False: There's no need to redeclare an extern variable, after declaring it externally, it is available in all function.

 

(c) The value of an automatic storage class variable persists between various function invocations.

False: Its persistence is limited within the block.

 

(d) If the CPU registers are not available, the register storage class variables are treated as static storage class variables.

False: If CPU registers are not available, the register storage

 

(e) The register storage class variables cannot hold float values.

False: If the CPU architecture is higher than 16-bit, so, it can also hold floats and doubles.

 

(f) If we try to use register storage class for a float variable the compiler will flash an error message.

False: It compiler will not flash any error.

 

(g) If the variable x is defined as extern and a variable x is also defined as a local variable of some function, then the global variable gets preference over the local variable.

False: Reverse is true.

 

(h) The default value for the automatic variable is zero.

False: Default value is garbage value.

 

(i) The life of the static variable is until the control remains within the block in which it is defined.

False: Life of static variable is till the execution of the program doesn't reach the end.

 

(j) If a global variable is to be defined, then the extern the keyword is necessary, in its declaration.

False: If a variable is defined outside all of the functions,  so it became an extern variable, without mentioning, extern keyword.

 

(k) The address of register variable is not accessible. 

True. (In case of C, but in C++, it is accessible.)

 

(l) A variable that is defined outside all functions can also have a static storage class.

True.

 

(m) One variable can have multiple storage class.

False: A variable can only have only one storage class.


© 2021 Garbage Valuegarbage value logo