Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1IF Mark >= 50 THEN IF Mark >= 80 THEN OUTPUT "Distinction" ENDIF ENDIF | AA nested IF: the inner test Mark >= 80 is only checked when the outer test Mark >= 50 is TRUE. | |
| 2IF Age >= 18 THEN OUTPUT "Adult" ELSE IF Age >= 13 THEN OUTPUT "Teen" ENDIF ENDIF | BIF Score > 0 THEN IF Score < 100 THEN OUTPUT "Valid" ENDIF ENDIF | |
| 3Every IF, including an inner IF, must be closed by its own ENDIF, and the inner ENDIF comes first. | CIF Temp > 30 THEN OUTPUT "Hot" ELSE IF Temp > 15 THEN OUTPUT "Warm" ENDIF ENDIF | |
| 4A nested IF can be placed in the ELSE part so that a second condition is only tested if the first is FALSE. | DThe outer IF is never closed. The inner ENDIF only closes the inner IF, so a final ENDIF is missing. | |
| 5IF X > 0 THEN IF X < 10 THEN OUTPUT "Small" ENDIF | EThe inner IF has no ENDIF of its own. Two IFs need two ENDIFs, so the second ENDIF is missing. | |
| 6IF Age >= 18 THEN OUTPUT "Adult" ELSE IF Age >= 13 THEN OUTPUT "Teen" ENDIF | FAn IF inside the ELSE part: the second test is only checked when Age >= 18 is FALSE. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
nested IF — An IF statement placed inside the THEN or ELSE part of another IF, with its own ENDIF. The inner condition is only checked when the outer one sends the program into that part.IF Age >= 13 THEN
IF Age < 20 THEN
OUTPUT "Teen" OUTPUT "Teen"
ENDIF
ENDIFIF Mark >= 80 THEN OUTPUT "Distinction"
ELSE
IF Mark >= 50 THEN OUTPUT "Pass"IF Age >= 18 THEN
IF HasTicket = TRUE THEN
OUTPUT "Enter" ENDIF
ENDIF
ENDIF