← 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 →- Q1. What does this print? (code)
- Q2. What is the difference between scope and lifetime?
- Q3. What does extern int count; do?
- Q4. A global variable is declared as static int hits; in log.c. What is true?
- Q5. Which of these will NOT compile?
- Q6. What does this print? (code)
- Q7. What is the default value of an uninitialised auto (local) int?
- Q8. Why is static int t = n 2; (inside a function, n a parameter) an error?
- Q9. Where do static and global variables live in memory?
- Q10. A function returns the address of its local array char buf[20]; (not static). What is the problem?
- Q11. What does this print? (code)
- Q12. What does this print? (code)
- Q13. What does static do when written before a function, as in static void helper(void)?
- Q14. Which variable keeps its value between calls but can be used only inside its own function?
- Q15. Where are ordinary auto local variables stored?