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 | |
|---|---|---|
| 1CASE OF Choice | AIF Age >= 16 AND HasTicket = TRUE THEN | |
| 2IF Mark >= 70 THEN | BTests one variable, Choice, against several single values such as 1, 2 or 3, like a menu | |
| 3A menu where the user picks 1, 2 or 3 is one variable tested against single values, so use CASE | CCASE OF Choice 1 : OUTPUT "Play" 2 : OUTPUT "Quit" ENDCASE | |
| 4A condition that combines two variables cannot be written as a CASE, so use IF | DTests a range of values, so IF is used rather than CASE, as in grade boundaries | |
| 5CASE OF Mark 70 TO 100 : Grade ← "A" ENDCASE | EGrade boundaries are ranges, so CASE is the wrong choice. Use IF Mark >= 70 THEN instead. | |
| 6IF Choice = 1 THEN OUTPUT "Play" ELSE IF Choice = 2 THEN OUTPUT "Quit" ENDIF ENDIF | FA menu tests one variable against single values, so CASE OF Choice is clearer than long nested IF statements. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
CASE OF — Use CASE OF to test one variable against single values, like a menu choice. Use IF for ranges, like grade boundaries, or when conditions combine several variables.CASE Choice OF
1 : OUTPUT "Play"
ENDCASECASE Choice OF
2 : OUTPUT "Quit"
ENDCASEIF Mark >= 70 THEN
OUTPUT "Merit"
ENDIFIF Age >= 13 AND Score > 50 THEN
OUTPUT "Pass"
ENDIFCASE Choice OF
3 : OUTPUT "Help"
ENDCASE