Important MCQ

int a=5,b=3; if(a>0){ if(b>5) cout<<"X"; else cout<<"Y"; } prints

Q.int a=5,b=3; if(a>0){ if(b>5) cout<<"X"; else cout<<"Y"; } prints

A) XY
B) nothing
C) X
D) Y
Correct Answer:
Option D
Detailed Explanation:
D) Y is correct. A nested if is an if statement inside another if. The inner condition is reached only if execution enters the outer block; braces and indentation make the structure clear.