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 | |
|---|---|---|
| 1FOR Index ← 1 TO 31 (array is ARRAY[1:30]) | AFOR Index ← 0 TO 9 | |
| 2Grid[Column, Row] (array is ARRAY[1:3, 1:5]) | BTotal ← 0 FOR Index ← 1 TO 30 Total ← Total + Scores[Index] NEXT Index | |
| 3A loop that fills ARRAY[0:9] must start at the lower bound of 0, not 1 | CLoop limit goes past the upper bound, so the last pass gives an index out of range error | |
| 4A running total must be set back to 0 before the loop that adds up the elements | DRow and column indexes are swapped, so the wrong element or an out of range index is used | |
| 5DECLARE Names : ARRAY[1:5] OF STRING Names[1] ← 42 | EThe loop starts at 1 and ends at 10, but the array bounds are 0 to 9. It skips element 0 and index 10 is out of range. Use FOR Index ← 0 TO 9. | |
| 6DECLARE Marks : ARRAY[0:9] OF INTEGER FOR Index ← 1 TO 10 Marks[Index] ← 0 NEXT Index | FA number is stored in a STRING array. Each element must hold the declared data type, so store text such as "Ava" instead. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
common array mistakes — Typical bugs: loop limits not matching ARRAY[l:u], swapped row and column indexes, a total not reset to 0, or the wrong data type stored. Check bounds, index order and starting values.DECLARE Score : ARRAY[1:30] OF INTEGER
FOR i ← 1 TO 30
NEXT iDECLARE Name : ARRAY[0:9] OF STRING
FOR Index ← 0 TO 9
NEXT IndexDECLARE Grid : ARRAY[1:3,1:5] OF INTEGER
FOR Row ← 1 TO 3
Grid[Row, 2] ← 0Total ← 0
FOR i ← 1 TO 10
Total ← Total + Mark[i]DECLARE Price : ARRAY[1:5] OF REAL
Price[1] ← 4.5