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 | AEach IF has its own ENDIF: the inner one closes first, then the outer one | |
| 2 ENDIF ENDIF | BThe second IF is nested inside the THEN part, so it is only checked when Mark is at least 50 | |
| 3A nested IF can be put in the ELSE part, so it is only reached when the outer condition is false | CThe outer IF has no ENDIF, because only the inner IF was closed. Each IF needs its own ENDIF. | |
| 4Choosing between three outcomes needs a nested IF, with the code indented two more spaces | DThe nested IF is not indented by two more spaces, so it is hard to see that it sits inside the ELSE. | |
| 5IF Mark >= 50 THEN IF Mark >= 80 THEN OUTPUT "Merit" ENDIF | EIF Age >= 18 THEN OUTPUT "Adult" ELSE IF Age >= 13 THEN | |
| 6IF Mark >= 50 THEN OUTPUT "Pass" ELSE IF Mark >= 40 THEN OUTPUT "Near" ENDIF ENDIF | FIF Score >= 50 THEN OUTPUT "Pass" ELSE IF Score >= 40 THEN OUTPUT "Near" ELSE OUTPUT "Fail" ENDIF ENDIF |
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 written inside the THEN or ELSE part of another IF. It only runs when the outer condition leads to it, and each IF needs its own ENDIF.IF Score >= 50 THEN
IF Score >= 80 THEN
OUTPUT "Distinction"IF Age >= 13 THEN
IF Age <= 19 THEN
OUTPUT "Teenager" OUTPUT "Distinction"
ENDIF
ENDIFIF Mark >= 50 THEN
OUTPUT "Pass"
ELSEIF Temp > 0 THEN
IF Temp < 25 THEN
OUTPUT "Mild"