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 10 | ARepeats the loop body once for each array position from 1 to 10, with Index counting up each time | |
| 2OUTPUT Marks[Index] | BThe loop starts at 0 and runs 11 times, but the array has positions 1 to 10, so Marks[0] does not exist. | |
| 3Fill an array by asking the user for a value at each position as the counter moves along | CDisplays the element at the current position, so each pass of the loop shows the next mark | |
| 4Output every element of the array in order using the loop counter as the index | DFOR Index ← 1 TO 10 INPUT Marks[Index] NEXT Index | |
| 5FOR Index ← 1 TO 10 OUTPUT Marks[10] NEXT Index | EFOR Index ← 1 TO 10 OUTPUT Marks[Index] NEXT Index | |
| 6FOR Index ← 0 TO 10 INPUT Marks[Index] NEXT Index | FThe index is fixed at 10, so the same element is output ten times instead of using Index to visit each element. |
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 10 — A loop whose counter is the array index. Inside it, Marks[Index] picks each element in turn, so the loop visits every item from position 1 to 10 once.FOR Index ← 1 TO 10
INPUT Marks[Index]
NEXT IndexFOR Index ← 1 TO 10
OUTPUT Marks[Index]
NEXT IndexFOR Index ← 1 TO 10
INPUT Marks[Index]
NEXT IndexDECLARE Marks : ARRAY[1:10] OF INTEGER
FOR Index ← 1 TO 10
INPUT Marks[Index]FOR Index ← 1 TO 10
OUTPUT Marks[Index]
NEXT Index