HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Computer Science
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Prepare for an Exam
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpFor SchoolsAboutContactPrivacy PolicyTerms of UseRefund Policy
Detecting Errors in Transmitted Data
  1. 1Why errors happen and the parity check
  2. 2Parity blocks, checksums and echo checks
  3. 3Check digits and automatic repeat query
  1. Computer Science
  2. /Detecting Errors in Transmitted Data
  3. /Why errors happen and the parity check

Course 2.2·Lesson 1 of 3

Why errors happen and the parity check

Bits can change on their way along a cable or through the air. This lesson explains how errors happen and why data must be checked after it is sent. Then it shows the simplest check: the parity bit, with even and odd parity.

about 25 min1 simulation1 practice question
Lesson 1 of 3Show all lessonsHide
Detecting Errors in Transmitted Data
  1. 1Why errors happen and the parity check
  2. 2Parity blocks, checksums and echo checks
  3. 3Check digits and automatic repeat query

Try the code and the simulations beside the lesson.

Why check the data at all?

Imagine a friend reads a phone number to you on a noisy bus. You might miss a digit, hear an extra one, or hear a 555 as a 999. Data on a cable or through the air has the same problems.

Errors can occur during data transmission because of interference: electrical noise from motors, other cables or the weather. There are three kinds of error.

  • Data loss: some bits never arrive.
  • Data gain: extra bits arrive that were never sent.
  • Data change: a bit arrives flipped, a 000 as a 111 or a 111 as a 000.

A computer cannot guess which bits are wrong. So the sender adds some extra information, and the receiver uses it to check for errors after the data is transmitted. If an error is found, the data is sent again. This course shows five methods: the parity check, the checksum, the echo check, the check digit and the automatic repeat query.

The parity check

A parity check uses one extra bit in each byte, called the parity bit. Seven bits hold the data, and the eighth is the parity bit. In this course the parity bit is the leftmost bit, the most significant bit.

Sender and receiver agree in advance to use even or odd parity.

  • Even parity: the parity bit is set so that the byte has an even number of 1s.
  • Odd parity: the parity bit is set so that the byte has an odd number of 1s.

Here is an example. The data is 1001011. It has 444 ones.

  • With even parity, 444 is already even, so the parity bit is 000. The byte sent is 01001011.
  • With odd parity, the parity bit must be 111 to make 555 ones. The byte sent is 11001011.

The check at the other end. The receiver counts the 1s in each byte it receives. With even parity it expects an even count. If the count is odd, at least one bit has changed. The receiver then asks for the byte to be sent again.

What a parity check cannot do

A parity check is quick, but it has two weaknesses.

  • Two errors cancel out. If two bits flip, the number of 1s goes up by 222, down by 222, or stays the same. It keeps its even or odd nature, so the error is not detected. The same is true for any even number of flipped bits.
  • It does not say which bit is wrong. It only says that the byte has an odd number of errors. The next lesson shows how a parity block can find the bit.

Checking parity in pseudocode and in Python

The exam writes algorithms in Cambridge pseudocode. The block below is pseudocode: you read it, but the site cannot run it. It counts the 1s in a byte held in an array of 888 bits and tests even parity.

pseudocode
// Count the 1s in a byte held in Bits[1] to Bits[8]
DECLARE Bits : ARRAY[1:8] OF INTEGER
DECLARE Count : INTEGER
DECLARE Index : INTEGER
Count ← 0
FOR Index ← 1 TO 8
    IF Bits[Index] = 1
      THEN
        Count ← Count + 1
    ENDIF
NEXT Index
IF MOD(Count, 2) = 0
  THEN
    OUTPUT "Even parity: no error found"
  ELSE
    OUTPUT "Even parity: error found"
ENDIF

The Python program further down does the same job, and you can run it. Python's count("1") replaces the loop, and % does the job of MOD.

Practise with new numbers

Try it in Python

The program adds an even parity bit to seven data bits. Then it checks the byte, changes one bit and checks again, and finally changes a second bit.

Read it first. Then run it. Look at the last two lines: which one fools the check?

1. Change data to "1110000". Predict the parity bit first.

2. Change the program to use odd parity. Which two lines must change?

Common mistakes

  • Counting the parity bit as data. Count the 1s in the seven data bits to choose the parity bit. At the receiver, count all eight.
  • Mixing up even and odd. Even parity makes the number of 1s even, not the parity bit itself.
  • Saying parity finds every error. Two flipped bits pass the check.
  • Saying parity finds the wrong bit. A single parity bit cannot say which bit changed.

Remember these

  • Errors come from interference: data loss, data gain and data change.
  • Even parity: the byte has an even number of 1s. Odd parity: an odd number.
  • The receiver counts the 1s; the wrong parity means an error, and the byte is sent again.
  • A parity check misses an even number of flipped bits.

Check yourself

Try each one on your own first. If you are stuck, open a hint. Then check with Show the answer.

  1. Name the three kinds of error that interference can cause.
  1. Seven data bits are 0110100. What is the even parity bit?
  1. The same seven bits use odd parity. What is the parity bit now?
  1. A system uses even parity. The byte 11010110 arrives. Is there an error?
  1. Why can a parity check miss an error in which two bits flip?

Enroll free in Detecting Errors in Transmitted Data

Every lesson is open to read. Enrolling also lets you:

  • Mark lessons done and carry on where you stopped.
  • Take the tests of this lesson and its course.
  • Count the course towards the certificate for its chapter.
No payment. You can leave at any time.

Problems (3)

A sensor sends each reading as seven data bits, 1011001…Easy · High School (9–10) · by StemPy Lab
A printer link uses odd parity. Three bytes arrive: 10110100; 01101101; 11100011; How many of the…Medium · High School (9–10) · by StemPy Lab
A system uses even parity. The byte 01101001 is sent…Hard · High School (9–10) · by StemPy Lab
Next: lesson 2Parity blocks, checksums and echo checks
← Detecting Errors in Transmitted Data
← PreviousParity blocks, checksums and echo checks →

Discussion (0)

Log in to join the discussion.

Loading…

1 Python program
5 questions to check yourself

This lesson is free to read. Enroll free to keep your place and take the tests.

Python Labs (1)

Add and check a parity bitPython Lab · by StemPy Lab