Prashnikaप्रश्निका
Code
About
Computer ScienceSpecimenClass 12

ISC Computer Science 2025 Specimen Paper with Answers

The ISC Computer Science 2025 Specimen Paper for Class 12: all 27 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.

27questions
70marks
10chapters
Q1(i)1 mark · MCQOpen: The compliment of the Boolean expression A' · (B · C' + B' · C)

Choose the correct option.

The compliment of the Boolean expression $A' \cdot (B \cdot C' + B' \cdot C)$
  • (a)$A' \cdot (B + C + B' + C)$
  • (b)$A + (B + C') \cdot (B + C')$
  • (c)$A + (B' + C) \cdot (B + C')$
  • (d)$A' \cdot (B' + C' + B' \cdot C)$
Show answer

Answer

Official answer key

Correct option: (c)

Answer: (c) $A + (B' + C) \cdot (B + C')$ By De Morgan's law, $[A' \cdot (B \cdot C' + B' \cdot C)]' = A + (B \cdot C' + B' \cdot C)' = A + (B' + C) \cdot (B + C')$.
Q1(ii)1 mark · Assertion-reasonOpen: Recursion utilises more memory as compared to iteration. Given below are two…

Study the Assertion and Reason and choose the correct option.

Assertion: Recursion utilises more memory as compared to iteration.

Reason: Time complexity of recursion is higher due to the overhead of maintaining the function call stack.

Given below are two statements marked Assertion and Reason. Read the two statements carefully and choose the correct option.
  • (a)Both Assertion and Reason are true and Reason is the correct explanation for Assertion.
  • (b)Both Assertion and Reason are true but Reason is not the correct explanation for Assertion.
  • (c)Assertion is true and Reason is false.
  • (d)Assertion is false and Reason is true.
Show answer

Answer

Official answer key

Correct option: (b)

Answer: (b) Both Assertion and Reason are true but Reason is not the correct explanation for Assertion. Recursion does use more memory than iteration, since each recursive call adds a new frame to the call stack, so the Assertion is true. The Reason (that recursion's time complexity is higher due to call-stack overhead) is also a true statement in general, but it is a statement about time complexity, not about why recursion uses more memory (a space argument) - so it does not explain the Assertion.
Q1(iii)1 mark · MCQOpen: According to the Principle of duality, the Boolean equation (A' + B) · (1 + B)…

Choose the correct option.

According to the Principle of duality, the Boolean equation $(A' + B) \cdot (1 + B) = A' + B$ will be equivalent to:
  • (a)$(A + B') \cdot (0 + B) = A + B'$
  • (b)$(A' \cdot B) + (0 \cdot B) = A' \cdot B$
  • (c)$(A' \cdot B) + (0 \cdot B) = A' + B$
  • (d)$(A' + B) \cdot (0 + B) = A' + B$
Show answer

Answer

Official answer key

Correct option: (b)

Answer: (b) $(A' \cdot B) + (0 \cdot B) = A' \cdot B$ By the Principle of Duality, every $+$ is replaced by $\cdot$, every $\cdot$ by $+$, and every $1$ by $0$ (and vice versa), leaving the variables unchanged. Applying this to $(A'+B)\cdot(1+B)=A'+B$ gives $(A'\cdot B)+(0\cdot B)=A'\cdot B$.
Q1(iv)1 mark · MCQOpen: Distributive law states that:

Choose the correct option.

Distributive law states that:
  • (a)$A + B \cdot C = (A + B) \cdot (A + C)$
  • (b)$A + (A \cdot B) = A$
  • (c)$A \cdot (B + C) = (A \cdot B) + (B \cdot C)$
  • (d)$A + B \cdot C = A \cdot B + A \cdot C$
Show answer

Answer

Official answer key

Correct option: (a)

Answer: (a) $A + B \cdot C = (A + B) \cdot (A + C)$ The Distributive Law has two dual forms: $A \cdot (B+C) = A \cdot B + A \cdot C$ (AND over OR) and $A + (B \cdot C) = (A+B) \cdot (A+C)$ (OR over AND). Option (a) is the second, correct form.
Q1(v)1 mark · MCQOpen: The complement of the reduced expression of F(A, B) = Σ (0, 1, 2, 3) is:

Choose the correct option.

The complement of the reduced expression of $F(A, B) = \Sigma (0, 1, 2, 3)$ is:
  • (a)1
  • (b)$A \cdot B$
  • (c)0
  • (d)$A' + B'$
Show answer

Answer

Official answer key

Correct option: (c)

Answer: (c) 0 For 2 variables A and B there are only 4 possible minterms (0,1,2,3), and $F(A,B)=\Sigma(0,1,2,3)$ includes all of them, so the reduced expression is $F=1$ (always true). The complement of this reduced expression is therefore $1'=0$.
Q1(vi)1 mark · Assertion-reasonOpen: s2 is converse of s1 Study the given propositions and the statements marked…

Study the Assertion and Reason and choose the correct option.

Assertion: s2 is converse of s1

Reason: Three-sided polygon must be a triangle.

Study the given propositions and the statements marked Assertion and Reason that follow it. Choose the correct option on the basis of your analysis. p = I am a triangle q = I am a three-sided polygon s1 = $p \rightarrow q$ s2 = $q \rightarrow p$
  • (a)Both Assertion and Reason are true and Reason is the correct explanation for Assertion.
  • (b)Both Assertion and Reason are true but Reason is not the correct explanation for Assertion.
  • (c)Assertion is true and Reason is false.
  • (d)Assertion is false and Reason is true.
Show answer

Answer

Official answer key

Correct option: (b)

Answer: (b) Both Assertion and Reason are true but Reason is not the correct explanation for Assertion. Given $s1: p \rightarrow q$, its converse is $q \rightarrow p$, which is exactly $s2$, so the Assertion ('s2 is the converse of s1') is true - this is a structural/definitional fact about conditionals. The Reason ('a three-sided polygon must be a triangle') is also true, but it is a fact of geometry, unrelated to why $s2$ is termed the converse of $s1$ - so it does not explain the Assertion.
Q1(vii)1 mark · Assertion-reasonOpen: In Java, the String class is used to create and manipulate strings, and it is…

Study the Assertion and Reason and choose the correct option.

Assertion: In Java, the String class is used to create and manipulate strings, and it is immutable.

Reason: Immutability ensures that once a String object is created, its value cannot be changed.

Given below are two statements marked Assertion and Reason. Read the two statements carefully and choose the correct option.
  • (a)Both Assertion and Reason are true and Reason is the correct explanation for Assertion.
  • (b)Both Assertion and Reason are true but Reason is not the correct explanation for Assertion.
  • (c)Assertion is true and Reason is false.
  • (d)Assertion is false and Reason is true.
Show answer

Answer

Official answer key

Correct option: (a)

Answer: (a) Both Assertion and Reason are true and Reason is the correct explanation for Assertion. The Assertion is true: Java's String class is used to create and manipulate strings, and String objects are immutable. The Reason is true and directly explains the Assertion: immutability means that once a String object is created, its value/content can never be changed - any apparent modification actually creates a new String object.
Q1(viii)1 mark · MCQOpen: Consider the following statement written in class Circle where pi is its data…

Choose the correct option.

Consider the following statement written in class Circle where pi is its data member.
static final double pi = 3.142;
Which of the following statements are valid for pi? I. It contains a common value for all objects class Circle. II. Its value is non-changeable. III. At a time two access modifiers, static and final, cannot be applied to a single data member pi.
  • (a)I and II
  • (b)II and III
  • (c)I and III
  • (d)Only III
Show answer

Answer

Official answer key

Correct option: (a)

Answer: (a) I and II Since pi is declared static, all objects of class Circle share the one common copy of it, so statement I is valid. Since it is also final, its value cannot be changed once initialised, so statement II is valid. Statement III is false, since static and final can (and often do) apply together to the same data member, exactly as shown here, to create a class-wide constant.
Q1(ix)1 mark · Short answerOpen: For Big O notation, state the difference between O(n) and O(n²).

Answer the following.

For Big O notation, state the difference between $O(n)$ and $O(n^2)$.
Show answer

Answer

Official answer key
$O(n)$ denotes linear time complexity, where the running time grows directly in proportion to the input size $n$; it is typically produced by a single loop that runs $n$ times. $O(n^2)$ denotes quadratic time complexity, where the running time grows in proportion to the square of $n$; it is typically produced by a nested loop (a loop inside a loop), and so it grows far faster than $O(n)$ as $n$ increases.
Q1(x)1 mark · Short answerOpen: A full adder needs five gates and those are 3 AND gates, 1 OR gate and 1 XOR…

Answer the following.

A full adder needs five gates and those are 3 AND gates, 1 OR gate and 1 XOR gate. When a full adder is constructed using 2 half adders, it also requires 5 gates. State the names along with the quantity those gates.
Show answer

Answer

Official answer key
When a full adder is constructed using 2 half adders, it requires 2 AND gates, 1 OR gate and 2 XOR gates - one AND gate and one XOR gate come from each of the two half adders, plus one extra OR gate is added to combine the two carry outputs into the final carry.
Q2(i)2 marks · ConversionOpen: Convert the following infix notation to prefix form. (A - B) / C * (D + E)

Convert the following.

Convert the following infix notation to prefix form. $(A - B) / C * (D + E)$
Show answer

Answer

Official answer key
Infix: $(A-B)/C*(D+E)$ Step 1: $(A-B) \to {-}AB$ Step 2: $(A-B)/C \to {/}{-}ABC$ Step 3: $(D+E) \to {+}DE$ Step 4: Combine the two results with $*$: ${*}\ {/}{-}ABC\ {+}DE$ Prefix form: $*/-ABC+DE$
Q2(ii)2 marks · NumericalOpen: A matrix M[-6 … 10, 4 … 15] is stored in the memory with each element requiring…

Solve the following.

A matrix $M[-6 \dots 10, 4 \dots 15]$ is stored in the memory with each element requiring 4 bytes of storage. If the base address is 1025, find the address of $M[4][8]$ when the matrix is stored in column major wise.
Show answer

Answer

Official answer key
Column Major formula: Address(M[I][J]) = B + W x [(J - Lc) x M + (I - Lr)], where M = number of rows. Row range -6 to 10 => M = 10 - (-6) + 1 = 17 Column range 4 to 15 => N = 15 - 4 + 1 = 12 (not needed further, column major) Given: B = 1025, W = 4, I = 4, J = 8, Lr = -6, Lc = 4 Address(M[4][8]) = 1025 + 4 x [(8-4) x 17 + (4-(-6))] = 1025 + 4 x [4 x 17 + 10] = 1025 + 4 x [68 + 10] = 1025 + 4 x 78 = 1025 + 312 = 1337

Final answer: 1337

Q2(iii)3 marks · Case basedOpen: The following function getIt() is a part of some class. Assume x is a positive…

Answer the following questions on the given code.

The following function getIt() is a part of some class. Assume x is a positive integer, f is the lower bound of arr[ ] and l is the upper bound of the arr[ ]. Answer the questions given below along with dry run/working.
public int getIt(int x,intarr[],int f,int l) 
    { 
        if(f>l) 
            return -1; 
        int m=(f+l)/2; 
        if(arr[m]<x) 
            return getIt(x,m+1,l); 
        else if(arr[m]>x) 
            return getIt(x,f,m-1); 
        else  
            return m; 
    } 
(a)[2]
What will the function getIt( ) return if arr[ ] = {10,20,30,40,50} and x=40?
(b)[1]
What is function getIt( ) performing apart from recursion?
Show answer

Answer (a)

Official answer key
The function getIt() performs a Binary Search on the sorted array. For $arr[\ ]=\{10,20,30,40,50\}$, $x=40$, $f=0$, $l=4$ (dry run, verified by running the corrected code): Call 1: getIt(40,arr,0,4) -> m=(0+4)/2=2, arr[2]=30<40 -> call getIt(40,arr,3,4) Call 2: getIt(40,arr,3,4) -> m=(3+4)/2=3, arr[3]=40==40 -> returns m=3 The function returns 3.

Answer (b)

Official answer key
Apart from recursion, the function getIt() is performing a Binary Search on the sorted array arr[ ] to locate the position (index) of the value x, returning its index if found, or -1 if x is not present in the array.
Q2(iv)3 marks · Case basedOpen: The following is a function of class Armstrong. This recursive function…

Fill in the blanks marked ?1?, ?2? ... so that the code works.

The following is a function of class Armstrong. This recursive function calculates and returns the sum of the cubes of all the digits of num, where num is an integer data member of the class Armstrong. [A number is said to be Armstrong if the sum of the cubes of all its digits is equal to the original number]. There are some places in the code marked by ?1?, ?2?,?3? which may be replaced by a statement/expression so, that the function works properly.
public int sumOfPowers(int num)  
    { 
            if (num == 0)  
                   return ?1?; 
           int digit = ?2?; 
                  return (int) Math.pow(digit, 3) + ?3?; 
    } 
(a)[1]
What is the expression or statement at ?1?
(b)[1]
What is the expression or statement at ?2?
(c)[1]
What is the expression or statement at ?3?
Show answer

Answer (a)

Official answer key

Blanks: 0

?1? = 0

Answer (b)

Official answer key

Blanks: num % 10

?2? = num % 10

Answer (c)

Official answer key

Blanks: sumOfPowers(num / 10)

?3? = sumOfPowers(num / 10)
Q310 marks · Case basedOpen: A shopping mall announces a special discount on all its products as a festival…

Answer the following using a truth table and a Karnaugh map.

A shopping mall announces a special discount on all its products as a festival offer only to those who satisfy any one of the following conditions. • If he/she is an employee of the mall and has a service of more than 10 years. OR • A regular customer of the mall whose age is less than 65 years and should not be an employee of the mall. OR • If he/she is a senior citizen but not a regular customer of the mall. The inputs are :
INPUTS
EEmployee of the mall
RRegular customer of the mall
SService of the employee is more than 10 years
CSenior citizen of 65 years or above
(In all the above cases, 1 indicates yes and 0 indicates no.) Output: X - Denotes eligible for discount [1 indicates YES and 0 indicates NO in all cases]
(i)[5]
Draw the truth table for the inputs and outputs given above and write the SOP expression for $X(E, R, S, C)$.
(ii)(a)[2.5]
Reduce the above expression $X(E, R, S, C)$ by using 4-variable Karnaugh map, showing the various groups (i.e. octal, quads and pairs).
(ii)(b)[2.5]
Draw the logic gate diagram for the reduced expression. Assume that the variables and their complements are available as inputs.

Draw: logic gate diagram for the reduced expression

Show answer

Answer

Official answer key
3(i): Truth table:
ERSCX
00000
00011
00100
00111
01001
01010
01101
01110
10000
10011
10101
10111
11000
11010
11101
11111
(E,R,S,C 1 = yes, 0 = no.) X = 1 when: (Condition 1) employee with service > 10 years, i.e. E.S; OR (Condition 2) regular customer, not employee, age below 65, i.e. E'.R.C'; OR (Condition 3) senior citizen (C) who is not a regular customer, i.e. C.R'. $X(E,R,S,C) = \Sigma(1,3,4,6,9,10,11,14,15)$ Canonical SOP: $X = E'R'S'C + E'R'SC + E'RS'C' + E'RSC' + ER'S'C + ER'SC' + ER'SC + ERSC' + ERSC$ 3(ii): 4-variable K-map for $X(E,R,S,C)=\Sigma(1,3,4,6,9,10,11,14,15)$ (rows in order E'R', E'R, ER, ER'; columns in order S'C', S'C, SC, SC' - Gray code order): Groups formed: Quad 1: cells (1,3,9,11) -> $R'C$ Quad 2: cells (10,11,14,15) -> $ES$ Pair: cells (4,6) -> $E'RC'$ Reduced SOP expression: $X(E,R,S,C) = R'C + ES + E'RC'$
Q4(i)5 marks · Case basedOpen: F(P, Q, R, S) = (P + Q + R + S) · (P + Q + R + S') · (P + Q + R' + S) · (P + Q'…

Reduce the following using a Karnaugh map.

$F(P, Q, R, S) = (P + Q + R + S) \cdot (P + Q + R + S') \cdot (P + Q + R' + S) \cdot (P + Q' + R + S) \cdot (P + Q' + R + S') \cdot (P + Q' + R' + S) \cdot (P + Q' + R' + S') \cdot (P' + Q + R + S) \cdot (P' + Q + R + S')$
(a)[4]
Reduce the Boolean function $F(P, Q, R, S) = (P + Q + R + S) \cdot (P + Q + R + S') \cdot (P + Q + R' + S) \cdot (P + Q' + R + S) \cdot (P + Q' + R + S') \cdot (P + Q' + R' + S) \cdot (P + Q' + R' + S') \cdot (P' + Q + R + S) \cdot (P' + Q + R + S')$ by using 4-variable Karnaugh map, showing the various groups (i.e. octal, quads and pairs).
(b)[1]
Draw the logic gate diagram for the reduced expression. Assume that the variables and their complements are available as inputs.

Draw: logic gate diagram for the reduced expression

Show answer

Answer (a)

Official answer key

Groups: (0, 1, 8, 9) → (Q + R); (4, 5, 6, 7) → (P + Q'); (0, 2, 4, 6) → (P + S)

Reduced expression: F = (Q + R)(P + Q')(P + S)

Three quads of 0s: (0,1,8,9) gives Q + R, (4,5,6,7) gives P + Q', (0,2,4,6) gives P + S.

Answer (b)

Official answer key
Logic gate diagram for $F = (Q+R) \cdot (P+Q') \cdot (P+S)$, drawn from the three OR-gate outputs feeding a 3-input AND gate.
Three 2-input OR gates: OR gate 1 has inputs Q and R, giving output (Q+R). OR gate 2 has inputs P and S, giving output (P+S). OR gate 3 has inputs P and Q', giving output (P+Q'). The three OR-gate outputs are wired into the three inputs of a 3-input AND gate, whose output is labelled F(P,Q,R,S) = (Q+R).(P+Q').(P+S).
Q4(ii)5 marks · Case basedOpen: From the given logic diagram: Derive Boolean expression and draw the truth…

Answer the following from the logic diagram.

From the given logic diagram:
Figure for this question
(a)[4]
Derive Boolean expression and draw the truth table for the derived expression.
(b)[1]
If $A = 1$, $B = 0$ and $C = 1$ then find the value of $X$.
Show answer

Answer (a)

Official answer key
From the logic diagram: Gate 1 is a NAND gate with inputs A and B, giving output (1) = $(A.B)'$. Gate 2 is an AND gate with inputs B' and C, giving output (2) = $B'.C$. Gate 3 is an OR gate combining (1) and (2), giving output (3) = $(A.B)' + B'.C$. The final gate is a NOT gate acting on (3), giving output $X = [(A.B)' + B'.C]'$. Truth table:
ABC(A.B)'B'.C(A.B)'+B'.CX
0001010
0011110
0101010
0111010
1001010
1011110
1100001
1110001

Answer (b)

Official answer key
$X = [(A.B)'+B'.C]'$. For $A=1, B=0, C=1$: $A.B = 1.0 = 0 \Rightarrow (A.B)'=1$. $B'=1 \Rightarrow B'.C = 1.1 = 1$. $(A.B)'+B'.C = 1+1 = 1$. $X = 1' = 0$.

Final answer: 0

Q5(i)5 marks · DrawingOpen: Draw the logic circuit to decode the following binary number (0001, 0101, 0111…

Draw the following.

Draw the logic circuit to decode the following binary number (0001, 0101, 0111, 1000, 1010, 1100, 1110, 1111) to its hexadecimal equivalents. Also state the Hexadecimal equivalents of the given binary numbers.

Draw: logic circuit to decode the binary numbers 0001, 0101, 0111, 1000, 1010, 1100, 1110, 1111 to their hexadecimal equivalents

Show answer

Answer

Official answer key
The 4-bit binary inputs are labelled A, B, C, D (A = MSB ... D = LSB). Each input line feeds a buffer (true form) and a NOT gate (complemented form). Each given binary number is decoded by one 4-input AND gate, taking the true or complemented form of A, B, C, D as required so the gate outputs 1 only for that exact combination: 0001 -> A'.B'.C'.D -> output labelled 1 0101 -> A'.B.C'.D -> output labelled 5 0111 -> A'.B.C.D -> output labelled 7 1000 -> A.B'.C'.D' -> output labelled 8 1010 -> A.B'.C.D' -> output labelled A 1100 -> A.B.C'.D' -> output labelled C 1110 -> A.B.C.D' -> output labelled E 1111 -> A.B.C.D -> output labelled F Hexadecimal equivalents: 0001 = 1, 0101 = 5, 0111 = 7, 1000 = 8, 1010 = A, 1100 = C, 1110 = E, 1111 = F.
A 4-to-16 line decoder built from eight 4-input AND gates. Four input lines A, B, C, D each also feed a NOT gate to make A', B', C', D' available. Each AND gate is wired to the correct combination of true/complemented literals (as listed above) so its output is 1 only for its designated 4-bit code; the 8 AND-gate outputs are labelled with their hexadecimal equivalents 1, 5, 7, 8, A, C, E, F.
Q5(ii)3 marks · Truth tableOpen: Verify if the following proposition is valid using the truth table:

Answer the following using a truth table.

Verify if the following proposition is valid using the truth table:
Show answer

Answer

Official answer key
XYZX.YX.Y => ZY => ZX => Y(Y => Z).(X => Y)X.Y => Z <=> (Y => Z).(X => Y)
000011111
001011111
010010100
011011111
100011000
101011000
110100101
111111111
The two sides differ in rows 3, 5 and 6 (the last column is not all 1s), so the proposition is not valid.
Q5(iii)2 marks · Case basedOpen: Answer the following questions related to the below image: What is the output…

Answer the following from the logic gate diagram.

Answer the following questions related to the below image:
Figure for this question
(a)[1]
What is the output of the above gate if input $A = 0$, $B = 1$?
(b)[1]
What are the values of the inputs if output = 1?
Show answer

Answer (a)

Official answer key
The gate shown is a NOR gate. Output = $(A+B)' = (0+1)' = 1' = 0$.

Answer (b)

Official answer key
The gate shown is a NOR gate, whose output is 1 only when all of its inputs are 0. So the output is 1 when A = 0 and B = 0.
Q610 marks · ProgramOpen: Given are two strings, input string and a mask string that remove all the…

Write the program described below.

Given are two strings, input string and a mask string that remove all the characters of the mask string from the original string. Example: INPUT: ORIGINALSTRING: communication MASK STRING: mont OUTPUT: cuicai A class StringOp is defined as follows to perform above operation. Some of the members of the class are given below: Class name : StringOp Data members/instance variables: str : to store the original string msk : to store the mask string nstr : to store the resultant string Methods / Member functions: StringOp() : default constructor to initialize the data member with legal initial value void accept( ) : to accept the original string str and the mask string msk in lower case void form() : to form the new string nstr after removal of characters present in mask from the original string void display( ) : to display the original string and the newly formed string nstr Specify the class StringOp giving details of the constructor( ), void accept( ), void form() and void display( ). Define a main( ) function to create an object and call all the functions accordingly to enable the task.
Show answer

Answer

Official answer key
import java.util.Scanner;

class StringOp
{
    String str;   // original string
    String msk;   // mask string
    String nstr;  // resultant string

    StringOp()
    {
        str = "";
        msk = "";
        nstr = "";
    }

    void accept()
    {
        Scanner sc = new Scanner(System.in);
        System.out.println("Enter the original string:");
        str = sc.nextLine().toLowerCase();
        System.out.println("Enter the mask string:");
        msk = sc.nextLine().toLowerCase();
    }

    void form()
    {
        for (int i = 0; i < str.length(); i++)
        {
            char ch = str.charAt(i);
            if (msk.indexOf(ch) == -1)
                nstr = nstr + ch;
        }
    }

    void display()
    {
        System.out.println("Original string : " + str);
        System.out.println("New string      : " + nstr);
    }

    public static void main(String args[])
    {
        StringOp ob = new StringOp();
        ob.accept();
        ob.form();
        ob.display();
    }
}
Explanation: The constructor initialises str, msk and nstr to empty strings. accept() reads the original string and the mask string, converting both to lower case as required. form() scans every character of str and appends it to nstr only if it does not occur anywhere in msk (String.indexOf returns -1 when the character is absent), which effectively removes every character of msk from str. display() prints both strings. Tested for str="communication", msk="mont": the program correctly outputs nstr="cuicai" (verified by running the code), matching the example in the question.
Q710 marks · ProgramOpen: A class Mixarray contains an array of integer elements along with its capacity…

Write the program described below.

A class Mixarray contains an array of integer elements along with its capacity (More than or equal to 3). Using the following description, form a new array of integers which will contain only the first 3 elements of the two different arrays one after another. Example: Array1: { 78, 90, 100, 45, 67 } Array2: {10, 67, 200, 90 } Resultant Array: { 78, 90, 100, 10, 67, 200} The details of the members of the class are given below: Class name : Mixarray Data members/instance variables: arr[] : integer array cap : integer to store the capacity of the array Member functions/methods: Mixarray (int mm ) : to initialize the capacity of the array cap=mm void input( ) : to accept the elements of the array Mixarray mix(Mixarray P, Mixarray Q) : returns the resultant array having the first 3 elements of the array of objects P and Q void display( ) : to display the array with an appropriate message. Specify the class Mixarraygiving details of the constructor(int), void input( ), Mixarray mix(Mixarray,Mixarray) and void display( ). Define a main( ) function to create objects and call all the functions accordingly to enable the task.
Show answer

Answer

Official answer key
import java.util.Scanner;

class Mixarray
{
    int arr[];
    int cap;

    Mixarray(int mm)
    {
        cap = mm;
        arr = new int[cap];
    }

    void input()
    {
        Scanner sc = new Scanner(System.in);
        System.out.println("Enter " + cap + " elements:");
        for (int i = 0; i < cap; i++)
            arr[i] = sc.nextInt();
    }

    Mixarray mix(Mixarray P, Mixarray Q)
    {
        Mixarray res = new Mixarray(6);
        int k = 0;
        for (int i = 0; i < 3; i++)
            res.arr[k++] = P.arr[i];
        for (int i = 0; i < 3; i++)
            res.arr[k++] = Q.arr[i];
        return res;
    }

    void display()
    {
        System.out.println("Resultant array:");
        for (int i = 0; i < cap; i++)
            System.out.print(arr[i] + " ");
        System.out.println();
    }

    public static void main(String args[])
    {
        Scanner sc = new Scanner(System.in);
        System.out.print("Enter capacity of first array (>=3): ");
        int c1 = sc.nextInt();
        Mixarray P = new Mixarray(c1);
        P.input();

        System.out.print("Enter capacity of second array (>=3): ");
        int c2 = sc.nextInt();
        Mixarray Q = new Mixarray(c2);
        Q.input();

        Mixarray R = new Mixarray(6);
        Mixarray res = R.mix(P, Q);
        res.display();
    }
}
Explanation: mix(P,Q) creates a new Mixarray object of capacity 6, copies the first three elements of P into it followed by the first three elements of Q, and returns it. Tested with Array1={78,90,100,45,67} and Array2={10,67,200,90}: the program correctly outputs the resultant array 78 90 100 10 67 200 (verified by running the code), matching the example in the question.
Q810 marks · ProgramOpen: A class LCM has been defined to find the Lowest Common Multiple of two…

Write the program described below.

A class LCM has been defined to find the Lowest Common Multiple of two integers. Some of the data members and member functions are given below: Class name : LCM Data members/instance variables: n1 : to store an integer number n2 : to store an integer number large : integer to store the largest from n1,n2 sm : integer to store the smallest from n1,n2 l : to store lcm of two numbers Methods / Member functions: LCM( ) : default constructor to initialize data members with legal initial values void accept( ) : to accept n1 and n2 int getLCM( ) : returns the lcm of n1 and n2 using the recursive technique void display( ) : to print the numbers n1, n2 and lcm Specify the class LCM giving details of the constructor( ), void accept( ), int getLCM() and void display( ). Define a main ( ) function to create an object and call the member functions accordingly to enable the task.
Show answer

Answer

Official answer key
import java.util.Scanner;

class LCM
{
    int n1, n2;
    int large, sm;
    int l;

    LCM()
    {
        n1 = 0; n2 = 0;
        large = 0; sm = 0;
        l = 0;
    }

    void accept()
    {
        Scanner sc = new Scanner(System.in);
        System.out.print("Enter first number  : ");
        n1 = sc.nextInt();
        System.out.print("Enter second number : ");
        n2 = sc.nextInt();
        large = (n1 > n2) ? n1 : n2;
        sm = (n1 > n2) ? n2 : n1;
    }

    int getLCM()
    {
        if (large % sm == 0)
            return (n1 * n2) / sm;
        else
        {
            int temp = large;
            large = sm;
            sm = temp % sm;
            return getLCM();
        }
    }

    void display()
    {
        l = getLCM();
        System.out.println("N1  = " + n1);
        System.out.println("N2  = " + n2);
        System.out.println("LCM = " + l);
    }

    public static void main(String args[])
    {
        LCM ob = new LCM();
        ob.accept();
        ob.display();
    }
}
Explanation: getLCM() recursively computes the GCD of large and sm using the Euclidean algorithm (large % sm == 0 is the base case; otherwise it sets large=sm, sm=large%sm and recurses), then applies the relation LCM = (n1*n2)/GCD. Tested for n1=12, n2=18: the program correctly outputs LCM=36 (verified by running the code).
Q95 marks · Case basedOpen: Recycle is an entity which can hold at the most 100 integers. The chain enables…

Answer the following on the class described.

Recycle is an entity which can hold at the most 100 integers. The chain enables the user to add and remove integers from both the ends i.e. front and rear. Define a class ReCycle with the following details: Class name : ReCycle Data members/instance variables: ele[ ] : the array to hold the integer elements cap : stores the maximum capacity of the array front : to point the index of the front rear : to point the index of the rear Methods / Member functions: ReCycle (int max) : constructor to initialize the data cap = max, front = rear = 0 and to create the integer array. void pushfront(int v) : to add integers from the front index if possible else display the message(“full from front”). int popfront( ) : to remove the return elements from front. If array is empty then return-999. void pushrear(int v) : to add integers from the front index if possible else display the message(“full from rear”). int poprear( ) : to remove and return elements from rear. If the array is empty then return-999.
(i)[4]
Specify the class ReCycle giving details of the functions void pushfront(int) and int poprear( ). Assume that the other functions have been defined. The main( ) function and algorithm need NOT be written.
(ii)[1]
Name the entity described above and state its principle.
Show answer

Answer (i)

Official answer key
void pushfront(int v)
{
    if (front != 0)
        ele[front--] = v;
    else
        System.out.println("full from front");
}

int poprear()
{
    if (front != rear)
        return ele[rear--];
    else
        return -999;
}
Explanation: This follows the same indexing scheme used by the already-defined pushrear()/popfront() methods of ReCycle. pushfront() stores the new value at the current front index and then decrements front (so ele[] fills from the front end downward), printing "full from front" if front has already reached 0 (no more room at that end). poprear() removes and returns the element at the current rear index and then decrements rear, unless front and rear have met (the structure is empty), in which case it returns -999.

Answer (ii)

Official answer key
The entity described is a Deque (Double Ended Queue). It works on a generalisation of the FIFO principle to both ends: insertion and deletion of elements are allowed from both the front and the rear of the structure, unlike a simple queue which allows insertion only at the rear and deletion only at the front.
Q105 marks · ProgramOpen: A library issues books on rental basis at a 2% charge on the cost price of the…

Write the program described below.

A library issues books on rental basis at a 2% charge on the cost price of the book per day. As per the rules of the library, a book can be retained for 7 days without any fine. If the book is returned after 7 days, a fine will also be charged for the excess days as per the chart given below:
Number of excess daysFine per day (Rs.)
1 to 52.00
6 to 103.00
Above 105.00
A super class Library has been defined. Define a sub class Compute to calculate the fine and the total amount. The details of the members of both the classes are given below: Class name : Library Data members/instance variables: name : to store the name of the book author : to store the author of the book p : to store the price of the book (in decimals) Methods / Member functions: Library( ... ) : parameterized constructor to assign values to the data members void show( ) : displays the book details Class name : Compute Data members/instance variables: d : number of days taken in returning the book f : to store the fine (in decimals) Methods / Member functions: Compute( ... ) : parameterized constructor to assign values to the data members of both the classes void fine( ) : calculates the fine for the excess days as given in the table above void show( ) : displays the book details along with the number of days, fine and the total amount to be paid. Total amount is (2% of price of book * total no of days) + fine Assume that the super class Library has been defined. Using the concepts of Inheritance, specify the class Compute giving the details of constructor, void fine ( ) and void show ( ) functions. The super class, main function and algorithm need NOT be written.
Show answer

Answer

Official answer key
class Compute extends Library
{
    int d;      // number of days taken in returning the book
    double f;   // fine

    Compute(String name, String author, double p, int d)
    {
        super(name, author, p);
        this.d = d;
        f = 0.0;
    }

    void fine()
    {
        int excess = d - 7;
        if (excess <= 0)
            f = 0.0;
        else if (excess <= 5)
            f = excess * 2.0;
        else if (excess <= 10)
            f = excess * 3.0;
        else
            f = excess * 5.0;
    }

    void show()
    {
        super.show();
        System.out.println("Number of days : " + d);
        System.out.println("Fine           : " + f);
        System.out.println("Total amount   : " + ((0.02 * p * d) + f));
    }
}
Explanation: Compute extends Library, so its constructor calls super(name, author, p) to initialise the inherited data members, then sets d. fine() computes the excess days beyond the free 7-day period and applies the given tiered rate (Rs.2/day for 1-5 excess days, Rs.3/day for 6-10, Rs.5/day beyond 10; 0 if not overdue). show() calls super.show() to print the book details, then prints the days, fine and total amount, calculated as (2% of price x total days) + fine. Tested (with a stub Library class) for price=500.0, d=12: excess=5, so fine=10.0 and total=(0.02x500x12)+10=130.0, matching manual calculation (verified by running the code).
Q11(i)2 marks · ProgramOpen: A linked list is formed from the objects of the class Node. The class structure…

Write the program described below.

A linked list is formed from the objects of the class Node. The class structure of the Node is given below:
class Node 
{ 
    int n; 
    Node link; 
} 
Write an Algorithm OR a Method to search for a number from an existing linked list. The method declaration is as follows: void FindNode( Node str, int b )
Show answer

Answer

Official answer key
Algorithm: Step 1: Start. Set a temporary pointer temp = str (the head of the list). Step 2: Repeat step 3 while temp is not null. Step 3: If temp.n equals b, display "b is found" and stop (exit). Otherwise, move temp to temp.link and repeat step 2. Step 4: If the loop ends without finding b (temp has become null), display "b is not found". Step 5: Stop. Method:
void FindNode(Node str, int b)
{
    Node temp = str;
    while (temp != null)
    {
        if (temp.n == b)
        {
            System.out.println(b + " is found");
            return;
        }
        temp = temp.link;
    }
    System.out.println(b + " is not found");
}
(Verified by running the code: correctly finds a value at the last node, at a middle node, and correctly reports 'not found' when the value is absent.)
Q11(ii)3 marks · Case basedOpen: Answer the following questions from the diagram of a Binary Tree given below…

Answer the following questions from the binary tree.

Answer the following questions from the diagram of a Binary Tree given below:
(a)[1]
Name the root of the left sub tree and its siblings.
(b)[1]
State the size and depth of the right sub tree.
(c)[1]
Write the in-order traversal of the above tree structure.
Show answer

Answer (a)

Official answer key
Root of the left subtree = B; its sibling = F (both B and F are children of the root A, so they are siblings of each other).

Answer (b)

Official answer key
The right subtree is rooted at F and contains the nodes F, C, G, H. Size = 4 nodes. Depth = 2 (the longest path from F down to the deepest node H is F -> G -> H, i.e. 2 levels/edges).

Answer (c)

Official answer key
In-order traversal (Left, Root, Right) of the whole tree: E D B A C F G H

About this specimen paper

The ISC Computer Science 2025 Specimen Paper is a specimen paper for Class 12: 27 questions in printed order, 70 marks in all, asked from 10 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.

By kind of question

KindQuestionsMarks printed*
Program537
Case based836
MCQ55
Drawing15
Assertion-reason33
Truth table13
Short answer22
Conversion12
Numerical12

By chapter

ChapterQuestionsMarks printed*
Boolean Algebra928
Recursion314
Arrays, Strings313
Data structures412
Objects110
Computer Hardware38
Inheritance, Interfaces and Polymorphism15
Implementation of algorithms to solve problems13
Complexity and Big O notation11
Variables, Expressions11

* 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.

Common questions

How many questions are in the ISC Computer Science 2025 Specimen Paper?

27 questions, 70 marks in all, shown in full and in printed order on this page.

Which chapters does the ISC Computer Science 2025 Specimen Paper ask most about?

By number of questions: Boolean Algebra (9), Data structures (4), Recursion (3) and Arrays, Strings (3).

Does this page have the answers to the ISC Computer Science 2025 Specimen Paper?

Tap “Show answer” under a question to see its answer. The download button saves the paper as a PDF, with or without the answers.