A-Level Computer Science / Unit 6: Protecting Data and Ensuring Accuracy

6.2.2 Detecting Errors During Data Transfer

🔒 Lesson slides are available to signed-in users. Sign in

6.2.2 Detecting Errors During Data Transfer

Data can change while it travels between devices. Electrical interference, weak signals, faulty equipment, or other transmission problems may cause one or more bits to flip. Transfer checks add extra information so that the receiver can test whether the received bit pattern is consistent with the data sent.

This section covers the three methods required by the syllabus: byte parity, block parity, and checksums.

By the end of this section, you should be able to:

  • Explain why extra checking information is transmitted with data.
  • Calculate and test even and odd parity for a byte.
  • Explain what simple parity can detect and what it may miss.
  • Describe how a checksum is generated and checked.
  • Construct and analyse a block-parity arrangement.
  • Explain what happens after a transfer error is detected.

Protecting Integrity While Data Travels

Transmission error: a change to one or more bits while data is travelling from the sender to the receiver.
Redundant data: additional information sent for checking rather than as part of the original message.

A transfer-checking method normally follows the same general process:

  1. The sender calculates checking information from the original data.
  2. The data and checking information are transmitted.
  3. The receiver repeats the relevant calculation or test.
  4. The receiver compares its result with the received checking information.
  5. If the results disagree, an error is reported and retransmission may be requested.
Exam tip: Describe both ends of the process. A complete answer should explain what the sender adds and what the receiver recalculates or counts.

Byte Parity

A parity bit is an extra bit added to a group of data bits. Its value is chosen so that the complete group contains either an even or an odd number of 1s.

Parity bit: an extra bit used to make the total number of 1s in a transmitted group either even or odd.
Parity system Required total number of 1s Receiver's test
Even parity Even An odd count indicates an error.
Odd parity Odd An even count indicates an error.

Worked example: preparing a byte

A remote weather station needs to send the seven-bit payload 1010110. It contains four 1s.

System Parity bit placed at the left Transmitted byte Total 1s
Even parity 0 01010110 4
Odd parity 1 11010110 5

Checking a received byte

Suppose the receiver expects even parity and receives 01100111. This byte contains five 1s. Because five is odd, the parity rule fails and the receiver detects that the byte has changed.

Exam tip: Count the 1s in the complete received byte, including the parity bit.

What Simple Parity Can and Cannot Do

A single parity bit detects any odd number of bit flips in the checked byte because the odd/even status changes. However, an even number of bit flips can preserve the same parity.

Two-bit error that passes even parity

Stage Byte Number of 1s Parity result
Sent 01010110 4 Even
Received after two flips 01110010 4 Still even

The received value is different, but the count of 1s remains even. The parity check therefore does not detect this particular corruption.

Common misconception: Passing a parity check does not prove that the byte is error-free. It only means that no error was detected by that parity rule.

Simple parity also tells the receiver that a problem exists, but it does not identify which bit is wrong. The usual response is to reject the affected data and request retransmission.

Checksum

A checksum is a value calculated from a block of data. The sender transmits the block together with the checksum. The receiver performs the same calculation on the received block and compares the result with the transmitted checksum.

Checksum: a value derived from a block of transmitted data and used by the receiver to test whether that block has changed.

Original worked example

In this simplified training scheme, three bytes are treated as unsigned denary values and added. Only the lowest eight bits of the total are used, equivalent to calculating the total modulo 256.

Byte Binary value Denary value
1 00110110 54
2 01001001 73
3 00011100 28

The sender calculates:

54 + 73 + 28 = 155, so the training checksum is 10011011.

If the second byte changes from 73 to 77, the receiver calculates 54 + 77 + 28 = 159, or 10011111. This does not match the transmitted checksum, so an error is detected.

Important: Real checksum algorithms use defined calculation rules that may be more sophisticated than this training example. Sender and receiver must use exactly the same rule.
Exam tip: Explain the comparison. The receiver does not simply “read the checksum”; it recalculates a value from the received data and compares the two results.

Block Parity

Block parity arranges several bytes as rows in a grid. A parity bit is added to each row, and an additional parity row checks the columns. This is sometimes described as parity in two directions.

Block parity: a method that applies parity across each byte and down corresponding bit positions in a block.

Creating an even-parity block

The following original example contains four data rows. The right-hand column contains each row's parity bit, and the bottom row provides column parity.

Row b1 b2 b3 b4 b5 b6 b7 Row parity
Data 1 10110010
Data 2 01011100
Data 3 11001001
Data 4 00110110
Column parity 000 100 01

Locating one corrupted bit

During transmission, suppose bit b6 in Data 2 changes from 1 to 0. The parity check for Data 2 fails, and the parity check for column b6 also fails. Their intersection identifies the changed bit.

Exam tip: For a single-bit error, identify the failing row and failing column. Their intersection gives the error position.
Common misconception: Block parity does not guarantee correction of every possible multiple-bit error. Its clear locating power applies when the pattern of errors is unambiguous, especially for a single corrupted bit.

Comparing the Three Methods

Method Checking information Main strength Important limitation
Byte parity One extra bit per byte Simple detection of odd numbers of bit flips in a byte Even numbers of flips may be missed; the bit position is not identified
Checksum Calculated value for a block Checks the block as a whole A mismatch does not identify the exact changed bit; some different blocks may produce the same checksum
Block parity Row parity plus column parity Can locate one corrupted bit using a row-column intersection Some multiple-error patterns may be ambiguous or undetected
Exam tip: Use precise verbs: detect, locate, correct, and request retransmission do not mean the same thing.

Worked Scenario: Sensor Data from a Mountain Station

Scenario

A mountain monitoring station sends small sensor readings to a control centre. Each reading is placed in a byte and several bytes are grouped into a transmission block.

Requirement Suitable method Reason
Quickly test each individual byte Byte parity An additional parity bit allows the receiver to test the 1-count for each byte.
Test whether an entire group of readings changed Checksum The sender and receiver calculate and compare a value for the whole block.
Locate one changed bit within a small grid of bytes Block parity A failing row and column identify the intersection.

If a check reports an error but the receiver cannot reliably correct it, the safest response is to discard the affected unit and request that the sender transmit it again.

Model structure: sender calculation → transmission → receiver calculation → comparison → accept, reject, correct, or retransmit.

Interactive: Transfer Error Lab

Use the existing widget to generate parity, test received bytes, calculate a checksum, and trace a single error through a block-parity grid.

Result Ready

Choose a method and run the check.

What is being checked?

A parity bit changes the total number of 1s to match the selected even or odd rule.

Count every 1 in the complete byte, including the parity bit.

Common Mistakes and Misconceptions

  • Counting only the data bits and forgetting the parity bit at the receiving end.
  • Assuming that passing a parity check proves the byte is correct.
  • Claiming simple parity identifies the exact corrupted bit.
  • Describing a checksum without saying that the receiver repeats the calculation.
  • Confusing a checksum with the check digit used for entered identifiers.
  • Claiming block parity can unambiguously correct every multiple-bit error.
  • Using “detect”, “locate”, and “correct” as interchangeable terms.

Practice

Try these original questions

  1. Using even parity, add a parity bit to the seven-bit payload 1100101.
  2. Using odd parity, add a parity bit to 0011100.
  3. A receiver using even parity obtains 10110101. State whether an error is detected and explain why.
  4. Explain why two flipped bits in one byte may pass a simple parity check.
  5. Describe the sender and receiver stages of a checksum method.
  6. A simplified checksum uses the sum modulo 256. Calculate the checksum for denary byte values 42, 91, and 36.
  7. Explain why a checksum mismatch normally leads to retransmission rather than direct correction.
  8. Describe how row and column parity can locate one corrupted bit in a block.
  9. Explain one limitation of block parity when several bits change.
  10. Compare byte parity and checksum, giving one strength and one limitation of each.

Review

Concept Strong recall statement
Even parity The complete transmitted group contains an even number of 1s.
Odd parity The complete transmitted group contains an odd number of 1s.
Simple parity limitation An even number of bit flips may leave the parity unchanged.
Checksum The receiver recalculates a value from the received block and compares it with the transmitted value.
Block parity Row and column parity can locate a single changed bit at their intersection.
Detected error The affected data may be rejected and retransmission requested.
Final exam tip: Use the sequence sender → checking information → receiver → comparison → response.