🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← All topics

Quiz: Storage Classes in C: questions with answers

15 questions, each with the answer and a short explanation.

Take the timed quiz + get a certificate →
  1. Q1. What does this print? (code)
  2. Q2. What is the difference between scope and lifetime?
  3. Q3. What does extern int count; do?
  4. Q4. A global variable is declared as static int hits; in log.c. What is true?
  5. Q5. Which of these will NOT compile?
  6. Q6. What does this print? (code)
  7. Q7. What is the default value of an uninitialised auto (local) int?
  8. Q8. Why is static int t = n 2; (inside a function, n a parameter) an error?
  9. Q9. Where do static and global variables live in memory?
  10. Q10. A function returns the address of its local array char buf[20]; (not static). What is the problem?
  11. Q11. What does this print? (code)
  12. Q12. What does this print? (code)
  13. Q13. What does static do when written before a function, as in static void helper(void)?
  14. Q14. Which variable keeps its value between calls but can be used only inside its own function?
  15. Q15. Where are ordinary auto local variables stored?