Important MCQ

int x=0; if(x>0) P; else if(x<0) N; else Z; gives

Q.int x=0; if(x>0) P; else if(x<0) N; else Z; gives

A) Z
B) P
C) N
D) nothing
Correct Answer:
Option A
Detailed Explanation:
A) Z is correct. An else-if ladder tests multiple conditions in order. Once one condition is true, its block runs and the remaining branches are skipped; the final else handles no match.