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 | |
|---|---|---|
| 1Average ← Total / Count | AIF Count > 0 THEN Average ← Total / Count ENDIF | |
| 2DECLARE Average : REAL | BNEXT Index Average ← Total / Count | |
| 3Divide after the loop has finished, so Total holds every value | CAverage is declared as INTEGER, so it cannot store decimal values such as 72.5. It should be declared as REAL. | |
| 4Check that Count is above zero before dividing, to avoid dividing by zero | DDivides the finished total by the number of items to give the mean | |
| 5FOR Index ← 1 TO 5 Total ← Total + Marks[Index] Average ← Total / Count NEXT Index | ESets up a variable that can store an average with decimal places | |
| 6DECLARE Average : INTEGER Average ← Total / Count | FThe average is calculated inside the loop, so it is worked out with an unfinished total. The division should come after NEXT Index. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
Average ← Total / Count — Divides the finished Total by Count after the loop ends, giving the mean. Declare Average as REAL. Check Count > 0 first to avoid dividing by zero.DECLARE Average : REALAverage ← Total / Count Total ← Total + Scores[Index]
NEXT Index
Average ← Total / CountIF Count > 0 THEN
Average ← Total / Count
ENDIFDECLARE Marks : ARRAY[1:3] OF INTEGER
Total ← Marks[1] + Marks[2] + Marks[3]
Average ← Total / 3