Multiple Choice
What is output by the following Java code segment?
Int temp = 180;
While (temp != 80)
{
If (temp > 90)
{
System.out.print("This porridge is too hot! ") ;
// cool down
Temp = temp - (temp > 150 ? 100 : 20) ;
}
Else
{
If (temp < 70)
{
System.out.print(
"This porridge is too cold! ") ;
// warm up
Temp = temp + (temp < 50 ? 30 : 20) ;
}
}
}
If (temp == 80)
System.out.println("This porridge is just right!") ;
A) This porridge is too cold! This porridge is just right!
B) This porridge is too hot! This porridge is just right!
C) This porridge is just right!
D) None of the above.
Correct Answer:

Verified
Correct Answer:
Verified
Q8: How many times is the body of
Q8: Which statement is false?<br>A) Unless directed otherwise,
Q9: In Java graphics,coordinate units are measured in
Q13: Counter-controlled repetition is also known as:<br>A)Definite repetition<br>B)Indefinite
Q14: In an expression containing values of the
Q16: A decision symbol in an activity diagram
Q17: In an activity diagram,the merge symbol has
Q24: Which of the following is the shape
Q29: Which of the following is not a
Q31: Which of the following is not a