Choose the correct option.
- (a)Associative Law
- (b)Distributive Law
- (c)Involution Law
- (d)Commutative Law
Show answer
Answer
Correct option: (b)
The ISC Computer Science 2023 Specimen Paper for Class 12: all 29 questions, 70 marks in all, in printed order and in full. It is free to download: tap "Show answer" under a question to see its answer, or use the download button to save the questions as a PDF, with or without answers; "Print this paper" below prints it as it was set.
Choose the correct option.
Answer
Correct option: (b)
Choose the correct option.
Answer
Correct option: (a)
Choose the correct option.
Answer
Correct option: (b)
Choose the correct option.
Answer
Correct option: (d)
Choose the correct option.
Answer
Correct option: (d)
Answer the following.
Answer
Answer the following.
Answer
Answer the following.
super in Java programming.Answer
super is used in a subclass's constructor to invoke (call) the constructor of its immediate superclass, so that the inherited data members get initialised by the superclass's own constructor (e.g. super(args); as the first statement).Answer the following.
Answer
Answer the following.
Answer
Answer the following.
Answer
Answer the following.
Answer
Final answer: 2224 bytes (address)
Answer the questions on the code given below.
void Solve(int n)
{ int a=1,b=1;
for (int i=n;i>0;i=i/10)
{ int d=i%10;
if (d%2==0)
a=a*d;
else
b=b*d;
}
System.out.println(a+" "+b);
}Answer (a)
Answer (b)
Answer the questions on the code given below.
int quiz( int n)
{
if ( n <= 1 )
return n;
else
return (--n % 2) + quiz(n/10);
}Answer (a)
Answer (b)
Reduce the following using a Karnaugh map.
Draw: Logic gate diagram for the reduced expression
Must show: variables and their complements as inputs
Answer (a)
Groups: (0, 2, 4, 6) → A'D'; (1, 3, 9, 11) → B'D; (9, 13) → AC'D
Reduced expression: F = A'D' + B'D + AC'D
Answer (b)

Reduce the following using a Karnaugh map.
Draw: Logic gate diagram for the reduced expression
Must show: variables and their complements as inputs
Answer (a)
Groups: (1, 3, 5, 7, 9, 11, 13, 15) → D'; (6, 7, 14, 15) → (B' + C'); (0, 1) → (A + B + C)
Reduced expression: F = D'(B' + C')(A + B + C)
Answer (b)

Answer the following using a truth table.
| INPUTS | |
|---|---|
| P | Quad core processor |
| M | Internal memory of 64 GB or more |
| R | Resale phone |
| W | Warranty of 1 year |
Answer
| P | M | R | W | P.M.R' | P.R.W' | P'.M.W | P.M.R' + P.R.W' + P'.M.W |
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 |
| 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
| 0 | 1 | 0 | 1 | 0 | 0 | 1 | 1 |
| 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 1 | 0 | 0 | 1 | 1 |
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 |
| 1 | 0 | 1 | 0 | 0 | 1 | 0 | 1 |
| 1 | 0 | 1 | 1 | 0 | 0 | 0 | 0 |
| 1 | 1 | 0 | 0 | 1 | 0 | 0 | 1 |
| 1 | 1 | 0 | 1 | 1 | 0 | 0 | 1 |
| 1 | 1 | 1 | 0 | 0 | 1 | 0 | 1 |
| 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 |
SOP: X = P.M.R' + P.R.W' + P'.M.W
Answer the following.
Answer

Answer the following.
Answer
Answer the following.
Answer

Answer the following using a truth table.
Answer
| P | Q | R | P => Q | P => R | (P => Q).(P => R) | Q.R | P => (Q.R) | (P => Q).(P => R) <=> P => (Q.R) |
| 0 | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 1 |
| 0 | 0 | 1 | 1 | 1 | 1 | 0 | 1 | 1 |
| 0 | 1 | 0 | 1 | 1 | 1 | 0 | 1 | 1 |
| 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
| 1 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 1 |
| 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 1 |
| 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
Answer the following.
Answer
Write the program described below.
| Class name | : | Pronic |
|---|---|---|
| Data members/instance variables: | ||
| num | : | to store a positive integer number |
| Methods / Member functions: | ||
| Pronic( ) | : | default constructor to initialize the data member with legal initial value |
| void acceptnum( ) | : | to accept a positive integer number |
| boolean ispronic(int v) | : | returns true if the number ‘num’ is a pronic number, otherwise returns false using recursive technique |
| void check( ) | : | checks whether the given number is a pronic number by invoking the function ispronic() and displays the result with an appropriate message |
Answer
import java.util.Scanner;
class Pronic
{
int num;
Pronic()
{
num = 0;
}
void acceptnum()
{
Scanner sc = new Scanner(System.in);
System.out.print("Enter a positive integer: ");
num = sc.nextInt();
}
boolean ispronic(int v)
{
return ispronic(v, 0);
}
boolean ispronic(int v, int n)
{
if (n > v)
return false;
else if (n * (n + 1) == v)
return true;
else
return ispronic(v, n + 1);
}
void check()
{
if (ispronic(num))
System.out.println(num + " is a Pronic number.");
else
System.out.println(num + " is not a Pronic number.");
}
public static void main(String args[])
{
Pronic obj = new Pronic();
obj.acceptnum();
obj.check();
}
}Explanation: ispronic(int) is the required single-argument method from the specification; it forwards to an overloaded recursive helper ispronic(v, n) which tries successive values of n starting at 0 - a pronic number satisfies num = n*(n+1) for some non-negative integer n. If n*(n+1) exceeds v (n>v) without a match, it returns false; if n*(n+1)==v it returns true; otherwise it recurses with n+1. Tested (run for real): num=12 correctly reported "12 is a Pronic number." (since 3*4=12) and num=15 correctly reported "15 is not a Pronic number."Write the program described below.
| Class name | : | OddEven |
|---|---|---|
| Data members/instance variables: | ||
| a[ ] | : | to store integers in the array |
| m | : | integer to store the size of the array |
| Methods / Member functions: | ||
| OddEven(int mm) | : | parameterised constructor to initialize the data member m=mm |
| void fillarray( ) | : | to enter integer elements in the array |
| OddEven arrange(OddEven P, OddEven Q ) | : | stores the odd numbers from both the parameterized object arrays followed by the even numbers from both the arrays and returns the object with the arranged array |
| void display( ) | : | displays the elements of the arranged array |
Answer
import java.util.Scanner;
class OddEven
{
int a[];
int m;
OddEven(int mm)
{
m = mm;
a = new int[m];
}
void fillarray()
{
Scanner sc = new Scanner(System.in);
for (int i = 0; i < m; i++)
{
System.out.print("Enter element " + (i + 1) + ": ");
a[i] = sc.nextInt();
}
}
OddEven arrange(OddEven P, OddEven Q)
{
OddEven R = new OddEven(P.m + Q.m);
int k = 0;
for (int i = 0; i < P.m; i++)
if (P.a[i] % 2 != 0)
R.a[k++] = P.a[i];
for (int i = 0; i < Q.m; i++)
if (Q.a[i] % 2 != 0)
R.a[k++] = Q.a[i];
for (int i = 0; i < P.m; i++)
if (P.a[i] % 2 == 0)
R.a[k++] = P.a[i];
for (int i = 0; i < Q.m; i++)
if (Q.a[i] % 2 == 0)
R.a[k++] = Q.a[i];
return R;
}
void display()
{
for (int i = 0; i < m; i++)
System.out.print(a[i] + " ");
System.out.println();
}
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
System.out.print("Enter size of array 1: ");
int m1 = sc.nextInt();
OddEven o1 = new OddEven(m1);
o1.fillarray();
System.out.print("Enter size of array 2: ");
int m2 = sc.nextInt();
OddEven o2 = new OddEven(m2);
o2.fillarray();
OddEven o3 = new OddEven(0);
OddEven result = o3.arrange(o1, o2);
result.display();
}
}Explanation: arrange() first copies all odd elements of P in order, then all odd elements of Q, then all even elements of P, then all even elements of Q, into a new OddEven object R sized m of P plus m of Q, and returns R. Tested (run for real) with Array1={2,13,6,19,26,11,4} and Array2={7,22,4,17,12,45): the program printed "13 19 11 7 17 45 2 6 26 4 22 4 12", which exactly matches the Arranged Array given in the question.Write the program described below.
| Class name | : | Encrypt |
|---|---|---|
| Data members/instance variables: | ||
| wrd | : | to store a word |
| len | : | integer to store the length of the word |
| newwrd | : | to store the encrypted word |
| Methods / Member functions: | ||
| Encrypt( ) | : | default constructor to initialize data members with legal initial values |
| void acceptword( ) | : | to accept a word in UPPER CASE |
| void freqvowcon( ) | : | finds the frequency of the vowels and consonants in the word stored in ‘wrd’ and displays them with an appropriate message |
| void nextVowel( ) | : | replaces only the vowels from the word stored in ‘wrd’ by the next corresponding vowel and assigns it to ‘newwrd’, with the remaining alphabets unchanged |
| void disp( ) | : | Displays the original word along with the encrypted word |
Answer
import java.util.Scanner;
class Encrypt
{
String wrd, newwrd;
int len;
Encrypt()
{
wrd = "";
newwrd = "";
len = 0;
}
void acceptword()
{
Scanner sc = new Scanner(System.in);
System.out.print("Enter a word in UPPER CASE: ");
wrd = sc.nextLine();
len = wrd.length();
}
void freqvowcon()
{
int vcount = 0, ccount = 0;
for (int i = 0; i < len; i++)
{
char ch = wrd.charAt(i);
if (ch == 'A' || ch == 'E' || ch == 'I' || ch == 'O' || ch == 'U')
vcount++;
else
ccount++;
}
System.out.println("Number of vowels: " + vcount);
System.out.println("Number of consonants: " + ccount);
}
void nextVowel()
{
for (int i = 0; i < len; i++)
{
char ch = wrd.charAt(i);
switch (ch)
{
case 'A': newwrd += 'E'; break;
case 'E': newwrd += 'I'; break;
case 'I': newwrd += 'O'; break;
case 'O': newwrd += 'U'; break;
case 'U': newwrd += 'A'; break;
default: newwrd += ch;
}
}
}
void disp()
{
System.out.println("Original word : " + wrd);
System.out.println("Encrypted word : " + newwrd);
}
public static void main(String args[])
{
Encrypt obj = new Encrypt();
obj.acceptword();
obj.freqvowcon();
obj.nextVowel();
obj.disp();
}
}Explanation: nextVowel() scans each character of wrd and, if it is one of the vowels A/E/I/O/U, replaces it by the next vowel in the cycle A->E->I->O->U->A using a switch statement, copying all other (consonant) characters unchanged into newwrd. freqvowcon() separately counts and displays the number of vowels and consonants in wrd. Tested (run for real): for wrd="COMPUTER" the program printed "Number of vowels: 3", "Number of consonants: 5", and Encrypted word "CUMPATIR", matching the example in the question exactly.Answer the questions on the class described below.
| Class name | : | Holder |
|---|---|---|
| Data members/instance variables: | ||
| Q[ ] | : | array to hold integers |
| cap | : | maximum capacity of the holder |
| front | : | to point the index of the front end |
| rear | : | to point the index of the rear end |
| Methods / Member functions: | ||
| Holder(int n ) | : | constructor to initialize cap=n, front= 0 and rear=0 |
| void addint( int v ) | : | to add integers in the holder at the rear end if possible, otherwise display the message “ HOLDER IS FULL ” |
| int removeint( ) | : | removes and returns the integers from the front end of the holder if any, else returns −999 |
| void show( ) | : | displays the elements of the holder |
Answer (i)
void addint(int v)
{
if (rear == cap)
System.out.println("HOLDER IS FULL");
else
{
Q[rear] = v;
rear++;
}
}
int removeint()
{
if (front == rear)
return -999;
else
{
int val = Q[front];
front++;
return val;
}
}Explanation: addint() checks whether rear has reached the capacity cap (holder full) before storing v at index rear and advancing rear; otherwise it prints "HOLDER IS FULL". removeint() checks whether the holder is empty (front==rear), returning -999 in that case; otherwise it returns the element at front and advances front, so elements always leave from the front in the order they were added (verified logically against the given constructor, which sets front=rear=0).Answer (ii)
Write the program described below.
| Class name | : | Bank |
|---|---|---|
| Data members/instance variables: | ||
| name | : | to store the name of the customer |
| acc_no | : | integer to store the account number |
| principal | : | to store the principal amount in decimals |
| Methods / Member functions: | ||
| Bank( ... ) | : | parameterized constructor to assign values to the data members |
| void display( ) | : | to display the customer details |
| Class name | : | Interest |
|---|---|---|
| Data members/instance variables: | ||
| rate | : | to store the interest rate in decimals |
| time | : | to store the time period in decimals |
| Methods / Member functions: | ||
| Interest( ... ) | : | parameterized constructor to assign values to the data members of both the classes |
| double calculate( ) | : | to calculate and return the compound interest using the formula $[ \text{CI} = P ( 1 + R/100 )^N - P ]$ where, P is the principal, R is the rate and N is the time |
| void display( ) | : | to display the customer details along with the compound interest |
Answer
class Interest extends Bank
{
double rate, time;
Interest(String n, int a, double p, double r, double t)
{
super(n, a, p);
rate = r;
time = t;
}
double calculate()
{
double ci = principal * Math.pow((1 + rate / 100), time) - principal;
return ci;
}
void display()
{
super.display();
System.out.println("Rate of Interest = " + rate);
System.out.println("Time Period = " + time);
System.out.println("Compound Interest = " + calculate());
}
}Explanation: Interest extends Bank. Its parameterised constructor passes name, account number and principal up to the superclass via super(n,a,p), then stores rate and time in the subclass. calculate() applies the given compound-interest formula CI = P(1+R/100)^N - P using the inherited principal along with rate and time, and returns the result. display() calls super.display() to reuse the superclass's printing of the customer details, then additionally prints rate, time and the computed compound interest, demonstrating inheritance and method overriding.Write the program described below.
class Node
{
int num;
Node next;
}
Write an Algorithm OR a Method to insert a node at the beginning of an existing linked list.
The method declaration is as follows:
void InsertNode( Nodes starPtr, int n )Answer
start holds the head of the linked list, and startPtr is the current head passed into the method:void InsertNode(Node startPtr, int n)
{
Node temp = new Node();
temp.num = n;
temp.next = startPtr;
start = temp;
}A new node temp is created and its data field is set to n; its next is made to point to the current first node (startPtr), and the class-level head pointer start is then updated to this new node, thereby inserting it at the beginning of the list.Answer the following questions from the binary tree.
Answer (a)
Answer (b)
Answer (c)
The ISC Computer Science 2023 Specimen Paper is a specimen paper for Class 12: 29 questions in printed order, 70 marks in all, asked from 8 chapters. A specimen paper is the sample question paper CISCE publishes before the exam to show the layout and style of that year’s paper. It is a good guide to the pattern you will meet.
The layout of the current Computer Science paper (sections, marks, choices) is in the paper pattern guide.
| Kind | Questions | Marks printed* |
|---|---|---|
| Program | 5 | 37 |
| Case based | 5 | 21 |
| Long answer | 2 | 8 |
| Truth table | 2 | 8 |
| Short answer | 5 | 7 |
| MCQ | 5 | 5 |
| Binary tree | 1 | 3 |
| One word | 2 | 2 |
| Conversion | 1 | 2 |
| Numerical | 1 | 2 |
| Chapter | Questions | Marks printed* |
|---|---|---|
| Boolean Algebra | 11 | 27 |
| Arrays, Strings | 3 | 22 |
| Data structures | 5 | 13 |
| Objects | 1 | 10 |
| Computer Hardware | 3 | 9 |
| Inheritance, Interfaces and Polymorphism | 4 | 8 |
| Methods | 1 | 3 |
| Recursion | 1 | 3 |
* Marks are those printed on each question; where a question offers an either-or choice, both options are counted, so the totals can come to more than the paper’s own total.
29 questions, 70 marks in all, shown in full and in printed order on this page.
By number of questions: Boolean Algebra (11), Data structures (5), Inheritance, Interfaces and Polymorphism (4) and Arrays, Strings (3).
Tap “Show answer” under a question to see its answer. The download button saves the paper as a PDF, with or without the answers.