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 Names : ARRAY[1:30] OF STRING | AName1, Name2, Name3 ... Name30 | |
| 2FOR i ← 1 TO 30 OUTPUT Names[i] NEXT i | BNames[7] | |
| 3One name and an index reach each value in an array | CWriting one OUTPUT per variable does not use a loop; with an array a FOR loop could output every element in a few lines | |
| 4Without arrays you need a separate variable for every value | DA loop processes every element of the array using the index | |
| 5DECLARE Name1 : STRING DECLARE Name2 : STRING DECLARE Name3 : STRING (repeated for 30 students) | EUsing a separate variable for every student makes the program long and hard to change; one array should be used instead | |
| 6OUTPUT Name1 OUTPUT Name2 OUTPUT Name3 (repeated 30 times) | FOne array stores 30 student names under a single name |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
ARRAY — An array stores many values of the same type under one name, so you need one array instead of many variables. An index reaches each value, and loops can process them all.DECLARE Names : ARRAY[1:30] OF STRINGNames[5] ← "Ava"FOR Index ← 1 TO 30
OUTPUT Names[Index]
NEXT IndexDECLARE Marks : ARRAY[1:30] OF INTEGERFOR Index ← 1 TO 30
Total ← Total + Marks[Index]
NEXT Index