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 | AOnly calculates the average when there is at least one value, so it never divides by zero | |
| 2IF Count > 0 THEN Average ← Total / Count ENDIF | BThe total has not been divided by the count, so this stores the total of the values instead of the average. | |
| 3The average needs both a total and a count, so both must be worked out before dividing | CWorks out the average by dividing the total of the values by how many values there are | |
| 4An average can be a REAL, so the variable that stores it should be declared as REAL | DDECLARE Average : REAL | |
| 5Average ← Total / 0 | EThe code divides by zero. The average must be divided by Count, the number of values, and Count must never be zero. | |
| 6Average ← Total | FFOR Index ← 1 TO 5 Total ← Total + Mark[Index] Count ← Count + 1 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 — The average is the total of the values divided by how many values there are. It needs both a total and a count, can be a REAL, and is not allowed when the count is zero.Average ← Total / CountAverage ← Total / CountDECLARE Average : REALIF Count > 0 THEN
Average ← Total / Count
ENDIFAverage ← Total / Count
OUTPUT "Average is ", Average