Parity bit

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

Parity bit

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. What is a parity bit?
A One extra bit added to a group of bits so the total number of 1s follows an agreed rule
B A bit that stores the ASCII code of the character
2. A byte holds 7 data bits plus a parity bit. How many bits are there in total?
A 8 bits
B 7 bits
3. Which statement about the rule is correct?
A The receiver works out which rule the sender used after the data arrives
B The sender and receiver agree the parity rule (even or odd) before the data is sent
4. What does the parity bit make the total number of 1s in the byte follow?
A A random pattern chosen by the receiver
B An agreed rule: always even, or always odd
5. Using even parity, the 7 data bits are 1011000. What should the parity bit be?
A 1, because there are three 1s and one more makes four
B 0, because there are three 1s and that is already even

Match the Pairs

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

Left columnRight column
11010001 + 1 → 10100011 AThe sender and receiver must agree on the same rule beforehand. Otherwise good data would look like errors.
20110100 → three 1s B1100101 + 0 → 11001010
3With an even parity rule, the parity bit makes the total number of 1s even CSeven data bits with a parity bit added to the end to make the byte; here the parity bit is 1
4With an odd parity rule, the parity bit makes the total number of 1s odd DCounting the 1s in the data bits, which is the first step in deciding the parity bit
5Parity bit added to 7 data bits makes a 9-bit byte E7 data bits plus 1 parity bit make 8 bits, not 9. The parity bit is only one extra bit.
6The sender picks even parity and the receiver picks odd parity F1100101 + 1 → 11001011

Definitions

parity bit

Fill in the Blanks

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

1.
Data bits 1011011 contain _ ones
2.
7 data bits + 1 parity bit = _ bits
3.
IF ones MOD 2 = 1 THEN parity ← _ ELSE parity ← 0
4.
Data 1101100 with even parity: parity = _
5.
IF ones MOD 2 = _ THEN OUTPUT "OK" ELSE OUTPUT "Error"

Spot the Error

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

Question 1
A ones = 1
B FOR each bit in data
C IF bit = 1 THEN
D ones = ones + 1
E ENDIF
F NEXT
Question 2
A sender rule = even
B data = 1010100
C receiver rule = odd
D parity = 1
Question 3
A data = 0110100
B ones = 4
C rule = odd
D parity = 0
Question 4
A data = 0000001
B ones = 1
C rule = even
D parity = 0
Question 5
A ones = 5
B parity = ones DIV 2
C total = ones + parity
D rule: total is even

Answer Key

Parity bit
Section A: Quick Questions
Q1
A — One extra bit added to a group of bits so the total number of 1s follows an agreed rule
Q2
A — 8 bits
Q3
B — The sender and receiver agree the parity rule (even or odd) before the data is sent
Q4
B — An agreed rule: always even, or always odd
Q5
A — 1, because there are three 1s and one more makes four
Section B: Match the Pairs
Q1
1010001 + 1 → 10100011 → Seven data bits with a parity bit added to the end to make the byte; here the parity bit is 1
Q2
0110100 → three 1s → Counting the 1s in the data bits, which is the first step in deciding the parity bit
Q3
With an even parity rule, the parity bit makes the total number of 1s even → 1100101 + 0 → 11001010
Q4
With an odd parity rule, the parity bit makes the total number of 1s odd → 1100101 + 1 → 11001011
Q5
Parity bit added to 7 data bits makes a 9-bit byte → 7 data bits plus 1 parity bit make 8 bits, not 9. The parity bit is only one extra bit.
Q6
The sender picks even parity and the receiver picks odd parity → The sender and receiver must agree on the same rule beforehand. Otherwise good data would look like errors.
Section C: Definitions
Q1
parity bit — One extra bit added to a group of bits (such as 7 data bits) so the total number of 1s follows a rule, even or odd, agreed by sender and receiver. It is used to detect errors.
Section D: Fill in the Blanks
Q1
Data bits 1011011 contain 5 ones
Q2
7 data bits + 1 parity bit = 8 bits
Q3
IF ones MOD 2 = 1 THEN parity ← 1 ELSE parity ← 0
Q4
Data 1101100 with even parity: parity = 0
Q5
IF ones MOD 2 = 0 THEN OUTPUT "OK" ELSE OUTPUT "Error"
Section E: Spot the Error
Q1
A — The counter for the number of 1s must start at 0. Starting at 1 means every count is one too high, so the parity bit would be wrong. It should be ones = 0.
Q2
C — The sender and receiver must agree the same rule beforehand. If the sender uses even parity, the receiver must check for even parity too. It should be receiver rule = even.
Q3
B — 0110100 contains three 1s, not four. The count of 1s must be right before the parity bit is chosen. It should be ones = 3.
Q4
D — There is one 1 in the data and the rule is even. The parity bit must be 1 to make the total two 1s. With parity = 0 the total stays odd. It should be parity = 1.
Q5
B — For even parity the parity bit is the remainder when the number of 1s is divided by 2, so MOD 2. DIV 2 gives the wrong value (2 here). It should be parity = ones MOD 2.