Course Content
Paper 2 – Problem Solving Approach -Practical
0/102
Past Paper-2 May/June 2025
Past Paper-1 May/June 2025
Download Files
0/1
Olevel : Computer Science 2210 / IGCSE 0478 : Recorded

Hello students. In today’s video, we are going to study Check Digit, which is an important verification technique in the Cambridge O Level Computer Science 2210 syllabus and is frequently tested in examinations. A check digit is an extra digit added to the end of a number and it is calculated using a mathematical rule. The main purpose of a check digit is to detect errors when data is entered into a system or transferred from one system to another. It is very important to remember for the exam that a check digit comes under verification and not validation. This means it does not check whether the data is sensible or reasonable; instead, it checks whether the data has been entered correctly without any typing mistakes.

Check digits are widely used in real-life systems. You can commonly see them in barcodes, ISBN numbers of books, credit and debit card numbers, and bank account numbers. Whenever a long number is entered into a system, the computer recalculates the check digit and compares it with the entered one to make sure no error has occurred during typing or transmission.

Now let us understand how a check digit works with a simple example that matches the level of the 2210 syllabus. Suppose we are given a six-digit number, 453621. To calculate the check digit, we follow a fixed set of steps. First, starting from the left side, we multiply the digits alternately by 1 and 3. After that, we add all the results together. Finally, we find the number that must be added to make the total a multiple of 10. That number becomes the check digit.

For this number, the digits are 4, 5, 3, 6, 2, and 1, and the multipliers are 1, 3, 1, 3, 1, and 3. When we perform the calculation, 4 multiplied by 1 gives 4, 5 multiplied by 3 gives 15, 3 multiplied by 1 gives 3, 6 multiplied by 3 gives 18, 2 multiplied by 1 gives 2, and 1 multiplied by 3 gives 3. When we add all these values together, the total becomes 45. The next multiple of 10 after 45 is 50, so the check digit is 5. This means the complete number becomes 4536215.

Now let us see how verification takes place. When this number is entered into a computer system, the system separates the last digit, which is the check digit, and then recalculates the check digit using the first six digits. If the newly calculated check digit matches the entered check digit, the number is accepted as correct. If it does not match, the system displays an error message, indicating that a mistake has occurred during data entry.

Let us now understand how a check digit can be calculated using pseudocode, according to the Cambridge O Level Computer Science 2210 standard. First, we declare our variables. The variable Number is declared as a STRING because we need to access each digit separately. Variables OddSum, EvenSum, Total, CheckDigit, and Position are declared as INTEGER. We then set OddSum and EvenSum to zero, as these variables will store the sum of digits in odd and even positions. The program asks the user to enter the number and stores it in the variable Number. A FOR loop then runs from position 1 to the length of the number. Inside the loop, the program checks whether the position is odd or even. If the position is odd, the digit at that position is converted into an integer and added to OddSum. If the position is even, the digit is added to EvenSum. This process continues until all digits of the number have been processed. After the loop ends, the total is calculated by multiplying the odd-position sum by 3 and then adding the even-position sum. Finally, the check digit is calculated using the modulus operation and displayed on the screen.

DECLARE Number : STRING
DECLARE OddSum, EvenSum, Total, CheckDigit, Position : INTEGER

OddSum ← 0
EvenSum ← 0

OUTPUT “Enter the number:”
INPUT Number

FOR Position ← 1 TO LENGTH(Number)
IF Position MOD 2 = 1 THEN
OddSum ← OddSum + INTEGER(Number[Position])
ELSE
EvenSum ← EvenSum + INTEGER(Number[Position])
ENDIF
NEXT Position

Total ← (OddSum * 3) + EvenSum
CheckDigit ← Total MOD 10

OUTPUT “Check Digit is: “, CheckDigit

To conclude, a check digit is a simple but very effective method used to detect data entry errors. It is widely used in many real-life applications where accuracy is important. However, it is important to remember that a check digit can only detect errors, not correct them. In exam answers, always explain what a check digit is, why it is used, and support your explanation with a clear example to secure full marks.

You cannot copy content of this page