All subjects · Computer Science · WCP03 Advanced Principles of Computer Science

Error detection: parity, block parity and checksums

Edexcel IAL Computer Science · WCP03 Advanced Principles of Computer Science

Interference can flip bits during transmission. Error detection lets the receiver spot that data has been corrupted so it can ask for it again. You must be able to calculate parity bits, two-dimensional block parity and checksums.

Practise this in the app: instant marking and a fix for every mistake. Free, no email needed to start.

Practise this lesson

Parity bits

A parity bit is added to each group of bits so the total number of 1s is even (even parity) or odd (odd parity), as agreed.

The receiver counts the 1s; the wrong parity means an error. Limits: it cannot detect an even number of flipped bits, and it cannot tell which bit is wrong. Benefit: very cheap, one extra bit.

Two-dimensional block parity

Data is arranged in a block of rows. A parity bit is added to each row and each column (the bottom row of column parity bits is the parity byte).

If one bit flips, exactly one row and one column show the wrong parity: their intersection locates the bit, so it can be corrected by flipping it back. It also detects many multi-bit errors. Drawback: more overhead, and some patterns (four errors at the corners of a rectangle) cancel out.

RowDataRow parity (even)
110110010
201101100
311100010
400011110
Column parity00100010

Checksums

A checksum is a value calculated from a block of data and sent with it. The receiver repeats the calculation; a different result means an error.

A simple method: add the data values and keep the remainder after dividing by 256 (so it fits in one byte).

Example: 45 + 120 + 200 + 99 = 464; 464 mod 256 = 208.

Benefits: detects many multi-bit errors in a whole block with little overhead. Drawbacks: cannot locate the error; swapping two values or errors that cancel out (one value +1, another -1) are missed. Real protocols use stronger methods (one's complement sums in TCP/IP, cyclic redundancy checks in Ethernet).

After detection

Detection is usually paired with automatic repeat request (ARQ): the receiver sends an acknowledgement if the data is correct, or a negative acknowledgement (or no acknowledgement) so the sender retransmits.

Worked example

Calculate the checksum (sum mod 256) for the bytes 45, 120, 200, 99.

  1. Sum = 45 + 120 + 200 + 99 = 464
  2. 464 - 256 = 208

Answer: Checksum = 208

Key idea: Parity: make the count of 1s even (or odd); misses even numbers of errors. Block parity: row and column parity locate and correct a single error. Checksum: sum mod 256 sent with the data; detects but cannot locate.

Check yourself

  1. What even parity bit is added to 1101011?
    Show answer

    1. 1101011 has five 1s; add 1 to make six.

  2. What odd parity bit is added to 0110110?
    Show answer

    1. 0110110 has four 1s; odd parity needs 1 to make five.

  3. Even parity is used, with the parity bit as the leftmost bit. Which byte has been received with an error?
    • 11000000
    • 01100110
    • 10100100
    • 00000000
    Show answer

    10100100. 10100100 has three 1s, an odd number, so even parity fails. The others have even counts.

  4. Why can a single parity bit fail to detect an error?
    • It only checks the first bit
    • If two bits flip, the number of 1s keeps the same parity
    • It can only be used with odd parity
    • It changes the data
    Show answer

    If two bits flip, the number of 1s keeps the same parity. An even number of errors leaves parity unchanged.

  5. Data rows 1011001, 0110110, 1110001, 0001111 are sent with even column parity. What is the parity bit for the first (leftmost) column?
    Show answer

    0. First column bits: 1, 0, 1, 0, which has 2 ones; even parity bit = 0.

  6. In two-dimensional block parity, how is a single flipped bit located?
    • It is always in the parity byte
    • It is where the row and the column with incorrect parity cross
    • The checksum gives its position
    • It cannot be located
    Show answer

    It is where the row and the column with incorrect parity cross. One bad row plus one bad column pinpoints the bit.

  7. Calculate the checksum (sum of values mod 256) for the bytes 90, 150, 77, 33.
    Show answer

    94. 90 + 150 + 77 + 33 = 350; mod 256 = 94.

  8. Which error would a simple additive checksum fail to detect?
    • One value changed from 40 to 41
    • One bit flipped in one byte
    • Two data values arriving in swapped order
    • A value lost completely
    Show answer

    Two data values arriving in swapped order. Addition gives the same total whatever the order.

Practise with instant feedback

Sources

Last updated 8 November 2026. Spotted a mistake? Tell us.