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[Index] | ADisplays a label, the index number and the element, all on one line, separated by commas. | |
| 2OUTPUT "Mark ", Index, ": ", Marks[Index] | BDisplays the element at the current index. Inside a FOR loop it outputs every element in order. | |
| 3To display every element of an array in reverse order, the loop counts down using STEP -1. | CFOR Index ← 1 TO 5 OUTPUT Names[Index] NEXT Index | |
| 4To display every element of a 5-element array in order, loop from the lower bound to the upper bound and output Names[Index]. | DThe array name is used without an index, so it does not output one element per pass. It should be StudentNames[Index]. | |
| 5FOR Index ← 1 TO 5 OUTPUT StudentNames NEXT Index | EA fixed index of 5 is used instead of the loop variable, so the same element is output every time. It should be Marks[Index]. | |
| 6FOR Index ← 1 TO 5 OUTPUT Marks[5] NEXT Index | FFOR Index ← 10 TO 1 STEP -1 OUTPUT Marks[Index] NEXT Index |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
OUTPUT StudentNames[Index] — Inside a FOR loop, this line displays every element of the array in order. Index changes on each pass, so each pass outputs the next element, from the lower bound to the upper bound.FOR Index ← 1 TO 5
OUTPUT StudentNames[Index]
NEXT IndexFOR Index ← 1 TO 5
OUTPUT StudentNames[Index]
NEXT IndexFOR Index ← 1 TO 10
OUTPUT "Mark ", Index, ": ", Marks[Index]
NEXT IndexFOR Index ← 5 TO 1 STEP -1
OUTPUT StudentNames[Index]
NEXT IndexFOR Index ← 1 TO 5
OUTPUT StudentNames[Index], Marks[Index]
NEXT Index