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

ISC Computer Science 2025 Improvement Paper with Answers

The ISC Computer Science 2025 Improvement 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
9chapters
Q1(i)1 mark · MCQOpen: The complement of the Boolean expression (P + Q') · (R' + P) is:

Choose the correct option.

The complement of the Boolean expression $(P + Q') \cdot (R' + P)$ is:
  • (a)$(P \cdot Q') + (R' \cdot P)$
  • (b)$(P' \cdot Q) + (R \cdot P')$
  • (c)$(P' \cdot Q) \cdot (R \cdot P')$
  • (d)$(P + Q') \cdot (R' + P)$
Show answer

Answer

Correct option: (b)

Answer: (b) (P'.Q) + (R.P') Complement of (P + Q').(R' + P) = (P + Q')' + (R' + P)' [De Morgan's law], applying De Morgan again inside each bracket = (P'.Q) + (R.P').
Q1(ii)1 mark · Assertion-reasonOpen: For overloaded method, signature matching happens at compile time. Given below…

Study the Assertion and Reason and choose the correct option.

Assertion: For overloaded method, signature matching happens at compile time.

Reason: The overloaded method must have a unique signature for its every prototype.

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)Both Assertion and Reason are false.
Show answer

Answer

Correct option: (a)

Answer: (a) Both Assertion and Reason are true and Reason is the correct explanation for Assertion. Method overloading is resolved by the compiler at compile time (static binding) precisely because every overloaded prototype has a unique signature, allowing the compiler to unambiguously match the call to the correct method at compile time itself.
Q1(iii)1 mark · MCQOpen: According to the Principle of Duality, the Boolean equation (X' + Y · 0) · X =…

Choose the correct option.

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

Answer

Correct option: (c)

Answer: (c) (X'.Y+1)+X=1 By the Principle of Duality, interchange + with ., . with +, and 0 with 1, keeping the same grouping: (X' + Y.0).X = 0 becomes (X'.Y + 1) + X = 1.
Q1(iv)1 mark · MCQOpen: Commutative law states that:

Choose the correct option.

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

Answer

Correct option: (d)

Answer: (d) (A+B) = (B+A) The Commutative law states that changing the order of operands does not change the result: A+B = B+A (and similarly A.B = B.A).
Q1(v)1 mark · MCQOpen: The canonical expression for F(x, y, z) = Σ(1, 3, 6) is:

Choose the correct option.

The canonical expression for $F(x, y, z) = \Sigma(1, 3, 6)$ is:
  • (a)$(x \cdot y \cdot z') + (x \cdot y' \cdot z') + (x' \cdot y' \cdot z)$
  • (b)$(x + y + z') \cdot (x + y' + z') \cdot (x' + y' + z)$
  • (c)$(x' + y' + z) \cdot (x' + y + z) \cdot (x + y + z')$
  • (d)$(x' \cdot y' \cdot z) + (x' \cdot y \cdot z) + (x \cdot y \cdot z')$
Show answer

Answer

Correct option: (d)

Answer: (d) (x'.y'.z) + (x'.y.z) + (x.y.z') Σ(1,3,6) gives minterms m1 = x'y'z, m3 = x'yz, m6 = xyz', so the canonical SOP is (x'.y'.z) + (x'.y.z) + (x.y.z').
Q1(vi)1 mark · Assertion-reasonOpen: An abstract class can contain abstract as well as non-abstract methods. Given…

Study the Assertion and Reason and choose the correct option.

Assertion: An abstract class can contain abstract as well as non-abstract methods.

Reason: Abstract classes are meant to provide complete implementation of all types of methods in its sub class.

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)Both Assertion and Reason are false.
Show answer

Answer

Correct option: (c)

Answer: (c) Assertion is true and Reason is false. An abstract class can indeed contain both abstract and non-abstract (concrete) methods - Assertion is true. However an abstract class is NOT meant to provide complete implementation of all methods for its subclass; rather it deliberately leaves the abstract methods unimplemented for the subclass to define - Reason is false.
Q1(vii)1 mark · Assertion-reasonOpen: If Sujata is in the merit list, then she is a topper (Y ⇒ X). Study the given…

Study the Assertion and Reason and choose the correct option.

Assertion: If Sujata is in the merit list, then she is a topper ($Y \Rightarrow X$).

Reason: Inverse is formed when both antecedent and consequent are negated.

Study the given propositions and the statements marked Assertion and Reason that follow it. Choose the correct option on the basis of your analysis. $X$ – Sujata is a topper $Y$ – Sujata is in the merit list
  • (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)Both Assertion and Reason are false.
Show answer

Answer

Correct option: (b)

Answer: (b) Both Assertion and Reason are true but Reason is not the correct explanation for Assertion. The Reason correctly defines an Inverse (formed by negating both antecedent and consequent). However the Assertion 'Y⇒X' is actually the Converse of the original proposition X⇒Y, not its Inverse, so the Reason (about Inverse) does not correctly explain the Assertion, even though both statements are individually true.
Q1(viii)1 mark · MCQOpen: Consider the following code segment: class Car extends Vehicle implements…

Choose the correct option.

Consider the following code segment:
class Car extends Vehicle implements Fourwheeler
{.......}
Which of the following statements are valid for the given code? I. Vehicle is a super class and Fourwheeler is an interface. II. Interface cannot have abstract methods. III. Keyword extends applies to class and keyword implements applies to interface.
  • (a)Only I and II
  • (b)Only II and III
  • (c)Only I and III
  • (d)Only II
Show answer

Answer

Correct option: (c)

Answer: (c) Only I and III I is true: Vehicle is the superclass and Fourwheeler is an interface. III is true: 'extends' is used for inheriting a class and 'implements' is used for implementing an interface. II is false: an interface CAN have abstract methods (by default all its methods are abstract, unless declared default/static).
Q1(ix)1 mark · DifferentiateOpen: Differentiate between Tautology and Contradiction.

Differentiate between the following.

Differentiate between Tautology and Contradiction.
Show answer

Answer

A Tautology is a compound proposition that is TRUE for every possible combination of truth values of its component propositions (the result column of its truth table is all 1's). A Contradiction is a compound proposition that is FALSE for every possible combination of truth values of its component propositions (the result column of its truth table is all 0's).
Q1(x)1 mark · Short answerOpen: For the given code segment, write Big O notation for worst case complexity. int…

Answer the following.

For the given code segment, write Big O notation for worst case complexity.
int i=1, j=1, k=1, p;
while (i <= p)
{
    statements
}
while (j <= p)
{
    while (k <= p)
    {
        statements
    }
}
Show answer

Answer

Checked answer.
$O(n^2)$ The first loop runs $n$ times, giving $O(n)$. The second part is a nested pair of loops: the outer loop runs $n$ times and, for each of its passes, the inner loop runs $n$ times, giving $n \times n$ steps, i.e. $O(n^2)$. Adding the two, $O(n) + O(n^2) = O(n^2)$, because the $n^2$ term dominates. Worst case time complexity = $O(n^2)$ (quadratic).
Q2(i)2 marks · ConversionOpen: Convert the following infix notation to postfix form. (A*B^C) + (D*E) where B^C…

Convert the following.

Convert the following infix notation to postfix form. (A*B^C) + (D*E) where B^C = $B^C$
Show answer

Answer

$(A * B\text{\textasciicircum}C) + (D * E)$ Since ^ (exponentiation) has the highest precedence and is right-associative, evaluate B^C first: $B\ C\ \text{\textasciicircum}$ Then $A*(B\text{\textasciicircum}C) \to A\ B\ C\ \text{\textasciicircum}\ *$ $D*E \to D\ E\ *$ Combine both operands of the outer + : Postfix: $A\ B\ C\ \text{\textasciicircum}\ *\ D\ E\ *\ +$
Q2(ii)2 marks · NumericalOpen: A matrix P[-10…10, 1…10] is stored in the memory with each element requiring 2…

Solve the following.

A matrix $P[-10\dots10, 1\dots10]$ is stored in the memory with each element requiring 2 bytes of storage. If the base address is 2000, find the address of $P[5][6]$ when the matrix is stored Row Major wise.
Show answer

Answer

Row Major formula: Addr(P[i][j]) = Base + W × [ (i - LR) × NC + (j - LC) ] Here LR (lower row bound) = -10, LC (lower column bound) = 1, UC (upper column bound) = 10, so NC (number of columns) = UC - LC + 1 = 10; W = 2, Base = 2000, i = 5, j = 6. Addr(P[5][6]) = 2000 + 2 × [ (5-(-10)) × 10 + (6-1) ] = 2000 + 2 × [ 15 × 10 + 5 ] = 2000 + 2 × 155 = 2000 + 310

Final answer: 2310

Q2(iii)3 marks · Case basedOpen: The following function think( ) is part of some class. Assume f is the lower…

Answer the following questions on the given code.

The following function think( ) is part of some class. Assume $f$ is the lower bound and $l$ is the upper bound of $arr[\ ]$. Answer the questions given below along with the dry run / working.
int think(int arr[ ], int f, int l)
{
    if (f > l)
        return 0;
    else
    {
        int current = (arr[f] % 2 == 0) ? arr[f] : 0;
        return current + think (arr, f + 1, l);
    }
}
(a)[2]
What will the function think( ) return, if $arr[\ ] = \{9, 7, 12, 16, 19, 25\}$, $f = 0$ and $l = 5$?
(b)[1]
What is the function think( ) performing apart from recursion?
Show answer

Answer (a)

Dry run: think(arr,0,5) for arr[] = {9,7,12,16,19,25} think(0): arr[0]=9 (odd) → current=0 → 0 + think(1) think(1): arr[1]=7 (odd) → current=0 → 0 + think(2) think(2): arr[2]=12 (even) → current=12 → 12 + think(3) think(3): arr[3]=16 (even) → current=16 → 16 + think(4) think(4): arr[4]=19 (odd) → current=0 → 0 + think(5) think(5): arr[5]=25 (odd) → current=0 → 0 + think(6) think(6): f=6 > l=5 → returns 0 Unwinding: think(5)=0, think(4)=0, think(3)=16+0=16, think(2)=12+16=28, think(1)=0+28=28, think(0)=0+28=28 think() returns 28

Answer (b)

Apart from recursion, the function computes and returns the sum of all the even elements present in the array arr[] from index f to index l.
Q2(iv)3 marks · Case basedOpen: The following function getPart( ) is a part of some class which is used to…

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

The following function getPart( ) is a part of some class which is used to extract h number of characters starting from index b of a string str. There are some places in the code marked by ?1?,?2?,?3? which must be replaced by an expression / statement so that the function works correctly.
String getPart(String str, int b, int h)
{
    int beg= ?1?;
    int end =b+h-1;
    String g="";
    while(beg<=?2? && beg>=0 && end<str.length() )
    {
        g+=str.charAt(beg);
        ?3?;
    }
    return g;
}
(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)

Blanks: b

?1? = $b$: the position of the first character to extract.

Answer (b)

Blanks: end

?2? = $end$: the loop runs while the index does not pass the last required character.

Answer (c)

Blanks: beg++

?3? = $beg++$: moves to the next character.
Q310 marks · Case basedOpen: A food delivery app offers free home delivery to its customers who meet any of…

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

A food delivery app offers free home delivery to its customers who meet any of the following criteria. • The order is above ₹ 1000 and payment is made through UPI OR • Food is ordered from a partner restaurant and payment is made through UPI OR • The customer uses the app for the first time and places order above ₹ 1000 The inputs are:
INPUTS
AOrder is above ₹ 1000
UPayment is done through UPI
PFood is ordered from a partner restaurant
FCustomer uses the app for the first time
(In all the above cases, 1 indicates YES, 0 indicates NO) Output: D - Denotes free home delivery [1 indicates YES and 0 indicates NO in all cases]
(i)[5]
Draw a truth table for the inputs and the outputs given above. Write the SOP expression for D(A, U, P, F).
(ii)(a)[2.5]
Reduce the above expression D(A, U, P, F) 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 using NAND gates only. Assume that the variables and their complements are available as inputs.

Draw: logic gate diagram using NAND gates only for the reduced expression

Show answer

Answer

3(i): | A | U | P | F | D |
00000
00010
00100
00110
01000
01010
01101
01111
10000
10011
10100
10111
11001
11011
11101
11111
D(A,U,P,F) = Σm(6,7,9,11,12,13,14,15) SOP expression: D(A,U,P,F) = A'UPF' + A'UPF + AU'P'F + AU'PF + AUP'F' + AUP'F + AUPF' + AUPF 3(ii): K-map (variables A, U, P, F) grouping the eight 1s (minterms 6, 7, 9, 11, 12, 13, 14, 15) into three quads (verified with the boolean tool): Quad 1: cells 12, 13, 14, 15 (A=1, U=1) → term A.U Quad 2: cells 9, 11, 13, 15 (A=1, F=1) → term A.F Quad 3: cells 6, 7, 14, 15 (U=1, P=1) → term U.P Reduced (minimal) SOP: D(A,U,P,F) = A.U + A.F + U.P With NAND gates only (NAND-NAND): one 2-input NAND gate for each term and a 3-input NAND gate combining them, since $[(AU)' \cdot (AF)' \cdot (UP)']' = AU + AF + UP$ by De Morgan's law.
Q4(i)5 marks · Case basedOpen: F(X, Y, Z, W) = π(0, 1, 2, 3, 4, 6, 8, 9, 11, 12) Reduce the Boolean function…

Reduce the following using a Karnaugh map.

$F(X, Y, Z, W) = \pi(0, 1, 2, 3, 4, 6, 8, 9, 11, 12)$
(a)[4]
Reduce the Boolean function $F(X, Y, Z, W) = \pi(0, 1, 2, 3, 4, 6, 8, 9, 11, 12)$ 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)

Groups: (0, 2, 4, 6) → (X + W); (1, 3, 9, 11) → (Y + W'); (0, 4, 8, 12) → (Z + W)

Reduced expression: F = (X + W)(Y + W')(Z + W)

Quad (0, 2, 4, 6) gives (X + W). Quad (1, 3, 9, 11) gives (Y + W'). Quad (0, 4, 8, 12) gives (Z + W). There is no octet.

Answer (b)

Logic gate diagram for $F = (X + W)(Y + W')(Z + W)$: three 2-input OR gates feeding one 3-input AND gate.
Diagram for this answer
Q4(ii)5 marks · Case basedOpen: From the logic gate diagram given below: Derive Boolean expression for X(A, B…

Answer the following from the logic gate diagram.

From the logic gate diagram given below:
Figure for this question
(a)[4]
Derive Boolean expression for X(A, B, C) and draw the truth table.
(b)[1]
Write the canonical expression for SUM and CARRY of a half adder.
Show answer

Answer (a)

Truth Table for X(A,B,C):
ABCX
0001
0011
0101
0111
1001
1011
1101
1110
Final reduced expression: X(A,B,C) = A' + B' + C'
  1. From the diagram: the top gate is a 2-input NAND gate with inputs A,B giving output (A.B)'.
  2. The bottom gate is a 2-input XOR (Ex-OR) gate with inputs B,C giving output B.C' + B'.C.
  3. The final OR gate combines both outputs: X = (A.B)' + (B.C' + B'.C)
  4. By De Morgan's law, (A.B)' = A' + B'
  5. So X = A' + B' + B.C' + B'.C
  6. By the identity B' + B.C' = B' + C' (Distributive law: B' + BC' = (B'+B).(B'+C') = B'+C'), X = A' + (B'+C') + B'.C = A' + B' + C' + B'.C
  7. By the Absorption law, B' + B'.C = B', so X = A' + B' + C'

Answer (b)

For a half adder with inputs A, B: SUM = A'B + AB' (canonical SOP, equivalent to A XOR B). CARRY = A.B (canonical AND term).
Q5(i)5 marks · DrawingOpen: Draw the logic gate diagram for an octal to binary encoder. State how…

Draw the following.

Draw the logic gate diagram for an octal to binary encoder. State how multiplexer can be derived from a decoder. Mention one application of multiplexer.

Draw: logic gate diagram for an octal to binary encoder

Show answer

Answer

Octal-to-Binary encoder: 8 input lines D0-D7 (only one HIGH at a time), 3 output lines A2 A1 A0 giving the binary code of the active input line. $A_2 = D_4 + D_5 + D_6 + D_7$ $A_1 = D_2 + D_3 + D_6 + D_7$ $A_0 = D_1 + D_3 + D_5 + D_7$ $D_0$ (code 000) needs no connection: when it is active all three outputs stay 0. Multiplexer from a decoder: the select lines are fed to the decoder's inputs; each decoder output is ANDed with one data input, and all the AND outputs go into one OR gate. Only the AND gate enabled by the selected decoder output passes its data input to the output. Application of a multiplexer: data selection/routing - sending one of many input signals onto a single line, e.g. in communication systems or onto a common data bus.
Diagram for this answer
Q5(ii)3 marks · DerivationOpen: From the logic gate diagram given below, derive the Boolean expression for X(A…

Derive the following from the logic gate diagram.

From the logic gate diagram given below, derive the Boolean expression for X(A, B, C) and reduce it using Boolean laws.
Figure for this question
Show answer

Answer

Checked answer.
$X = (A + A \cdot B) \cdot (B + B \cdot C) \cdot (C + C \cdot A) = A \cdot B \cdot C$
  1. From the diagram: the first AND gate gives $A \cdot B$, which is ORed with $A$: $A + A \cdot B$
  2. The second AND gate gives $B \cdot C$, which is ORed with $B$: $B + B \cdot C$
  3. The third AND gate gives $C \cdot A$, which is ORed with $C$: $C + C \cdot A$
  4. The three OR outputs go into an AND gate: $X = (A + A \cdot B) \cdot (B + B \cdot C) \cdot (C + C \cdot A)$
  5. By the Absorption law ($P + P \cdot Q = P$): $A + A \cdot B = A$, $B + B \cdot C = B$, $C + C \cdot A = C$
  6. Therefore $X = A \cdot B \cdot C$
Q5(iii)2 marks · Truth tableOpen: Verify if the following compound proposition is valid or not using the truth…

Answer the following using a truth table.

Verify if the following compound proposition is valid or not using the truth table.
Show answer

Answer

ABCA ∧ BA ∧ B ∧ C(A ∧ B) ∧ C => (A ∧ B ∧ C)(A ∧ B) <=> (A ∧ B ∧ C)((A ∧ B) ∧ C => (A ∧ B ∧ C)) = ((A ∧ B) <=> (A ∧ B ∧ C))
00000111
00100111
01000111
01100111
10000111
10100111
11010100
11111111
In the row A = 1, B = 1, C = 0 the two sides differ (1 and 0), so the last column is not 1 in every row and the proposition is not valid.
Q610 marks · ProgramOpen: A class Mighty has been defined to create m1 and m2 as mighty numbers from…

Write the program described below.

A class Mighty has been defined to create m1 and m2 as mighty numbers from integers n1 and n2. m1 will become mighty by placing the eventual sum of digits of n2 at the end of n1. m2 will become mighty by placing the eventual sum of digits of n1 at the end of n2. Example: If n1 = 235, the eventual sum of digits of n1 = 1 n2 = 106, the eventual sum of digits of n2 = 7 then, m1 = 2357 m2 = 1061 The details of the members of the class are given below: Class name : Mighty Data members/instance variables: n1 : to store first integer n2 : to store second integer m1 : to store the first mighty number m2 : to store the second mighty number Methods/Member functions: Mighty( ) : constructor to initialise data members with legal initial values void accept( ) : to accept values for n1 and n2 int sumofdigits(int x) : to return the eventual sum of digits of x using recursive technique void calMighty( ) : to calculate mighty numbers m1 and m2 by invoking sumofdigits() void display( ) : to display mighty numbers m1 and m2 Specify the class Mighty giving details of the constructor( ), void accept( ), int sumofdigits(int), void calMighty( ) and void display( ). Define the main( ) function to create an object and call the functions accordingly to enable the task.
Show answer

Answer

import java.util.Scanner;

class Mighty
{
    int n1, n2;
    int m1, m2;

    Mighty()
    {
        n1 = 0;
        n2 = 0;
        m1 = 0;
        m2 = 0;
    }

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

    int sumofdigits(int x)
    {
        if (x == 0)
            return 0;
        else
            return (x % 10) + sumofdigits(x / 10);
    }

    void calMighty()
    {
        int s2 = n2;
        while (s2 > 9)
            s2 = sumofdigits(s2);

        int s1 = n1;
        while (s1 > 9)
            s1 = sumofdigits(s1);

        m1 = n1 * 10 + s2;
        m2 = n2 * 10 + s1;
    }

    void display()
    {
        System.out.println("m1 = " + m1);
        System.out.println("m2 = " + m2);
    }

    public static void main(String args[])
    {
        Mighty ob = new Mighty();
        ob.accept();
        ob.calMighty();
        ob.display();
    }
}
Explanation: sumofdigits(x) recursively adds up the digits of x in a single pass (x%10 + sumofdigits(x/10)); calMighty() repeatedly calls it in a loop until the result is a single digit (0-9), giving the 'eventual' digit sum for n1 and n2. m1 is formed by appending the eventual digit sum of n2 to the end of n1 (n1*10 + s2), and m2 by appending the eventual digit sum of n1 to the end of n2 (n2*10 + s1). Tested: for n1=235, n2=106, the program correctly outputs m1=2357 and m2=1061, matching the example in the question.
Q710 marks · ProgramOpen: A class JoinArray contains an array of integer elements. Form a new array which…

Write the program described below.

A class JoinArray contains an array of integer elements. Form a new array which will contain elements of the second array from last index to first index followed by elements of the first array from last index to first index. Example: Array1 | 9 | 7 | 6 | 4 | Array2 | 8 | 3 | 2 | 1 | Resultant Array | 1 | 2 | 3 | 8 | 4 | 6 | 7 | 9 | The details of the members of the class are given below: Class name : JoinArray Data members/instance variables: arr[ ] : integer array size : integer to store the size of the array Member functions/methods: JoinArray(int s) : parameterised constructor to initialise size = s void accept( ) : to input the elements of the array JoinArray attach(JoinArray P, JoinArray Q) : to return the resultant array after combining arrays of objects P and Q as per the description given above void display( ) : to display the array elements Specify the class JoinArray giving details of the constructor(int), void accept( ), JoinArray attach(JoinArray, JoinArray) and void display( ). Define the main( ) function to create objects and call the functions accordingly to enable the task.
Show answer

Answer

import java.util.Scanner;

class JoinArray
{
    int arr[];
    int size;

    JoinArray(int s)
    {
        size = s;
        arr = new int[size];
    }

    void accept()
    {
        Scanner sc = new Scanner(System.in);
        for (int i = 0; i < size; i++)
        {
            System.out.print("Enter element: ");
            arr[i] = sc.nextInt();
        }
    }

    JoinArray attach(JoinArray P, JoinArray Q)
    {
        JoinArray R = new JoinArray(P.size + Q.size);
        int k = 0;
        for (int i = Q.size - 1; i >= 0; i--)
            R.arr[k++] = Q.arr[i];
        for (int i = P.size - 1; i >= 0; i--)
            R.arr[k++] = P.arr[i];
        return R;
    }

    void display()
    {
        for (int i = 0; i < size; 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 size of Array1: ");
        int s1 = sc.nextInt();
        JoinArray P = new JoinArray(s1);
        P.accept();
        System.out.print("Enter size of Array2: ");
        int s2 = sc.nextInt();
        JoinArray Q = new JoinArray(s2);
        Q.accept();

        JoinArray R = P.attach(P, Q);
        System.out.print("Resultant Array: ");
        R.display();
    }
}
Explanation: attach(P,Q) creates a new JoinArray R of size P.size+Q.size, first copies Q's elements from its last index down to its first index, then copies P's elements from its last index down to its first index, into R. Tested: for Array1={9,7,6,4} and Array2={8,3,2,1}, the program correctly outputs the resultant array 1 2 3 8 4 6 7 9, matching the example in the question.
Q810 marks · ProgramOpen: A class Palprime has been defined to display Palprime words from a sentence…

Write the program described below.

A class Palprime has been defined to display Palprime words from a sentence. Palprime is a palindrome word and its length is a prime number. Example: Input: MY MOM POSSESSES A GOOD LEVEL OF KNOWLEDGE IN MALAYALAM Output: MOM, LEVEL The details of the members of the class are given below: Class name : Palprime Data member/instance variable: line : to store a sentence Methods/Member functions: Palprime( ) : constructor to initialise data member void input( ) : to accept the sentence in UPPER CASE boolean isPalin(String n) : to check whether the string n is a palindrome word and return true, otherwise return false boolean primelen(String n) : to find the length of the string and to check for prime and return true if the length is a prime number otherwise return false void display( ) : to display the palprime word(s) from the sentence by invoking isPalin() and primelen() Specify the class Palprime giving details of the constructor( ), void input( ), boolean isPalin(String), boolean primelen(String) and void display( ). Define a main( ) function to create an object and call the member functions accordingly to enable the task.
Show answer

Answer

import java.util.Scanner;
import java.util.StringTokenizer;

class Palprime
{
    String line;

    Palprime()
    {
        line = "";
    }

    void input()
    {
        Scanner sc = new Scanner(System.in);
        System.out.print("Enter a sentence: ");
        line = sc.nextLine().toUpperCase();
    }

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

    boolean primelen(String n)
    {
        int len = n.length();
        if (len < 2)
            return false;
        for (int i = 2; i <= len / 2; i++)
        {
            if (len % i == 0)
                return false;
        }
        return true;
    }

    void display()
    {
        StringTokenizer st = new StringTokenizer(line, " ");
        String result = "";
        while (st.hasMoreTokens())
        {
            String word = st.nextToken();
            if (isPalin(word) && primelen(word))
            {
                if (result.length() > 0)
                    result += ", ";
                result += word;
            }
        }
        System.out.println("Palprime words: " + result);
    }

    public static void main(String args[])
    {
        Palprime ob = new Palprime();
        ob.input();
        ob.display();
    }
}
Explanation: isPalin() checks a word for being a palindrome by comparing characters from both ends inward. primelen() checks whether the word's length is a prime number. display() tokenizes the sentence into words and prints every word for which both isPalin() and primelen() return true. Tested with 'MY MOM POSSESSES A GOOD LEVEL OF KNOWLEDGE IN MALAYALAM', the program correctly outputs 'MOM, LEVEL', matching the example in the question.
Q95 marks · Case basedOpen: A circular queue is a linear data structure that allows data insertion at the…

Answer the following on the class described.

A circular queue is a linear data structure that allows data insertion at the rear and removal from the front, with the rear end connected to the front end forming a circular arrangement. Given below are the details of class MerryGoRound Class name : MerryGoRound Data members/instance variables: q[ ] : an array to hold integers cap : to store the maximum capacity of the array front : to point the index of the front end rear : to point the index of the rear end Methods/Member functions: MerryGoRound(int n) : parameterised constructor to initialise cap = n, front = rear = 0 void add(int val) : to add integers from the rear index if possible, else display the message "QUEUE IS FULL" int remove( ) : to remove and return the integer from front if any, else return -999 void display( ) : to display the elements of the circular queue in the order of front to rear
(i)[4]
Specify the class MerryGoRound giving details of the functions void add(int) and int remove( ). Assume that the other functions have been defined. The main( ) function and algorithm need NOT be written.
(ii)[1]
State the principle on which the entity works.
Show answer

Answer (i)

void add(int val)
{
    if ((rear + 1) % cap == front)
        System.out.println("QUEUE IS FULL");
    else
    {
        q[rear] = val;
        rear = (rear + 1) % cap;
    }
}

int remove()
{
    if (front == rear)
        return -999;
    int val = q[front];
    front = (front + 1) % cap;
    return val;
}
Explanation: add() checks whether inserting at rear would collide with front (queue full) using modulo arithmetic to wrap around the array; if not full it stores val at q[rear] and advances rear circularly. remove() checks for an empty queue (front==rear) returning -999 in that case; otherwise it returns the element at front and advances front circularly. Tested with cap=4: after add(10),add(20),add(30), remove() correctly returns 10; then add(40) succeeds but a further add(50) correctly prints 'QUEUE IS FULL', and the queue then displays as 20 30 40.

Answer (ii)

A circular queue works on the principle of FIFO (First In First Out), with the added feature that the rear end is logically connected back to the front end, forming a circular arrangement so that vacated front spaces can be reused instead of the queue getting prematurely full.
Q105 marks · ProgramOpen: A superclass Train has been defined to store the details of a train for booking…

Write the program described below.

A superclass Train has been defined to store the details of a train for booking tickets. Define a subclass Booking to compute the total cost of the tickets based on the number of passengers and any discount for group bookings. The details of the members of both the classes are given below: Class name : Train Data members/instance variables: trainName : to store the name of the train trainNumber : to store the train number ticketPrice : to store the price of a single ticket in decimal Methods/Member functions: Train(...) : parameterised constructor to assign values to data members void displayDetails( ) : to display the train details Class name : Booking Data members/instance variables: numPassengers : to store the number of passengers for booking groupDiscount : to store the group discount percentage totalCost : to store the total cost after applying the group discount in decimal Methods/Member functions: Booking(...) : parameterised constructor to assign values to data members of both the classes void calCost( ) : to calculate the cost as per the formula (ticket price * numPassengers), apply a group discount of 10% if numPassengers is greater than 5 and calculate the total cost with discount, if any void displayDetails( ) : to display the train details, number of passengers, group discount and the total cost with discount, if any Assume that the superclass Train has been defined. Using the concept of Inheritance, specify the class Booking giving the details of the constructor(...), void calCost( ) and void displayDetails( ). The superclass, main function and algorithm need NOT be written.
Show answer

Answer

class Booking extends Train
{
    int numPassengers;
    double groupDiscount;
    double totalCost;

    Booking(String tn, int tno, double tp, int np)
    {
        super(tn, tno, tp);
        numPassengers = np;
        groupDiscount = 0.0;
        totalCost = 0.0;
    }

    void calCost()
    {
        totalCost = ticketPrice * numPassengers;
        if (numPassengers > 5)
        {
            groupDiscount = 10.0;
            totalCost = totalCost - (totalCost * groupDiscount / 100);
        }
    }

    void displayDetails()
    {
        super.displayDetails();
        System.out.println("Number of Passengers: " + numPassengers);
        System.out.println("Group Discount: " + groupDiscount + "%");
        System.out.println("Total Cost: " + totalCost);
    }
}
Explanation: Booking extends Train, so it inherits trainName, trainNumber and ticketPrice. Its constructor calls super(...) to initialise the inherited members and then sets its own. calCost() computes the base cost (ticketPrice * numPassengers) and applies a 10% group discount only if numPassengers > 5. displayDetails() calls super.displayDetails() to show the train details, then prints the booking-specific details. Tested (with a stub Train class and main): for ticketPrice=1500.0 and numPassengers=7 (>5), the program correctly computes groupDiscount=10.0% and totalCost = 1500*7 - 10% = 9450.0.
Q11(i)2 marks · ProgramOpen: A linked list is formed from the objects of class VotersList. The class…

Write the program described below.

A linked list is formed from the objects of class VotersList. The class structure is given below.
class VotersList
{
    int age;
    VotersList link;
}
Write an Algorithm OR a Method to count and return total number of nodes whose age >= 60. The method prototype is as follows: int countNodes(VotersList start)
Show answer

Answer

int countNodes(VotersList start)
{
    if (start == null)
        return 0;
    else
    {
        if (start.age >= 60)
            return 1 + countNodes(start.link);
        else
            return countNodes(start.link);
    }
}
Explanation: The method recursively traverses the linked list node by node using the link reference. At each node, if age is 60 or more it adds 1 to the count returned by the recursive call on the rest of the list (start.link); otherwise it simply returns the count from the rest of the list. The base case (start == null) returns 0 when the end of the list is reached. Tested with a 4-node list of ages {65, 45, 70, 30}, the method correctly returns 2 (the nodes with age 65 and 70).
Q11(ii)3 marks · Case basedOpen: Refer to the Binary Tree given below and answer the questions that follow…

Answer the following questions from the binary tree.

Refer to the Binary Tree given below and answer the questions that follow:
(a)[1]
Write the post-order traversal of the above tree structure.
(b)[1]
Name the internal nodes of the right subtree and the external nodes of the left subtree
(c)[1]
Write the size of the tree and the degree of node D.
Show answer

Answer (a)

Post-order traversal (Left, Right, Root) of the entire tree: A, C, E, D, B, H, I, G, F

Answer (b)

Right subtree (rooted at G): its nodes are G, I, H. Its internal nodes (nodes having at least one child) are G and I. Left subtree (rooted at B): its nodes are B, A, D, C, E. Its external/leaf nodes (nodes with no children) are A, C and E.

Answer (c)

Size of the tree (total number of nodes) = 9 (F, B, G, A, D, I, C, E, H). Degree of node D (number of children of D) = 2 (children C and E).

About this improvement paper

The ISC Computer Science 2025 Improvement Paper is a improvement paper for Class 12: 27 questions in printed order, 70 marks in all, asked from 9 chapters. An improvement paper is the paper of the improvement examination, which candidates who sit a subject again to improve their marks take.

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 based734
MCQ55
Drawing15
Assertion-reason33
Derivation13
Conversion12
Numerical12
Truth table12
Differentiate11
Short answer11

By chapter

ChapterQuestionsMarks printed*
Objects330
Boolean Algebra1026
Data structures412
Computer Hardware210
Inheritance, Interfaces and Polymorphism48
Implementation of algorithms to solve problems13
Recursion13
Arrays, Strings12
Complexity and Big O notation11

* 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 Improvement 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 Improvement Paper ask most about?

By number of questions: Boolean Algebra (10), Data structures (4), Inheritance, Interfaces and Polymorphism (4) and Objects (3).

Does this page have the answers to the ISC Computer Science 2025 Improvement 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.