← IGCSE Computer Science Paper 1

Checksum

A value calculated from a block of data by a set rule and sent with it. The receiver repeats the calculation and compares the results. If they differ, an error occurred.

Understanding Checksum in IGCSE Computer Science Paper 1

What it does: The checksum travels together with the data. The receiver needs both to be able to compare the values. The receiver applies the same rule as the sender to the received data. If it used a different rule, the comparison would be meaningless. A checksum is worked out from the block of data using an agreed calculation, so the data decides the value. A mismatch shows the data (or the checksum) was changed, lost or gained on the way. A checksum only helps detect errors. It does not correct them. A match means no error was found, but this does not prove that nothing went wrong.

Common mistakes: The checksum must be sent with the data so the receiver can compare it. The line should be SEND data, checksum. The receiver needs the checksum that was sent with the data, otherwise sentSum has no value to compare against. It should be RECEIVE data, sentSum.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 168–178) and word search (Modules 168–188).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Where does a checksum value come from?
It is calculated from the data itself using a set ruleIt is chosen at random by the sender
Matches
checksum = 42 # a fixed number chosen at random
↓
The checksum is not calculated from the data. It must come from the data using a set rule, so a made-up value cannot show whether the data changed.
Applying
Meanings
Term
checksum
Meaning
A value calculated from a block of data by a set rule and sent with it. The receiver repeats the calculation and compares the results. If they differ, an error occurred.
Practice
checksum ← SUM(data) MOD 256
Testing
Gaps
checksum ← (data) MOD 256
Check Answer
Spots
2checksum ← SUM(data)
3SEND data

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Reef Shark' badge — Reef Ruler, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. Where does a checksum value come from?
A. It is calculated from the data itself using a set rule ✓
B. It is chosen at random by the sender
A checksum is worked out from the block of data using an agreed calculation, so the data decides the value.
2. How is a checksum sent to the receiver?
A. Along with the data it was calculated from ✓
B. On a separate, slower connection after the data is deleted
The checksum travels with the data (e.g. in the packet trailer) so the receiver has both to compare.
3. What does the receiver do with the checksum it receives?
A. Adds it to the data and stores it as part of the file
B. Recalculates it from the received data and compares the two values ✓
The receiver repeats the same calculation on the data it got and compares its result with the checksum that was sent.
4. The sender and receiver must use which calculation?
A. A different calculation each, to double-check the data
B. The same calculation ✓
If the two used different rules, the values would differ even when no error occurred, so the rule must be agreed in advance.
5. The receiver's calculated checksum is different from the one that was sent. What does this mean?
A. An error occurred during transmission ✓
B. The data arrived correctly
A mismatch shows the data (or the checksum) was changed, lost or gained on the way.

Match the Pairs

checksum = sum(data) % 256 → The sender calculates a value from the data itself using a set rule
if received_checksum == calculated_checksum: → The receiver compares the sent checksum with the one it calculated again
The checksum is sent with the data so the receiver can use it to check for errors → send(data, checksum)
The sender and receiver must use the same calculation, so the receiver repeats the sender's rule → new_checksum = sum(received_data) % 256
checksum = 42 # a fixed number chosen at random → The checksum is not calculated from the data. It must come from the data using a set rule, so a made-up value cannot show whether the data changed.
Receiver: the checksum arrived, so the data must be correct → The receiver must calculate the checksum again from the received data and compare it. Receiving a checksum does not prove the data is correct.

Key Term

checksum
A value calculated from a block of data by a set rule and sent with it. The receiver repeats the calculation and compares the results. If they differ, an error occurred.

Fill in the Blanks

1. checksum ← SUM(data) MOD 256
Hint: Type the function that adds up all the values in the data block.
2. SEND data, checksum
Hint: Type the variable that travels with the data so the receiver can compare.
3. calc ← SUM(received) MOD 256
Hint: Type the operator that gives the remainder after division, so the receiver repeats the sender's calculation.
4. IF calc = checksum THEN OUTPUT "No error found"
Hint: Type the keyword that follows an IF condition.
5. IF calc <> checksum THEN OUTPUT "Error detected"
Hint: Type the comparison operator meaning not equal, which signals the two values differ.

Spot the Error

Question 1
A data ← [12, 7, 30, 5]
B checksum ← SUM(data)
C SEND data
Line C — The checksum must be sent with the data so the receiver can compare it. The line should be SEND data, checksum.
Question 2
A RECEIVE data
B newSum ← SUM(data)
C IF newSum = sentSum THEN
D OUTPUT "No error"
Line A — The receiver needs the checksum that was sent with the data, otherwise sentSum has no value to compare against. It should be RECEIVE data, sentSum.
Question 3
A data ← [8, 15, 3, 22]
B sum ← 0
C FOR i ← 0 TO 3
D sum ← data[i]
E NEXT i
F SEND data, sum
Line D — This overwrites sum on each pass, so only the last value is kept. The checksum must add every value: sum ← sum + data[i].
Question 4
A RECEIVE data, sentSum
B newSum ← SUM(data)
C IF newSum = sentSum THEN
D OUTPUT "Error detected"
E ENDIF
Line C — An error is detected when the two checksums are different, not equal. The test should be IF newSum <> sentSum THEN.
Question 5
A data ← [6, 11, 9]
B checksum ← 100
C SEND data, checksum
Line B — A checksum must be calculated from the data itself. A fixed number would not change if the data changed. It should be checksum ← SUM(data).

Student with a class code? Join your class →