ISC Practical 2027: Account Number Checksum Verifier – Algorithm and Java Program
Fully solved ISC Computer Science Practical 2027 question: validate a 10-digit account number, apply the double-every-second-digit checksum and find the digital root. Includes the algorithm, a documented Java program, verified outputs and exam tips.

This is Question 1 of Sample Paper 1 from the specimen questions CISCE has released for the ISC Year 2027 Computer Science Practical (Paper 2). The concept area is Number logic. Below you will find the question, a plain-language explanation of the logic, an exam-ready algorithm, a fully documented Java program, the real output for every sample input, and tips for scoring the full 15 marks.
Every program on this page was compiled with JDK 21 and run on CISCE’s sample inputs, plus extra boundary inputs of the kind a visiting examiner will try.
The question
A bank performs a few checks on an account number before accepting it. Design a class AccountVerifier to accept one 10-digit account number and perform the following tasks:
- Check whether the account number has exactly 10 digits. If not, display
INVALID FORMATand stop. - Starting from the right, double every second digit and leave the other digits unchanged. If a doubled value is greater than 9, subtract 9 from it. Add the resulting digits. If the total is divisible by 10, display Checksum Valid; otherwise display Checksum Invalid.
- Add up the original digits of the number. If the result has more than one digit, add its digits again, and repeat until a single digit remains. This final digit is the Digital Root. Display whether the digital root is odd or even.
Worked example from the paper for 4388576018: the doubled digits are 4 → 8, 8 → 16 − 9 = 7, 5 → 10 − 9 = 1, 6 → 12 − 9 = 3 and 1 → 2. Total = 8 + 3 + 7 + 8 + 1 + 7 + 3 + 0 + 2 + 8 = 47, which is not divisible by 10, so the checksum is invalid.
CISCE gives 3 examples with this question. Each one is shown with its output in the Output section below, so you can check your own program against it.
Understanding the problem
This is a number logic question built on the Luhn checksum, the same check used for credit-card numbers. There are three independent jobs: validate the format, compute the checksum, and compute the digital root. Write one method for each and the program almost writes itself.
- Read the number as a String, not an int. A 10-digit number can be as large as 9999999999, which does not fit in an
int(maximum 2147483647). A String also lets you check that every character is a digit and keeps leading zeros. - Positions are counted from the right. The rightmost digit is position 1, so positions 2, 4, 6, 8 and 10 are doubled. Loop from the last character to the first and keep a position counter.
- "Subtract 9" is the same as adding the two digits of the doubled value (16 → 1 + 6 = 7 = 16 − 9). Either way gives the same total.
- Digital root: keep adding digits while the sum is greater than 9.

Algorithm [3 marks]
Write the algorithm in the planning session, in numbered steps like these. It must match your program exactly.
- Start.
- Input the account number as a String
acc. - If the length of
accis not 10, or any character is not a digit, print "INVALID FORMAT" and stop. - Set
total = 0andpos = 1. - For i from the last index down to 0: let d = digit at i. If pos is even, set d = d × 2, and if d > 9 set d = d − 9. Add d to total. Increase pos by 1.
- If total % 10 == 0, print "Checksum: Valid", otherwise print "Checksum: Invalid".
- Set sum = sum of all digits of
acc. - While sum > 9: replace sum by the sum of its own digits.
- Print the digital root (sum) followed by "(Root Even)" if sum is even, otherwise "(Root Odd)".
- Stop.
Java program [7 marks]
The program uses a class with separate methods for each task and comments that explain every data member and the special logic. That is what the 2 documentation marks are for.
import java.util.Scanner;
/**
* ISC Practical 2027 - Sample Paper 1, Question 1
* Verifies a 10-digit bank account number using a checksum rule
* and finds the digital root of the number.
*/
public class AccountVerifier
{
String acc; // account number, kept as a String so that all 10 digits are preserved
AccountVerifier(String a)
{
acc = a.trim();
}
// true only if acc has exactly 10 characters and every character is a digit
boolean isValidFormat()
{
if (acc.length() != 10)
return false;
for (int i = 0; i < acc.length(); i++)
{
if (!Character.isDigit(acc.charAt(i)))
return false;
}
return true;
}
// starting from the right, doubles every second digit (subtracting 9 if it exceeds 9) and adds all digits
int checksumTotal()
{
int total = 0;
int pos = 1; // position counted from the right
for (int i = acc.length() - 1; i >= 0; i--)
{
int d = acc.charAt(i) - '0'; // character to digit
if (pos % 2 == 0) // every second digit from the right
{
d = d * 2;
if (d > 9)
d = d - 9;
}
total += d;
pos++;
}
return total;
}
// adds the digits repeatedly until a single digit remains
int digitalRoot()
{
int sum = 0;
for (int i = 0; i < acc.length(); i++)
sum += acc.charAt(i) - '0';
while (sum > 9)
{
int s = 0;
while (sum > 0)
{
s += sum % 10;
sum /= 10;
}
sum = s;
}
return sum;
}
void display()
{
System.out.println("Account Number: " + acc);
if (!isValidFormat())
{
System.out.println("INVALID FORMAT");
return;
}
if (checksumTotal() % 10 == 0)
System.out.println("Checksum : Valid");
else
System.out.println("Checksum : Invalid");
int root = digitalRoot();
System.out.println("Digital Root : " + root + (root % 2 == 0 ? " (Root Even)" : " (Root Odd)"));
}
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
System.out.print("Account Number: ");
String a = sc.nextLine();
AccountVerifier ob = new AccountVerifier(a);
ob.display();
}
}Variable description
Name Type Purpose
------------- --------- -------
acc String account number entered by the user
total int checksum total of the processed digits
pos int position of the digit counted from the right
d int current digit (doubled when pos is even)
sum int running sum used to find the digital root
root int final single-digit digital rootOutput [3 marks]
These are the actual outputs of the program above for every example in the question:
INPUT:
Account Number: 1000000016
OUTPUT:
1000000016
Checksum : Valid
Digital Root : 8 (Root Even)INPUT:
Account Number: 4388576018
OUTPUT:
4388576018
Checksum : Invalid
Digital Root : 5 (Root Odd)INPUT:
Account Number: 123456789
OUTPUT:
123456789
INVALID FORMATTest it on unknown inputs
One of the 3 output marks is for correct output on inputs the examiner chooses, usually boundary cases. Our program handles these correctly:
INPUT:
Account Number: 43885A6018
OUTPUT:
43885A6018
INVALID FORMATINPUT:
Account Number: 7992739871
OUTPUT:
7992739871
Checksum : Invalid
Digital Root : 8 (Root Even)INPUT:
Account Number: 0000000000
OUTPUT:
0000000000
Checksum : Valid
Digital Root : 0 (Root Even)How to score full marks on this question

- State in your algorithm that the number is read as a String and why. Examiners award the "choice of data type" mark for exactly this kind of reasoning.
- Keep the output format close to the question: label, colon, value. The examiner compares your printout with the expected output.
- Test a number with letters (43885A6018) and a 9-digit number. These are the unknown inputs an examiner is most likely to try.
- Keep the typed program identical to the planned one. Large differences between your planning sheet and the printout cost the 2 hard-copy marks.
Common mistakes to avoid
- Using
intornextInt(), which crashes with an InputMismatchException for most 10-digit numbers. - Doubling every second digit from the left. That is wrong for a 10-digit number: the rightmost digit is never doubled.
- Stopping the digital root after one addition (50 → 5 works, but 99 → 18 needs a second step → 9).
This post is part of our series that solves all 12 specimen questions for the ISC 2027 Computer Science practical, one question a day. Practise writing the algorithm and program on paper in 90 minutes before you type it. That is exactly how the exam works.
Related Posts
Continue learning with these related articles

ISC Class 11 Computer Science Evaluation II Sample Paper 2026-27 with Solutions
A full ISC Class 11 Computer Science Evaluation II paper for 2026-27 on Boolean algebra, propositional logic, number systems, the full adder, Java class design and Python, with a checked answer key and complete solutions.

ISC Class 12 Computer Science Evaluation II Sample Paper 2026-27 with Solutions
A full ISC Class 12 Computer Science Evaluation II theory paper for 2026-27 on Boolean algebra, K-maps, encoders, recursion, deque, linked list and binary trees, with a checked answer key, logic diagrams and solved Java programs.

ISC Class 11 Computer Science Notes: Propositional Logic and Truth Tables
Complete ISC Class 11 Computer Science notes on propositional logic: propositions, logical connectives, truth tables, tautology, contradiction, converse, inverse and contrapositive, and the laws of logic, with solved examples.