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 UNTIL count = 5 | AAn infinite loop, because count never changes and so never reaches 5 | |
| 2REPEAT UNTIL count = 5 (no change to count) | BREPEAT UNTIL lives = 0: SET lives TO lives - 1 | |
| 3Adding 1 to the counter inside the loop works towards the stopping condition | CThe loop stops only when count becomes 5, so count must change inside the loop | |
| 4A loop that fixes the problem has a step that moves the variable towards the stop value | DSET count TO count + 1 | |
| 5SET count TO 0 REPEAT UNTIL count = 3 SAY "Hi" | EThe counter is never changed inside the loop, so count stays 0 and the loop never stops. Add SET count TO count + 1 inside the loop. | |
| 6SET steps TO 10 REPEAT UNTIL steps = 0 SET steps TO steps + 1 | FThe variable changes in the wrong direction. Steps goes up away from 0, so the loop never stops. It should be steps - 1. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
infinite loop — A loop that never stops because its stopping condition can never become true. Something inside the loop, like a counter, must change to work towards the condition.SET count TO 0
REPEAT UNTIL count = 5
SET count TO count + 1SET lives TO 3
REPEAT UNTIL lives = 0
SET lives TO lives - 1SET count TO 1
REPEAT UNTIL count = 10
SET count TO count + 1SET steps TO 0
REPEAT UNTIL steps = 4
SET steps TO steps + 1SET water TO 5
REPEAT UNTIL water = 0
SET water TO water - 1