Important MCQ

Output? int a = 10; if (a > 5) cout << "1"; else if (a > 8) cout << "2"; else cout << "3";

Q.Output? int a = 10; if (a > 5) cout << "1"; else if (a > 8) cout << "2"; else cout << "3";

A) 1
B) 2
C) 3
D) 12
Correct Answer:
Option A
Detailed Explanation:
Both a>5 and a>8 are true, but only the first runs.