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 | |
|---|---|---|
| 1Marks[3] ← 55 | AIndex 6 is outside the bounds 1 to 5, so this causes an error. Use an index from 1 to 5, such as Marks[5]. | |
| 2OUTPUT Marks[Index] | BDisplays the element whose position is given by the variable Index | |
| 3Reading one element: the value stored at index 3 is copied into a variable | CScore ← Marks[3] | |
| 4Using a variable as the index so the same line works on different elements | DRound brackets are used instead of square brackets. The element should be written as Marks[3] ← 55. | |
| 5DECLARE Marks : ARRAY[1:5] OF INTEGER Marks[6] ← 55 | EChanges the element at index 3 of the array Marks to the value 55 | |
| 6Marks(3) ← 55 | FMarks[Index] ← 0 |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
Marks[3] — Refers to one element of the array Marks by its index, here 3. You can read it or assign to it, e.g. Marks[3] ← 55. An index outside the array bounds causes an error.// Change the element at index 3
Marks[3] ← 55DECLARE Marks : ARRAY[1:5] OF INTEGER
OUTPUT Marks[3]Index ← 4
OUTPUT Marks[Index]// Add 5 to element 2
Marks[2] ← Marks[2] + 5DECLARE Marks : ARRAY[1:5] OF INTEGER
// Highest valid index is used here
Marks[5] ← 70