Even parity

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Even parity

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. A system uses even parity. The 7 data bits are 1011000. What should the parity bit be?
A 0
B 1
2. A system uses even parity. The 7 data bits are 0110011. What should the parity bit be?
A 0
B 1
3. A system uses even parity. The 7 data bits are 0000000. What should the parity bit be?
A 0, because zero 1s is an even count
B 1, because there are no 1s so one must be added
4. Which statement describes even parity?
A The total number of 1s, including the parity bit, is even
B The total number of 1s, including the parity bit, is odd
5. With even parity, the data bits contain an odd number of 1s. What is the parity bit?
A 0
B 1

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
11011001 + parity bit 0 -> 10110010 AThe data 1100110 already has four 1s (even), so the parity bit should be 0. Adding 1 makes five 1s, which is odd.
20110100 + parity bit 1 -> 01101001 BThe data 1011001 has four 1s, which is already even, so the even parity bit is 0
3Data with no 1s at all still has an even count of 1s, because 0 is even, so the even parity bit is 0 CThe data 1000001 has two 1s, which is even, so parity bit 0 is right. The error is in a different case: the learner counted 0s instead of 1s.
4With even parity, an odd number of 1s in the data means the parity bit is set to 1 to make the total even D1110000 + parity bit 1 -> 11100001
51100110 + parity bit 1 -> 11001101 EThe data 0110100 has three 1s, which is odd, so the even parity bit is 1 to make the total four
61000001 + parity bit 0 -> 10000010 F0000000 + parity bit 0 -> 00000000

Definitions

even parity

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
data = 1011001 ones = 4 (even) parity bit = _
2.
data = 0110100 ones = 3 (odd) parity bit = _
3.
data = 0000000 ones = 0, which is an even count parity bit = _
4.
Even parity makes the number of 1s ____
5.
data = 1101110 ones = _ parity bit = 1

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A data = "1011001"
B ones = data.count("0")
C if ones % 2 == 0:
D parity = 0
E else:
F parity = 1
Question 2
A bits = 1100110
B ones = bits.count("1")
C parity = ones % 2
D print(bits + str(parity))
Question 3
A ones ← 4
B IF ones MOD 2 = 0 THEN
C parity ← 1
D ELSE
E parity ← 1
F ENDIF
Question 4
A def even_parity(bits):
B ones = bits.count("1")
C return ones // 2
D print(even_parity("1011000"))
Question 5
A data = "0000000"
B ones = data.count("1")
C parity = 1
D print(parity)

Answer Key

Even parity
Section A: Quick Questions
Q1
B — 1
Q2
A — 0
Q3
A — 0, because zero 1s is an even count
Q4
A — The total number of 1s, including the parity bit, is even
Q5
B — 1
Section B: Match the Pairs
Q1
1011001 + parity bit 0 -> 10110010 → The data 1011001 has four 1s, which is already even, so the even parity bit is 0
Q2
0110100 + parity bit 1 -> 01101001 → The data 0110100 has three 1s, which is odd, so the even parity bit is 1 to make the total four
Q3
Data with no 1s at all still has an even count of 1s, because 0 is even, so the even parity bit is 0 → 0000000 + parity bit 0 -> 00000000
Q4
With even parity, an odd number of 1s in the data means the parity bit is set to 1 to make the total even → 1110000 + parity bit 1 -> 11100001
Q5
1100110 + parity bit 1 -> 11001101 → The data 1100110 already has four 1s (even), so the parity bit should be 0. Adding 1 makes five 1s, which is odd.
Q6
1000001 + parity bit 0 -> 10000010 → The data 1000001 has two 1s, which is even, so parity bit 0 is right. The error is in a different case: the learner counted 0s instead of 1s.
Section C: Definitions
Q1
even parity — A parity bit is added so the total number of 1s in the byte, including the parity bit, is even. Odd count of 1s in the data gives parity bit 1; even count (even 0) gives 0.
Section D: Fill in the Blanks
Q1
data = 1011001 ones = 4 (even) parity bit = 0
Q2
data = 0110100 ones = 3 (odd) parity bit = 1
Q3
data = 0000000 ones = 0, which is an even count parity bit = 0
Q4
Even parity makes the number of 1s even
Q5
data = 1101110 ones = 5 parity bit = 1
Section E: Spot the Error
Q1
B — Parity depends on the number of 1s in the data, so the code must count "1", not "0". The line should be ones = data.count("1").
Q2
A — The bits must be stored as a string in quotes so that .count("1") works on them. Without quotes it is a number and the program fails. It should be bits = "1100110".
Q3
C — Four 1s is an even count, and the data already has an even number of 1s. With even parity the parity bit must therefore be 0, not 1. The line should be parity ← 0.
Q4
C — The parity bit is the remainder after dividing the number of 1s by 2, which is 0 for an even count and 1 for an odd count. // gives the whole-number quotient instead. It should be return ones % 2.
Q5
C — Zero 1s is an even count, because 0 is even. The data already has an even number of 1s, so the even parity bit is 0. The line should be parity = ones % 2, which gives 0.