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 ← 0 TO 29 | AThe loop ends at 30, which is past the upper bound 29, so it goes out of range. It should end at 29. | |
| 2FOR Index ← 1 TO 30 | BFOR Index ← 0 TO 9 | |
| 3To loop through ARRAY[0:9], start at the lower bound and finish at the upper bound | CThe loop starts at 1, so element 0 is never visited. It should start at the lower bound 0. | |
| 4The loop limits must match the declaration of the array ARRAY[0:49] | DVisits every element of ARRAY[0:29] from the lower bound to the upper bound | |
| 5FOR Index ← 1 TO 29 (for ARRAY[0:29]) | EMisses element 0 and goes past the end of ARRAY[0:29] | |
| 6FOR Index ← 0 TO 30 (for ARRAY[0:29]) | FFOR Index ← 0 TO 49 |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
FOR Index ← 0 TO 29 — For ARRAY[0:29], the loop must start at the lower bound 0 and end at the upper bound 29. It then visits all 30 elements and never goes outside the array.DECLARE Scores : ARRAY[0:29] OF INTEGER
FOR Index ← 0 TO 29DECLARE Names : ARRAY[0:29] OF STRING
FOR Index ← 0 TO 29DECLARE Marks : ARRAY[0:9] OF INTEGER
FOR Index ← 0 TO 9
OUTPUT Marks[Index]DECLARE Items : ARRAY[0:19] OF STRING
FOR Index ← 0 TO 19FOR Index ← 0 TO 29
OUTPUT Scores[Index]
NEXT Index