C MCQs on Storage Classes
This section focuses on the "Storage Classes" of C programming. These Multiple Choice Questions (mcq) should be practiced to improve the C programming skills required for various interviews (campus interview, walk-in interview, company interview), placement, entrance exam and other competitive examinations.
1. which of the following is not a storage class specifier?
A. auto
B. register
C. extern
D. volatile
View Answer
Ans : A
Explanation: volatile is not a storage class specifier. volatile and const are type qualifiers.
2. what is the inital value of register storage class specifier?
A. 0
B. Null
C. Garbage
D. Infinite
View Answer
Ans : C
Explanation: Garbage is the inital value of register storage class specifier.
3. What is the scope of extern class specifier?
A. Within block
B. Within Program
C. Global Multiple files
D. None of the above
View Answer
Ans : C
Explanation: Global Multiple files is the scope of extern class specifier.
4. What is the scope of static class specifier?
A. Within block
B. Within Program
C. Global Multiple files
D. None of the above
View Answer
Ans : A
Explanation: Within block is the scope of static class specifier.
5. what is the inital value of extern storage class specifier?
A. 0
B. Null
C. Garbage
D. Infinite
View Answer
Ans : A
Explanation: Garbage is the inital value of extern storage class specifier.
6. What will be output for the folowing code?
A. 2 1
B. 0 0
C. 3 2
D. Compilation error
View Answer
Ans : B
Explanation: A static variable is shared among all calls of a function.All calls to main() in the given program share the same x.x becomes 0 before the printf() statement in all calls to main()..
7. What will be output for the folowing code?
A. 5
B. 6
C. 4
D. Compilation error
View Answer
Ans : C
Explanation: we have a constant pointer and we are not changing ptr to point to any other location. We are only decrementing value pointed by ptr.
8. Which of the following statement are correct?
(I) The maximum value a variable can hold depends upon its storage class.
(II) By default all variables enjoy a static storage class.
A. Only I is correct
B. Only II is correct
C. Both I & II are correct
D. Both I & II are incorrect
View Answer
Ans : D
Explanation: The maximum value a variable can hold depends upon its storage class and By default all variables enjoy a static storage class both statement are incorrect.
9. An identifier's storage class determines
A. The time during which the identifier exists in memory
B. Which function is to use
C. Where to store the program
D. None of them
View Answer
Ans : A
Explanation: An identifier's storage class determines The time during which the identifier exists in memory.
10. how many storage classes in c?
A. 2
B. 3
C. 4
D. 5
View Answer
Ans : C
Explanation: There are four storage classes in C those are automatic, register, static, and external.
Also check :
Discussion