Skills101
← All practice quizzes

Quiz: Storage Classes in C

5 questions · new set on every retakeNo time limitPass: 60%+10 XP on first pass

Every C variable has a scope (where its name works), a lifetime (how long it exists) and a linkage (whether other files can see it). Learn how auto, static, extern and register control all three, with programs you can run.

Log in to take the quiz

Free account · see your score, answers and explanations, earn XP

  1. Question 1

    What does this print?

    #include <stdio.h>
    void f(void) {
        static int s = 5;
        int a = 5;
        s++; a++;
        printf("%d %d ", s, a);
    }
    int main(void) {
        f(); f(); f();
        return 0;
    }
    
  2. Question 2

    What is the difference between scope and lifetime?

  3. Question 3

    What does extern int count; do?

  4. Question 4

    A global variable is declared as static int hits; in log.c. What is true?

  5. Question 5

    Which of these will NOT compile?

🎯 Today’s placement challenge — 10 questions, no login. Can you score 10/10?Take today’s challenge →