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 | |
|---|---|---|
| 1INPUT Marks[Student, Test] | AOUTPUT "Enter mark for student ", Student, " test ", Test | |
| 2FOR Test ← 1 TO 3\n INPUT Marks[Student, Test]\nNEXT Test | BFOR Test ← 1 TO 3\n FOR Student ← 1 TO 30\n INPUT Marks[Student, Test] | |
| 3A prompt can show which row and column is being entered, so the user knows which mark to type. | CReads a typed value into one cell of the 2D array, chosen by the current row (Student) and column (Test). | |
| 4To enter values column by column instead of row by row, swap the loops so the outer loop controls the test (column). | DThere is no inner loop for Test, so Test never changes. Only one column is filled for each student, and the other columns stay empty. | |
| 5FOR Student ← 1 TO 30\n INPUT Marks[Student, Test]\nNEXT Student | EThe indexes are in the wrong order. Marks[Test, Student] treats Test as the row and Student as the column, which does not match the Marks[Student, Test] layout and can go out of range. | |
| 6FOR Student ← 1 TO 30\n FOR Test ← 1 TO 3\n INPUT Marks[Test, Student] | FThe inner loop reads three values into one row, one for each test, before the outer loop moves to the next student. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
INPUT Marks[Student, Test] — Inside nested FOR loops, this reads a typed value into one cell of a 2D array. The inner loop fills a whole row before the outer loop moves to the next row.FOR Student ← 1 TO 3
FOR Test ← 1 TO 4
INPUT Marks[Student, Test]FOR Student ← 1 TO 3
FOR Test ← 1 TO 4
INPUT Marks[Student, Test]FOR Test ← 1 TO 4
OUTPUT "Row ", Student, " column ", Test
INPUT Marks[Student, Test]FOR Test ← 1 TO 4
FOR Student ← 1 TO 3
INPUT Marks[Student, Test]FOR Student ← 1 TO 3
FOR Test ← 1 TO 4
INPUT Marks[Student, Test]