Lesson 5: Catching Flipped Bits — Noise, Even Parity Checks, and End-of-Unit Assessment
Time: 50 minutes
Unit: Binary, Pixels, Logic Gates, and Packet Switching | Previous: Lesson 4
Goal
Add an even-parity check bit to 8-bit bytes, detect single-bit transmission errors, explain why two simultaneous bit flips in the same byte escape 1-bit parity, and complete the 5-part End-of-Unit Assessment.
Materials
- Large two-sided paper cards or tokens (
Light = 1, Dark = 0), 9 cards per pair (or a printed 9-box row where students can point, dictate, or write 0 and 1 instead of handling small objects).
- Printed or board-copied End-of-Unit Assessment (20 points total; 20 minutes at the end of this 50-minute lesson, or administered in a separate quiz period).
Steps
1. Opening (5 min): What If Static Flips a 0 to a 1?
Ask the class:
- "Suppose a hospital or spacecraft sends the 8-bit number 00000101 (5 milligrams or 5 degrees), and a burst of radio static on the wire flips the leftmost bit from 0 to 1 (10000101 = 133!). How can the receiver tell that a bit was flipped without already knowing the secret number?"
2. Main Activity (15 min): The Even-Parity Check Bit
Demonstrate how adding one extra check bit (a 9th bit called the Even Parity Bit) catches any single-bit flip (or any odd number of bit flips):
The Even-Parity Rule
Before sending an 8-bit data byte, the sender counts how many 1s are in the 8 data bits:
- If the number of 1s in the 8 data bits is already even (0, 2, 4, 6, or 8), set the 9th Parity Bit = 0 so the total number of 1s across all 9 bits stays even.
- If the number of 1s in the 8 data bits is odd (1, 3, 5, or 7), set the 9th Parity Bit = 1 so the total number of 1s across all 9 bits becomes even.
Worked Example 1: Computing the Parity Bit
| 8 Data Bits |
Count of 1s in Data |
Even or Odd? |
9th Bit (Even Parity Bit) |
Complete 9-Bit Frame Sent |
Total 1s Sent |
01000001 ('A') |
2 ones |
Even |
0 |
01000001 0 |
2 (Even) |
01000011 ('C') |
3 ones |
Odd |
1 |
01000011 1 |
4 (Even) |
Worked Example 2: Checking Incoming Frames at the Receiver
When the receiver gets a 9-bit frame, it counts the total number of 1s across all 9 bits:
- Received Frame X: 01001001 0 → Count of 1s = 3 (Odd!). Since every valid frame was sent with an even number of 1s, an odd total signals that an odd number of bits (1, 3, 5...) flipped during transmission: ERROR DETECTED — discard and request re-send!
- Crucial limitation ("No Error Detected" ≠ Proof of Zero Errors): What if lightning flips two (or 4, 6, 8) bits inside the same 9-bit frame? Changing an even count by +2, 0, or -2 keeps the total even, so a single parity bit cannot detect an even number of bit flips. Therefore, a passing (even) parity check means no error was detected, not absolute proof that zero bits changed!
3. Student Practice Tasks (5.1 – 5.8) (10 min)
- Task 5.1: Find the Even Parity Bit (
0 or 1) to append to the 8-bit data byte 00110101.
- Task 5.2: Find the Even Parity Bit (
0 or 1) to append to the 8-bit data byte 10110101.
- Task 5.3: A receiver uses even parity and receives these four 9-bit frames. Which ones have a detected error?
- Frame A:
01010101 0
- Frame B:
11001010 1
- Frame C:
00000000 0
- Frame D:
10000000 0
- Task 5.4: What if the Parity Bit itself (the 9th bit) gets flipped by static during transmission while the 8 data bits are untouched? Will the receiver still detect an error? Explain why.
- Task 5.5: Assuming at most one bit flipped in a 9-bit frame, explain why a single 9th parity bit can tell you that a bit flipped, but cannot tell you which of the 9 bits flipped.
- Task 5.6 (2D Grid Parity Puzzle): Arrange three 4-bit data rows into a grid with an even Row Parity bit at the right end of each row and an even Column Parity bit at the bottom of each data column:
- Row 1:
1 0 1 0 | 0
- Row 2:
0 1 1 0 | 1
- Row 3:
1 1 0 0 | 0
- Col Parity:
0 0 1 0
Assume that at most one bit in the entire diagram flipped during transmission, and in fact exactly one data bit inside the 3 × 4 data grid flipped. Check the row sums and column sums to pinpoint the exact (Row, Column) of the flipped bit.
- Task 5.7 (Error Rate Ratio): Out of
500 transmitted packets, 15 packets fail their parity check and must be re-sent. Write the error rate as a simplified ratio (failed : total) and as a rate per 100 packets (percentage).
- Task 5.8 (Overhead Comparison): Adding
1 parity bit to every 8 data bits creates 9 total bits per byte. What is the ratio of check bits to data bits (1 : 8) and data bits to total bits (8 : 9)?
Complete Answer Key (Tasks 5.1 – 5.8)
- Answer 5.1:
00110101 has 4 ones (already even) → Parity Bit = 0 (00110101 0).
- Answer 5.2:
10110101 has 5 ones (odd) → Parity Bit = 1 (10110101 1, making 6 ones total).
- Answer 5.3:
- Frame A (
01010101 0): 4 ones (Even) → Passes check (no error detected).
- Frame B (
11001010 1): 5 ones (Odd) → ERROR DETECTED (odd number of bit flips).
- Frame C (
00000000 0): 0 ones (0 is an even number!) → Passes check (no error detected).
- Frame D (
10000000 0): 1 one (Odd) → ERROR DETECTED (odd number of bit flips).
- Answer 5.4: Yes! Flipping any single bit among the 9 bits — including the 9th parity bit itself — changes the total count of
1s by +1 or -1, turning an even total into an odd total.
- Answer 5.5: Under the single-bit-flip assumption, flipping any one of the 9 bit positions changes the total parity from even to odd in the exact same way, so an odd total tells the receiver that a bit flipped (or, more generally, that an odd number of bits flipped), but not which slot (
1 through 9) changed.
- Answer 5.6: Count the
1s in each row (including its right-hand Row Parity bit):
- Row 1 (
1 0 1 0 | 0): 2 ones (Even — passes check).
- Row 2 (
0 1 1 0 | 1): 3 ones (Odd — error detected in Row 2!).
- Row 3 (
1 1 0 0 | 0): 2 ones (Even — passes check).
Now count the 1s in each data column (including its bottom Column Parity bit):
- Column 1 (
1, 0, 1 | 0): 2 ones (Even — passes check).
- Column 2 (
0, 1, 1 | 0): 2 ones (Even — passes check).
- Column 3 (
1, 1, 0 | 1): 3 ones (Odd — error detected in Column 3!).
- Column 4 (
0, 0, 0 | 0): 0 ones (Even — passes check).
Because Row 2 and Column 3 both fail their even-parity check, the single flipped bit lies at their intersection: (Row 2, Column 3) (changing that 1 back to 0 restores both Row 2 and Column 3 to 2 ones).
- Answer 5.7:
15 : 500 simplifies (dividing by 5) to 3 : 100, which is 3 failed packets per 100 packets (3%).
- Answer 5.8: Check bits to data bits =
1 : 8; data bits to total transmitted bits = 8 : 9.
End-of-Unit Synthesis Assessment (20 Points Total — 20 Minutes)
Instructions for Students
Answer all 5 problems (4 points each = 20 points total). Show your place-value additions, intermediate gate values, or unit-rate steps clearly.
Problem 1: Doubling Cards & 8-Bit Binary (4 points)
- (a) [1 pt] List the 8 binary place-value cards in order from left (
8th bit) to right (1st bit).
- (b) [1 pt] Convert the 8-bit binary byte
01011010 to a base-10 number.
- (c) [2 pts] Convert the base-10 number
150 into an 8-bit binary byte. Show which place-value cards are switched ON (1).
Problem 2: ASCII Characters & Bitmap Pixel Ratios (4 points)
- (a) [2 pts] In standard ASCII, uppercase
'A' is 65 (01000001). Decode the 2-byte word 01001000 01001001.
- (b) [2 pts] A small
10 × 10 game icon (100 pixels total) is upgraded from a 2-color palette (1 bit per pixel) to an 8-color palette (3 bits per pixel). Counting raw uncompressed pixel data (excluding any headers), how many bits did the icon take before the upgrade, how many bits does it take after the upgrade, and what is the ratio of old raw pixel size to new raw pixel size?
Problem 3: Logic Gates & Truth Table (4 points)
A solar battery charger turns ON (Output = 1) according to the logic circuit:
Output = S AND (NOT F)
where S = 1 when Sunlight is detected (0 when dark), and F = 1 when the Battery is already Full (0 when not full).
- (a) [3 pts] Write out the 4-row truth table for (S, F) = (0,0), (0,1), (1,0), (1,1), showing the intermediate column NOT F and the final Output column.
- (b) [1 pt] Explain in plain English which single row turns the charger ON and why.
Problem 4: Packet Switching & Network Unit Rates (4 points)
- (a) [2 pts] Three packets arrive at a receiver in the order:
Packet 3 of 3: "ONE!"
Packet 1 of 3: "WELL"
Packet 2 of 3: " D"
Write the reassembled message and explain why packets from the same message can arrive out of order on a packet-switched network.
- (b) [2 pts] A network link transfers
450 packets in 9 seconds. Each packet is 100 bits long (20 header bits + 80 payload bits). Find the link's rate in packets per second and its total throughput in bits per second.
Problem 5: Even-Parity Error Detection (4 points)
- (a) [1 pt] What Even Parity Bit (
0 or 1) should be attached to the 8-bit byte 11010011?
- (b) [2 pts] A receiver using even parity receives Frame 1 (
10101010 0) and Frame 2 (11100011 0). Which frame has a detected error? Show your count of 1s for each frame.
- (c) [1 pt] Explain why even parity fails to detect an error if exactly two bits flip inside the same 9-bit frame.
End-of-Unit Assessment Answer Key & Scoring Guide (20 Points)
- Problem 1 (4 pts):
- (a) [1 pt]:
128, 64, 32, 16, 8, 4, 2, 1.
- (b) [1 pt]:
64 + 16 + 8 + 2 = 90.
- (c) [2 pts]:
150 = 128 + 16 + 4 + 2 → 10010110 (1 pt for correct card decomposition, 1 pt for exact 8-bit string).
- Problem 2 (4 pts):
- (a) [2 pts]: Byte 1 (
01001000) = 64 + 8 = 72 (8th letter = 'H'). Byte 2 (01001001) = 64 + 8 + 1 = 73 (9th letter = 'I'). Decoded word: "HI".
- (b) [2 pts]: Before upgrade:
100 pixels × 1 bit/pixel = 100 bits. After upgrade: 100 pixels × 3 bits/pixel = 300 bits. Ratio of old to new storage = 1 : 3.
- Problem 3 (4 pts):
- (a) [3 pts]:
(S=0, F=0) → NOT F = 1 → 0 AND 1 = 0
(S=0, F=1) → NOT F = 0 → 0 AND 0 = 0
(S=1, F=0) → NOT F = 1 → 1 AND 1 = 1
(S=1, F=1) → NOT F = 0 → 1 AND 0 = 0
- (b) [1 pt]: Row
(S=1, F=0) turns the charger ON (1) because there is sunlight (S=1) and the battery is not full (F=0, so NOT F = 1).
- Problem 4 (4 pts):
- (a) [2 pts]: Reassembled message (
1, 2, 3): "WELL DONE!". Packets can arrive out of order because different packets may take different router paths (with different hop counts or congestion delays) around busy or broken links.
- (b) [2 pts]: Packet rate:
450 packets ÷ 9 seconds = 50 packets per second. Total throughput: 50 packets/sec × 100 bits/packet = 5,000 bits per second.
- Problem 5 (4 pts):
- (a) [1 pt]:
11010011 has 5 ones (odd) → Even Parity Bit = 1.
- (b) [2 pts]: Frame 1 (
10101010 0) has 4 ones (even → passes check, no error detected). Frame 2 (11100011 0) has 5 ones (odd → ERROR DETECTED in Frame 2).
- (c) [1 pt]: Flipping two bits changes the number of
1s by +2, 0, or -2, which keeps an even total even, so the receiver sees an even count and cannot tell that two bits changed.
Vocabulary
- noise / interference: Unwanted electrical or radio disturbances that can accidentally flip a
0 bit to a 1 (or 1 to 0) during transmission.
- even parity bit: An extra check bit (
0 or 1) appended to a group of data bits so the total number of 1s across the entire frame is always an even number.
Differentiation
- Extra support: Allow students to keep their 8 physical place-value cards (
128, 64, 32, 16, 8, 4, 2, 1) on their desk during the assessment.
- Extra challenge: Have students complete the 2D
3 × 4 grid parity puzzle (Task 5.6) where they intentionally flip one data coin while their partner looks away, and see if their partner can find the exact flipped coin in one try using only row and column parity!
Safety
No physical hazards in this unplugged lesson.
Teacher notes
- Zero-is-even reminder: Remind students before Task 5.3 that
0 is an even number, so an all-zero byte 00000000 already has an even count of 1s (0 ones) and receives a 0 parity bit (00000000 0).