Multiple choice

What will be the output for the following? enum color{pink,yellow,blue,black}; #include<iostream.h> void main() { cout<<blue; cout<<black; }

  1. Blue Black

  2. 3 4

  3. 2 3

  4. None of the above

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

In C++, enum constants are assigned integer values starting from 0 by default. So pink=0, yellow=1, blue=2, black=3. When printed, the enum values are converted to their integer equivalents, producing '2 3' as output.