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 | |
|---|---|---|
| 1FOR Count ← 1 TO 10 | AFOR needs a known number as its end value, not a condition. A condition-based repeat needs WHILE or REPEAT. | |
| 2REPEAT ... UNTIL Guess = Secret | BA WHILE loop must end with ENDWHILE, not NEXT. NEXT belongs to a FOR loop. | |
| 3The condition is tested at the start, so the loop body may never run | CA count-controlled loop: the number of repeats is known (10) before it starts | |
| 4The number of repeats is known: read exactly 5 marks | DWHILE Password <> "open" DO | |
| 5WHILE Total < 100 DO INPUT Num Total ← Total + Num NEXT | EA condition-controlled loop that tests at the end, so the body always runs at least once | |
| 6FOR Count ← 1 TO Answer <> 5 | FFOR Index ← 1 TO 5 |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
FOR, WHILE, REPEAT — Use FOR when the number of repeats is known. Use WHILE (tests at the start) or REPEAT (tests at the end) when repeating depends on a condition.FOR Count ← 1 TO 5
OUTPUT Count
NEXT CountWHILE Number < 0 DO
INPUT Number
ENDWHILEREPEAT
INPUT Guess
UNTIL Guess = 7WHILE Lives > 0 DO
Lives ← Lives - 1
ENDWHILEFOR Day ← 1 TO 7
OUTPUT Day
NEXT Day