static & Storage Classes

This C quiz digs into storage classes, the keywords that decide how long a variable lives and who can see it. You will trace static local counters, reason about default initialization and linkage, and spot code that breaks the rules for static and register.

कठिन 10 सवाल ~8 मिनट पास होने के लिए 80% C17

मोड चुनें

आप गेस्ट के तौर पर खेल रहे हैं: XP और streak सेव रखने के लिए साइन इन करें।

सैंपल सवाल

सवाल 1 / 10

What does this print?

#include <stdio.h>

int next(void) {
    static int n = 0;
    n++;
    return n;
}

int main(void) {
    int a = next();
    int b = next();
    int c = next();
    printf("%d %d %d\n", a, b, c);
    return 0;
}
जवाब दिखाएं

C. 1 2 3 A static local is created once, before the program starts, and keeps its value between calls. static int n = 0; is not run again on each call, so n goes 1, 2, 3.

इस क्विज़ में क्या है

  • static local variables keep their value between calls
  • Static initializers run once and must be constant
  • static and extern at file scope (linkage)
  • Default zero initialization of static storage
  • register and why its address cannot be taken

अक्सर पूछे जाने वाले सवाल

क्या अकाउंट ज़रूरी है?

नहीं। कोई भी खेल सकता है। XP, streak, badge और हिस्ट्री सेव रखने के लिए साइन इन करें।

क्या मैं इसे दोबारा दे सकता हूं?

हां। आपका बेस्ट स्कोर सेव रहता है, और हर बार सवाल और जवाब शफ़ल होते हैं।