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 Answer UNTIL Answer = "Y" | AThe loop ends as soon as this condition becomes TRUE | |
| 2UNTIL Count > 5 | BAsks for Answer at least once, then keeps asking until the user types Y | |
| 3A REPEAT loop always runs its body at least once, even if the condition is already TRUE at the start | CENDREPEAT does not exist. A REPEAT loop must finish with UNTIL followed by the condition. | |
| 4A REPEAT loop is closed by UNTIL and its condition, with no separate end keyword such as ENDREPEAT | DREPEAT Total <- Total + 1 UNTIL Total = 10 | |
| 5REPEAT INPUT Pin ENDREPEAT Pin = 1234 | ENum <- 10 REPEAT OUTPUT Num UNTIL Num > 5 | |
| 6REPEAT INPUT Answer UNTIL Answer <> "Y" | FThe condition is the wrong way round. UNTIL stops when TRUE, so this stops on any answer except Y, instead of repeating until the user types Y. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
REPEAT UNTIL — A post-condition loop: the body runs first, then UNTIL tests the condition. It always runs at least once and stops when the condition is TRUE. There is no ENDREPEAT.REPEAT
INPUT Answer
UNTIL Answer = "Y"REPEAT
INPUT Answer
UNTIL Answer = "Y"REPEAT
INPUT Answer
UNTIL Answer = "Y"REPEAT
INPUT Num
UNTIL Num >= 1 AND Num <= 10REPEAT
Count <- Count + 1
UNTIL Count = 5