Important MCQ

Output? int x = 1; switch (x) { case 1: cout << "A"; break; case 1 + 1: cout << "B"; break; }

Q.Output? int x = 1; switch (x) { case 1: cout << "A"; break; case 1 + 1: cout << "B"; break; }

A) A
B) AB
C) B
D) Error
Correct Answer:
Option A
Detailed Explanation:
1+1 is a valid constant expression for case 2.