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 | |
|---|---|---|
| 1UNTIL Password = "Secret" | AREPEAT OUTPUT "Hello" UNTIL TRUE | |
| 2REPEAT INPUT Password UNTIL Password = "Secret" | BThere is no ENDREPEAT keyword. The loop must end with UNTIL and a condition such as UNTIL Password = "Secret". | |
| 3A REPEAT loop tests its condition after the body, so the body always runs at least once | CAsks for a password at least once, then keeps asking until the correct one is entered | |
| 4A REPEAT loop is closed by UNTIL and a condition. There is no ENDREPEAT keyword | DREPEAT INPUT Number UNTIL Number > 0 | |
| 5REPEAT INPUT Password ENDREPEAT | EThe condition is the wrong way round. The loop stops when it is TRUE, so this stops on a wrong password. It should be UNTIL Password = "Secret". | |
| 6REPEAT INPUT Password UNTIL Password <> "Secret" | FThe loop stops as soon as Password equals "Secret", because UNTIL ends the loop when its condition is TRUE |
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 loop that runs its statements first, then tests the condition. It stops when the condition is TRUE, so the body always runs at least once. It has no ENDREPEAT keyword.REPEAT
INPUT Password
UNTIL Password = "Secret"REPEAT
INPUT Password
UNTIL Password = "Secret"REPEAT
INPUT Password
UNTIL Password = "Secret"REPEAT
INPUT Password
UNTIL Password = "Secret"REPEAT
INPUT Password
UNTIL Password = "Secret"