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 NoughtsAndCrosses : ARRAY[1:3, 1:3] OF CHAR | ADeclares a 2D array of characters with 3 rows and 3 columns, giving 9 elements | |
| 2NoughtsAndCrosses[2,3] ← 'X' | BFOR Row ← 1 TO 3 FOR Col ← 1 TO 3 OUTPUT NoughtsAndCrosses[Row,Col] NEXT Col NEXT Row | |
| 3A 2D array is declared with a lower and upper bound for the rows and for the columns | CStores 'X' in the element in row 2, column 3 | |
| 4Nested FOR loops visit every element of a 2D array, the outer loop for rows and the inner loop for columns | DOnly one index range is given, so this declares a 1D array. A 2D array needs two ranges, for example ARRAY[1:3, 1:3]. | |
| 5DECLARE Board : ARRAY[1:3] OF CHAR | EDECLARE Grid : ARRAY[1:4, 1:5] OF INTEGER | |
| 6NoughtsAndCrosses[2][3] ← 'X' | FThe row and column indexes are written in separate brackets. In pseudocode they go in one pair of brackets separated by a comma: [2,3]. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
DECLARE NoughtsAndCrosses : ARRAY[1:3, 1:3] OF CHAR — Declares a 2D array of characters with 3 rows and 3 columns. Reach one element with a row index then a column index, e.g. NoughtsAndCrosses[2,3] ← 'X'.DECLARE Grid : ARRAY[1:3, 1:3] OF CHARDECLARE Grid : ARRAY[1:3, 1:3] OF CHAR// 3 rows and 4 columns
DECLARE Board : ARRAY[1:3, 1:4] OF CHAR// row 2, column 3
NoughtsAndCrosses[2,3] ← 'X'FOR Row ← 1 TO 3
FOR Col ← 1 TO 3
Grid[Row, Col] ← '-'