What is the result if the integer value is 33?

Given the following code fragment:
<code>
if (value >= 0) {
if (value != 0)
System.out.print(“the “);
else
System.out.print(“quick “);
if (value < 10)
System.out.print(“brown “);
if (value > 30)
System.out.print(“fox “);
else if (value < 50)
System.out.print(“jumps “);
else if (value < 10)
System.out.print(“over “);
else
System.out.print(“the “);
if (value > 10)
System.out.print(“lazy “);
} else {
System.out.print(“dog “);
}
System.out.print(“… “);
}
</code>
What is the result if the integer value is 33?

Given the following code fragment:

if (value >= 0) {
if (value != 0)
System.out.print("the ");
else
System.out.print("quick ");
if (value < 10)
System.out.print("brown ");
if (value > 30)
System.out.print("fox ");
else if (value < 50)
System.out.print("jumps ");
else if (value < 10)
System.out.print("over ");
else
System.out.print("the ");
if (value > 10)
System.out.print("lazy ");
} else {
System.out.print("dog ");
}
System.out.print("… ");
}

What is the result if the integer value is 33?

A.
The fox jump lazy …

B.
The fox lazy …

C.
Quick fox over lazy …

D.
Quick fox the ….

Explanation:

33 is greater than 0.
33 is not equal to 0.
the is printed.
33 is greater than 30
fox is printed
33 is greater then 10 (the two else if are skipped)
lazy is printed
finally … is printed.



Leave a Reply 1

Your email address will not be published. Required fields are marked *


sully

sully

there is no finally to print.
isn’t this a nested if statement where you take the inner loop and work ur way out