Q5.When a variable is declared as 'static' at the global level in C, where does it get stored?
a) in the stack
b) in the heap
c) in the data segment
d) in the code segment
Answer: c) in the data segment
Q6.What is the default initial value of a variable declared as 'static' in C?
a) 0
b) 1
c) Random garbage value
d) Compiler dependent
Answer: a) 0
Q7.If a variable is declared as 'extern' in C, where is its actual storage allocated?
a) in the stack
b) in the heap
c) in the data segment
d) in the code segment
Answer: c) in the data segment
Q8.When a variable is declared as 'register' in C, where is it allocated?
a) in the stack
b) in the heap
c) in the data segment
d) in the CPU register for faster access
Answer: d) in the CPU register for faster access
Q9.What happens to a variable declared as 'auto' in C when the function in which it is declared ends?
a) It retains its value for the next function call
b) It is stored in the register
c) It becomes a global variable
d) It is automatically deallocated
Answer: d) It is automatically deallocated
Q10.The 'const' keyword is used to declare variables with which storage class in C?
a) auto
b) static
c) extern
d) register
Answer: a) auto
Q11.Which storage class is used to declare variables that are visible only within the file they are declared in?
a) auto
b) static
c) extern
d) register
Answer: b) static
Q12.Where are global variables declared in C stored by default?
a) in the stack
b) in the heap
c) in the data segment
d) in the code segment
Answer: c) in the data segment
Q13.Which storage class in C is used to declare variables that exist for the entire duration of the program?
a) auto
b) extern
c) static
d) register
Answer: b) extern
Q14.What is the default storage class for a global variable declared outside of any function in C?
a) auto
b) extern
c) static
d) register
Answer: b) extern
Q15.In C programming, which storage class is used to declare variables stored on the stack?
a) auto
b) extern
c) static
d) register
Answer: a) auto
Q16.How many storage classes are there in C programming?
a) 2
b) 3
c) 4
d) 5
Answer: c) 4
Q17.Which storage class in C is used to declare variables that remain in memory for the entire program execution?
a) auto
b) extern
c) static
d) register
Answer: C) static
Q18.What happens to a variable declared as 'register' in C if there are more variables to store than available registers?
a) It gets stored in the data segment
b) It gets stored in the heap
c) It gets stored in the stack
d) It behaves like an 'auto' variable
Answer: d) It behaves like an 'auto' variable
Q19.In which storage class can the address of a variable be taken in C?
a) auto
b) extern
c) static
d) register
Answer: b) extern
Q20.Which storage class is used to declare variables that are stored in the heap memory in C?
a) auto
b) extern
c) static
d) malloc
Answer: d) malloc
Q21.What storage class is used to declare variables that are automatically deallocated when the program exits in C?
b) auto
c) extern
d) static
d) register
Answer: b) extern
Q22.What storage class is used to declare variables that are stored in a specific memory location in C?
a) auto
b) extern
c) static
d) volatile
Answer: d) volatile
Q23.Which storage class in C is used to declare variables that are accessed faster than variables stored in memory?
a) auto
b) extern
c) static
d) register
Answer: d) register
Q24.The keyword 'volatile' is used to declare variables with which storage class in C?
a) auto
b) extern
c) static
d) register
Answer: b) extern
Q25.Which storage class in C is used to declare variables that retain their value between function calls?
a) auto
b) extern
c) static
d) register
Answer: c) static
Previous Topic:-->>Files MCQ. || Next topic:-->>Dynamic Memory MCQ in C.