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 Marks : ARRAY[1:5] OF INTEGER | AFOR Row ← 1 TO 3 FOR Col ← 1 TO 4 INPUT Grid[Row, Col] NEXT Col NEXT Row | |
| 2FOR Index ← 1 TO 5 INPUT Marks[Index] NEXT Index | BFOR Index ← 1 TO 5 OUTPUT Names[Index], Marks[Index] NEXT Index | |
| 3After the array is filled, a second FOR loop with the same bounds shows every element on the screen. | CThe loop goes up to 10 but the array only has indexes 1 to 5, so it goes out of range. The loop should be FOR Index ← 1 TO 5. | |
| 4A 2D grid is filled using a loop inside a loop, with one index for the row and one for the column. | DOUTPUT Marks does not show each element. A second FOR loop is needed with OUTPUT Marks[Index] to display every element. | |
| 5DECLARE Marks : ARRAY[1:5] OF INTEGER FOR Index ← 1 TO 10 INPUT Marks[Index] NEXT Index | EStep 1 of the program: create the array before using it, with its bounds and data type. | |
| 6FOR Index ← 1 TO 5 INPUT Marks[Index] NEXT Index OUTPUT Marks | FStep 2 of the program: a loop that fills every element of the array with a value typed in by the user. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
DECLARE, FOR INPUT, FOR OUTPUT — The pattern of a complete array program: declare the array, use a FOR loop to INPUT a value into each element, then use a second FOR loop to OUTPUT every element.DECLARE Marks : ARRAY[1:5] OF INTEGERFOR Count ← 1 TO 5
INPUT Marks[Count]
NEXT CountFOR Count ← 1 TO 5
OUTPUT Names[Count]
NEXT CountFOR Row ← 1 TO 3
FOR Col ← 1 TO 4
INPUT Grid[Row, Col]DECLARE Names : ARRAY[1:3] OF STRING
FOR Index ← 1 TO 3
OUTPUT Names[Index]