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 Total : INTEGER Total ← 0 | AThe comparison uses < instead of >, so this finds the lowest mark rather than the highest. It should be Marks[Index] > Highest. | |
| 2FOR Index ← 1 TO 30 Total ← Total + Marks[Index] NEXT Index | BAverage ← Total / 30 OUTPUT "Average: ", Average | |
| 3After the loop has finished, work out the class average from the total and the number of marks, then show it. | CIF Marks[Index] >= 50 THEN Passes ← Passes + 1 ENDIF | |
| 4To count the passes, start a counter at 0 and add 1 only when a mark meets the pass condition. | DLoop through all 30 marks in the array and add each one to the running total. | |
| 5FOR Index ← 1 TO 30 Total ← 0 Total ← Total + Marks[Index] NEXT Index | ETotal is reset to 0 inside the loop, so it is wiped on every repeat and only the last mark is kept. The start value must be set before the loop. | |
| 6Highest ← 0 FOR Index ← 1 TO 30 IF Marks[Index] < Highest THEN Highest ← Marks[Index] ENDIF NEXT Index | FDeclare the variable and set its start value to 0 before the loop, so the running total begins correctly. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
DECLARE, loop, OUTPUT — To solve a described problem, list the inputs, pick the standard method, then write it: DECLARE variables, set start values, loop through the data, and OUTPUT the result.DECLARE Total : INTEGERDECLARE Total : INTEGER
Total ← 0FOR Index ← 1 TO 30
Total ← Total + Marks[Index]
NEXT IndexOUTPUT "Highest mark: ", HighestIF Marks[Index] >= 50 THEN
Passes ← Passes + 1
ENDIF