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 | |
|---|---|---|
| 1REPEAT INPUT Guess UNTIL Guess = 7 | ANum ← 50 REPEAT OUTPUT Num UNTIL Num > 10 | |
| 2UNTIL Count = 10 | BThe UNTIL condition can never become TRUE because Count only goes up, so the loop never stops. It needs a condition such as Count = 10. | |
| 3A REPEAT loop always runs its body at least once, because the condition is checked after the body | CWHILE Num < 5 DO Num ← Num + 1 ENDWHILE | |
| 4A WHILE loop checks first and may never run, but a REPEAT loop runs once before it checks | DThe stopping condition: the loop ends when Count equals 10 and repeats while it is FALSE | |
| 5REPEAT Count ← Count + 1 ENDREPEAT | EREPEAT loops end with UNTIL and a condition, not ENDREPEAT. The loop needs UNTIL Count = 5 or similar. | |
| 6REPEAT Count ← Count + 1 UNTIL Count < 0 | FAsks for a guess at least once and keeps asking until the guess equals 7 |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
REPEAT ... UNTIL condition — A loop that runs its lines first, then checks the UNTIL condition. It stops when the condition is TRUE, so the body always runs at least once.REPEAT
INPUT Guess
UNTIL Guess = 7REPEAT
Count ← Count + 1
UNTIL Count = 5REPEAT
INPUT Password
UNTIL Password = "open"REPEAT
INPUT Number
UNTIL Number >= 1 AND Number <= 10REPEAT
Lives ← Lives - 1
UNTIL Lives <= 0