Open In App

ISRO | ISRO CS 2015 | Question 67

Consider the following program fragment

if(a > b)
if(b > c)
s1;
else s2;

s2 will be executed if
(A) a (B) b > c
(C) b >= c and a (D) a > b and b Answer: (D)
Explanation: The code actually works like:

if(a > b)
{
  if(b > c)
     s1;
  else s2;
}

Outer if statement has a scope till the end of inner if and else statements. In order to execute s2, (a>b) should be true so the control enters the inner block and (b>c) should be false. So, (bQuiz of this Question

Article Tags :