Understanding Data

Marks in a register, readings from a weather sensor, the photos on a phone — all of it is data, and almost every program exists to collect, store or process some of it. This chapter looks at what data is and the forms it takes, how it is collected, where it is stored, and what processing turns it into. It then covers the handful of statistical measures used to summarise a set of numbers: three that describe its centre — mean, median and mode — and two that describe how spread out it is — range and standard deviation. The paper asks for these as short calculations, so work each one through on the examples.
Overview

Data and Its Types

1 min read · 2 parts

Data is a collection of raw facts — numbers, text, images, sounds — that by themselves may carry little meaning. When data is organised and processed so that it answers a question, it becomes information: a list of each student's marks is data; the class average and the topper's name, drawn from it, are information. Data helps an organisation take decisions, from a shop deciding what to restock to a government planning schools from census figures.

Structured and unstructured data
TypeWhat it isExamples
Structuredorganised in a fixed format, typically rows and columns, so it is easy to search and analysea marks register, a train timetable, a bank statement, a table in a database
Unstructuredno predefined row-and-column formatphotographs, audio and video recordings, e-mails, social-media posts, scanned letters

Data is a collection of raw facts — numbers, text, images, sounds — that by themselves may carry little meaning. When data is organised and processed so that it answers a question, it…

Collecting, Storing and Processing Data

1 min read · 4 parts
  • Data collection means identifying the sources that can supply the data a question needs and gathering it — through forms and surveys, sensors and instruments, transactions recorded by a system, or data already published by organisations and government portals.
  • Data storage keeps the collected data for later use, as files or in databases, on devices such as hard disk drives, solid state drives, CDs and DVDs, pen drives and memory cards, or on remote servers in the cloud.
  • Data processing turns data into information through a cycle of input → process → output: data is entered, then classified, sorted, calculated or summarised, and the results are presented — an examination board turning answer-sheet marks into results is one such cycle.
From raw data to information
  1. Data collectionForms, surveys, sensors, transactions
  2. Data storageFiles or databases; devices or cloud
  3. Input: data is entered
  4. Process: classify, sort, calculate
  5. Output: results presented
  6. Informatione.g. marks turned into results

Data collection means identifying the sources that can supply the data a question needs and gathering it — through forms and surveys, sensors and instruments, transactions recorded by a…

Measures of Central Tendency: Mean, Median, Mode

1 min read · 2 parts

A measure of central tendency is a single value that represents the centre of a set of data. The mean (arithmetic average) is the sum of the values divided by their number. The median is the middle value once the data is arranged in order; with an even number of values it is the average of the two middle ones. The mode is the value that occurs most often. Take 4, 8, 6, 5, 3, 8, 9: the sum is 43 over 7 values, so the mean is about 6.14; sorted, the data is 3, 4, 5, 6, 8, 8, 9 and the median is the fourth value, 6; 8 appears twice and every other value once, so the mode is 8.

⚠️ Sort before taking the median
The median of 12, 7, 3, 9 is not the average of 7 and 3, the two values that happen to sit in the middle as written. Sorted, the data is 3, 7, 9, 12, and the median is (7 + 9) / 2 = 8.
🎯 Why the median is sometimes preferred
The mean uses every value, so one extreme value drags it. For 10, 12, 14, 16, 98 the mean is 30 — larger than four of the five values — while the median stays at 14. When data has an outlier, such as one very high salary in a small office, the median describes the typical value better.

A measure of central tendency is a single value that represents the centre of a set of data. The mean (arithmetic average) is the sum of the values divided by their number. The median is…

Measures of Variability: Range and Standard Deviation

1 min read · 2 parts

Two classes can have the same mean and very different marks — one with everyone near the average, the other split between very high and very low scores. A measure of variability (dispersion) describes that spread. The range is the simplest: largest value minus smallest. For 15, 22, 9, 30, 18 it is 30 − 9 = 21. It uses only two values, so a single outlier changes it completely.

The standard deviation (σ) uses every value. Find the mean x̄; subtract it from each value to get its deviation; square each deviation; take the mean of the squares; and take the square root: σ = √( Σ(x − x̄)² / n ). For 2, 4, 4, 4, 5, 5, 7, 9 the mean is 40 / 8 = 5; the deviations are −3, −1, −1, −1, 0, 0, 2, 4; their squares add to 9 + 1 + 1 + 1 + 0 + 0 + 4 + 16 = 32; 32 / 8 = 4; and σ = √4 = 2. A small standard deviation means the values cluster close to the mean; a large one means they are widely spread.

🧠 What shifting the data does
Add the same number to every value and the mean, median and mode all rise by that number, but the range and standard deviation do not change at all — every value has moved together, so the spread is the same. If every value is equal, the standard deviation is 0.
Standard deviation step by step
  1. Mean x̄ = 40 / 8 = 5Data: 2, 4, 4, 4, 5, 5, 7, 9
  2. Deviations: −3, −1, −1, −1, 0, 0, 2, 4
  3. Squares add to 32
  4. Mean of squares: 32 / 8 = 4
  5. σ = √4 = 2

Two classes can have the same mean and very different marks — one with everyone near the average, the other split between very high and very low scores. A measure of variability…

Worked Example: Every Measure on One Data Set

2 min read · 2 parts

Take the data 2, 4, 4, 4, 5, 5, 7, 9. The mean is 40 / 8 = 5. Arranged in order, the middle two values are 4 and 5, so the median is 4.5. The value 4 appears most often, so the mode is 4. The range is 9 − 2 = 7. The deviations from the mean are −3, −1, −1, −1, 0, 0, 2, 4, with squares 9, 1, 1, 1, 0, 0, 4, 16 adding to 32. The population variance is 32 / 8 = 4, so the standard deviation is 2; dividing by n − 1 = 7 instead, as for a sample, gives about 2.14. Now add one extreme value, 100: the mean jumps to about 15.6 while the median only moves to 5, which is the reason the median is preferred for skewed data such as incomes.

The measures for 2, 4, 4, 4, 5, 5, 7, 9
MeasureWorkingValue
Mean40 / 85
Median(4 + 5) / 24.5
Modemost frequent4
Range9 − 27
Standard deviation√(32 / 8)2
⚠️ Averaging averages and sample spread
When two groups are combined, the mean of the means is wrong unless the groups are the same size. If 10 students average 60 and 20 students average 75, the combined mean is (10 x 60 + 20 x 75)/30 = 2100/30 = 70, not (60 + 75)/2 = 67.5; the larger group carries more weight. Standard deviation behaves differently under changes of scale: multiplying every value by 3 multiplies the mean and the standard deviation by 3, so the data 2, 4, 4, 4, 5, 5, 7, 9 (mean 5, SD 2) becomes mean 15 and SD 6. When the data is only a sample of a larger group, divide by n - 1 instead of n; for the same data that gives the square root of 32/7, about 2.14, rather than 2.

Take the data 2, 4, 4, 4, 5, 5, 7, 9. The mean is 40 / 8 = 5. Arranged in order, the middle two values are 4 and 5, so the median is 4.5. The value 4 appears most often, so the mode is 4.…

Key takeaways

  • Data is raw facts; processed to answer a question, it becomes information.
  • Structured data sits in rows and columns; images, audio, video and e-mail are unstructured.
  • Processing follows input → process → output; data is stored in files or databases on disks, drives or the cloud.
  • Mean is the average, median the middle value after sorting (average of two middles if the count is even), mode the most frequent value.
  • An outlier pulls the mean far more than the median.
  • Range = largest − smallest; standard deviation = √(Σ(x − x̄)² / n); adding a constant to every value changes neither.

Practice questions (27)

Attempt each one before opening the answer. Every explanation names the tempting wrong option as well as the right one, because that is where marks are lost.

  1. For the data 4, 8, 6, 5, 3, 8, 9, what are the median and the mode?

    1. Median 6, mode 8
    2. Median 5, mode 8
    3. Median 6, mode 9
    4. Median 8, mode 6
    Show answer

    Answer: A — Median 6, mode 8

    Sorted, the seven values are 3, 4, 5, 6, 8, 8, 9, so the median is the fourth, 6; 8 occurs twice and every other value once, so the mode is 8. Median 5 is the middle of the data as written, before sorting. Mode 9 picks the largest value instead of the most frequent, and median 8 with mode 6 swaps the two measures.
  2. What is the standard deviation of 2, 4, 4, 4, 5, 5, 7, 9, taking σ = √(Σ(x − x̄)² / n)?

    1. 4
    2. 5
    3. 7
    4. 2
    Show answer

    Answer: D — 2

    The mean is 40 / 8 = 5; the squared deviations are 9, 1, 1, 1, 0, 0, 4 and 16, adding to 32; dividing by 8 gives 4, and the square root is 2. Answering 4 stops one step early, giving the mean of the squared deviations rather than its root. 5 is the mean itself, and 7 is the range, 9 − 2, a different measure of spread.
  3. What is the median of the values 12, 7, 3, 9?

    1. 5
    2. 7.75
    3. 8
    4. 9
    Show answer

    Answer: C — 8

    Sorted, the values are 3, 7, 9, 12; with an even count the median is the average of the two middle values, (7 + 9) / 2 = 8. Five is the average of 7 and 3, the middle pair before sorting. 7.75 is the mean, 31 / 4, and 9 picks just one of the middle pair instead of averaging them.
Show the other 24 questions
  1. Which of the following is an example of unstructured data?

    1. A table of students' roll numbers and marks
    2. Video recordings of classroom lectures
    3. A railway timetable listing trains and times
    4. A bank statement with date, amount and balance columns
    Show answer

    Answer: B — Video recordings of classroom lectures

    A video has no predefined rows and columns that a program can search directly, which is what makes it unstructured. The marks table, the timetable and the bank statement are all organised into fixed fields — the defining feature of structured data — even though they look very different from one another.
  2. The data 10, 12, 14, 16, 98 contains one extreme value. Which statement is correct?

    1. The mean (30) is pulled far above most values, while the median (14) is not
    2. The median (14) is pulled towards 98, while the mean is unaffected
    3. Both the mean and the median equal 30 here
    4. Neither measure can be calculated when an outlier is present
    Show answer

    Answer: A — The mean (30) is pulled far above most values, while the median (14) is not

    The sum is 150, so the mean is 30, larger than four of the five values, because every value — including 98 — enters the average. The median is the middle value after sorting, 14, and would be the same if 98 were 20. Claiming the median is pulled while the mean is not reverses the two measures' sensitivity, and an outlier never prevents either from being calculated.
  3. What is the range of the data 15, 22, 9, 30, 18?

    1. 15
    2. 18.8
    3. 3
    4. 21
    Show answer

    Answer: D — 21

    The range is the largest value minus the smallest: 30 − 9 = 21. 15 is the difference between the first and last values as written, which ignores where the extremes actually are. 18.8 is the mean, 94 / 5, a measure of centre rather than spread, and 3 is not any measure of this data.
  4. Assertion (A): If 5 is added to every value in a data set, its standard deviation does not change. Reason (R): Adding the same constant to every value leaves the mean of the data unchanged.

    1. Both A and R are true, and R is the correct explanation of A
    2. Both A and R are true, but R is not the correct explanation of A
    3. A is true, but R is false
    4. A is false, but R is true
    Show answer

    Answer: C — A is true, but R is false

    Adding 5 to every value raises the mean by 5 as well, so each deviation x − x̄ is exactly what it was and the standard deviation is unchanged: A is true. R is false — the mean does change, by 5. It is precisely because the mean moves along with the data that the deviations stay the same, so a candidate who thinks the mean stays fixed has the right conclusion for the wrong reason.
  5. Which of the following is a measure of variability (spread) rather than of central tendency?

    1. Mean
    2. Median
    3. Standard deviation
    4. Mode
    Show answer

    Answer: C — Standard deviation

    Standard deviation measures how far the values lie from the mean, which is a description of spread; range is the other spread measure in the syllabus. Mean, median and mode each give a single value representing the centre of the data — two classes can share all three and still differ completely in how spread out their marks are.
  6. Ten students average 60 marks and twenty students average 75 marks. The mean of all thirty students is ____.

    Numerical answer — type the value.

    Show answer

    Answer: 70

    Total marks = 600 + 1,500 = 2,100, and 2,100/30 = 70. Second route: weights 1/3 and 2/3 give 20 + 50 = 70. Averaging 60 and 75 to get 67.5 ignores the group sizes and is the tempting wrong answer.
  7. The data 2, 4, 4, 4, 5, 5, 7, 9 is only a sample, so the standard deviation is found by dividing by n - 1. To two decimal places it is ____.

    Numerical answer — type the value.

    Show answer

    Answer: 2.14

    The sum of squared deviations is 32 and n - 1 = 7, so SD = sqrt(32/7) = sqrt(4.571) = 2.14. Check: 2.14 squared is 4.58. Dividing by 8 gives the population value 2, the tempting wrong answer here.
  8. Every value of the data 2, 4, 4, 4, 5, 5, 7, 9 is multiplied by 3. The new standard deviation (population form, original value 2) is ____.

    Numerical answer — type the value.

    Show answer

    Answer: 6

    Each deviation is multiplied by 3, so the squared deviations are multiplied by 9 and the square root by 3: SD = 6. Check directly: the new data 6, 12, 12, 12, 15, 15, 21, 27 has mean 15 and squared deviations summing to 288, so sqrt(288/8) = 6. Adding 3 instead of multiplying would leave SD at 2, the tempting wrong answer.
  9. What are the mean and the median of 2, 4, 6, 10?

    1. Mean 5.5, median 5
    2. Mean 5, median 5.5
    3. Mean 5.5, median 4
    4. Mean 6, median 6
    Show answer

    Answer: A — Mean 5.5, median 5

    The sum is 22, so the mean is 5.5; the middle two values are 4 and 6, so the median is 5. The second option swaps the two measures, which is the tempting error.
  10. The arithmetic mean of a set of values is:

    1. The sum of the values divided by their number
    2. The middle value
    3. The most frequent value
    4. The difference between largest and smallest
    Show answer

    Answer: A — The sum of the values divided by their number

    Mean is the sum divided by the count. The middle value is the median, the most frequent is the mode and the largest minus smallest is the range.
  11. The value that occurs most often in a data set is called the:

    1. Mode
    2. Mean
    3. Median
    4. Range
    Show answer

    Answer: A — Mode

    The mode is the most frequent value. The median is the middle value of the ordered data.
  12. The range of the data 6, 11, 3, 20, 9 is:

    1. 17
    2. 20
    3. 3
    4. 49
    Show answer

    Answer: A — 17

    Range = maximum − minimum = 20 − 3 = 17. 20 is only the maximum and 49 is the sum.
  13. Which of the following is a measure of the spread of data?

    1. Standard deviation
    2. Mean
    3. Mode
    4. Median
    Show answer

    Answer: A — Standard deviation

    Standard deviation tells how far values lie from the mean. Mean, mode and median are measures of central tendency.
  14. What is the output of the following code?
    import statistics as st
    d = [3, 5, 5, 7, 10]
    print(st.mean(d), st.median(d), st.mode(d))

    1. 5 5 5
    2. 6 5 5
    3. 6 7 5
    4. 6 6 5
    Show answer

    Answer: B — 6 5 5

    The sum is 30 so the mean is 6, the middle value is 5 and the most frequent is 5: 6 5 5. "5 5 5" takes the mean as 5, and "6 7 5" mixes up the middle value.
  15. What is the output of the following code?
    import statistics as st
    print(st.pstdev([2, 4, 4, 4, 5, 5, 7, 9]))

    1. 4.0
    2. 2.0
    3. 3.0
    4. 1.0
    Show answer

    Answer: B — 2.0

    The mean is 5 and the squared deviations average 4, so the population standard deviation is 2.0. 4.0 is the variance, not its square root.
  16. Gender recorded as male or female is an example of:

    1. Nominal (categorical) data
    2. Continuous data
    3. Interval data
    4. Ratio data
    Show answer

    Answer: A — Nominal (categorical) data

    Gender names categories with no order, so it is nominal. Heights or temperatures are continuous or interval data.
  17. Assertion (A): The median is less affected by extreme values than the mean.
    Reason (R): The median depends only on the middle position of the ordered data, not on how large the extreme values are.
    Choose the correct option:

    1. Both A and R are true and R is the correct explanation of A
    2. Both A and R are true but R is not the correct explanation of A
    3. A is true but R is false
    4. A is false but R is true
    Show answer

    Answer: A — Both A and R are true and R is the correct explanation of A

    The extremes change the sum but not the middle position, which R states. Option 2 is wrong.
  18. Consider the following statements:
    A. The mean is affected by outliers.
    B. Standard deviation measures the spread of data about the mean.
    C. The mode of a data set is always unique.
    D. The range uses only the largest and smallest values.
    Choose the correct answer:

    1. A, B and D only
    2. A and C only
    3. B, C and D only
    4. A, B, C and D
    Show answer

    Answer: A — A, B and D only

    A, B and D are correct. C is false because a set can have more than one mode, so option 4 is the trap.
  19. The median of the values 12, 7, 3, 9, 5 is:

    1. 7
    2. 3
    3. 9
    4. 7.2
    Show answer

    Answer: A — 7

    Sorted, the values are 3, 5, 7, 9, 12 and the middle one is 7. 7.2 is the mean, not the median.
  20. What is the output of the following code?
    import statistics as st
    d = [10, 20, 30, 40, 1000]
    print(st.mean(d), st.median(d))

    1. 220 30
    2. 30 220
    3. 220 220
    4. 30 30
    Show answer

    Answer: A — 220 30

    The outlier 1000 pulls the mean to 220, whereas the median remains the middle value 30: 220 30. "30 220" swaps the two measures.
  21. What is the output of the following code?
    import statistics as st
    a = [1, 2, 3, 4, 5]
    b = [x * 2 + 10 for x in a]
    print(st.mean(b), st.pstdev(b) / st.pstdev(a))

    1. 13 1.0
    2. 16 2.0
    3. 16 1.0
    4. 16 4.0
    Show answer

    Answer: B — 16 2.0

    Doubling and adding 10 turns the mean 3 into 16, and the spread doubles while adding a constant does not change it: 16 2.0. "16 1.0" forgets that scaling changes the standard deviation.
  22. Assertion (A): Adding the same constant to every value leaves the standard deviation unchanged.
    Reason (R): Every value moves by the same amount, so the distances between values and the mean stay the same.
    Choose the correct option:

    1. Both A and R are true and R is the correct explanation of A
    2. Both A and R are true but R is not the correct explanation of A
    3. A is true but R is false
    4. A is false but R is true
    Show answer

    Answer: A — Both A and R are true and R is the correct explanation of A

    The shift moves the mean along with the values, so deviations are the same, as R states. Option 2 is wrong.
  23. What is the output of the following code?
    import statistics as st
    print(st.multimode([1, 2, 2, 3, 3, 4]))

    1. [2]
    2. [2, 3]
    3. [3]
    4. [2, 3, 4]
    Show answer

    Answer: B — [2, 3]

    Both 2 and 3 occur twice, so there are two modes: [2, 3]. "[2]" and "[3]" list only one of them.
  24. What is the output of the following code?
    v = [60, 80]
    w = [1, 3]
    print(sum(a * b for a, b in zip(v, w)) / sum(w))

    1. 70.0
    2. 75.0
    3. 72.0
    4. 80.0
    Show answer

    Answer: B — 75.0

    The weighted mean is (60×1 + 80×3) ÷ 4 = 300 ÷ 4 = 75.0. 70.0 is the simple mean, which ignores the weights.