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 | |
|---|---|---|
| 1DECLARE Grid : ARRAY[1:3, 1:3] OF CHAR | AOnly one range is given, so this is a 1D list, not a table. A 2D array needs two ranges, such as ARRAY[1:4, 1:3]. | |
| 2Marks[2, 3] | BA 2D array with 3 rows and 3 columns that holds characters, such as a noughts and crosses board | |
| 3The first index is the row and the second is the column, so this puts an X in the top row, third column of a noughts and crosses grid | COnly one index is given. An element of a 2D array needs two indexes, a row and a column, such as Grid[2, 1]. | |
| 4A table of marks for 4 students and 3 tests needs rows and columns, so the array has two ranges | DGrid[1, 3] ← 'X' | |
| 5Grid[2] ← 'O' | EDECLARE Marks : ARRAY[1:4, 1:3] OF INTEGER | |
| 6DECLARE Marks : ARRAY[1:4] OF INTEGER | FThe element in row 2 and column 3 of the Marks table |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
2D array — A table of rows and columns held in one variable. Each element needs two indexes: the first is the row (across), the second is the column (down), e.g. Marks[2, 3].DECLARE Board : ARRAY[1:3, 1:3] OF CHAR// Put X in row 2, column 3
Board[2, 3] ← 'X'// Student 4 scored 75 in test 2
Marks[4, 2] ← 75// Show the mark in row 2, column 3
OUTPUT Marks[2, 3]FOR Row ← 1 TO 5
OUTPUT Marks[Row, 1]
NEXT Row