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 Password UNTIL Password = "secret" | AA REPEAT loop must finish with UNTIL and a condition. ENDREPEAT does not exist in Cambridge pseudocode. | |
| 2UNTIL Count = 10 | BREPEAT OUTPUT "Hello" UNTIL TRUE | |
| 3A REPEAT loop always runs its statements at least once, because the condition is tested after them | CThe condition is the wrong way round. The loop stops when the condition is TRUE, so this stops on a wrong password. | |
| 4A WHILE loop tests its condition first and can run zero times, but a REPEAT loop always runs once | DThe condition tested after the loop body; the loop stops when Count equals 10 and repeats while it does not. | |
| 5REPEAT INPUT Password ENDREPEAT | EAsks for a password at least once and keeps asking until the password typed in equals "secret". | |
| 6REPEAT INPUT Password UNTIL Password <> "secret" | FWHILE Age < 0 DO INPUT Age ENDWHILE |
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: its statements run at least once, then the condition is tested after them. The loop stops when the condition is TRUE.REPEAT
INPUT Password
UNTIL Password = "Secret1"REPEAT
INPUT Guess
UNTIL Guess = 7REPEAT
INPUT Number
UNTIL Number > 0REPEAT
Count ← Count + 1
UNTIL Count = 5REPEAT
INPUT Password
UNTIL Password = "Secret1"