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 | |
|---|---|---|
| 1Total ← 0 | ASets the total to 0 before the loop so it starts from a known value | |
| 2Count ← 0 | BCount ← 0 WHILE Count < 10 DO Count ← Count + 1 ENDWHILE | |
| 3Correct: set the total to 0 once, before the loop starts | CTotal ← 0 FOR Index ← 1 TO 5 INPUT Num Total ← Total + Num NEXT Index | |
| 4Correct: set the counter to 0 before the loop so it is not reset each time | DSets the counter to 0 before the loop so it counts from zero | |
| 5FOR Index ← 1 TO 5 INPUT Num Total ← Total + Num NEXT Index | ETotal is never set to 0 before the loop, so it starts from an unknown value. Fix: add Total ← 0 before the FOR line. | |
| 6FOR Index ← 1 TO 5 Count ← 0 Count ← Count + 1 NEXT Index | FCount ← 0 is inside the loop, so it resets every time and always ends as 1. Fix: move Count ← 0 above the loop. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
Total ← 0 — Set a total or counter to 0 before the loop. If you forget, it starts from an unknown value; if you put it inside the loop, it resets every time.Total ← 0
FOR Index ← 1 TO 5Count ← 0
WHILE Num <> 0 DO
Count ← Count + 1Total ← 0
FOR Index ← 1 TO 5
Total ← Total + NumCount ← 0
REPEAT
Count ← Count + 1Total ← 0
WHILE Total < 20 DO
Total ← Total + 5