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
Q27: Which of the following is true?<br>A) Pseudocode
Q28: What is the size in bits of
Q29: Which of the following is not a
Q30: In an expression containing values of the
Q31: Which of the following is not a
Q33: Which of the following is not a
Q34: Java is considered a strongly typed language
Q35: Which of the following is a double-selection
Q36: How many times is the body of
Q37: Local variables must be _.<br>A) initialized when