Average: how it works

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Average: how it works

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. How do you calculate the average of a set of values?
A Total divided by Count
B Total multiplied by Count
2. Which two things must you know before you can work out an average?
A The total and the count
B The maximum and the minimum
3. Which line correctly calculates the average?
A Average ← Total / Count
B Average ← Total + Count
4. The marks are 4, 5 and 6. What is the average?
A 15
B 5
5. Which data type should the variable Average be declared as?
A DECLARE Average : INTEGER
B DECLARE Average : REAL

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight 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

Definitions

Average ← Total / Count

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
Average ← _____ / Count
2.
Average ← Total _ Count
3.
DECLARE Average : ____
4.
IF Count > _ THEN Average ← Total / Count ENDIF
5.
Average ← Total / Count OUTPUT "Average is ", _______

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A Total ← 150
B Count ← 5
C Average ← Count / Total
D OUTPUT Average
Question 2
A DECLARE Average : INTEGER
B Average ← Total / Count
C OUTPUT Average
Question 3
A Total ← 0
B Count ← 5
C FOR i ← 1 TO Count
D Total ← Total + i
E NEXT i
F Average ← Total / Count
Question 4
A Count ← 0
B Total ← 0
C IF Count = 0 THEN
D Average ← Total / Count
E ENDIF
Question 5
A INPUT Mark
B Total ← Total + 1
C Count ← Count + 1
D Average ← Total / Count

Answer Key

Average: how it works
Section A: Quick Questions
Q1
A — Total divided by Count
Q2
A — The total and the count
Q3
A — Average ← Total / Count
Q4
B — 5
Q5
B — DECLARE Average : REAL
Section B: Match the Pairs
Q1
Average ← Total / Count → Works out the average by dividing the total of the values by how many values there are
Q2
IF Count > 0 THEN Average ← Total / Count ENDIF → Only calculates the average when there is at least one value, so it never divides by zero
Q3
The average needs both a total and a count, so both must be worked out before dividing → FOR Index ← 1 TO 5 Total ← Total + Mark[Index] Count ← Count + 1 NEXT Index
Q4
An average can be a REAL, so the variable that stores it should be declared as REAL → DECLARE Average : REAL
Q5
Average ← Total / 0 → The code divides by zero. The average must be divided by Count, the number of values, and Count must never be zero.
Q6
Average ← Total → The total has not been divided by the count, so this stores the total of the values instead of the average.
Section C: Definitions
Q1
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.
Section D: Fill in the Blanks
Q1
Average ← Total / Count
Q2
Average ← Total / Count
Q3
DECLARE Average : REAL
Q4
IF Count > 0 THEN Average ← Total / Count ENDIF
Q5
Average ← Total / Count OUTPUT "Average is ", Average
Section E: Spot the Error
Q1
C — The average is the total divided by the count, not the other way round. It should be Average ← Total / Count.
Q2
A — An average often has decimal places, so it can be a REAL. Declaring it as INTEGER is wrong. It should be DECLARE Average : REAL.
Q3
D — This adds the loop counter i, not the score stored in the array. It should be Total ← Total + Score[i].
Q4
C — The division must only happen when Count is not zero, because dividing by zero is not allowed. The test should be IF Count > 0 THEN.
Q5
B — The total must add the value that was input, not 1. Adding 1 is what the count does. It should be Total ← Total + Mark.