★★★★★
"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
ISC Class 12 · Computer Science 868 · Work file 2027
Searching for an ISC Class 12 Computer Science project? The 2027 syllabus does not set one. It sets a work file holding the year’s programming assignments, at least 25 of them, and it is worth 15 marks. Here is a complete plan for that file, with more than half of the entries written out as you would submit them.
Live online · 25 assignments mapped to the syllabus · 14 run on Java 21 · your days and your timing · first class free
Start here
A good file is a by-product of learning Java properly. Choose by what is missing: the whole subject, the language, or (after school) deeper data structures.

ISC side / 868
ISC students learn Java, object oriented programming, Boolean algebra and data structures here, with lab assignments along the way.
Open the course →
The language / Java
If the first five entries of the plan already feel hard, begin here: it assumes nothing and reaches classes, collections and data structures.
Open the course →
College / 18+
Entries 21 to 25 are the doorway to this course, which is meant for college students and takes them up to interview level.
Open the course →Ans. The short version
There is no separate project in ISC Class 12 Computer Science: the ISC 2027 syllabus asks for a work file of the year’s programming assignments, with a minimum of twenty-five. It carries 15 of the 30 practical marks, 10 by internal evaluation and 5 by the Visiting Examiner; the other 15 are for the problem solved in the lab exam. Class 11 is different and does have one project. This page gives a plan of 25 assignments that touches every programming topic, 14 of them solved in Java. Modern Age Coders helps students write theirs in personalised one to one classes, with a priority demo to try first.
Q1. Project or no project?
No. Paper II in the ISC 2027 document has two sources of marks for Class XII, the assignments of the year and the terminal problem, and the word project does not appear in its evaluation scheme. What you submit is called a work file.
| Practical, 30 marks | Class 11 | Class 12 |
|---|---|---|
| Minimum assignments in the work file | 20 | 25 |
| Marks for assignments | 10 | 10 internal and 5 by the Visiting Examiner |
| Project | One, 5 marks | Not in the document |
| Problem solved on the computer | 15 | 15 |
| Who evaluates | The school | The school for 10 marks, the Visiting Examiner for the rest |
So why do so many people search for an ISC Class XII Computer Science project? Partly because Class 11 has one and the memory carries over, and partly because students call the bound work file “the project”. Most files shared online under that name are simply lists of Java programs. If your teacher uses the word, ask one question: is it a separate piece of work, or the file? If it is separate, it belongs to your school’s own arrangements, so get its size, date and marks in writing.
The document we read is the ISC Year 2027 syllabus marked February 2025. It prints no layout for the work file, no list of programs and no cover page, so your teacher’s format comes first everywhere below. The rest of the subject is set out in the 2027 syllabus guide.
Q2. Which 25 programs?
One sentence in the syllabus decides the list: each major topic should be covered in at least one assignment, and the problems should be challenging enough to need real algorithm design. This plan takes the programming items 5 to 14 in turn.
Linked titles are solved on this page. The rest are yours to write; the check line gives a value that your program must reproduce, and we computed each one by running code.
| No. | Assignment | Syllabus item |
|---|---|---|
| 1 | Reverse and add until a palindrome Check: 349 needs 3 steps | 5 Objects, 8 Loops |
| 2 | Count the numbers in a range whose digits are all different Check: 100 to 999 gives 648 | 9 Methods |
| 3 | A table of casts: char to int, int to char, int to byte, text to int, with wrapper methods Check: 'A' in binary is 1000001; (byte) 200 is -56 | 6 Wrapper classes, casting |
| 4 | Root of a cubic by halving Check: x³ - x - 2 = 0 has root 1.5214 | 7 Expressions, 9 this, roots of equations |
| 5 | Bill from one typed line, bad tokens handled Check: Bill 324.00, 2 rejected | 5(c) Scanner, StringTokenizer, exceptions |
| 6 | Token desks sharing one counter Check: Sixth token refused | 9 Static members |
| 7 | Class Weight (kg, g): methods that take and return objects, sum and difference Check: 5 kg 750 g and 2 kg 480 g: 8 kg 230 g, 3 kg 270 g | 9 Object arguments |
| 8 | Bubble sort that stops when a pass makes no exchange, counting comparisons Check: 6 sorted values: 5; 6 in reverse: 15 | 10 Sorting |
| 9 | Latin square test: every row and column of an N by N matrix holds 1 to N once Check: 1 2 3, 2 3 1, 3 1 2 passes | 10 Two dimensional arrays |
| 10 | Address of an element, row major and column major Check: 2128 and 2092 | 10 Address calculation |
| 11 | Three linear equations by elimination Check: x = 2, y = 3, z = 4 | 10 Linear equations |
| 12 | Sort each row of a matrix, then order the rows by their first element Check: 9 4 7, 3 8 1 becomes 1 3 8, 4 7 9 | 10 Sorting in a matrix |
| 13 | Letters of the alphabet missing from a sentence Check: Quick wizards jump over boxes: FGHLNTY | 10 Strings |
| 14 | One line editor with StringBuffer Check: 2 changes in the sample note | 10 StringBuffer |
| 15 | Binary search by recursion, counting the calls Check: 15 values: at most 4 calls if present, 5 for a key larger than all | 11 Recursion |
| 16 | Number of teams by recursion Check: 6 players, teams of 2: 15 | 11 Recursion |
| 17 | Remove letters repeated side by side, by recursion Check: aabbbca becomes abca | 11 Recursion on a string |
| 18 | Lockers: a derived class with super Check: Total 2710.0 | 12(a) Inheritance |
| 19 | Abstract class Bill with two derived classes, called through one array Check: 120 units at 6 plus 50, and 18 kilolitres at 12: 986 | 12(a) Abstract class, dynamic binding |
| 20 | One sort, two orders, through an interface Check: Imran first, then Leela first | 12(b) Interfaces |
| 21 | Infix to postfix with a stack Check: ABCD-*E/+ | 13(a) Stack, conversion |
| 22 | Dequeue of letters used to test a palindrome from both ends Check: LEVEL yes, LEMON no at the first pair | 13(a) Dequeue |
| 23 | A queue interface, stored two ways Check: Array of 3 refuses the fourth | 13(a) Circular queue, interface |
| 24 | Linked list in order: insert, delete, sublist, reverse Check: 20 to 50 gives 29, 42, 42 | 13(b) Single linked list |
| 25 | Counting steps of two searches and a sort Check: 1600 values: 1600, 11, 1279200 | 14 Complexity, Big O |
Binary trees do not appear because the syllabus keeps them conceptual. Boolean algebra is also missing on purpose: it is theory, and its chapter is in our Boolean algebra and K-map notes. If your school asks for more than 25, the blog’s list of ISC Java programs has others, none of them repeated here.
Cover with name, class, subject code 868 and session; a certificate if the school wants one; an index with number, title, date, page and signature. Use your Unique ID only where the school tells you to.
Question, algorithm in numbered pseudo code, Java program with comments, a table of the variables that matter, and the output. Two runs beat one: the usual case and an awkward one.
Teachers are told to keep a record of assignments through the year. Entries dated week by week tell that story; twenty-five entries with one date tell another.
Q3. What do the Section B entries look like?
Eight entries on objects, methods, arrays, strings and recursion. Most of them keep the data in a class and the work in its methods, with main doing little more than calling them. What follows a prompt on the screen was typed; runs are parted by an empty line.
Question. Accept a number from 1 to 99999. Add it to its own reverse, and repeat with the sum until a palindrome appears. Show each sum and the steps taken; give up after 15.
Algorithm
import java.util.Scanner;
// Assignment 1: add the reverse until a palindrome appears
public class MirrorSteps {
private long num; // present value
private int steps; // additions done so far
MirrorSteps(long start) {
num = start;
steps = 0;
}
long reverse(long n) {
long rev = 0;
for (; n > 0; n /= 10)
rev = rev * 10 + n % 10;
return rev;
}
void solve(int limit) {
System.out.println("Start " + num);
while (num != reverse(num) && steps < limit) {
num += reverse(num);
steps++;
System.out.println("Step " + steps + " " + num);
}
if (num == reverse(num))
System.out.println("Palindrome in " + steps
+ " steps");
else
System.out.println("No palindrome in " + limit);
}
public static void main(String[] args) {
Scanner kb = new Scanner(System.in);
System.out.print("Number (1 to 99999): ");
long n = kb.nextLong();
if (n < 1 || n > 99999)
System.out.println("Not accepted");
else
new MirrorSteps(n).solve(15);
}
}
Number (1 to 99999): 349 Start 349 Step 1 1292 Step 2 4213 Step 3 7337 Palindrome in 3 steps Number (1 to 99999): 196 Start 196 Step 1 887 Step 2 1675 Step 3 7436 Step 4 13783 Step 5 52514 Step 6 94039 Step 7 187088 Step 8 1067869 Step 9 10755470 Step 10 18211171 Step 11 35322452 Step 12 60744805 Step 13 111589511 Step 14 227574622 Step 15 454050344 No palindrome in 15 Number (1 to 99999): 7 Start 7 Palindrome in 0 steps
| Name | Type | What it holds |
|---|---|---|
num | long | present value, data member |
steps | int | additions so far |
rev | long | reverse being built |
limit | int | most steps allowed |
Explain it like this: the sums grow, so the data member is long. The limit matters: 196 is still going after 15 additions, and a loop without a limit may never end.
Question. For ax³ + bx² + cx + d = 0, accept the four coefficients and an interval. If the polynomial changes sign over it, find the root to four decimal places by repeated halving.
Algorithm
import java.util.Scanner;
// Assignment 4: a root of a cubic by halving an interval
public class CubicRoot {
private double a, b, c, d; // ax^3 + bx^2 + cx + d
CubicRoot(double a, double b, double c, double d) {
this.a = a; // this tells the data
this.b = b; // member apart from the
this.c = c; // parameter
this.d = d;
}
double value(double x) { // Horner's form
return ((a * x + b) * x + c) * x + d;
}
void findRoot(double low, double high) {
if (value(low) * value(high) > 0) {
System.out.println("No sign change, choose again");
return;
}
int halvings = 0;
while (high - low > 0.00001) {
double mid = (low + high) / 2;
if (value(low) * value(mid) <= 0)
high = mid; // root is on the left
else
low = mid; // root is on the right
halvings++;
}
System.out.printf("Root %.4f after %d halvings%n",
(low + high) / 2, halvings);
}
public static void main(String[] args) {
Scanner kb = new Scanner(System.in);
System.out.print("a b c d: ");
CubicRoot eq = new CubicRoot(kb.nextDouble(),
kb.nextDouble(), kb.nextDouble(), kb.nextDouble());
System.out.print("Interval: ");
eq.findRoot(kb.nextDouble(), kb.nextDouble());
}
}
a b c d: 1 0 -1 -2 Interval: 1 2 Root 1.5214 after 17 halvings a b c d: 1 0 0 1 Interval: 1 3 No sign change, choose again
| Name | Type | What it holds |
|---|---|---|
a, b, c, d | double | coefficients |
low, high | double | ends of the interval |
mid | double | middle of the interval |
halvings | int | times the interval was cut |
Explain it like this: each step cuts the width in half, so a width of 1 falls below 0.00001 after 17 steps, because 2 to the power 17 is 131072. The keyword this is needed because parameters and data members share names.
Question. Items are typed on one line as name=quantity@rate, parted by semicolons. Show the cost of each, skip any item that is badly written with a reason, and show the bill.
Algorithm
import java.util.Scanner;
import java.util.StringTokenizer;
// Assignment 5: tokens of a line, with a bad token handled
public class LineReader {
public static void main(String[] args) {
Scanner kb = new Scanner(System.in);
System.out.println("item=quantity@rate, divided by ;");
StringTokenizer line =
new StringTokenizer(kb.nextLine(), ";");
double bill = 0;
int rejected = 0;
System.out.println("Pieces: " + line.countTokens());
while (line.hasMoreTokens()) {
String piece = line.nextToken().trim();
StringTokenizer part =
new StringTokenizer(piece, "=@");
try {
String item = part.nextToken();
int qty = Integer.parseInt(part.nextToken());
double rate =
Double.parseDouble(part.nextToken());
bill += qty * rate;
System.out.printf("%-14s%8.2f%n",
item, qty * rate);
} catch (NumberFormatException e) {
System.out.println("Not a number in " + piece);
rejected++;
} catch (java.util.NoSuchElementException e) {
System.out.println("Part missing in " + piece);
rejected++;
}
}
System.out.printf("%-14s%8.2f%n", "Bill", bill);
System.out.println("Rejected: " + rejected);
}
}
item=quantity@rate, divided by ; pencil=12@4.5; eraser=three@5; geometry box=2@135; ink=4 Pieces: 4 pencil 54.00 Not a number in eraser=three@5 geometry box 270.00 Part missing in ink=4 Bill 324.00 Rejected: 2
| Name | Type | What it holds |
|---|---|---|
line | StringTokenizer | pieces of the whole line |
part | StringTokenizer | tokens inside one piece |
qty, rate | int, double | converted tokens |
rejected | int | pieces that could not be used |
Explain it like this: geometry box stays one token because a space is not a delimiter here. The try block sits inside the loop, so one bad piece does not end the bill.
Question. Two desks hand out numbered tokens from one sequence, at most five in all. Show each token, the number left at any time, and how many each desk gave.
Algorithm
issued static, so there is one counter for all desks; keep mine per object.// Assignment 6: static members shared by all the objects
public class TokenDesk {
private static int issued = 0; // one copy, all desks
static final int LIMIT = 5; // named constant
private final String desk; // one copy per desk
private int mine;
TokenDesk(String desk) {
this.desk = desk;
}
void issue() {
if (issued == LIMIT) {
System.out.println(desk + ": no tokens left");
return;
}
issued++;
mine++;
System.out.println(desk + ": token " + issued);
}
static int left() { // needs no object
return LIMIT - issued;
}
public static void main(String[] args) {
TokenDesk north = new TokenDesk("North");
TokenDesk south = new TokenDesk("South");
north.issue();
south.issue();
south.issue();
System.out.println("Left: " + TokenDesk.left());
north.issue();
south.issue();
north.issue();
System.out.println("North gave " + north.mine
+ ", South gave " + south.mine);
}
}
North: token 1 South: token 2 South: token 3 Left: 2 North: token 4 South: token 5 North: no tokens left North gave 2, South gave 3
| Name | Type | What it holds |
|---|---|---|
issued | static int | tokens given by all desks |
LIMIT | static final int | most tokens, a named constant |
mine | int | tokens given by this desk |
desk | String | name of the desk |
Explain it like this: left() is called with the class name because it uses only static data. If issued were not static, both desks would give token 1.
Question. Accept the bounds of a matrix, its base address and the bytes per element. For a given element print its address in row major and in column major order.
Algorithm
import java.util.Scanner;
// Assignment 10: address of an element in both orders
public class CellAddress {
private int lr, ur, lc, uc; // lower and upper bounds
private int base, width;
void accept(Scanner kb) {
System.out.print("Row bounds : ");
lr = kb.nextInt();
ur = kb.nextInt();
System.out.print("Column bounds : ");
lc = kb.nextInt();
uc = kb.nextInt();
System.out.print("Base and width: ");
base = kb.nextInt();
width = kb.nextInt();
}
int rowMajor(int i, int j) {
int cols = uc - lc + 1;
return base + width * ((i - lr) * cols + (j - lc));
}
int columnMajor(int i, int j) {
int rows = ur - lr + 1;
return base + width * ((j - lc) * rows + (i - lr));
}
public static void main(String[] args) {
Scanner kb = new Scanner(System.in);
CellAddress m = new CellAddress();
m.accept(kb);
System.out.print("Element i j : ");
int i = kb.nextInt(), j = kb.nextInt();
if (i < m.lr || i > m.ur || j < m.lc || j > m.uc) {
System.out.println("Outside the matrix");
return;
}
System.out.println("Row major " + m.rowMajor(i, j));
System.out.println("Column major "
+ m.columnMajor(i, j));
}
}
Row bounds : -2 7 Column bounds : 3 12 Base and width: 2000 4 Element i j : 1 5 Row major 2128 Column major 2092 Row bounds : 0 4 Column bounds : 0 4 Base and width: 500 2 Element i j : 5 1 Outside the matrix
| Name | Type | What it holds |
|---|---|---|
lr, ur | int | lower and upper row index |
lc, uc | int | lower and upper column index |
base | int | address of the first element |
width | int | bytes in one element |
Explain it like this: for the first run there are 10 columns, so row major gives 2000 + 4 (3 × 10 + 2) = 2128, and column major gives 2000 + 4 (2 × 10 + 3) = 2092. This is a theory sum too, so the program doubles as a checker.
Question. Accept three equations as rows of four numbers, the last being the right hand side. Solve them by elimination, or say that there is no unique solution.
Algorithm
import java.util.Scanner;
// Assignment 11: three linear equations by elimination
public class ThreeUnknowns {
// the last column holds the right hand sides
private double[][] m = new double[3][4];
void accept(Scanner kb) {
for (int r = 0; r < 3; r++) {
System.out.print("Equation " + (r + 1) + ": ");
for (int c = 0; c < 4; c++)
m[r][c] = kb.nextDouble();
}
}
// the row with the largest entry of column p becomes row p
boolean pivot(int p) {
int best = p;
for (int r = p + 1; r < 3; r++)
if (Math.abs(m[r][p]) > Math.abs(m[best][p]))
best = r;
double[] held = m[p];
m[p] = m[best];
m[best] = held;
return Math.abs(m[p][p]) > 1e-9;
}
boolean eliminate() {
for (int p = 0; p < 3; p++) {
if (!pivot(p))
return false; // no single solution
for (int r = p + 1; r < 3; r++) {
double f = m[r][p] / m[p][p];
for (int c = p; c < 4; c++)
m[r][c] -= f * m[p][c];
}
}
return true;
}
void display() {
double[] x = new double[3];
for (int r = 2; r >= 0; r--) { // last row first
double sum = m[r][3];
for (int c = r + 1; c < 3; c++)
sum -= m[r][c] * x[c];
x[r] = sum / m[r][r];
}
System.out.printf("x = %.2f, y = %.2f, z = %.2f%n",
x[0], x[1], x[2]);
}
public static void main(String[] args) {
ThreeUnknowns e = new ThreeUnknowns();
e.accept(new Scanner(System.in));
if (e.eliminate())
e.display();
else
System.out.println("No unique solution");
}
}
Equation 1: 2 1 -1 3 Equation 2: 1 3 2 19 Equation 3: 3 -1 1 7 x = 2.00, y = 3.00, z = 4.00 Equation 1: 1 1 1 6 Equation 2: 2 2 2 12 Equation 3: 1 -1 2 3 No unique solution
| Name | Type | What it holds |
|---|---|---|
m | double[3][4] | coefficients and right sides |
p | int | pivot row and column |
f | double | multiple of the pivot row |
x | double[3] | values of the unknowns |
Explain it like this: the nearly zero test uses 1e-9 because doubles rarely come out as exactly 0. In the second run one equation is twice another, so elimination wipes it out.
Question. Accept a note, remove extra spaces, replace every occurrence of one text by another and insert a room number after the first “lab”. Use StringBuffer throughout.
Algorithm
import java.util.Scanner;
// Assignment 14: a one line editor on a StringBuffer
public class NoteEditor {
private StringBuffer note;
NoteEditor(String text) {
note = new StringBuffer(text);
}
void insertAfter(String mark, String extra) {
int at = note.indexOf(mark);
if (at < 0)
System.out.println("Not found: " + mark);
else
note.insert(at + mark.length(), extra);
}
int replaceAllOf(String old, String fresh) {
int changed = 0, at = note.indexOf(old);
while (at >= 0) {
note.replace(at, at + old.length(), fresh);
changed++;
at = note.indexOf(old, at + fresh.length());
}
return changed;
}
void squeeze() { // one space between words
for (int i = note.length() - 1; i > 0; i--)
if (note.charAt(i) == ' '
&& note.charAt(i - 1) == ' ')
note.deleteCharAt(i);
}
public static void main(String[] args) {
Scanner kb = new Scanner(System.in);
System.out.print("Note: ");
NoteEditor ed = new NoteEditor(kb.nextLine());
ed.squeeze();
System.out.println("1 " + ed.note);
System.out.print("Replace what: ");
String old = kb.nextLine();
System.out.print("With what: ");
String fresh = kb.nextLine();
if (old.length() == 0) {
System.out.println("Nothing to look for");
return;
}
System.out.println("Changed "
+ ed.replaceAllOf(old, fresh));
System.out.println("2 " + ed.note);
ed.insertAfter("lab", " 2");
System.out.println("3 " + ed.note);
}
}
Note: Meet in lab at ten. Bring the lab file. 1 Meet in lab at ten. Bring the lab file. Replace what: lab With what: computer lab Changed 2 2 Meet in computer lab at ten. Bring the computer lab file. 3 Meet in computer lab 2 at ten. Bring the computer lab file. Note: Closed today 1 Closed today Replace what: x With what: y Changed 0 2 Closed today Not found: lab 3 Closed today
| Name | Type | What it holds |
|---|---|---|
note | StringBuffer | the text, changed in place |
at | int | index where a text was found |
changed | int | replacements made |
old, fresh | String | text to find, text to put |
Explain it like this: deleting from the right keeps the indexes still to be visited unchanged. Searching again from at + fresh.length() is what stops “computer lab” from being replaced for ever, since it contains “lab”.
Question. Find how many different teams of r can be chosen from n players, without factorials, and count how many times the recursive method runs.
Algorithm
import java.util.Scanner;
// Assignment 16: teams of r from n players, by recursion
public class TeamCount {
private int calls; // how often choose() ran
// either player n is in the team, or is not
long choose(int n, int r) {
calls++;
if (r == 0 || r == n)
return 1; // only one way
return choose(n - 1, r - 1) + choose(n - 1, r);
}
public static void main(String[] args) {
Scanner kb = new Scanner(System.in);
System.out.print("Players and team size: ");
int n = kb.nextInt(), r = kb.nextInt();
if (r < 0 || n < r || n > 25) {
System.out.println("Not possible here");
return;
}
TeamCount t = new TeamCount();
System.out.println("Teams: " + t.choose(n, r));
System.out.println("Calls: " + t.calls);
}
}
Players and team size: 6 2 Teams: 15 Calls: 29 Players and team size: 20 5 Teams: 15504 Calls: 31007 Players and team size: 4 7 Not possible here
| Name | Type | What it holds |
|---|---|---|
n | int | players available |
r | int | size of the team |
calls | int | times choose() has run |
Explain it like this: there are two base cases, and both are needed. The calls come to one less than twice the answer: 29 for 15, and 31007 for 15504. That is why the program stops at 25 players.
Q4. And for inheritance and data structures?
Six entries: a derived class, an interface, a stack, a queue, a linked list and a measurement of complexity. These are the ones a Visiting Examiner can turn into a question fastest, so each comes with the sentence to say.
Question. A locker has a number and a monthly rent. A cool locker also pays for power each month, and one month’s rent is returned when it is hired for six months or more. Show the charge of each locker in a mixed array, and the total.
Algorithm
// Assignment 18: a derived class built on a base class
class Locker {
protected int number;
protected double monthlyRent;
Locker(int number, double monthlyRent) {
this.number = number;
this.monthlyRent = monthlyRent;
}
double charge(int months) {
return monthlyRent * months;
}
public String toString() { // redefines Object's method
return "Locker " + number;
}
}
class CoolLocker extends Locker {
private double power; // electricity per month
CoolLocker(int number, double rent, double power) {
super(number, rent); // must be the first line
this.power = power;
}
double charge(int months) { // overrides the base one
double amount = super.charge(months) + power * months;
if (months >= 6)
amount -= monthlyRent; // one month's rent back
return amount;
}
public String toString() {
return "Cool " + super.toString();
}
}
public class LockerDemo {
public static void main(String[] args) {
Locker[] hired = { new Locker(11, 150),
new CoolLocker(12, 150, 40),
new CoolLocker(13, 200, 40) };
int[] months = { 6, 3, 6 };
double total = 0;
for (int i = 0; i < hired.length; i++) {
double c = hired[i].charge(months[i]);
System.out.println(hired[i] + " for " + months[i]
+ " months: " + c);
total += c;
}
System.out.println("Total: " + total);
}
}
Locker 11 for 6 months: 900.0 Cool Locker 12 for 3 months: 570.0 Cool Locker 13 for 6 months: 1240.0 Total: 2710.0
| Name | Type | What it holds |
|---|---|---|
number, monthlyRent | protected | inherited by CoolLocker |
power | private double | belongs to CoolLocker only |
hired | Locker[] | objects of both classes |
total | double | sum of the charges |
Explain it like this: the array type is Locker, yet the second and third calls run CoolLocker’s charge. Which method runs is decided by the object while the program runs: that is dynamic binding.
Question. Sort the same runners fastest first, and then oldest first with equal ages settled by time. The sorting method must not change between the two.
Algorithm
// Assignment 20: one sorting method, two orders
interface Rule {
boolean before(Runner p, Runner q); // is p ahead of q?
}
class Runner {
String name;
double seconds;
int age;
Runner(String name, double seconds, int age) {
this.name = name;
this.seconds = seconds;
this.age = age;
}
}
class FastestFirst implements Rule {
public boolean before(Runner p, Runner q) {
return p.seconds < q.seconds;
}
}
class OldestFirst implements Rule {
public boolean before(Runner p, Runner q) {
if (p.age != q.age)
return p.age > q.age;
return p.seconds < q.seconds; // equal ages
}
}
public class SortByRule {
// insertion sort; works for any class that implements Rule
static void arrange(Runner[] list, Rule rule) {
for (int i = 1; i < list.length; i++) {
Runner item = list[i];
int j = i - 1;
while (j >= 0 && rule.before(item, list[j])) {
list[j + 1] = list[j];
j--;
}
list[j + 1] = item;
}
}
static void show(String title, Runner[] list) {
System.out.println(title);
for (Runner r : list)
System.out.println(" " + r.name + " " + r.seconds
+ " s, age " + r.age);
}
public static void main(String[] args) {
Runner[] heat = { new Runner("Zoya", 13.9, 17),
new Runner("Imran", 12.4, 16),
new Runner("Leela", 14.2, 18),
new Runner("Pavan", 13.1, 17) };
arrange(heat, new FastestFirst());
show("Fastest first", heat);
arrange(heat, new OldestFirst());
show("Oldest first", heat);
}
}
Fastest first Imran 12.4 s, age 16 Pavan 13.1 s, age 17 Zoya 13.9 s, age 17 Leela 14.2 s, age 18 Oldest first Leela 14.2 s, age 18 Pavan 13.1 s, age 17 Zoya 13.9 s, age 17 Imran 12.4 s, age 16
| Name | Type | What it holds |
|---|---|---|
rule | Rule | object that knows the order |
item | Runner | runner being placed |
j | int | position being compared |
heat | Runner[] | the runners |
Explain it like this: the sort knows how to arrange, the rule knows what order. A third order needs one new class and no change to the sort.
Question. Change an infix expression with single letter operands, brackets and the operators + - * / ^ into postfix. Report brackets that do not match.
Algorithm
import java.util.Scanner;
// Assignment 21: infix to postfix with a stack of characters
public class ToPostfix {
private char[] stack = new char[50];
private int top = -1;
static int rank(char op) {
if (op == '^') return 3;
if (op == '*' || op == '/') return 2;
if (op == '+' || op == '-') return 1;
return 0; // an opening bracket
}
// should the operator on top leave before op is pushed?
boolean leavesFirst(char op) {
if (top < 0)
return false;
int r = rank(stack[top]);
return r > rank(op) || (r == rank(op) && op != '^');
}
String convert(String infix) {
String post = "";
for (int i = 0; i < infix.length(); i++) {
char ch = infix.charAt(i);
if (ch == ' ')
continue;
if (Character.isLetterOrDigit(ch)) {
post += ch;
} else if (ch == '(') {
stack[++top] = ch;
} else if (ch == ')') {
while (top >= 0 && stack[top] != '(')
post += stack[top--];
if (top < 0)
return "Brackets do not match";
top--; // drop the '('
} else {
while (leavesFirst(ch))
post += stack[top--];
stack[++top] = ch;
}
}
while (top >= 0) {
if (stack[top] == '(')
return "Brackets do not match";
post += stack[top--];
}
return post;
}
public static void main(String[] args) {
Scanner kb = new Scanner(System.in);
System.out.print("Infix : ");
String infix = kb.nextLine();
System.out.println("Postfix: "
+ new ToPostfix().convert(infix));
}
}
Infix : A + B * (C - D) / E Postfix: ABCD-*E/+ Infix : P ^ Q ^ R - S Postfix: PQR^^S- Infix : (X + Y * Z Postfix: Brackets do not match
| Name | Type | What it holds |
|---|---|---|
stack | char[] | operators and opening brackets |
top | int | index of the top, -1 if empty |
post | String | the postfix answer |
ch | char | character being read |
Explain it like this: equal rank pops for + - * / because they work from left to right, but not for ^, which works from right to left. That is why P ^ Q ^ R gives PQR^^ and not PQ^R^.
Question. Define a queue of names through an interface with join, serve and waiting. Implement it as a circular array of three and as linked objects, and test both with the same method.
Algorithm
// Assignment 23: one interface, two ways to store a queue
interface WaitingLine {
void join(String name);
String serve(); // null when nobody is waiting
int waiting();
}
class ArrayLine implements WaitingLine {
private String[] seat = new String[3];
private int front = 0, size = 0;
public void join(String name) {
if (size == seat.length) {
System.out.println(" full, " + name
+ " sent away");
return;
}
seat[(front + size) % seat.length] = name;
size++;
}
public String serve() {
if (size == 0) return null;
String name = seat[front];
front = (front + 1) % seat.length;
size--;
return name;
}
public int waiting() { return size; }
}
class Person {
String name;
Person next; // reference to the one behind
Person(String name) { this.name = name; }
}
class LinkedLine implements WaitingLine {
private Person front, rear;
private int size = 0;
public void join(String name) {
Person p = new Person(name);
if (front == null) front = p;
else rear.next = p;
rear = p;
size++;
}
public String serve() {
if (front == null) return null;
String name = front.name;
front = front.next;
if (front == null) rear = null;
size--;
return name;
}
public int waiting() { return size; }
}
public class LineInTwoWays {
static void test(WaitingLine line) {
String[] names = { "Asha", "Binu", "Cyrus", "Divya" };
for (String n : names)
line.join(n);
System.out.println(" served " + line.serve());
line.join("Esha");
while (line.waiting() > 0)
System.out.println(" served " + line.serve());
System.out.println(" then " + line.serve());
}
public static void main(String[] args) {
System.out.println("Array of 3");
test(new ArrayLine());
System.out.println("Linked objects");
test(new LinkedLine());
}
}
Array of 3 full, Divya sent away served Asha served Binu served Cyrus served Esha then null Linked objects served Asha served Binu served Cyrus served Divya served Esha then null
| Name | Type | What it holds |
|---|---|---|
seat | String[] | circular store of the names |
front, size | int | first index, names waiting |
front, rear | Person | ends of the linked version |
next | Person | the person behind |
Explain it like this: with size stored, full and empty are never confused, and all three places get used. Divya is refused by the array but not by the linked line, which has no fixed size.
Question. Build a single linked list in ascending order by insertion. Delete a value, extract the part between two values as a new list, reverse the list, and show it at each stage, including when it is empty.
Algorithm
// Assignment 24: a linked list kept in ascending order
class Link {
int value;
Link next;
Link(int value, Link next) {
this.value = value;
this.next = next;
}
}
public class OrderedChain {
private Link start; // null means the list is empty
void insert(int v) {
if (start == null || v < start.value) {
start = new Link(v, start);
return;
}
Link p = start;
while (p.next != null && p.next.value <= v)
p = p.next;
p.next = new Link(v, p.next);
}
boolean delete(int v) {
Link p = start, prev = null;
while (p != null && p.value != v) {
prev = p;
p = p.next;
}
if (p == null) return false;
if (prev == null) start = p.next;
else prev.next = p.next;
return true;
}
// a new list with the values from low to high
OrderedChain between(int low, int high) {
OrderedChain part = new OrderedChain();
for (Link p = start; p != null; p = p.next)
if (p.value >= low && p.value <= high)
part.insert(p.value);
return part;
}
void reverse() {
Link done = null;
while (start != null) {
Link rest = start.next; // keep hold of the rest
start.next = done;
done = start;
start = rest;
}
start = done;
}
public String toString() {
String s = "";
for (Link p = start; p != null; p = p.next)
s += p.value + (p.next == null ? "" : " > ");
return s.length() == 0 ? "empty" : s;
}
public static void main(String[] args) {
OrderedChain c = new OrderedChain();
int[] given = { 42, 17, 63, 8, 42, 29 };
System.out.println("New " + c);
for (int v : given)
c.insert(v);
System.out.println("Filled " + c);
System.out.println("20 to 50 " + c.between(20, 50));
System.out.println("Delete 8 " + c.delete(8)
+ ", " + c);
System.out.println("Delete 9 " + c.delete(9)
+ ", " + c);
c.reverse();
System.out.println("Reversed " + c);
}
}
New empty Filled 8 > 17 > 29 > 42 > 42 > 63 20 to 50 29 > 42 > 42 Delete 8 true, 17 > 29 > 42 > 42 > 63 Delete 9 false, 17 > 29 > 42 > 42 > 63 Reversed 63 > 42 > 42 > 29 > 17
| Name | Type | What it holds |
|---|---|---|
start | Link | first node, null if empty |
p, prev | Link | current node and the one before |
part | OrderedChain | extracted sublist |
done, rest | Link | reversed part, part still to do |
Explain it like this: in reverse, rest must be saved before the link is turned round, or the remaining nodes are lost. After reversing, insert should not be used, because the list is no longer ascending.
Question. For arrays of 100, 200, 400, 800 and 1600 values, count the steps of a linear and a binary search for a missing key, and the comparisons of a bubble sort on falling values.
Algorithm
// Assignment 25: steps counted, to see O(n) and O(log n)
public class CountSteps {
static int steps;
static int linear(int[] a, int key) {
steps = 0;
for (int i = 0; i < a.length; i++) {
steps++;
if (a[i] == key)
return i;
}
return -1;
}
static int binary(int[] a, int key) {
steps = 0;
int low = 0, high = a.length - 1;
while (low <= high) {
steps++;
int mid = (low + high) / 2;
if (a[mid] == key)
return mid;
if (a[mid] < key)
low = mid + 1;
else
high = mid - 1;
}
return -1;
}
static int bubble(int[] a) { // returns comparisons
int made = 0;
for (int pass = 1; pass < a.length; pass++)
for (int i = 0; i < a.length - pass; i++) {
made++;
if (a[i] > a[i + 1]) {
int held = a[i];
a[i] = a[i + 1];
a[i + 1] = held;
}
}
return made;
}
public static void main(String[] args) {
System.out.println("n linear binary bubble");
for (int n = 100; n <= 1600; n *= 2) {
int[] even = new int[n];
for (int i = 0; i < n; i++)
even[i] = 2 * i;
linear(even, 1); // odd, so never found
int l = steps;
binary(even, 2 * n); // larger than all
int b = steps;
int[] falling = new int[n];
for (int i = 0; i < n; i++)
falling[i] = n - i;
System.out.printf("%-7d%-8d%-8d%d%n",
n, l, b, bubble(falling));
}
}
}
n linear binary bubble 100 100 7 4950 200 200 8 19900 400 400 9 79800 800 800 10 319600 1600 1600 11 1279200
| Name | Type | What it holds |
|---|---|---|
steps | static int | elements examined in a search |
made | int | comparisons of the sort |
even, falling | int[] | data for the tests |
n | int | size of the input |
Explain it like this: when n doubles, the linear column doubles, the binary column grows by 1, and the bubble column becomes about four times as large. Those are O(n), O(log n) and O(n²), read off your own output.
Q5. Only a few weeks left?
Five entries a week, one evening each, with the two weekend days for testing and for explaining them aloud. It works only if an entry is closed on the day it is opened.
| Week | Entries | Before moving on you can |
|---|---|---|
| 1 | 1, 2, 3, 5, 6 | Say what is stored in an object and what is shared by the class |
| 2 | 4, 7, 8, 9, 13 | Trace a nested loop on paper without running it |
| 3 | 10, 11, 12, 14, 15 | Work one address sum by hand and match your program |
| 4 | 16, 17, 18, 19, 20 | Point at the base case, the super call and the overridden method |
| 5 | 21, 22, 23, 24, 25 | Draw the stack, queue or list after each line of the test |
It is the habit the lab exam pays 3 marks for, and an algorithm copied from finished code always reads like code.
Lockers can become hostel rooms with a deposit, runners can become books with a price and a year. A changed rule forces you to think; a changed name does not.
Try an empty list, a single row, a negative number, a missing bracket. Keep that run in the file as the second output.
If you can rebuild entry 24 from a blank screen, the examiner’s question about it will not trouble you, and neither will the terminal problem.
The other 15 marks are earned in one sitting, so rehearse that too with the solved practical papers. Section B and C programs return in the theory paper: see the practice paper and the important questions. In our live classes the student writes every entry while the teacher asks why; we do not write files for students.
One to one, at your own timing
Before enrolling you can book a priority demo: a paid, full live class at a slot you pick, followed by a written skill report, with its fee adjusted against the first month if you enrol. The free demo class is the other way in. Regular classes are personalised one to one, paid monthly, and carry no admission fee.
Before you enrol · Try a class
a full live class of about 45 to 60 minutes
The classes · Choose your own timing
₹4,999
per month, 4 private classes, fully flexible timingtwo private classes a week, at a time set with you
Someone with fifteen good entries needs a short spell on Section C. Someone with none needs steady weeks and an honest date. Tell us the number in your file now and the demo is built around it; the fee shown above is per month and you can leave after any month.
For ISC students abroad
The minimum of 25 assignments is in the syllabus itself, so it is the same in Sharjah, Singapore and Kolkata. Lessons can sit in the evening or at the weekend where you live.
| Where you live | Time difference | Usual class window, local time | Format |
|---|---|---|---|
| India every Indian city | Indian time | Any time you choose | Personalised 1-on-1 |
| United Arab Emirates Dubai, Sharjah | 1 h 30 min behind India | 3:00 PM to 9:00 PM | Personalised 1-on-1 |
| Indonesia and Thailand West Java, Bangkok area | 1 h 30 min ahead of India | 3:30 PM to 9:00 PM | Personalised 1-on-1 |
| Singapore Singapore | 2 h 30 min ahead of India | 3:30 PM to 9:00 PM | Personalised 1-on-1 |
Your school fixes the date on which the file is closed, so share it early. What else the subject needs is on the ISC Class 12 Computer Science tuition page, and students a year younger should read the Class 11 practical and project page instead.
What families say
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
Every page in the ISC Computer Science (868) series, grouped by what you need.
CBSE Class 12 Computer Science (083): Class 12 CS viva questions Class 12 CS sample paper practice Class 12 CS project with source code Class 12 CS important questions
CBSE Class 12 Informatics Practices (065): Class 12 IP practical file Class 12 IP project with source code Class 12 IP sample paper practice Class 12 IP important questions
CBSE Class 12 Information Technology (802): IT 802 practical and project file IT 802 Java notes and programs IT 802 notes
CBSE Class 11 CS, IP and AI: Class 11 CS practical file Class 11 IP practical file CS or IP in Class 11
Program lists with output: Java programs for ISC Class 11 and 12 String and array programs in Java
Work file questions
Not in the ISC 2027 document. Class XII submits a work file with the programming assignments of the year, at least twenty-five, worth 10 marks by internal evaluation and 5 by the Visiting Examiner. A separate project of 5 marks exists in Class XI only.
A minimum of twenty-five assignments, as the 2027 syllabus says. Class XI needs twenty. Prepare one or two extra in case an entry is returned, but quality decides the marks: assignments should cover every major topic and be challenging enough to need real design.
Use the Print command of your browser on this page and choose Save as PDF for a reference copy of the plan and the 14 worked entries. Please do not hand that copy in. The file should hold programs you typed, ran and can explain, with your own data.
The syllabus prints no layout. A safe entry has the question, the algorithm in pseudo code, the Java program with comments, a short variable description table and the output for two inputs. If your teacher gives a format, that one wins.
Fifteen out of the 30 practical marks: ten through internal evaluation in school and five by the Visiting Examiner. The remaining fifteen are for the problem solved in the three-hour practical. Theory carries 70 marks, which makes 100 in total.
Objects and constructors, wrapper classes and casting, methods and static members, arrays and address calculation, strings and StringBuffer, recursion, inheritance, abstract classes and interfaces, stack, queue, circular queue, dequeue, infix conversion, single linked list, and complexity. Binary trees are conceptual, so a program is not required.
Read them if they help you understand a topic, then write your own. The same files are passed around widely, and several hold only ten or twenty programs. An examiner who asks one question about a copied program finds out quickly.
BlueJ is recommended in the syllabus for its ease of use, and any text editor with javac, Eclipse or NetBeans is also allowed. The programs here are ordinary Java classes that compile from the command line and open in BlueJ without change.
Linked list, yes in effect: the syllabus marks single linked list for algorithm and programming, and lists insertion, deletion, reversal and extracting a sublist. Binary trees and traversals are marked conceptual, so learn the terms and the three traversals rather than writing code.
No. We teach, the student writes. In a one to one class your child plans and codes each entry while the teacher checks the logic and asks questions. Begin with a priority demo at your own slot or with the free demo class.
Start
Count your finished entries and send us the number with the submission date. In the demo class your child writes one new entry from a blank screen and you hear which syllabus items still have no program.
Submission soon? A priority demo lets you pick the slot yourself. You receive a written skill report, and the demo fee is taken off the first month if you enrol.
WhatsApp us · +91 91233 66161 · connect@modernagecoders.com
Every class is live video. The form requests a callback and reserves nothing.
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