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 OUTPUT "Pass" ELSE OUTPUT "Fail" ENDIF | AIF Number MOD 2 = 0 THEN OUTPUT "Even" ELSE OUTPUT "Odd" ENDIF | |
| 2ELSE IF Score >= 40 THEN | BELSE was given its own condition and THEN. ELSE never has a condition. It should be written on its own line as just ELSE. | |
| 3ELSE has no condition of its own. It simply runs when the IF condition is FALSE. | CIF Age >= 16 THEN OUTPUT "Allowed" ELSE OUTPUT "Not allowed" ENDIF | |
| 4Exactly one branch runs: THEN or ELSE, never both and never neither. | DOutputs Pass if Mark is 50 or more, otherwise outputs Fail. Exactly one of the two lines runs. | |
| 5IF Mark >= 50 THEN OUTPUT "Pass" ELSE Mark < 50 THEN OUTPUT "Fail" ENDIF | EThe ENDIF is missing. Every IF...THEN...ELSE structure must be closed with ENDIF. | |
| 6IF Mark >= 50 THEN OUTPUT "Pass" ELSE OUTPUT "Fail" | FAdds a second condition that is only checked when the first IF condition was FALSE. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
ELSE — Starts the lines that run when the IF condition is FALSE. Exactly one branch runs: THEN or ELSE, never both. ELSE has no condition of its own.IF Mark >= 50 THEN OUTPUT "Pass"
ELSE OUTPUT "Fail"
ENDIFIF Temp > 30 THEN OUTPUT "Hot"
ELSE OUTPUT "Not hot"
ENDIFIF Score >= 70 THEN OUTPUT "A"
ELSE IF Score >= 50 THEN OUTPUT "B"
ELSE OUTPUT "C" ENDIFIF Stock < 5 THEN OUTPUT "Reorder"
ELSE OUTPUT "Stock OK"
ENDIFIF Pin = Code THEN OUTPUT "Open"
ELSE OUTPUT "Locked"
ENDIF