Check digit

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

Check digit

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. What is a check digit?
A A digit that is chosen at random and added to the front of a number
B An extra digit added to the end of a number, calculated from its other digits
2. How is the check digit worked out?
A It is calculated from the other digits of the number
B It is typed in by the user as any digit they like
3. A number is typed in with its check digit. What does the computer do next?
A Recalculates the check digit from the other digits and compares it with the one entered
B Sends the number back to the user to ask if it is right
4. What is a check digit mainly used to detect?
A Data entry errors, such as a mistyped digit
B Errors caused by interference during data transmission
5. The recalculated check digit does NOT match the one that was entered. What does this suggest?
A The number is definitely correct
B A mistake was probably made when the number was entered

Match the Pairs

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

Left columnRight column
1check digit AThe check digit is calculated from the other digits and added to the end of the number, not chosen randomly
2recalculate and compare Bnumber = 978030640615 -> check digit = calc(number)
3The check digit is calculated from the other digits of the number CAn extra digit added to the end of a number, calculated from the other digits, to detect data entry mistakes
4On entry, the check digit is recalculated and compared with the one typed DOn entry, the system works out the check digit again from the other digits and compares it with the one typed
5A check digit is used to detect errors in data sent across a network EA check digit detects data entry errors made by a person typing or scanning, not errors in transmission
6The check digit is chosen at random and put at the start of the number FIF calc(first digits) <> last digit THEN reject

Definitions

check digit

Fill in the Blanks

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

1.
total <- digit1 + digit2 + digit3 check <- total ___ 10
2.
IF newCheck _ enteredCheck THEN OUTPUT "Number accepted" ENDIF
3.
IF newCheck <> enteredCheck ____ OUTPUT "Check digit error" ENDIF
4.
remainder <- total MOD 11 checkDigit <- 11 - _________
5.
IF newCheck <> enteredCheck THEN ______ "Please re-enter the number" ENDIF

Spot the Error

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

Question 1
A total ← 0
B FOR i ← 1 TO 4
C total ← digit[i]
D NEXT i
E check ← total MOD 10
Question 2
A INPUT number
B given ← LastDigit(number)
C rest ← AllButLast(number)
D IF given <> calc THEN
E IF given = calc THEN
F OUTPUT "Accepted"
Question 3
A total ← d1*4 + d2*3
B total ← total + d3*2
C remainder ← total DIV 11
D check ← 11 - remainder
Question 4
A total ← d1 + d2 + d3 + check
B check ← total MOD 10
C full ← number & check
Question 5
A remainder ← total MOD 11
B check ← remainder - 11
C IF check = 10 THEN
D check ← "X"

Answer Key

Check digit
Section A: Quick Questions
Q1
B — An extra digit added to the end of a number, calculated from its other digits
Q2
A — It is calculated from the other digits of the number
Q3
A — Recalculates the check digit from the other digits and compares it with the one entered
Q4
A — Data entry errors, such as a mistyped digit
Q5
B — A mistake was probably made when the number was entered
Section B: Match the Pairs
Q1
check digit → An extra digit added to the end of a number, calculated from the other digits, to detect data entry mistakes
Q2
recalculate and compare → On entry, the system works out the check digit again from the other digits and compares it with the one typed
Q3
The check digit is calculated from the other digits of the number → number = 978030640615 -> check digit = calc(number)
Q4
On entry, the check digit is recalculated and compared with the one typed → IF calc(first digits) <> last digit THEN reject
Q5
A check digit is used to detect errors in data sent across a network → A check digit detects data entry errors made by a person typing or scanning, not errors in transmission
Q6
The check digit is chosen at random and put at the start of the number → The check digit is calculated from the other digits and added to the end of the number, not chosen randomly
Section C: Definitions
Q1
check digit — An extra digit added to the end of a number, calculated from its other digits. It is recalculated on entry and compared, to detect data entry mistakes.
Section D: Fill in the Blanks
Q1
total <- digit1 + digit2 + digit3 check <- total MOD 10
Q2
IF newCheck = enteredCheck THEN OUTPUT "Number accepted" ENDIF
Q3
IF newCheck <> enteredCheck THEN OUTPUT "Check digit error" ENDIF
Q4
remainder <- total MOD 11 checkDigit <- 11 - remainder
Q5
IF newCheck <> enteredCheck THEN OUTPUT "Please re-enter the number" ENDIF
Section E: Spot the Error
Q1
C — The check digit is calculated from all the other digits. The line overwrites total each time, so only the last digit is used. It should add each digit: total ← total + digit[i].
Q2
D — On entry the check digit is recalculated and compared with the one typed. The number is accepted only when they match, so the test should be IF given = calc THEN.
Q3
C — Modulus 11 needs the remainder after dividing by 11, which is MOD. DIV gives the whole-number quotient. It should be remainder ← total MOD 11.
Q4
A — The check digit is calculated from the other digits of the number, so it cannot be used in its own calculation. The total should be d1 + d2 + d3 + d4.
Q5
B — In this weighted modulus 11 method the check digit is 11 minus the remainder. Writing remainder - 11 gives a negative number. It should be check ← 11 - remainder.