Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1calc ← (10 - total MOD 10) MOD 10 | ARecalculates the check digit from the weighted total of the other digits of the number that was entered | |
| 2IF calc <> entered THEN | Bcalc = 7, entered = 7, so accept | |
| 3If the recalculated check digit differs from the entered one, the number is rejected and the user is asked to re-enter it | CCompares the recalculated check digit with the entered one and runs the rejection code if they differ | |
| 4For the valid ISBN 978-0-306-40615-7, the recalculated check digit is 7, which matches the entered 7, so the number is accepted | DThe recalculated check digit (5) differs from the entered one (7), so the number should be rejected, not accepted. Swapping two digits changed the total. | |
| 5978-0-306-04615-7 gives calc = 5, entered = 7, so ACCEPT | EIF calc <> entered THEN OUTPUT "Please re-enter the number" | |
| 6IF calc = entered THEN OUTPUT "Please re-enter the number" | FThe condition is the wrong way round. The re-enter message is shown when the check digits match, which is when the number is valid. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
recalculate and compare — Work out the check digit again from the other digits, then compare it with the one entered. If they differ, reject the number and ask the user to re-enter it.calculated ← CalcCheckDigit(first12)
IF calculated <> entered THEN
OUTPUT "Re-enter the number"IF calculated <> entered THEN
OUTPUT "Re-enter the number"
ENDIFcalculated ← 5
entered ← 7
IF calculated <> entered THEN rejectIF calculated = entered THEN
OUTPUT "Number accepted"
ENDIFWHILE calculated <> entered DO
OUTPUT "Re-enter the number"
INPUT entered