← IGCSE Computer Science Paper 1

Checking a checksum at the receiver

The receiver recalculates the checksum from the received data and compares it with the one sent. Match means no error detected; mismatch means error, so resend is requested.

Understanding Checking a checksum at the receiver in IGCSE Computer Science Paper 1

What it does: The receiver applies the same checksum calculation to the received data to get a value it can compare with the one sent. When the two checksums differ, the receiver treats the data as corrupted and requests it again. If the two checksums match, no error has been detected, so the data is accepted. A checksum can only detect that an error occurred. It cannot say which part is wrong, so the receiver asks for a resend.

Common mistakes: The receiver must recalculate the checksum from the data it received, not from the checksum that was sent. It should be calc ← SUM(data) MOD 256. When the two checksums differ, an error has occurred, so the receiver must request the data again. It must not say that no error was detected.

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
After receiving a block of data, what does the receiver do with the checksum?
It recalculates the checksum from the received data and compares it with the checksum that was sentIt simply reads the sent checksum and assumes the data is correct
Matches
IF calculated == received_checksum THEN request_resend
↓
A resend is requested when the checksums match. It should only be requested on a mismatch, because a match means no error was detected.
Applying
Meanings
Term
recalculate and compare
Meaning
The receiver recalculates the checksum from the received data and compares it with the one sent. Match means no error detected; mismatch means error, so resend is requested.
Practice
calculated ← SUM(received_data) MOD 256
Testing
Gaps
IF calculated sent THEN
Check Answer
Spots
1calc ← sentChecksum MOD 256
2IF calc = sentChecksum THEN

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

The 'Star Fox' badge — Frozen Master, 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. After receiving a block of data, what does the receiver do with the checksum?
A. It simply reads the sent checksum and assumes the data is correct
B. It recalculates the checksum from the received data and compares it with the checksum that was sent ✓
The receiver does not trust the sent checksum alone. It works out its own checksum from the data it received, then compares the two.
2. The recalculated checksum is 142 and the checksum that was sent is 142. What does this show?
A. No error was detected ✓
B. An error has definitely occurred
If the two checksums match, no error has been detected, so the data is accepted.
3. The recalculated checksum is 139 but the checksum that was sent is 142. What should happen next?
A. The data is accepted because the numbers are close
B. An error is detected and the data is requested again ✓
Any difference at all is a mismatch. A mismatch means an error occurred, so the receiver asks for the data to be sent again.
4. Which statement about a matching checksum is correct?
A. A match means no error was detected ✓
B. A match proves the data is 100% error-free
A match means no error was detected. Some errors can still go unnoticed, for example when two changes cancel each other out.
5. The data arrives correctly, but the checksum itself was changed during transmission. What will the receiver find?
A. A mismatch, because the checksum itself was corrupted ✓
B. A match, because the data is correct
The receiver compares its recalculated value with the corrupted checksum. They differ, so an error is reported even though the data was fine, and the data is requested again.

Match the Pairs

calculated == received_checksum → The checksum the receiver worked out matches the one sent, so no error is detected
calculated != received_checksum → The checksums differ, so an error has occurred and the data must be requested again
The receiver works out its own checksum from the data it received, using the same method as the sender → calculated = checksum(received_data)
A mismatch means an error was found, so the receiver asks the sender to send the data again → IF calculated != received_checksum THEN request_resend
IF calculated == received_checksum THEN request_resend → A resend is requested when the checksums match. It should only be requested on a mismatch, because a match means no error was detected.
A mismatch means the checksum is corrupted, so the data must be fine → The checksum itself can be corrupted in transmission, so a mismatch does not prove which part is wrong. Either way, the data is requested again.

Key Term

recalculate and compare
The receiver recalculates the checksum from the received data and compares it with the one sent. Match means no error detected; mismatch means error, so resend is requested.

Fill in the Blanks

1. IF calculated = sent THEN OUTPUT "No error detected" ENDIF
Hint: Type the comparison operator that checks whether the recalculated checksum and the sent checksum are equal.
2. IF calculated <> sent THEN OUTPUT "Request data again" ENDIF
Hint: Type the operator that means not equal, so the code runs when the two checksums differ.
3. IF calculated = sent THEN OUTPUT "OK" ELSE OUTPUT "Request resend" ENDIF
Hint: Type the keyword that starts the branch for when the checksums do not match.
4. calculated ← SUM(received) MOD 256 IF calculated = sent THEN OUTPUT "OK" ENDIF
Hint: Type the variable holding the data the receiver actually got, which the checksum is recalculated from.
5. // Data is fine but checksum corrupted IF calculated <> sent THEN OUTPUT "Resend" ENDIF
Hint: Type the variable holding the checksum that arrived with the data, which may itself have been corrupted.

Spot the Error

Question 1
A calc ← sentChecksum MOD 256
B IF calc = sentChecksum THEN
C OUTPUT "No error detected"
D ELSE
E OUTPUT "Request resend"
F ENDIF
Line A — The receiver must recalculate the checksum from the data it received, not from the checksum that was sent. It should be calc ← SUM(data) MOD 256.
Question 2
A calc ← SUM(received) MOD 256
B IF calc <> sentSum THEN
C OUTPUT "No error detected"
D ELSE
E OUTPUT "No error detected"
Line C — When the two checksums differ, an error has occurred, so the receiver must request the data again. It must not say that no error was detected.
Question 3
A INPUT received
B calc ← SUM(received) MOD 256
C IF calc = sentSum THEN
D OUTPUT "No error detected"
Line A — The receiver needs the checksum that was sent as well as the data, otherwise it has nothing to compare with. It should be INPUT received, sentSum.
Question 4
A sent ← 142
B calc ← LENGTH(data)
C IF calc <> sent THEN
D OUTPUT "Error: resend"
Line B — A checksum is calculated from the values in the data, not by counting how many items there are. It should be calc ← SUM(data) MOD 256, using the same method as the sender.
Question 5
A received ← [10, 20, 40]
B sentSum ← 60
C calc ← sentSum
D IF calc <> sentSum THEN
E OUTPUT "Request again"
Line C — Copying the sent checksum means the two values always match, so errors are never found. The receiver must recalculate it with calc ← SUM(received).

Student with a class code? Join your class →