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 | ANEXT uses a different identifier from the FOR line. It must repeat the same loop variable, so it should be NEXT Index. | |
| 2NEXT Index | BStarts a loop that repeats the statements below once for each whole number from 1 to 30 inclusive | |
| 3The loop variable changes by itself, so you never write a line to add 1 to it | CThe loop variable is given its start value with = instead of the assignment arrow. It should be FOR Index ← 1 TO 30. | |
| 4The loop variable is an INTEGER, so it must be declared as one before the loop | DFOR Count ← 1 TO 5 OUTPUT Count NEXT Count | |
| 5FOR Index ← 1 TO 30 OUTPUT Index NEXT Count | EDECLARE Index : INTEGER FOR Index ← 1 TO 30 OUTPUT Index NEXT Index | |
| 6FOR Index = 1 TO 30 OUTPUT Index NEXT Index | FEnds the FOR loop and names the same loop variable that the FOR line used |
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 — Repeats the statements below once for each whole number from 1 to 30 inclusive. Index is an INTEGER that changes automatically each time. Close the loop with NEXT Index.FOR Index ← 1 TO 30
OUTPUT Index
NEXT IndexFOR Index ← 1 TO 30
OUTPUT Index
NEXT IndexFOR Number ← 1 TO 10
OUTPUT Number * 2
NEXT NumberFOR Count ← 1 TO 5
OUTPUT Count
NEXT CountFOR Index ← 1 TO 30
OUTPUT Index
NEXT Index