Question 1 of 10
What is displayed when temp is 32?
IF (temp < 32)
{
DISPLAY ("freeze")
}
ELSE
{
DISPLAY ("safe")
}
- A. safe
- B. 32
- C. Nothing is displayed.
- D. freeze
What is displayed when temp is 32?
IF (temp < 32)
{
DISPLAY ("freeze")
}
ELSE
{
DISPLAY ("safe")
}
For score = 90, what is displayed?
IF (score >= 90)
{
DISPLAY ("pass")
}
ELSE
{
DISPLAY ("retry")
}
A shipping rule uses weight. Both branches look useful. For weight = 10, what is displayed?
IF (weight <= 10)
{
DISPLAY ("standard box")
}
ELSE
{
DISPLAY ("large box")
}
Which value of n causes the ELSE branch to run?
IF (n > 5)
{
DISPLAY ("above")
}
ELSE
{
DISPLAY ("not above")
}
Trace with balance = 50.
IF (balance < 50)
{
fee ← 5
}
ELSE
{
fee ← 0
}
DISPLAY (fee)
What is displayed?
age is 17. What is displayed?
IF (age >= 18)
{
DISPLAY ("adult")
}
ELSE
{
DISPLAY ("minor")
}
For x = 0, which message appears?
IF (x = 0)
{
DISPLAY ("zero")
}
ELSE
{
DISPLAY ("nonzero")
}
A thermostat uses the segment below with reading = 72. Both displayed phrases sound reasonable for a home. What actually displays?
IF (reading > 72)
{
DISPLAY ("cool the room")
}
ELSE
{
DISPLAY ("leave as is")
}
points is 100. What is grade after the segment?
IF (points > 100)
{
grade ← "error"
}
ELSE
{
grade ← "ok"
}
Which input makes "below" display?
IF (speed >= 60)
{
DISPLAY ("at or above")
}
ELSE
{
DISPLAY ("below")
}