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 | ATwo branches: Pass is output when Mark >= 50 is TRUE, otherwise Fail is output. Exactly one branch runs. | |
| 2ELSE OUTPUT "Fail" | BENDIF is missing, so the IF...ELSE structure is never closed. | |
| 3ELSE lines up with its IF, and ENDIF closes the whole structure | CThe ELSE branch, which runs only when the IF condition is FALSE and has no condition of its own. | |
| 4One result only: if the condition is FALSE, only the ELSE branch runs | DELSE was given its own condition (Mark < 50 THEN). ELSE has no condition; it just runs when the IF condition is FALSE. | |
| 5IF Mark >= 50 THEN OUTPUT "Pass" ELSE Mark < 50 THEN OUTPUT "Fail" ENDIF | EScore <- 30 IF Score >= 50 THEN OUTPUT "Pass" ELSE OUTPUT "Fail" ENDIF | |
| 6IF Mark >= 50 THEN OUTPUT "Pass" ELSE OUTPUT "Fail" | FIF Age >= 16 THEN OUTPUT "Allowed" ELSE OUTPUT "Too young" ENDIF |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
ELSE — Adds a second branch that runs when the IF condition is FALSE, so exactly one of the two branches runs. ELSE has no condition of its own and lines up with its IF.IF Mark >= 50 THEN OUTPUT "Pass"
ELSE OUTPUT "Fail"
ENDIFIF Mark >= 50 THEN OUTPUT "Pass"
ELSE OUTPUT "Fail"
ENDIFIF Score >= 40 THEN OUTPUT "Pass"
ELSE OUTPUT "Fail"
ENDIFIF Mark < 50 THEN OUTPUT "Fail"
ELSE OUTPUT "Pass"
ENDIFIF Age >= 18 THEN OUTPUT "Adult"
ELSE OUTPUT "Minor"
ENDIF