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 | |
|---|---|---|
| 1FOR Index ← 1 TO 30 | AThe statement inside the loop is not indented. The body should be indented, as in ' OUTPUT Index', so it is clear which lines repeat. | |
| 2NEXT Index | BCloses the loop, adds 1 to Index and goes back to the FOR line | |
| 3The statements inside the loop are indented so you can see which lines repeat on each pass | CFOR Index ← 1 TO 30 OUTPUT Index NEXT Index | |
| 4A loop that runs 30 times, with Index going up by 1 each time, from 1 to 30 | DFOR Index ← 1 TO 30 | |
| 5FOR Index ← 1 TO 30 OUTPUT Index NEXT Count | EStarts a loop that repeats the indented statements once for each value of Index, from 1 up to 30 | |
| 6FOR Index ← 1 TO 30 OUTPUT Index NEXT Index | FNEXT uses a different name (Count) from the loop variable Index. NEXT must repeat the same variable name as the FOR line, so it should be NEXT Index. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
FOR Index ← 1 TO 30 — A count-controlled loop. It repeats the indented statements once for each value of Index, from 1 up to 30, going up by 1 each time. NEXT Index closes the loop.FOR Index ← 1 TO 30
Scores[Index] ← 0
NEXT IndexFOR Index ← 1 TO 30
OUTPUT Scores[Index]
NEXT IndexFOR Index ← 1 TO 30
OUTPUT Scores[Index]
NEXT IndexFOR Index ← 1 TO 30
Total ← Total + Scores[Index]
NEXT IndexFOR Index ← 1 TO 30
Scores[Index] ← 0
NEXT Index