skip to content

A single parity bit is appended to each data word: which corruptions does a parity recheck catch, and which slip through?

level: juniorimportance: must knowfreq 62%

answer

  1. one extra bit, whole-codeword check
  2. counts ones, ignores arrangement
  3. odd counts flip it
  4. even flips cancel silently
  5. no position, no repair

basics

~20 s

A parity recheck catches every odd number of flipped bits in the codeword and misses every even number. It cannot say which bit flipped, cannot repair anything, and is blind to bits that were reordered rather than flipped.

solid answer

~40 s

The sender sets one extra bit so the number of `1` bits in the whole codeword has an agreed parity; the receiver recounts and compares that parity. Flipping a bit changes the one-count by one and so flips its parity, and flipping a second bit flips it back. The rule is therefore exact, not probabilistic: any odd number of flips — including a flip of the parity bit itself — is always detected, and any even number is always missed. Parity also depends only on how many bits are one, not where they are, so a permutation of the bits passes untouched. The result is one bit of information, pass or fail, which is far too little to name a position, so nothing can be repaired from it.

go deeper

for a junior

Recall the exact rule: odd numbers of flipped bits are caught, even numbers are missed, and nothing is repaired. Being able to say 'it detects single-bit errors but not double-bit errors' already clears the first screen.

for a middle

Explain why the rule holds — each flip changes the one-count by one, so two flips restore the parity — and add the blind spot most people miss: a permutation of the bits preserves the count and passes.

for a senior

Show judgement about when one bit of overhead is the right purchase: single-flip-dominated faults yes, bursty noise no. Note that the odd convention rejects an all-zero codeword, which catches a dead sender.

for a principal

Frame it as a cost boundary. One check bit buys a pass/fail verdict and nothing else, so recovery must live in the surrounding system; widening the check is a deliberate trade of bits for localisation and repair.

## The construction A **parity bit** is a single extra bit carried alongside a group of data bits — a byte on a bus, a word in a register file, a character on a serial line. The sender counts the `1` bits in the data and sets the extra bit so that the number of `1` bits across the whole codeword, data plus parity, is even. That convention is **even parity**; **odd parity** is the same rule with the total forced odd. Equivalently, the parity bit is the XOR of all the data bits under even parity, or its complement under odd parity. The field costs one bit no matter how wide the data is. That is why it survives on buses, memory lanes and slow links where a wider check would cost real money: it is the cheapest integrity field that exists. ## What the recheck actually tests The receiver does not compare the parity bit against a stored copy — it recomputes. It counts the `1` bits in everything it received, the parity bit included, and asks whether that count has the agreed parity. Exactly two outcomes exist: the parity holds, or it does not. Flipping any one bit changes the one-count by exactly one, which flips the count's parity. Flipping a second bit flips it back. The detection rule falls straight out of that arithmetic: - an **odd** number of flipped bits anywhere in the codeword — one, three, five, and including a flip of the parity bit itself — always changes the parity, and is always caught; - an **even** number of flipped bits always restores the parity, and is always missed. Neither statement carries a probability. A two-bit error is not usually missed; it is missed every time. ## The blind spots | What happened to the codeword | Parity recheck | |---|---| | one data bit flipped | detected | | the parity bit itself flipped | detected | | three bits flipped | detected | | any two bits flipped | missed | | a burst flipping four adjacent bits | missed | | the bits permuted, none flipped | missed | | the word replaced by a different word of the same parity | missed | The last two rows are the ones candidates rarely reach. Parity is a function of **how many** bits are one, never of **where** they are, so a corruption that rearranges bits without flipping any of them — two swapped lanes on a parallel bus, a rotation, a pair of units delivered in the wrong order — leaves the count identical and passes. And since half of all words carry any given parity, a corruption that substitutes a whole unrelated word slips through roughly half the time. ## Detection only, and why one bit can never be more A parity result carries exactly one bit of information: pass or fail. One bit distinguishes two states, so it can never point at one of eight positions, and with no position there is nothing to repair. Naming the flipped position needs enough check bits to address every position plus the no-error case, which is a different and more expensive family of codes. A single parity bit sits deliberately on the cheap side of that trade. That is why a detection-only check pushes recovery out of the code and into the system around it. The response to a failed parity is to discard the unit and obtain it again, never to fix it in place. ## Where one bit is still the right choice - Where the dominant fault genuinely is a single flip — an isolated cell upset, one noisy lane — the two-flip case is a second-order term, and one bit of overhead buys most of the available value. - Under **odd** parity an all-zero codeword is illegal, so a dead transmitter or a line stuck low is rejected rather than accepted as a legitimate zero word. Under even parity all zeros is a perfectly valid codeword. That operational difference, not detection strength, is the honest reason to prefer one convention over the other. - Where flips are independent with probability p per bit, the missed cases start at the two-flip term, which grows with p squared. That is tolerable when p is genuinely tiny and useless when noise arrives in bursts, because a burst delivers an even number of flips about half the time. ## In the interview The answer that scores states the rule and its boundary in one breath: odd flip counts always caught, even flip counts always missed, no localisation, no repair, and blind to rearrangement. Saying 'parity detects errors' and stopping describes a claim rather than a mechanism, and claiming that a parity bit can correct the flip it found confuses it with a code carrying enough redundancy to name a position.

  • Does choosing odd parity rather than even parity change what gets detected?
    No. Both detect exactly the odd flip counts and miss exactly the even ones; the convention only fixes the value of the extra bit. Odd parity has one operational advantage: an all-zero codeword becomes illegal, so a dead sender or a line stuck low is rejected instead of being accepted as a legitimate zero word.
  • Why does a parity check pass when a byte's bits are permuted but none are flipped?
    Parity is computed from how many bits are one, not from where they sit. Every permutation preserves that count, so the recomputed parity still matches. Corruptions that rearrange rather than flip — two swapped lanes on a parallel bus, for instance — are invisible to the check.
  • Why can a single parity bit never point at the corrupted position?
    Its result is one bit wide: pass or fail. One bit separates two states, and naming which of eight positions changed needs at least three. Localisation, and the repair that depends on it, therefore requires extra check bits and belongs to a different family of codes.

saying these in an interview costs you the question

  • Claims a parity bit detects any two-bit error
  • Says the parity bit identifies which position flipped
  • Believes parity can correct the error it detects
  • Says odd parity detects strictly more errors than even parity
  • Assumes shuffling a byte's bit order will fail a parity check
  • Treats a passing parity check as proof the byte is intact