Examlex

Solved

What Is Output by the Following Java Code Segment

question 32

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!") ;
}


Definitions:

Case Study

A carefully drawn biography of an individual.

Standardized Intelligence Test

A psychometric test designed to measure a person's intellectual capabilities in comparison to the population.

IQ Scores

Quantitative measures of intelligence, typically obtained through standardized tests, reflecting cognitive abilities in relation to a peer group.

Inherently Good

A philosophical and ethical stance suggesting that human beings are born with an innate tendency towards goodness.

Related Questions