Multiple choice

Directions: Use the following program segment:

IF Sex$ = "M" THEN IF Height > 66 THEN IF Weight > 180 THEN PRINT "Try out for the football team." END IF END IF END IF

What happens if the value of Height is 66, Weight 181, and Sex equals M when this statement is executed?

  1. The message Try out for football team. is displayed.

  2. Nothing happens; program execution simply continues on to the next statement.

  3. An error message is displayed.

  4. The program immediately stops executing.

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

When Height=66, the condition (Height > 66) is false because 66 is not greater than 66 (it's equal). The innermost IF block containing the PRINT statement is never executed. No error occurs; the nested IFs simply complete without action.