ISC Class 12 · Computer Science 868 · Paper II practical 2027

ISC Class 12 Computer Science practical questions, solved.

Three problems on the paper, one to attempt, ninety minutes on paper and ninety at the keyboard. These ISC Class 12 Computer Science practical questions are solved the way the session asks: algorithm first, then the Java program, then the output on more than one input. Every program below was run.

Live online · nine problems run on Java 21 · three more to try · your days and your timing · first class free

Start here

Courses behind the practical

The practical rewards a student who can turn a page of English into Java without a template. These are the three courses that train that, at three different depths.

Ans. The short version

The ISC Class 12 Computer Science practical is Paper II, 30 marks. In the 2027 syllabus the three-hour exam gives three programming problems and you solve one: up to 90 minutes of planning for the algorithm and a handwritten Java program, then 90 minutes to key it in and run it on seen and unseen inputs. That problem carries 15 marks: algorithm 3, program 7, printout 2, output 3. The other 15 come from the year’s assignments. Below are original practical questions solved in full. Modern Age Coders rehearses this exam in personalised one to one classes, and a priority demo lets you try one first.

Q1. What happens in the three hours?

How does the ISC Class 12 Computer Science practical work in 2027?

You choose one problem out of three, plan it on paper for up to 90 minutes, then type and run it for up to 90 minutes in front of the Visiting Examiner. Nobody moves to the computers early: the ISC 2027 syllabus says the second part starts only after the 90 minutes of planning are over.

PartWhat you doWhat is handed over
Planning Session, 90 minutesRead three problems, pick one, write its algorithm and a Java program by handThe answer script, given in at the end of the session
Examination Session, 90 minutesGet your script back, key the program in, run it on the inputs you can see and on inputs only the examiner hasA printout of the listing with output, attached to the script

Where the 30 practical marks come from

ComponentMarksWho gives them
Programming assignments of the year10Internal evaluation by the school
The same assignments, seen again5Visiting Examiner
Algorithm for the exam problem3Visiting Examiner
Java program with internal documentation7Visiting Examiner
Hard copy, the printout2Visiting Examiner
Output3Visiting Examiner
Total30Added to 70 marks of theory

The four lines that make 15 come from the sample table printed at the end of the syllabus document (ISC Year 2027, marked February 2025). Two things follow from it. A program that does not run can still earn from the first two heads, 10 marks between them, because the algorithm and the code are marked apart from the output. And two marks depend on a printer, so leave time for it.

No practical date for 2027 is known to us: ask your school, which receives it. The theory paper is a separate day, reported from CISCE’s timetable as Wednesday 17 March 2027 at 2:00 PM; go by your admit card. The syllabus that feeds both papers is laid out in our ISC Computer Science syllabus 2027 guide, and the half of the practical you can finish before the exam is the work file of 25 assignments.

Q2. What goes on the answer script?

How do you write an ISC Java practical answer in the planning session?

Four things, in this order: algorithm, handwritten program, variable description, and a dry run of the sample input. The syllabus fixes no minutes inside the 90, so the plan below is ours; it keeps the last quarter for checking.

MinutesWorkStop when
0 to 12Read all three. For each, say the hardest step in one line. Choose the one whose hardest step you have done before.You can name the loop that does the work
12 to 32Algorithm as numbered pseudo code, including what to do with invalid inputA classmate could code it without asking you
32 to 66Program by hand, one method for each job, a comment over each methodEvery variable is declared and every method is called
66 to 80Dry run on the sample from the question, then on the smallest legal inputThe written output matches the question line for line
80 to 90Variable description table and class headerThe script is ready to give in

The document asks for a program documented well enough that the algorithm, the representation and the development process are clear from reading it. A variable description table is not listed as a mark head of its own, but it is the neatest way to show representation, and it takes six lines. Keep it to the variables that carry the idea; loop counters used once can be left out.

One sentence in the syllabus deserves a circle in red: large differences between the planned program and the printout lose marks. So plan the version you will type. Correcting a missing bracket is normal. Replacing the method is not.

A dry run that is worth writing down

This is the working for the parcel code problem with the code 4071936I. Seven products, one sum, one remainder, and you know the answer before the computer does.

Digit4071936
Multiplier2345678
Product80285542148

The sum is 164. 164 divided by 26 leaves 8, and the letter eight places after A is I, so the code is valid.

Q3. What does a full set look like?

ISC Class 12 Computer Science practical question paper A, solved

Paper A has one problem on numbers, one on a matrix and one on a sentence. Cover the solutions, give yourself ninety minutes for one of them, and only then compare. In the output boxes the text after a prompt was typed, and a blank line separates two runs.

Paper A, Problem 1: staircase numbers

A whole number of two or more digits is a staircase number if every digit differs by exactly 1 from the digit next to it. 4565 is one; 4568 is not, because 6 and 8 are two apart.

Accept two numbers M and N, where M is at least 10, N is at most 99999 and M is less than N. Display all staircase numbers from M to N, six to a line, with their frequency. Display NIL if there are none, and INVALID INPUT if the limits break the rules.

Algorithm

  1. Read M and N. If M is below 10, N is above 99999 or M is not less than N, print INVALID INPUT and stop.
  2. Set the frequency to 0 and take each number from M to N in turn.
  3. For a number, remember its last digit as right and remove it. While digits remain, take the new last digit as left.
  4. If the difference of left and right is not 1, the number fails. Otherwise move left into right and repeat.
  5. A number that never fails is printed and counted; after every sixth one, start a new line.
  6. If nothing was printed, print NIL. Print the frequency.
StaircaseNumberJava program
import java.util.Scanner;

/** Paper A, Problem 1: staircase numbers in a range. */
public class StaircaseNumber {
    // true if every digit differs by 1 from the digit beside it
    static boolean isStaircase(int num) {
        int right = num % 10;        // digit seen last
        num = num / 10;
        while (num > 0) {
            int left = num % 10;
            if (Math.abs(left - right) != 1)
                return false;        // one bad step is enough
            right = left;
            num = num / 10;
        }
        return true;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.print("M = ");
        int m = in.nextInt();
        System.out.print("N = ");
        int n = in.nextInt();
        if (m < 10 || n > 99999 || m >= n) {
            System.out.println("INVALID INPUT");
            return;
        }
        int count = 0;
        System.out.println("STAIRCASE NUMBERS:");
        for (int num = m; num <= n; num++) {
            if (isStaircase(num)) {
                System.out.print(num + "\t");
                count++;
                if (count % 6 == 0)  // six on a line
                    System.out.println();
            }
        }
        if (count == 0)
            System.out.print("NIL");
        if (count == 0 || count % 6 != 0)
            System.out.println();
        System.out.println("FREQUENCY = " + count);
    }
}
Output3 runs
M = 450
N = 1300
STAIRCASE NUMBERS:
454	456	543	545	565	567	
654	656	676	678	765	767	
787	789	876	878	898	987	
989	1010	1012	1210	1212	1232	
1234	
FREQUENCY = 25

M = 20
N = 20
INVALID INPUT

M = 35
N = 42
STAIRCASE NUMBERS:
NIL
FREQUENCY = 0
VariableTypePurpose
m, nintlimits of the range
numintnumber being tested; a copy is cut down in the method
right, leftinttwo digits standing side by side
countintstaircase numbers found so far

Unseen inputs to try: M one less than N, a range that holds exactly six answers (does the program print a stray blank line?), and a range with a zero in the answer, such as 1005 to 1015.

Paper A, Problem 2: shift the outer ring

Accept the order N of a square matrix, 3 to 8, and fill it with integers, negative values allowed. Move every element of the outer ring one place clockwise, leaving the inside as it is. Display the matrix before and after, and the sum of the four new corner elements. For any other order display MATRIX SIZE OUT OF RANGE.

Algorithm

  1. Read N; reject it if it is outside 3 to 8. Read the matrix row by row and display it.
  2. Store the top left element, because it is the first to be overwritten.
  3. Move the left column up by one, the bottom row left by one, the right column down by one and the top row right by one, each time copying from the neighbour that has not been changed yet.
  4. Put the stored element in the second place of the top row.
  5. Display the matrix again and add its four corners.
RingShiftJava program
import java.util.Scanner;

/** Paper A, Problem 2: shift the outer ring of a matrix. */
public class RingShift {
    static void show(int[][] a) {
        for (int i = 0; i < a.length; i++) {
            for (int j = 0; j < a.length; j++)
                System.out.print(a[i][j] + "\t");
            System.out.println();
        }
    }

    // each outer element moves one place clockwise
    static void shiftRing(int[][] a) {
        int last = a.length - 1;
        int corner = a[0][0];            // kept for the end
        for (int i = 0; i < last; i++) // left column moves up
            a[i][0] = a[i + 1][0];
        for (int j = 0; j < last; j++) // bottom row moves left
            a[last][j] = a[last][j + 1];
        for (int i = last; i > 0; i--) // right side goes down
            a[i][last] = a[i - 1][last];
        for (int j = last; j > 1; j--) // top row moves right
            a[0][j] = a[0][j - 1];
        a[0][1] = corner;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.print("ORDER N = ");
        int n = in.nextInt();
        if (n < 3 || n > 8) {
            System.out.println("MATRIX SIZE OUT OF RANGE");
            return;
        }
        int[][] a = new int[n][n];
        for (int i = 0; i < n; i++) {
            System.out.print("ROW " + (i + 1) + ": ");
            for (int j = 0; j < n; j++)
                a[i][j] = in.nextInt();
        }
        System.out.println("ORIGINAL MATRIX");
        show(a);
        shiftRing(a);
        System.out.println("AFTER ONE SHIFT");
        show(a);
        int corners = a[0][0] + a[0][n - 1]
                    + a[n - 1][0] + a[n - 1][n - 1];
        System.out.println("SUM OF NEW CORNERS = " + corners);
    }
}
Output3 runs
ORDER N = 4
ROW 1: 1 2 3 4
ROW 2: 5 6 7 8
ROW 3: 9 10 11 12
ROW 4: 13 14 15 16
ORIGINAL MATRIX
1	2	3	4	
5	6	7	8	
9	10	11	12	
13	14	15	16	
AFTER ONE SHIFT
5	1	2	3	
9	6	7	4	
13	10	11	8	
14	15	16	12	
SUM OF NEW CORNERS = 34

ORDER N = 3
ROW 1: 2 -7 4
ROW 2: 0 5 9
ROW 3: 8 1 -3
ORIGINAL MATRIX
2	-7	4	
0	5	9	
8	1	-3	
AFTER ONE SHIFT
0	2	-7	
8	5	4	
1	-3	9	
SUM OF NEW CORNERS = 3

ORDER N = 9
MATRIX SIZE OUT OF RANGE
VariableTypePurpose
aint[][]the matrix, changed in place
lastintindex of the last row and column
cornerinttop left element, held until the end
cornersintsum of the four corners after the shift

Unseen inputs to try: order 3, where the inside is one element; a matrix with all values equal, which should look untouched; and order 2 and 9, which must be refused.

Paper A, Problem 3: neighbours trade first letters

Accept a sentence ending in a full stop, question mark or exclamation mark. Take its words two at a time. If both words of a pair begin with a consonant, they trade first letters; otherwise the pair is left alone. A word without a partner stays as it is. Display the new sentence in capitals with its original end mark, and the number of pairs that traded. Without an end mark display INVALID SENTENCE.

Algorithm

  1. Read the sentence, trim it and change it to capitals. If the last character is not one of the three marks, print INVALID SENTENCE and stop.
  2. Keep the mark aside and split the rest into words with a StringTokenizer.
  3. For i = 0, 2, 4 and so on while word i + 1 exists, look at words i and i + 1.
  4. If neither begins with a vowel, build both again with the other’s first letter and add 1 to the trades.
  5. Join the words with single spaces, add the mark, print it and the number of trades.
LetterTradeJava program
import java.util.Scanner;
import java.util.StringTokenizer;

/** Paper A, Problem 3: neighbours trade first letters. */
public class LetterTrade {
    static boolean startsWithVowel(String word) {
        return "AEIOU".indexOf(word.charAt(0)) >= 0;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.print("SENTENCE: ");
        String text = in.nextLine().trim().toUpperCase();
        int len = text.length();
        if (len < 2
                || ".?!".indexOf(text.charAt(len - 1)) < 0) {
            System.out.println("INVALID SENTENCE");
            return;
        }
        char mark = text.charAt(len - 1);
        StringTokenizer st =
            new StringTokenizer(text.substring(0, len - 1));
        int total = st.countTokens();
        String[] word = new String[total];
        for (int i = 0; i < total; i++)
            word[i] = st.nextToken();

        int trades = 0;
        for (int i = 0; i + 1 < total; i += 2) {
            String p = word[i], q = word[i + 1];
            if (!startsWithVowel(p) && !startsWithVowel(q)) {
                word[i] = q.charAt(0) + p.substring(1);
                word[i + 1] = p.charAt(0) + q.substring(1);
                trades++;
            }
        }
        String result = "";
        for (int i = 0; i < total; i++)
            result += (i == 0 ? "" : " ") + word[i];
        System.out.println(result + mark);
        System.out.println("PAIRS TRADED = " + trades);
    }
}
Output3 runs
SENTENCE: Bright stars shine over calm water.
SRIGHT BTARS SHINE OVER WALM CATER.
PAIRS TRADED = 2

SENTENCE: Can my father ride the new horse?
MAN CY RATHER FIDE NHE TEW HORSE?
PAIRS TRADED = 3

SENTENCE: No stop here
INVALID SENTENCE
VariableTypePurpose
textStringsentence in capitals, with its end mark
markcharthe end mark, put back at the end
wordString[]words of the sentence, in order
p, qStringthe pair as it was before trading
tradesintpairs that were changed

Unseen inputs to try: a single word, several spaces between two words, and a pair such as SKY HIGH. Notice that p and q are saved first: without them the second word would receive its own letter back.

Q4. Another set?

ISC Java practical programs, paper B: a check letter, peaks and climbing words

Paper B has shorter programs with stricter conditions. Most of the thinking goes into saying exactly when something counts, which is also where unseen inputs are chosen.

Paper B, Problem 1: parcel code with a check letter

A courier labels parcels with a code of eight characters: seven digits and one capital letter. The digits, from the left, are multiplied by 2, 3, 4, 5, 6, 7 and 8 and the products are added. The remainder when the sum is divided by 26 gives the letter: 0 means A, 1 means B and 25 means Z.

Accept a code. If it is not seven digits followed by a capital letter, display INCORRECT FORMAT. Otherwise display the weighted sum and VALID CODE, or INVALID CODE with the letter it should have ended in.

Algorithm

  1. Read the code as one word. If its length is not 8, or any of the first seven characters is not a digit, or the eighth is not a capital letter, print INCORRECT FORMAT and stop.
  2. For i = 0 to 6, change the character to a number by subtracting the character 0, multiply by i + 2 and add to the sum.
  3. The expected letter is A moved forward by the remainder of sum and 26.
  4. Compare it with the last character and print the verdict.
ParcelCodeJava program
import java.util.Scanner;

/** Paper B, Problem 1: parcel code with a check letter. */
public class ParcelCode {
    // seven digits followed by one capital letter
    static boolean wellFormed(String code) {
        if (code.length() != 8)
            return false;
        for (int i = 0; i < 7; i++)
            if (!Character.isDigit(code.charAt(i)))
                return false;
        return Character.isUpperCase(code.charAt(7));
    }

    // digits times 2, 3, ... 8; sum by 26 gives the letter
    static char checkLetter(String code) {
        int sum = 0;
        for (int i = 0; i < 7; i++)
            sum += (code.charAt(i) - '0') * (i + 2);
        System.out.println("WEIGHTED SUM = " + sum);
        return (char) ('A' + sum % 26);
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.print("CODE: ");
        String code = in.next();
        if (!wellFormed(code)) {
            System.out.println("INCORRECT FORMAT");
            return;
        }
        char letter = checkLetter(code);
        if (letter == code.charAt(7))
            System.out.println("VALID CODE");
        else
            System.out.println("INVALID CODE, LETTER SHOULD BE "
                               + letter);
    }
}
Output3 runs
CODE: 4071936I
WEIGHTED SUM = 164
VALID CODE

CODE: 4071936V
WEIGHTED SUM = 164
INVALID CODE, LETTER SHOULD BE I

CODE: 40719V
INCORRECT FORMAT
VariableTypePurpose
codeStringthe parcel code as typed
suminttotal of digit times multiplier
lettercharletter the code should end in

Unseen inputs to try: a small letter at the end, a code with a space typed in the middle (next() reads only the first part), and 0000000A, whose sum is 0.

Paper B, Problem 2: peaks in a height map

The heights of a field are stored in a matrix of M rows and N columns, both 2 to 9. A peak is a cell higher than every cell directly above, below, left and right of it; cells on the edge have fewer neighbours. Display each peak with its position counted from 1, the number of peaks and the highest one.

Algorithm

  1. Read M and N; if either is outside 2 to 9, print SIZE OUT OF RANGE and stop. Read the heights.
  2. A helper answers whether one neighbour is lower. If the neighbour lies outside the matrix, the answer is yes.
  3. A cell is a peak when the helper says yes for all four sides.
  4. Visit the cells row by row. For a peak, print it, add 1 to the count and compare it with the highest peak so far.
  5. Print the count, and the highest peak if the count is not 0.
PeakCellsJava program
import java.util.Scanner;

/** Paper B, Problem 2: cells taller than their neighbours. */
public class PeakCells {
    static int[][] h;        // heights
    static int rows, cols;

    // a missing neighbour (outside the matrix) is never taller
    static boolean lower(int r, int c, int value) {
        if (r < 0 || r >= rows || c < 0 || c >= cols)
            return true;
        return h[r][c] < value;
    }

    static boolean isPeak(int r, int c) {
        int v = h[r][c];
        return lower(r - 1, c, v) && lower(r + 1, c, v)
            && lower(r, c - 1, v) && lower(r, c + 1, v);
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.print("M N: ");
        rows = in.nextInt();
        cols = in.nextInt();
        if (rows < 2 || rows > 9 || cols < 2 || cols > 9) {
            System.out.println("SIZE OUT OF RANGE");
            return;
        }
        h = new int[rows][cols];
        for (int r = 0; r < rows; r++) {
            System.out.print("ROW " + (r + 1) + ": ");
            for (int c = 0; c < cols; c++)
                h[r][c] = in.nextInt();
        }
        int count = 0, bestR = -1, bestC = -1;
        for (int r = 0; r < rows; r++)
            for (int c = 0; c < cols; c++)
                if (isPeak(r, c)) {
                    count++;
                    System.out.println("PEAK " + h[r][c]
                        + " AT (" + (r + 1) + ","
                        + (c + 1) + ")");
                    if (count == 1
                            || h[r][c] > h[bestR][bestC]) {
                        bestR = r;
                        bestC = c;
                    }
                }
        System.out.println("NUMBER OF PEAKS = " + count);
        if (count > 0)
            System.out.println("HIGHEST PEAK = "
                               + h[bestR][bestC]);
    }
}
Output3 runs
M N: 3 4
ROW 1: 12 18 11 14
ROW 2: 10 15 20 13
ROW 3: 25 16 17 19
PEAK 18 AT (1,2)
PEAK 14 AT (1,4)
PEAK 20 AT (2,3)
PEAK 25 AT (3,1)
PEAK 19 AT (3,4)
NUMBER OF PEAKS = 5
HIGHEST PEAK = 25

M N: 2 2
ROW 1: 5 5
ROW 2: 5 5
NUMBER OF PEAKS = 0

M N: 1 6
SIZE OUT OF RANGE
VariableTypePurpose
hint[][]heights, shared by the three methods
rows, colsintsize of the field
vintheight of the cell being judged
bestR, bestCintposition of the highest peak found

Unseen inputs to try: two equal cells side by side (neither is a peak), all heights negative, and a 2 by 9 strip. Starting bestR at -1 instead of 0 keeps a matrix of negative heights safe.

Paper B, Problem 3: words that climb the alphabet

A word of two or more letters is a climbing word if no letter comes earlier in the alphabet than the letter before it. ALMOST and BEGIN climb; repeated letters are allowed. Accept a sentence ending in a full stop, display the number of climbing words and the longest of them, then display the sentence with the climbing words first and the rest after, each group in its original order.

Algorithm

  1. Read the sentence in capitals. If it does not end in a full stop, print FULL STOP MISSING and stop.
  2. Go through it one character at a time. A letter is added to the current word.
  3. Any other character ends the word. If the word is not empty, test it, join it to the first group or to the rest, and clear it.
  4. While testing, compare each letter with the one before it; a smaller letter means the word does not climb.
  5. Print the count, the longest climbing word and the two groups together.
ClimbingWordsJava program
import java.util.Scanner;

/** Paper B, Problem 3: words that climb the alphabet. */
public class ClimbingWords {
    static boolean climbs(String w) {
        for (int i = 1; i < w.length(); i++)
            if (w.charAt(i) < w.charAt(i - 1))
                return false;
        return w.length() > 1;   // one letter does not count
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.print("SENTENCE: ");
        String text = in.nextLine().trim().toUpperCase();
        if (!text.endsWith(".")) {
            System.out.println("FULL STOP MISSING");
            return;
        }
        String first = "", rest = "", longest = "", word = "";
        int count = 0;
        for (int i = 0; i < text.length(); i++) {
            char ch = text.charAt(i);
            if (Character.isLetter(ch)) {
                word += ch;         // still inside a word
            } else if (word.length() > 0) {
                if (climbs(word)) {
                    first += word + " ";
                    count++;
                    if (word.length() > longest.length())
                        longest = word;
                } else {
                    rest += word + " ";
                }
                word = "";          // ready for the next word
            }
        }
        System.out.println("CLIMBING WORDS = " + count);
        if (count > 0)
            System.out.println("LONGEST = " + longest);
        System.out.println((first + rest).trim() + ".");
    }
}
Output3 runs
SENTENCE: Almost every boy will begin his work in fog.
CLIMBING WORDS = 5
LONGEST = ALMOST
ALMOST BOY BEGIN HIS IN EVERY WILL WORK FOG.

SENTENCE: Mumbai wakes.
CLIMBING WORDS = 0
MUMBAI WAKES.

SENTENCE: No stop
FULL STOP MISSING
VariableTypePurpose
wordStringletters of the word being collected
firstStringclimbing words, in order
restStringall other words
longestStringlongest climbing word so far
countintnumber of climbing words

Unseen inputs to try: the word A on its own, a comma between words, and two longest words of equal length. With > in the comparison the earlier one is kept.

Paper B’s matrix and string problems use nothing beyond the array and String topics of Section B, the section that carries ten-mark programs in the CISCE specimen we could read (2025); see the paper pattern and important questions.

Q5. And a harder one?

ISC computer practical 2027, paper C: recursion, a zigzag and a column code

Paper C is harder to plan and shorter to type. All three problems look long until you find the one fact that runs them: a remainder, a constant sum, a jump of k.

Paper C, Problem 1: palindromes in two bases

Accept three integers: a lower limit, an upper limit and a base from 2 to 9. Display every number in the range that reads the same backwards in base 10 and also when written in the given base, with both forms, and the count. The conversion must be recursive. Limits run from 1 to 9999; anything else is OUT OF RANGE.

Algorithm

  1. Read the three values. Reject them if a limit or the base is outside the range, or if the lower limit is above the upper.
  2. For each number, test its decimal digits first. If that fails, go to the next number without converting.
  3. Recursive rule: a number smaller than the base is written as itself; otherwise write (number / base) in that base, then put the remainder on the right.
  4. A text is a palindrome if the characters at its two ends match, moving inwards until the ends meet.
  5. Print and count the numbers that pass both tests.
TwoBasePalindromeJava program
import java.util.Scanner;

/** Paper C, Problem 1: palindromes in base 10 and in base b. */
public class TwoBasePalindrome {
    // recursive: digits of num written in the given base
    static String convert(int num, int base) {
        if (num < base)
            return "" + num;                    // base case
        return convert(num / base, base) + num % base;
    }

    static boolean isPalin(String s) {
        int i = 0, j = s.length() - 1;
        while (i < j)
            if (s.charAt(i++) != s.charAt(j--))
                return false;
        return true;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.print("LOWER, UPPER, BASE: ");
        int low = in.nextInt(), high = in.nextInt();
        int base = in.nextInt();
        if (low < 1 || high > 9999 || low > high
                || base < 2 || base > 9) {
            System.out.println("OUT OF RANGE");
            return;
        }
        int count = 0;
        for (int num = low; num <= high; num++) {
            if (!isPalin("" + num))
                continue;                  // fails in base 10
            String other = convert(num, base);
            if (isPalin(other)) {
                System.out.println(num + "\t" + other);
                count++;
            }
        }
        System.out.println("COUNT = " + count);
    }
}
Output3 runs
LOWER, UPPER, BASE: 1 999 2
1	1
3	11
5	101
7	111
9	1001
33	100001
99	1100011
313	100111001
585	1001001001
717	1011001101
COUNT = 10

LOWER, UPPER, BASE: 100 700 8
121	171
292	444
333	515
373	565
414	636
585	1111
COUNT = 6

LOWER, UPPER, BASE: 1 50 10
OUT OF RANGE
VariableTypePurpose
low, high, baseintrange and base typed in
numintnumber being tested
otherStringnum written in the other base
i, jintleft and right ends inside isPalin
countintnumbers that passed

Unseen inputs to try: equal limits, base 2 with the number 1, and a one digit range in base 9. The number 7 appears for base 2 because 111 reads the same both ways.

Paper C, Problem 2: fill a matrix along its slants

Accept the order N of a square matrix (2 to 9), a starting value and a positive step. Fill the matrix along its slants in a zigzag: the first slant is the top left cell, the second runs downwards from the top row, the third runs upwards, and so on. Each cell gets the next value. Display the matrix and the sums of its two diagonals.

Algorithm

  1. Read N, start and step; print INVALID DATA if N is outside 2 to 9 or the step is below 1.
  2. Number the slants s = 0 to 2N - 2. Every cell of slant s has row + column = s.
  3. On an even slant let the row fall from s to 0; on an odd slant let it rise from 0 to s. The column is s minus the row.
  4. If that cell lies inside the matrix, store the value and add the step.
  5. Print the matrix, adding the left diagonal (i, i) and the right diagonal (i, N - 1 - i) as you go.
ZigzagFillJava program
import java.util.Scanner;

/** Paper C, Problem 2: fill a matrix along its slants. */
public class ZigzagFill {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.print("ORDER N: ");
        int n = in.nextInt();
        System.out.print("START: ");
        int start = in.nextInt();
        System.out.print("STEP: ");
        int step = in.nextInt();
        if (n < 2 || n > 9 || step < 1) {
            System.out.println("INVALID DATA");
            return;
        }
        int[][] z = new int[n][n];
        int value = start;
        // on one slant, row + column is the same number s
        for (int s = 0; s <= 2 * n - 2; s++) {
            for (int k = 0; k <= s; k++) {
                // even slants run upwards, odd slants downwards
                int row = (s % 2 == 0) ? s - k : k;
                int col = s - row;
                if (row < n && col < n) {
                    z[row][col] = value;
                    value += step;
                }
            }
        }
        int left = 0, right = 0;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++)
                System.out.print(z[i][j] + "\t");
            System.out.println();
            left += z[i][i];
            right += z[i][n - 1 - i];
        }
        System.out.println("LEFT DIAGONAL  = " + left);
        System.out.println("RIGHT DIAGONAL = " + right);
    }
}
Output3 runs
ORDER N: 4
START: 1
STEP: 1
1	2	6	7	
3	5	8	13	
4	9	12	14	
10	11	15	16	
LEFT DIAGONAL  = 34
RIGHT DIAGONAL = 34

ORDER N: 3
START: 10
STEP: 5
10	15	35	
20	30	40	
25	45	50	
LEFT DIAGONAL  = 90
RIGHT DIAGONAL = 90

ORDER N: 1
START: 4
STEP: 2
INVALID DATA
VariableTypePurpose
zint[][]the matrix being filled
sintslant number, equal to row + column
row, colintcell on the slant
valueintvalue for the next cell
left, rightintsums of the two diagonals

Unseen inputs to try: order 2, a negative start with step 3, and order 9, where the last value must be start + 80 steps. If it is not, a slant was skipped.

Paper C, Problem 3: the column code

Accept a message and a number of columns k from 2 to 8. Keep only the letters, in capitals. Write them row by row in k columns, completing the last row with X, and read them column by column to get the code. Display the letters, the code, and the message decoded from the code. If k is out of range or there are fewer than k letters, display CANNOT BE CODED.

Algorithm

  1. Read the message and k. Build a new string of its letters only, in capitals; check k and the length.
  2. Add X until the length divides evenly by k.
  3. For each column c = 0 to k - 1, take the letters at c, c + k, c + 2k and so on. That is the code.
  4. To decode, the number of rows is length / k. Reading the code with that many columns, in the same way, gives the message back.
  5. Print letters, code and decoded message.
ColumnCodeJava program
import java.util.Scanner;

/** Paper C, Problem 3: column code, coding and decoding. */
public class ColumnCode {
    static String lettersOnly(String s) {
        String t = "";
        for (int i = 0; i < s.length(); i++)
            if (Character.isLetter(s.charAt(i)))
                t += Character.toUpperCase(s.charAt(i));
        return t;
    }

    // written row by row in k columns, read column by column
    static String encode(String msg, int k) {
        while (msg.length() % k != 0)
            msg += 'X';              // fill the last row
        String code = "";
        for (int c = 0; c < k; c++)
            for (int i = c; i < msg.length(); i += k)
                code += msg.charAt(i);
        return code;
    }

    // reading with as many columns as there were rows undoes it
    static String decode(String code, int k) {
        int rows = code.length() / k;
        String msg = "";
        for (int r = 0; r < rows; r++)
            for (int i = r; i < code.length(); i += rows)
                msg += code.charAt(i);
        return msg;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.print("MESSAGE: ");
        String msg = lettersOnly(in.nextLine());
        System.out.print("COLUMNS (2 to 8): ");
        int k = in.nextInt();
        if (k < 2 || k > 8 || msg.length() < k) {
            System.out.println("CANNOT BE CODED");
            return;
        }
        String code = encode(msg, k);
        System.out.println("LETTERS : " + msg);
        System.out.println("CODE    : " + code);
        System.out.println("DECODED : " + decode(code, k));
    }
}
Output3 runs
MESSAGE: Meet at the old library, gate two
COLUMNS (2 to 8): 5
LETTERS : MEETATTHEOLDLIBRARYGATETWO
CODE    : MTLRAOETDATXEHLREXTEIYTXAOBGWX
DECODED : MEETATTHEOLDLIBRARYGATETWOXXXX

MESSAGE: Run now
COLUMNS (2 to 8): 3
LETTERS : RUNNOW
CODE    : RNUONW
DECODED : RUNNOW

MESSAGE: Go
COLUMNS (2 to 8): 7
CANNOT BE CODED
VariableTypePurpose
msgStringletters of the message, then padded
kintnumber of columns
rowsintrows filled, used as the jump in decoding
codeStringthe coded text
tStringletters kept by lettersOnly

Unseen inputs to try: a message whose length already divides by k (no X at all), k equal to the number of letters, and a message made of digits only.

Q6. Ready to sit one?

Practice paper D: three problems with no program shown

Choose one problem, set a timer for 90 minutes, and use paper only. The sample answers come from programs we ran, so you can check yours against them at the keyboard afterwards.

D1. Hinge numbers

A number with an odd number of digits, three or more, is a hinge number if its middle digit equals the sum of its first and last digits. Accept M and N with 100 as the least M and 99999 as the greatest N. Display all hinge numbers from M to N and their count.

100 to 200: 110, 121, 132, 143, 154, 165, 176, 187, 198; count 9.
12100 to 12300: count 20, the first 12100 and the last 12291.
1000 to 9999: count 0. Can you say why without running it?

D2. Twin lines

Accept a matrix of M rows and N columns. A row and a column are twin lines if their sums are equal. Display every such pair and its sum, or NO TWIN LINES.

Rows 4 1 5, 2 6 2, 9 3 7: row 1 and column 2, sum 10; row 2 and column 2, sum 10; total 2.
Rows 1 2 3, 4 5 6: NO TWIN LINES.

Plan for speed: add each row and column once, not once for every pair.

D3. Short forms

Accept a sentence with an end mark. Replace every word of more than four letters by its first letter, the number of letters left out and its last letter. Display the new sentence in capitals and the number of characters saved.

Examination tickets arrive by Thursday morning. gives E9N T5S A4E BY T6Y M5G. with 24 characters saved.
How are you? is unchanged, 0 saved.

Mark your own attempt out of 15

HeadFull marks look likeMarks usually slip away when
Algorithm, 3Numbered steps in pseudo code, with the invalid case and the stopping conditionIt is the Java program in English words, or the key step reads “check the number”
Program, 7Named methods, meaningful variables, a comment for each method, the rule of the question in one placeEverything sits in main, or the limits in the question are not checked
Hard copy, 2Listing and output printed and attached, close to the handwritten versionThe printout is of a new program invented at the computer
Output, 3Seen inputs match the question exactly; unseen ones also come out rightSpelling or order of the messages differs, or zero, one and equal values were never tried

The right-hand column is our reading of how such answers go wrong in class, not a published CISCE list. Want more single programs before full papers? The blog has Java programs for ISC Class 11 and 12 sorted by type. For the written paper, sit the 70-mark practice paper; if the calendar is tight, the ISC crash course puts both on one plan. A younger brother or sister can start with the Class 11 practical problems.

One to one, at your own timing

Rehearse the ISC practical one to one

The quickest way to know whether this helps is to try it. A priority demo is a paid full live class at a slot you pick; you get a written skill report afterwards and the fee is adjusted against your first month if you enrol. A free demo class is available as well. After that, classes are personalised one to one, billed month by month, with no admission fee.

Before you enrol · Try a class

Priority demo, at a slot you pick

a full live class of about 45 to 60 minutes

  • Your child plans one unseen practical problem on paper while the teacher watches
  • The algorithm and handwritten Java are marked 3 and 7, as in the published table
  • The program is keyed in and tested on inputs your child has not seen
  • A written report on planning, Java and testing follows
Book a priority demo

The classes · Choose your own timing

Personalised one to one

₹4,999

per month, 4 private classes, fully flexible timing

  • Full three-hour rehearsals split across classes: planning one day, keyboard the next
  • More time on the problem type your child avoids, matrix, string or number
  • Work file assignments looked at together, with the student doing the writing
  • Days and hours that move when the school calendar does
Ask for a personalised plan

Students who already code comfortably mostly need paper practice, because writing Java without a compiler is a skill of its own. Students who are slow at the keyboard need the reverse. The demo shows which it is. You may stop at the end of any month, and the fee for your country is shown above.

ISC schools outside India

Practical rehearsal for ISC students abroad

An ISC student in Dubai or Singapore faces the same Paper II: one problem from three, planned for 90 minutes. Lessons are placed after your school day, wherever that is.

Where you liveTime differenceUsual class window, local timeFormat
India
every Indian city
Indian timeAny time you choosePersonalised 1-on-1
United Arab Emirates
Dubai, Sharjah
1 h 30 min behind India3:00 PM to 9:00 PMPersonalised 1-on-1
Indonesia and Thailand
West Java, Bangkok area
1 h 30 min ahead of India3:30 PM to 9:00 PMPersonalised 1-on-1
Singapore
Singapore
2 h 30 min ahead of India3:30 PM to 9:00 PMPersonalised 1-on-1

Schools arrange their own lab day, so tell us the date as soon as you hear it and the rehearsals are counted back from it. The full subject is described on ISC Class 12 Computer Science classes.

What families say

Rated 4.9 across 547 Google reviews

Real reviews from real families. We neither write nor commission them.

★★★★★

"The one step solution for my son. Modern Age Coders make learning coding so simple that kids love it. The teachers explain complex concepts clearly with practical exercises and interactive content."

Ria Mukherjee

Parent

★★★★★

"Modern Age Coders has been a game-changer for me. I struggled to grasp IT concepts and coding before joining, but their classes transformed everything. I can now confidently write complex programs with ease."

Samriddha Mondal

Student

★★★★★

"One of the most wonderful education centres out there. Education is not limited to school syllabus but focuses on skill development."

Vansh Agarwal

Student

★★★★★

"My child Dhairya is really enjoying the Modern Age Coders classes. This is his first online class and he eagerly looks forward to it. I can already see his improvement, and the teachers are very cooperative."

Sonam Oswal

Parent of Dhairya

★★★★★

"Modern Age Coders have wonderful teachers who teach in a clear, easy and practical way. The teacher boosts students' confidence and inspires them to learn without hesitation."

Sonu Goyal

Parent

★★★★★

"I highly recommend this computer coding class! The teachers are incredibly knowledgeable and passionate about coding."

Ritu Kedia

Parent

The rest of the ISC Class 11 and 12 series

More for ISC Computer Science 868

Every page in the ISC Computer Science (868) series, grouped by what you need.

Practical exam questions

What students ask about the ISC Class 12 Computer Science practical

How many questions come in the ISC Class 12 Computer Science practical?

Three programming problems are given and you attempt any one. The ISC 2027 syllabus allows a maximum of 90 minutes for planning and 90 minutes for keying in and running the program, three hours in all. The chosen problem is worth 15 of the 30 practical marks.

What is the marking scheme of the ISC computer practical 2027?

The sample table in the 2027 document gives 15 marks to the problem: algorithm 3, Java program with internal documentation 7, hard copy 2 and output 3. Assignments done in the year give 10 marks by internal evaluation and 5 by the Visiting Examiner, which makes 30.

When is the ISC Class 12 Computer Science practical in 2027?

We have not seen a practical date, and schools are told theirs separately, so ask your subject teacher. Only the theory date has been reported from the CISCE timetable: Wednesday 17 March 2027, 2:00 PM. Confirm that on your admit card too.

Where can I get ISC Class 12 Computer Science practical question papers with solutions?

This page has three original papers of three problems solved in full, with algorithm, Java program, variable table and output, and a fourth to try alone. They are written for practice on the 2027 rules and are not copies of old CISCE papers, which belong to the Council.

What are unseen inputs in the ISC practical?

Inputs that only the examiner has. Your program must run on the sample values printed in the question and then on these. They usually test the edges of the problem, so plan for the smallest and largest legal values, equal values, and input that must be refused.

Is a variable description table compulsory in the ISC practical?

The 2027 document does not list it as a separate head. It asks for a program documented so that the algorithm, representation and development process are clear. A short variable table does that job for representation, so include one, and follow the headings your teacher uses.

Do I need to write the algorithm if my program works?

Yes. The algorithm has 3 marks of its own and is prepared in the planning session before you touch the computer. The syllabus says any standard scheme such as pseudo code is fine, so numbered steps in plain English are enough if they are precise.

Can I change my program while typing it in the examination session?

Small corrections are expected, since compiling finds slips. The syllabus warns that large differences between the planned program and the printout result in loss of marks. If the plan has a logical error, fix the smallest part that cures it and leave the structure alone.

Which Java version and editor are used for the ISC practical?

The syllabus says Java 5.0 or later for programming, lists JDK 6 or later under software, and recommends BlueJ for its simplicity. Your school decides what is installed. The programs on this page use Scanner, StringTokenizer, arrays and strings only, so they run in any of them.

Which topics are asked in the ISC Java practical?

The document does not name topics for the problem; it says the assignments should cover each major topic of the syllabus. Practise numbers and base conversion, one and two dimensional arrays, strings and sentences, and recursion, then add classes, inheritance and data structures through your work file.

Can I get online help for the ISC Computer Science practical?

Yes, in personalised one to one classes at a time you choose. The student plans, writes and runs every program while the teacher questions and marks it. You can start with a priority demo at your own slot, or with the free demo class.

Start

Start with one problem on paper

Keep a sheet of paper and a pen beside the computer. In the demo the teacher gives an original problem, your child plans it by hand, and you see how far the plan is from a program that runs.

Lab day close? Choose the priority demo: the slot is yours, a written skill report comes after it, and the amount is adjusted against the first month if you join.

WhatsApp us · +91 91233 66161 · connect@modernagecoders.com

Every class is live video. The form requests a callback and reserves nothing.

We call within a few hours. No card, no enrolment fee.

Want it sooner? Book a priority demo

A full live class of about 45 to 60 minutes at a slot you pick, with a written skill report and learning roadmap on WhatsApp afterwards. The fee is adjusted against your first month if you enrol.

Book a priority demo

Keep exploring Modern Age Coders

By class and age

Learn more

Free resources

From the blog

Start here