Data Transmission, Error Checking and Encryption: Question 5

Syllabus 2.2

Structured 7 marks

A wireless keyboard sends the code for each key pressed to a USB receiver dongle as an 8-bit byte, with one extra parity bit added to each byte. The keyboard uses odd parity, so the total number of 1 bits sent for each keystroke (the 8 data bits plus the parity bit) must always be odd.

A user presses a key whose 8-bit data byte is 1 0 1 1 0 0 1 0 (bit 1 to bit 8, reading left to right).

(a) Calculate the parity bit that the keyboard must transmit with this byte, and give the full 9-bit sequence (the 8 data bits followed by the parity bit) that is actually sent. [2]

(b) A burst of interference during transmission flips bit 6 of the data (changing it from 0 to 1), but does not affect the parity bit. State the 8 data bits as received, and show, with a calculation, how the dongle's parity check detects that an error has occurred. [2]

(c) On a different occasion, the same interference flips both bit 6 and bit 8 of the data byte (changing both from 0 to 1), again without affecting the parity bit. Explain, with reference to this example, why a simple parity check is unable to detect this particular error. [3]

Show worked solution Hide worked solution

Worked solution

Part (a): Calculating the parity bit

Counting the 1 bits in 1 0 1 1 0 0 1 0: positions 1, 3, 4 and 7 are 1, giving four 1 bits, an even count.

Odd parity requires the total number of 1 bits sent (the 8 data bits plus the parity bit) to be odd. Since the data bits alone already give an even count of four, the parity bit must be set to 1, making the total five 1 bits, which is odd.

The full 9-bit sequence transmitted is therefore:

1 0 1 1 0 0 1 0 1

(the original 8 data bits, followed by the parity bit, 1).

Part (b): Detecting a single-bit error

Interference flips bit 6 from 0 to 1. The 8 data bits received are:

1 0 1 1 0 1 1 0

Counting the 1 bits in these received data bits: positions 1, 3, 4, 6 and 7 are now 1, giving five 1 bits. The parity bit itself was not affected by the interference, so it is still received as 1.

Total number of 1 bits received = 5 (data) + 1 (parity) = 6, which is even. Odd parity requires this total to be odd, so an even total tells the dongle that an error has occurred somewhere in the transmission.

Part (c): Why a two-bit error goes undetected

This time, interference flips both bit 6 and bit 8. The 8 data bits received become:

1 0 1 1 0 1 1 1

Counting the 1 bits: positions 1, 3, 4, 6, 7 and 8 are now 1, giving six 1 bits, an even count, just like the four 1 bits in the correct, original byte. Adding the unaffected parity bit (1) gives a total of seven 1 bits, which is odd, so the check reports the data as correct even though two of its bits are wrong.

The underlying reason is that flipping any single bit changes the total count of 1 bits by exactly one (switching odd to even, or even to odd), which is why a single-bit error is always caught. Flipping two bits, however, changes the total count by two, zero, or minus two. Always an even amount, so the overall total’s odd/even nature is left exactly as it was before the error. A simple parity check only ever tests whether that overall total is odd, so it cannot tell the difference between “no error” and “an even number of bits changed,” which is exactly why two simultaneous bit errors (as in this example) slip through undetected.

Final answers

  • (a) Parity bit = 1; transmitted sequence = 1 0 1 1 0 0 1 0 1
  • (b) Received data bits = 1 0 1 1 0 1 1 0; total 1 bits (with parity) = 6, which is even, so the error is detected.
  • (c) Total 1 bits (with parity) = 7, which is odd as required, so no error is flagged. A two-bit error changes the count by an even amount and so cannot be detected by a simple parity check.