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 | |
|---|---|---|
| 1OUTPUT StudentNames[3], Marks[3] | ADisplays the name and the mark of the same student, because index 3 is used in both parallel arrays. | |
| 2DECLARE Marks : ARRAY[1:30] OF INTEGER | BFOR Index ← 1 TO 30 INPUT StudentNames[Index] INPUT Marks[Index] NEXT Index | |
| 3One loop can read both parallel arrays, because the same index refers to the same student in each array. | CDeclares an INTEGER array with 30 elements that can sit beside a 30-element names array, so each index matches one student. | |
| 4Parallel arrays can hold different data types for one record, such as STRING names and INTEGER marks. | DDECLARE StudentNames : ARRAY[1:30] OF STRING DECLARE Marks : ARRAY[1:30] OF INTEGER | |
| 5DECLARE StudentNames : ARRAY[1:30] OF STRING DECLARE Marks : ARRAY[1:25] OF INTEGER | EDifferent indexes are used, so the name of student 3 is shown with the mark of student 4, which are not related. | |
| 6OUTPUT StudentNames[3], Marks[4] | FThe arrays have different lengths (30 and 25), so some students would have no matching mark and the indexes would not line up. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
parallel arrays — Two or more arrays of the same size where the same index holds related data, e.g. StudentNames[3] and Marks[3] both describe the same student.DECLARE StudentNames : ARRAY[1:5] OF STRINGDECLARE Marks : ARRAY[1:5] OF INTEGEROUTPUT StudentNames[Index], Marks[Index]DECLARE StudentNames : ARRAY[1:30] OF STRING
DECLARE Marks : ARRAY[1:30] OF INTEGERFOR Index ← 1 TO 30
OUTPUT StudentNames[Index], Marks[Index]
NEXT Index