Syllabus & Goals 3 min
Cambridge 2.2 · Methods of error detection Paper 1 · Computer Systems
By the end of this lesson you can:
- Explain why transmitted data must be checked for errors.
- Use a parity check (even and odd) and a parity block to find an error.
- Describe a checksum and an echo check.
Recap / Warm-Up 5 min
Packets can be corrupted on the way — by electrical interference, switching problems or skewing. The receiver must be able to spot a corrupted byte.
Quick starter
How many 1s are in the byte 01101100? Is that an even or odd count?
Reveal the answer
Four 1s — an even count. That count is the whole idea behind a parity check.
Key Concept 14 min
1 · Parity checks
A parity check counts the number of 1-bits in a byte. One bit (usually the most significant) is reserved as the parity bit and set so the total is even (even parity) or odd (odd parity).
Sender and receiver agree the parity first. If a byte arrives with the wrong parity, an error is detected.
2 · Parity blocks (2-D parity)
Send a block of bytes plus a parity byte. Check parity along every row and every column. The error sits at the intersection of the faulty row and faulty column — so you can find and fix it.
0.Diagram · Advaslearning Hub (simplified 4-bit block)3 · Checksum and echo check
Worked Example 12 min
(a) Set the even-parity bit
The 7-bit value 1101100 has four 1s — already even. So for even parity the parity bit is 0, giving 0 1101100. For odd parity it would be 1.
(b) Detect a transmission error
Even parity was agreed. A byte arrives as 01001100 — that is three 1s (odd). The parity has changed from even to odd, so an error is detected.
The parity check as an algorithm
Cambridge pseudocode
// Work out the EVEN parity bit for a 7-bit value
DECLARE Bits : ARRAY[1:7] OF INTEGER
DECLARE Index, Ones, ParityBit : INTEGER
Bits ← [1, 1, 0, 1, 1, 0, 0]
Ones ← 0
FOR Index ← 1 TO 7
IF Bits[Index] = 1
THEN
Ones ← Ones + 1
ENDIF
NEXT Index
IF Ones MOD 2 = 0
THEN
ParityBit ← 0
ELSE
ParityBit ← 1
ENDIF
OUTPUT "Even parity bit is ", ParityBitThe same algorithm in Python (IDLE)
# Work out the even parity bit for a 7-bit value bits = [1, 1, 0, 1, 1, 0, 0] ones = sum(bits) if ones % 2 == 0: parity_bit = 0 else: parity_bit = 1 print("Even parity bit is", parity_bit)
Output
Even parity bit is 0
Try It Yourself 12 min
Goal: The 7-bit value 0001111 uses even parity. What is the parity bit?
Goal: Odd parity was agreed. The byte 11101101 is received. Has an error occurred? Show how you decided.
Goal: Explain why a checksum can catch errors that a single parity check misses.
📝 Exam Practice 10 min
Define the term parity bit.
Mark scheme
- An extra bit added to a byte to make the number of 1-bits even or odd, as agreed (1).
Explain why a single parity check might fail to detect a transmission error.
Mark scheme
- If two (an even number of) bits change (1)…
- …the parity stays the same, so no error is flagged (1).
Describe how a checksum is used to detect errors in a transmitted block of data.
Mark scheme
- A checksum is calculated from the data (by an agreed algorithm) and sent with it (1).
- The receiver recalculates the checksum from the received data (1).
- If the two values differ, an error occurred and the data is re-sent (1).
Recap & Key Terms 3 min
A parity check counts 1-bits and uses a parity bit (even/odd) to flag a changed byte; a parity block finds the exact bit at a row/column intersection. A checksumrecalculates a value over a block, and an echo check sends the data back to compare.
- Parity check
- Checking the count of 1-bits against an agreed even/odd parity.
- Parity block
- A 2-D parity check over rows and columns that locates the exact bit in error.
- Checksum
- A value calculated from a data block, recalculated by the receiver to detect errors.
- Echo check
- Sending received data back to the sender to compare with the original.
Homework 1 min
Task (≤ 15 min): Even parity is used. For each 7-bit value, give the parity bit: (a) 1110000, (b) 1011011, (c) 0000001.
Model answer
- (a) three 1s (odd) → parity bit 1.
- (b) five 1s (odd) → parity bit 1.
- (c) one 1 (odd) → parity bit 1.