When data is sent over a network or stored on a device, errors can occur. To detect or correct these errors, different error-control techniques are used.
The three most important techniques are:
✔ Parity Bits
✔ CRC (Cyclic Redundancy Check)
✔ Hamming Code
Let’s understand them in simple language.
🔹 1. Parity Bits
✔ Definition
A parity bit is a simple method of error detection.
It adds one extra bit to the data to ensure the total number of 1s is either even or odd.
✔ Types of Parity
- Even Parity
- Total number of 1s (including parity bit) must be even.
- Odd Parity
- Total number of 1s (including parity bit) must be odd.
✔ How It Works
- Count all the 1s in the data.
- Set parity bit such that total 1s become even or odd (depending on method).
✔ Key Formula
Parity bit = XOR of all data bits
(XOR gives 1 if number of 1s is odd)
✔ Capabilities
- Detects single-bit errors
- Cannot correct errors
- Cannot detect all multi-bit errors
✔ Applications
- RAM error checking
- Communication protocols (simple serial communication)
- Basic hardware-level error detection
🔹 2. CRC (Cyclic Redundancy Check)
✔ Definition
CRC is a strong error-detection method.
It uses polynomial division to generate a checksum (CRC value) that is added to the data.
✔ How It Works
- Treat data as a long binary number.
- Divide it by a generator polynomial (e.g., x³ + x + 1).
- The remainder of this division is the CRC code.
- This CRC is sent along with data.
- Receiver divides again → if remainder is 0, data is correct.
✔ Capabilities
- Detects single-bit, double-bit, and burst errors
- Very reliable
- Cannot correct errors (detection only)
✔ Common CRC Types
- CRC-8
- CRC-16
- CRC-32
✔ Applications
- Ethernet (LAN)
- Storage devices (HDD/SSD/CD/DVD)
- File integrity checks (ZIP files, downloads)
- Network protocols (PPP, HDLC)
🔹 3. Hamming Code
✔ Definition
Hamming Code is an error-detection + error-correction technique.
It can identify and correct single-bit errors.
✔ How It Works
- Hamming Code inserts parity bits at positions that are powers of 2:
1, 2, 4, 8… - Each parity bit covers specific positions in the data.
- Receiver checks all parity bits:
- If they match → no error
- If mismatch → the error position is calculated
- The incorrect bit is flipped to correct the error
✔ Key Formula
To calculate how many parity bits (r) are needed for m data bits: 2r≥m+r+12^r \geq m + r + 12r≥m+r+1
✔ Capabilities
- Detects single-bit errors
- Corrects single-bit errors
- Detects some multi-bit errors (but cannot correct)
✔ Applications
- Satellite and space communication
- ECC memory (Error-Correcting Code RAM)
- Communication in noisy environments
- Reliable data transmission
🔹 4. Comparison Table
| Feature | Parity Bits | CRC | Hamming Code |
|---|---|---|---|
| Error Detection | Single-bit | Single + burst errors | Single-bit |
| Error Correction | ❌ No | ❌ No | ✔ Yes (single-bit) |
| Complexity | Low | Medium | High |
| Uses | RAM, simple protocols | Networks, storage, file integrity | ECC RAM, satellite |
| Technique | Adds 1 bit | Polynomial division | Multiple parity bits |
| Strength | Weak | Very strong detection | Strong correction |
🔹 5. Easy Mnemonics
⭐ Hamming Code
“H for Help” → It helps fix (correct) single-bit errors.
⭐ Parity Bit
“P for Parity = Prevents mistakes (detects single-bit errors).”
⭐ CRC
“Check Redundancy Carefully → Detects burst errors.”
🔹 6. Quick Revision
- Parity Bit → Detects only single-bit errors; simple.
- CRC → Detects multiple and burst errors; very reliable; no correction.
- Hamming Code → Detects + corrects single-bit errors.
- CRC is used in Ethernet, storage, downloads.
- Hamming is used in ECC memory and satellite.
- Parity is used in basic error checking (RAM, simple transmission).
MCQ
What is the purpose of a parity bit?
a) To add redundancy to a signal
b) To check and correct errors
c) To detect single-bit errors
d) To encode data
Answer: c) To detect single-bit errors
What are the two types of parity?
a) Bit and Byte
b) Odd and Even
c) Forward and Reverse
d) High and Low
Answer: b) Odd and Even
What does an even parity bit ensure?
a) Total number of 1s is odd
b) Total number of 1s is even
c) Total number of 0s is even
d) Total number of bits is even
Answer: b) Total number of 1s is even
Parity bits are ineffective in detecting:
a) Single-bit errors
b) Burst errors
c) Even-numbered errors
d) Both b and c
Answer: d) Both b and c
Where are parity bits commonly used?
a) Satellite communication
b) File compression algorithms
c) RAM error checking
d) Video streaming
Answer: c) RAM error checking
What does CRC stand for?
a) Cyclic Rotational Check
b) Cyclic Redundancy Check
c) Coded Redundancy Check
d) Cyclic Resource Check
Answer: b) Cyclic Redundancy Check
What does CRC primarily detect?
a) Single-bit errors
b) Burst errors
c) Packet loss
d) Noise interference
Answer: b) Burst errors
What is used in CRC to calculate the remainder?
a) Division by binary numbers
b) Exclusive-OR (XOR) operation
c) Logical AND
d) Subtraction
Answer: b) Exclusive-OR (XOR) operation
Which of the following is a commonly used CRC polynomial?
a) x³ + x + 1
b) x⁴ + x² + 1
c) x² + 1
d) x⁵ + 1
Answer: a) x³ + x + 1
What is the main limitation of CRC?
a) Cannot detect burst errors
b) Cannot correct errors
c) Low accuracy in detection
d) Inefficient for small data packets
Answer: b) Cannot correct errors
Which of these is NOT an application of CRC?
a) Ethernet networks
b) Hard disk error checking
c) File verification
d) Error correction in Hamming codes
Answer: d) Error correction in Hamming codes
How is the CRC value added to the data?
a) Appended at the beginning
b) Appended at the end
c) Inserted randomly in the data stream
d) Encoded within the data bits
Answer: b) Appended at the end
What is the main purpose of Hamming code?
a) Data encryption
b) Error correction
c) File compression
d) Burst error detection
Answer: b) Error correction
Hamming code can correct which type of errors?
a) Burst errors
b) Double-bit errors
c) Single-bit errors
d) Multi-bit errors
Answer: c) Single-bit errors
In Hamming code, where are parity bits placed?
a) At the end of the data
b) In positions that are powers of 2
c) In positions that are multiples of 3
d) At random positions
Answer: b) In positions that are powers of 2
Which of the following is an application of Hamming code?
a) CRC error checking
b) RAM error correction
c) File compression
d) Network address translation
Answer: b) RAM error correction
What is the result when no errors are found in Hamming code parity checks?
a) A non-zero error syndrome
b) All parity bits are 0
c) Parity bits are 1
d) The data is discarded
Answer: b) All parity bits are 0
Hamming code is unable to correct which of the following errors?
a) Single-bit errors
b) Double-bit errors
c) Errors in parity bits
d) Errors in first data bit
Answer: b) Double-bit errors
What is the minimum Hamming distance required for single-bit error correction?
a) 1
b) 2
c) 3
d) 4
Answer: c) 3
Which technique detects errors but cannot correct them?
a) Parity bits
b) CRC
c) Hamming code
d) Both a and b
Answer: d) Both a and b
Which of the following is the most robust for detecting burst errors?
a) Parity bits
b) CRC
c) Hamming code
d) None of these
Answer: b) CRC
Which error detection method uses a polynomial generator?
a) Parity bit
b) CRC
c) Hamming code
d) Checksum
Answer: b) CRC
How does Hamming code correct errors?
a) By recalculating parity bits
b) By flipping the identified erroneous bit
c) By discarding erroneous data
d) By using CRC for correction
Answer: b) By flipping the identified erroneous bit
What is the main advantage of Hamming code over parity bits?
a) Higher speed
b) Burst error detection
c) Ability to correct single-bit errors
d) Simplicity of implementation
Answer: c) Ability to correct single-bit errors
Focus Points:
- Parity bits are simple and detect single-bit errors only.
- CRC detects burst errors but does not correct them.
- Hamming code detects and corrects single-bit errors.
- Remember the formula for parity bits in Hamming code: 2r≥m+r+12^r \geq m + r + 12r≥m+r+1.
- CRC is used in networks like Ethernet, while Hamming code is used in RAM and satellite communication.
