Important MCQ

Output? int x = 4; if (x > 2) { cout << "A"; } else { cout << "B"; } else { cout << "C"; }

Q.Output? int x = 4; if (x > 2) { cout << "A"; } else { cout << "B"; } else { cout << "C"; }

A) A
B) B
C) Compile error
D) Error
Correct Answer:
Option C
Detailed Explanation:
Two else for one if is a syntax error.