Difficulty: Easy
Correct Answer: 0, 2, 1
Explanation:
Introduction / Context:
C enumerations by default assign integer values starting at 0 and increment by 1 unless explicitly set. Understanding this default behavior helps in reading printed enum values and interfacing with APIs.
Given Data / Assumptions:
Concept / Approach:
By default: pass = 0, fail = 1, atkt = 2. The program prints the integer values corresponding to the assigned enumerators.
Step-by-Step Solution:
Assign defaults: pass→0, fail→1, atkt→2.Map variables: stud1=0, stud2=2, stud3=1.Print order is stud1, stud2, stud3 → “0, 2, 1”.
Verification / Alternative check:
Adding explicit initializers (e.g., pass=10) would change the printed numbers accordingly; here no such initialization exists.
Why Other Options Are Wrong:
A/D/E list other permutations not matching the actual assignments. B starts at 1 which is not the default.
Common Pitfalls:
Assuming enums start at 1; forgetting the order of printing vs declaration order.
Final Answer:
0, 2, 1
Discussion & Comments