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
91. Which storage class can retain values in between system calls ?
- auto
- static
- extern
- Global
92. The static storage class specifier can not be applied to
- Functions
- Function declarations within a block
- Anonymous unions
- All of these
93. Find the output. void main (register int argc) { static int y; y=argc; printf("%d",y); }
- 0
- 1
- 2
- Compilation error
94. Find the output int main (void); int main ( ) { unsigned int static main =4; int (*p) ( ); p=(int *) main ; (*p) ( ); printf("%d", main++); return 0; }
- 4
- stack overflow
- Abnormal program termination
- Compilation error
95. Find the output main ( ) { static int a[5]={1, 2, 3, 4, 5}; static int b[5]={6, 7, 8, 9, 10}; int i; for (i=0; i<10; i++) printf("%d", a[i]); }
- 1, 2, 3, 4, 5, 0, 0, 0, 0, 0
- 1,2,3,4,5,6,7,8,9,10
- 1,2,3,4,5,garbage
- None of these
96. Choose the correct one a.c a) static char x[4000]; void main ( ) { } b.c b) void main ( ) { auto char x[4000]; }
- Size of a is more than size of b
- size of b is more than size of a
- both a and b is same size
- None of the above
97. How many time the loop wil iterate ? void main ( ) { register char i=1; while (i) { printf("%d", i); i++; } }
- infinite times
- 255 times
- 65535 times
- none of these