Important MCQ

Output? int x = 8; if (x > 5) { cout << "A"; if (x > 7) { cout << "B"; if (x > 9) cout << "C"; } cout << "D"; }

Q.Output? int x = 8; if (x > 5) { cout << "A"; if (x > 7) { cout << "B"; if (x > 9) cout << "C"; } cout << "D"; }

A) AB
B) ABD
C) ABCD
D) AD
Correct Answer:
Option B
Detailed Explanation:
x > 9 is false so C is skipped; D prints after inner block.