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 | |
|---|---|---|
| 1OUTPUT NoughtsAndCrosses[2,3] | ADisplays the value stored at row 2, column 3 of the NoughtsAndCrosses array | |
| 2Winner ← Marks[4,2] | BIF Marks[1,2] > Marks[3,2] THEN | |
| 3Compare two elements of a 2D array in an IF statement | COUTPUT Marks[3,1] | |
| 4Read a value from a table of marks: row 3 is the third student, column 1 is Maths | DCopies the value at row 4, column 2 of Marks into the variable Winner | |
| 5OUTPUT NoughtsAndCrosses[2][3] | EThe row and column are swapped. To show row 2, column 3 the indexes must be written in the order [2,3], row first and then column. | |
| 6OUTPUT NoughtsAndCrosses[3,2] | FSeparate brackets are used for the indexes. In Cambridge pseudocode both indexes go in one pair of square brackets, separated by a comma: NoughtsAndCrosses[2,3]. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
Name[row, column] — Gives the value stored at that row and column of a 2D array. Use it in an expression or OUTPUT, e.g. OUTPUT NoughtsAndCrosses[2,3] shows the value at row 2, column 3.OUTPUT NoughtsAndCrosses[2,3]// Copy row 3, column 2 into Score
Score ← Marks[3,2]IF Marks[1,2] > Marks[2,2] THEN
OUTPUT Marks[1,2]
ENDIFTop ← Marks[2,3]
OUTPUT Top// Show the mark in row 3, column 1
OUTPUT Marks[3,1]