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 score >= 50 THEN | AIF temp > 30 THEN OUTPUT "Hot" ELSE OUTPUT "Not hot" ENDIF | |
| 2ELSE | BStarts a selection: the indented lines below run only when score is 50 or more | |
| 3A one-way IF with no ELSE: nothing happens if the condition is false, and ENDIF closes it at the same indent as IF | CThe ENDIF is missing, so the IF construct is never closed. Add ENDIF at the same indent as IF after the ELSE lines. | |
| 4A two-way IF with ELSE: one set of lines runs if the condition is true, a different set runs if it is false | DIF age < 18 THEN OUTPUT "Under 18" ENDIF | |
| 5IF score >= 50 THEN OUTPUT "Pass" ELSE OUTPUT "Fail" | EENDIF is indented as if it were inside the IF. It must line up with IF at the same indent. | |
| 6IF mark = 100 THEN OUTPUT "Full marks" ENDIF | FIntroduces the lines that run when the IF condition is false |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
IF THEN ELSE ENDIF — Runs the indented lines after THEN if the condition is true, otherwise runs the ELSE lines. ENDIF closes the construct and sits at the same indent as IF. ELSE is optional.IF Age >= 18 THEN
OUTPUT "Adult"
ENDIFIF Score >= 50 THEN
OUTPUT "Pass"
ENDIFIF Temp < 10 THEN
OUTPUT "Cold"
ENDIFELSE
OUTPUT "Fail"
ENDIFIF Pin <> 1234 THEN
OUTPUT "Wrong PIN"
ENDIF