Difficulty: Easy
Correct Answer: 2
Explanation:
Introduction / Context:
This problem checks knowledge of how enumeration types are stored in memory on older 16-bit C implementations and what sizeof yields for an enum object.
Given Data / Assumptions:
Concept / Approach:
In C, the size of an enum type is implementation-defined, but historically on 16-bit compilers (e.g., Turbo C), enum typically has the size of int. On such systems, int is 2 bytes, so sizeof(enum variable) is 2.
Step-by-Step Solution:
Verification / Alternative check:
Modern 32-bit or 64-bit compilers often make enum the size of int (commonly 4 bytes). The question explicitly fixes a 16-bit context to remove this ambiguity.
Why Other Options Are Wrong:
Common Pitfalls:
Assuming sizeof(enum) is always 4. It depends on the compiler and target model; always consider platform details given in the stem.
Final Answer:
2
Discussion & Comments