The Lumenary · Grades 6–8
Check digits and error detection
Name: ______________________
Date: ______________________
You will learn to
- Compute and verify ISBN-10 and ISBN-13 check digits
- Prove that ISBN-10 detects every single-digit error and every swap of two neighbouring digits
- Explain why ISBN-13 detects every single-digit error but misses swaps of neighbouring digits that differ by 5
- Add a parity bit to binary data and prove that it detects any odd number of flipped bits and no even number
- Explain why a single check digit can detect an error but cannot correct it
- 1.
The first nine digits of an ISBN-10 are . What is the check digit? (If it is X, answer .)
- 2.
Exactly one of these is a valid ISBN-13. Which one?
- A.978-9966-25-118-3
- B.978-9966-25-181-3
- C.978-9966-52-118-3
- D.978-9966-25-118-8
- 3.
Find the check digit of the ISBN-13 that begins .
- 4.
What parity bit should be added to the message so that the total number of 1s is even? (Answer or .)
- 5.
Which swap of two neighbouring digits can go undetected in an ISBN-13?
- A.
- B.
- C.
- D.
- 6.
In the proof that ISBN-10 catches every swap of neighbours, is in position and in position . By how much does the swap change the check sum?
- A.By (up to sign)
- B.By
- C.By
- D.By — the sum does not change
- 7.
One digit of a valid ISBN-10 is smudged: . The smudged digit is in position . Find it. (Hint: you will need a partner modulo .)
- 8.
A received ISBN-10 fails the check. Which statement is true?
- A.At least one digit is wrong, but in general we cannot tell which one.
- B.The computer can find and fix the wrong digit using the check digit.
- C.The check digit itself must be the wrong digit.
- D.Exactly one digit is wrong.
- 9.
In Lean, a code number is a list of digits and
pre ++ x :: postis the listpre, then the digitx, then the listpost. Which statement says that ISBN-10 detects every single-digit error?- A.
ValidISBN10 (pre ++ x :: post) → ValidISBN10 (pre ++ y :: post) → x = y(for digitsx, y ≤ 10) - B.
ValidISBN10 (pre ++ x :: post) → ¬ ValidISBN10 (pre ++ y :: post) - C.
ValidISBN10 (pre ++ x :: y :: post) → ValidISBN10 (pre ++ y :: x :: post) → x = y - D.
x ≠ y → ValidISBN10 (pre ++ x :: post)
- A.
- 10.
Write
luhn_valid(number), wherenumberis a string of digits, returningTrueif it passes the Luhn test: from the right, keep the 1st, 3rd, 5th, … digits as they are; double the 2nd, 4th, … digits, subtracting when the double is more than ; the total must be a multiple of . Then check the blind spot:1099and1909differ by a swap.Computational — Practice