C Quiz: Unions & Enums

This C quiz covers enums, which give names to integer constants, and unions, whose members share the same memory. You will predict enum values, build a tagged union and learn what C does and does not promise about them.

मीडियम 10 सवाल ~6 मिनट पास होने के लिए 80% C17

मोड चुनें

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

सैंपल सवाल

सवाल 1 / 10

What does this print?

#include <stdio.h>

enum color { RED, GREEN, BLUE };

int main(void) {
    printf("%d %d %d\n", RED, GREEN, BLUE);
    return 0;
}
जवाब दिखाएं

D. 0 1 2 Enum constants are plain integers that start at 0 and go up by one. printf() prints numbers, C has no built-in way to get an enum's name as text.

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

  • Default and explicit enum values
  • Enums in switch and the COUNT trick for array sizes
  • Why enum constants live in one shared namespace
  • Union members share storage, so the last write wins
  • Tagged unions and the size of a union

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

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

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

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

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