Declaration of Storage Class
1. Which storage class specifier tells the compiler to store the variable
in the CPU registers?
○ a) static
○ b) extern
○ c) register
○ d) auto
○ Answer: c) register
2. Variables declared inside a function without any storage class
specification are by default:
○ a) static
○ b) extern
○ c) register
○ d) auto
○ Answer: d) auto
3. Which storage class specifier makes a variable accessible across
multiple files?
○ a) static
○ b) extern
○ c) register
○ d) auto
○ Answer: b) extern
4. Which storage class specifier preserves the variable's value between
function calls?
○ a) static
○ b) extern
○ c) register
○ d) auto
○ Answer: a) static
5. What is the default initial value of a static variable?
○ a) Garbage value
○ b) 1
○ c) 0
○ d) -1
○ Answer: c) 0
6. Which storage class is not allowed for global variables?
○ a) static
○ b) extern
○ c) register
○ d) All are allowed.
○ Answer: c) register
7. The scope of a static variable declared inside a function is:
○ a) Global
○ b) Within the function
○ c) Within the block it is defined
○ d) Across all files
○ Answer: b) Within the function
8. The lifespan of an auto variable is:
○ a) Throughout the program
○ b) Until the function returns
○ c) Until the block it is defined ends
○ d) Until the program terminates
○ Answer: c) Until the block it is defined ends
9. Which storage class is used to declare a variable that is known to all
functions in a program file?
○ a) static
○ b) extern
○ c) register
○ d) auto
○ Answer: a) static (when declared outside of functions)
10. What is the scope of an extern variable?
○ a) Local to the function
○ b) Global to the entire program
○ c) Local to the file
○ d) Global to the block
○ Answer: b) Global to the entire program