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. /Check digits and automatic repeat query

Course 2.2·Lesson 3 of 3

Check digits and automatic repeat query

A check digit catches mistakes made when a person types a number, such as a book number or a bar code. An automatic repeat query makes sure transmitted data arrives without error, using acknowledgements and a timeout. This lesson teaches both.

about 30 min1 simulation1 practice question
Lesson 3 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.

Errors at the keyboard

The checks so far look for errors in transmission. Errors also happen in data entry, when a person types a number or a scanner misreads it. A check digit catches these.

A check digit is an extra digit added to the end of a number. It is calculated from the other digits. When the number is entered, the computer works out the check digit again from the other digits and compares it with the one entered. If they differ, the number is rejected and must be entered again.

A check digit can find errors such as these.

  • A wrong digit: 555 typed instead of 888.
  • Two digits swapped (a transposition): 474747 typed as 747474.
  • A digit left out or an extra digit typed.

Where check digits are used

  • ISBN. Every book has an international standard book number. The modern ISBN has 131313 digits, and the last one is a check digit.
  • Bar codes. The 131313-digit numbers under the bar codes on products use the same method as the ISBN.

The 13-digit method (ISBN-13 and bar codes).

  1. Multiply the first 121212 digits by 1,3,1,3,…1, 3, 1, 3, \dots1,3,1,3,… from the left.
  2. Add the results.
  3. The check digit is the number you must add to make the total a multiple of 101010. If the total is already a multiple of 101010, the check digit is 000.

Example: the first 121212 digits are 978190598311. The weighted total is 103103103. To reach 110110110 we add 777, so the check digit is 777 and the full number is 9781905983117.

To check a full 131313-digit number, use the weights 1,3,1,3,…1, 3, 1, 3, \dots1,3,1,3,… on all 131313 digits. The total must be a multiple of 101010.

Other check digit methods exist. The older 101010-digit ISBN uses modulo 11: weights 10,9,8,…,210, 9, 8, \dots, 210,9,8,…,2 on the first nine digits, then the check digit is 111111 minus the remainder after dividing by 111111. A result of 101010 is written as X, and 111111 is written as 000. In the exam, the question gives you the method to use.

Automatic repeat query (ARQ)

An automatic repeat query (ARQ) makes sure that transmitted data is received without error. It uses acknowledgements and a timeout.

A timeline with the sender on the left and the receiver on the right, time running down the page. Packet 1 crosses and a positive acknowledgement comes back. Packet 2 crosses, an error is found, and a negative acknowledgement comes back, so packet 2 is sent again and gets a positive acknowledgement. Packet 3 is lost on the way; the sender's timer runs out at the timeout, and packet 3 is sent again and acknowledged.
  1. The sender sends a packet of data and starts a timer.
  2. The receiver checks the packet for errors, for example with a checksum.
  3. If there is no error, the receiver sends a positive acknowledgement back.
  4. If there is an error, the receiver sends a negative acknowledgement back, and the sender sends the packet again.
  5. If the sender gets no acknowledgement before the timeout, it assumes the packet was lost and sends it again automatically.
  6. This goes on until a positive acknowledgement arrives, or until a set number of tries has been made.

The timeout is a fixed time that the sender waits. If it is too short, the sender resends packets that were only slow. If it is too long, a lost packet holds everything up.

Practise with new numbers

Try it in Python

The first program works out the check digit of a book number and shows a swap of two digits being caught. The second follows an ARQ with a timeout.

Read it first. Then run it. Is the number with the swapped digits valid?

1. Change first12 to the first twelve digits of a book on your shelf. Does the program give its real check digit?

Run it. Which packets needed two sends?

1. Change timeout = 50 to timeout = 200. Predict the new total time first.

Common mistakes

  • Using a check digit for transmission errors. A check digit is for data entry, such as typing or scanning a number.
  • Giving the remainder as the check digit. In the 131313-digit method, the check digit is what you add to reach a multiple of 101010.
  • Mixing up the acknowledgements. Positive means received without error. Negative means an error was found.
  • Forgetting the timeout. If no acknowledgement arrives in time, the sender resends.

Remember these

  • A check digit is worked out from the other digits and catches data entry errors, such as swapped digits.
  • ISBN-13 and bar codes: weights 1,3,1,3,…1, 3, 1, 3, \dots1,3,1,3,…; the total with the check digit is a multiple of 101010.
  • ARQ: positive acknowledgement, negative acknowledgement, timeout, resend.

Check yourself

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

  1. Where is a check digit used: in data entry or in transmission?
  1. A clerk types 352835283528 instead of 325832583258. Which kind of error is this?
  1. The weighted total of the first 121212 digits of a bar code is 868686. What is the check digit?
  1. In ARQ, what does a negative acknowledgement tell the sender?
  1. What does the sender do if no acknowledgement arrives before the timeout?

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 library adds a new book. The first twelve digits of its 13-digit ISBN are 978186197876…Easy · High School (9–10) · by StemPy Lab
The valid book number 9781861978769 is typed into a library system, but the 7th and 8th digits are…Medium · High School (9–10) · by StemPy Lab
A sender uses an automatic repeat query to send 8 packets, one at a time…Hard · High School (9–10) · by StemPy Lab
That was the last lessonBack to the course: take the test
← Detecting Errors in Transmitted Data
← Parity blocks, checksums and echo checksNext →

Discussion (0)

Log in to join the discussion.

Loading…

2 Python programs
5 questions to check yourself

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

Python Labs (1)

Check digits for book numbersPython Lab · by StemPy Lab

Question Sets (1)

Error Detection: Concept Check10 questions · by StemPy Lab

Notes (1)

Error Detection: Quick RevisionNote · by StemPy Lab