Storage Class Questions and Answers
Storage Class Questions with Answers are a core part of C programming aptitude and interview tests. These programming questions and answers cover storage types like auto, static, register, and extern, which define variable scope and lifetime. Frequently asked in Wipro, Tech Mahindra, and TCS exams, storage class MCQs evaluate your understanding of memory management and code optimization. Solving these C programming MCQs with detailed explanations will enhance your technical readiness. You can practice online or download free PDFs of storage class questions for quick revision.
Storage Class
Showing 10 of
97 questions
61. Find the output void main ( ) { static int i=i++, j=j++; printf('%c", s); } printf("%d", s); }
- 11
- Garbage value
- Compilation error
- None of these
62. Find the output void main ( ) { static int i=i++, j=j++; printf("%d%d", i, j); }
- 11
- Garbage value
- Compilation error
- None of these
63. Find the output char s; void main ( ) { s='a}'; { static char s='b'; printf ('%c",s); }
- b97
- b0
- b49
- Compilation error
64. The extern storage class can be used to
- Access a variable from another file.
- Access a global variable.
- Both a and b
- None of these
65. Find the output void main ( ) { show ( ); dis ( ); } show ( ) { extern int x; x--; printf("%d", x); } int x=10; dis ( ) { { x++; printf('%d", x); }
- 10 11
- Garbage 11
- 9 10
- Compilation error
66. Find the output void main ( ) { extern int a; a=10; printf("5d", sizeof (a)); }
- 2
- 0
- Compilation error
- None of these
67. Find the output int a=6; void main ( ) { static int *x=&a; printf('5d", *x); }
- 6
- 0
- Compilation error
- None of these
68. State the incorrect statement
- Memory for a static variable is not deallocated until the entire program terminates.
- Memory for a static variable is allocated exactly once, at the very beginning of program execution.
- Static variable is visible throughout the function, but not outside.
- Static variable creates program scoping.
69. The disadvantages of external storage class is/are
- The storage for an external variable exists even when the variable is not needed
- The side effect may produce surprising output
- Modification of the program is difficult
- All of these
70. The advantages of external storage calss
- Persistent storage of a variable retains the latest value
- The value is globally available
- Generality of a program is affected
- Both a and b