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 | |
|---|---|---|
| 1INPUT StudentNames[Index] | AFOR Index ← 1 TO 30 INPUT Marks[Index] NEXT Index | |
| 2FOR Index ← 1 TO 5 INPUT Marks[Index] NEXT Index | BOUTPUT "Enter mark ", Index INPUT Marks[Index] | |
| 3Show a prompt before each INPUT so the user knows which value to type, then store it in the next element | CReads five values from the user and stores them in elements 1 to 5 of Marks, one per repeat of the loop | |
| 4A loop with a changing Index fills an INTEGER array of marks, so every element gets its own value from the user | DINPUT names the whole array without an index, so it does not say which element stores the value. It should be INPUT Marks[Index]. | |
| 5FOR Index ← 1 TO 5 INPUT Marks NEXT Index | EStores the value the user types into the element of StudentNames at the position held in Index | |
| 6FOR Index ← 1 TO 5 INPUT Marks[1] NEXT Index | FThe index is fixed at 1, so every value typed overwrites element 1 and the other elements stay empty. It should be INPUT Marks[Index]. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
INPUT Name[Index] — Inside a FOR loop, INPUT Name[Index] stores each value the user types into the next array element, because Index changes every time the loop repeats.FOR Index ← 1 TO 5
INPUT StudentNames[Index]
NEXT IndexFOR Index ← 1 TO 5
INPUT StudentNames[Index]
NEXT IndexDECLARE Marks : ARRAY[1:5] OF INTEGER
FOR Index ← 1 TO 5
INPUT Marks[Index]DECLARE StudentNames : ARRAY[1:30] OF STRING
FOR Index ← 1 TO 30
INPUT StudentNames[Index]FOR Index ← 1 TO 5
OUTPUT "Enter a name: "
INPUT StudentNames[Index]