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

ISC Computer Science 2023 Specimen Paper with Answers

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.

29questions
70marks
8chapters
Q1(i)1 mark · MCQOpen: The law which states a + (b · c) = (a + b) · (a + c) is:

Choose the correct option.

The law which states $a + (b \cdot c) = (a + b) \cdot (a + c)$ is:
  • (a)Associative Law
  • (b)Distributive Law
  • (c)Involution Law
  • (d)Commutative Law
Show answer

Answer

Correct option: (b)

Answer: (b) Distributive Law The identity $a+(b\cdot c)=(a+b)\cdot(a+c)$ is the (OR-over-AND) form of the Distributive Law, which distributes one operation over the other.
Q1(ii)1 mark · MCQOpen: The dual of (P + P') · (Q + 0) = Q is:

Choose the correct option.

The dual of $(P + P') \cdot (Q + 0) = Q$ is:
  • (a)$P \cdot P' + Q \cdot 1 = Q$
  • (b)$P \cdot P' + Q \cdot 0 = Q$
  • (c)$P \cdot P + Q \cdot 1 = Q'$
  • (d)$P + P' + Q + 1 = Q$
Show answer

Answer

Correct option: (a)

Answer: (a) $P \cdot P' + Q \cdot 1 = Q$ The dual of an expression is formed by interchanging every $+$ with $\cdot$ and every $0$ with $1$ (variables are left unchanged): $(P+P')\cdot(Q+0)=Q$ becomes $(P\cdot P')+(Q\cdot 1)=Q$.
Q1(iii)1 mark · MCQOpen: The complement of the Boolean expression (P · Q)' + R' is:

Choose the correct option.

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

Answer

Correct option: (b)

Answer: (b) $PQR$ By De Morgan's laws, complementing $(P\cdot Q)'+R'$ gives $[(P\cdot Q)']' \cdot [R']' = (P\cdot Q)\cdot R = PQR$ (verified with the boolean tool).
Q1(iv)1 mark · MCQOpen: If (x ⇒ ~ y) then, its inverse will be:

Choose the correct option.

If $(x \Rightarrow \sim y)$ then, its inverse will be:
  • (a)$x \Rightarrow y$
  • (b)$y \Rightarrow x$
  • (c)$\sim y \Rightarrow x$
  • (d)$\sim x \Rightarrow y$
Show answer

Answer

Correct option: (d)

Answer: (d) $\sim x => y$ For an implication $p \Rightarrow q$, its inverse is $\sim p \Rightarrow \sim q$. Here $p=x$ and $q=\sim y$, so the inverse is $\sim x \Rightarrow \sim(\sim y) = \sim x \Rightarrow y$.
Q1(v)1 mark · MCQOpen: Transitive nature of inheritance is implemented through

Choose the correct option.

Transitive nature of inheritance is implemented through
  • (a)Single inheritance
  • (b)Multiple inheritance
  • (c)Hybrid inheritance
  • (d)Multilevel inheritance
Show answer

Answer

Correct option: (d)

Answer: (d) Multilevel inheritance The transitive property (if A relates to B, and B relates to C, then A relates to C) is realised by Multilevel inheritance, where a subclass extends a class that is itself a subclass, so members pass down through several levels.
Q1(vi)1 mark · One wordOpen: Write the canonical sum of product form of the function y(A, B) = A + B.

Answer the following.

Write the canonical sum of product form of the function $y(A, B) = A + B$.
Show answer

Answer

The canonical SOP form lists every minterm where the output is 1. For $y=A+B$, the output is 1 for $(A,B)=(0,1),(1,0),(1,1)$, i.e. minterms $A'B, AB', AB$: $y(A,B) = A'B + AB' + AB$
Q1(vii)1 mark · One wordOpen: Name the basic gate that is equivalent to two NOR gates connected in series.

Answer the following.

Name the basic gate that is equivalent to two NOR gates connected in series.
Show answer

Answer

OR gate. A NOR gate with a repeated (single) input acts as a NOT gate: $NOR(X,X) = (X+X)'=X'$. So the first NOR gate gives $N_1=(A+B)'$, and the second NOR gate, with both its inputs tied to $N_1$, gives $N_1' = ((A+B)')' = A+B$. Hence two NOR gates in series (the second used as an inverter) are equivalent to a single OR gate.
Q1(viii)1 mark · Short answerOpen: State any one purpose of using the keyword super in Java programming.

Answer the following.

State any one purpose of using the keyword super in Java programming.
Show answer

Answer

The keyword 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).
Q1(ix)1 mark · Short answerOpen: Define Interface with respect to data abstraction.

Answer the following.

Define Interface with respect to data abstraction.
Show answer

Answer

An Interface is a Java construct that contains only abstract methods (method signatures with no body) and constants, with no implementation. It specifies WHAT a class must do without specifying HOW, thus achieving full data abstraction; any class that implements the interface must provide (define) the actual implementation of every method declared in it.
Q1(x)1 mark · Short answerOpen: What is a linked list?

Answer the following.

What is a linked list?
Show answer

Answer

A linked list is a linear, dynamic data structure made up of a sequence of nodes, where each node holds a data item and a reference (pointer/link) to the next node in the sequence. Unlike an array, its elements need not occupy contiguous memory locations, and the list can grow or shrink at run time.
Q2(i)2 marks · ConversionOpen: Convert the following infix notation to postfix form. ( P / Q - R ) * ( S + T )

Answer the following.

Convert the following infix notation to postfix form. $( P / Q - R ) * ( S + T )$
Show answer

Answer

$(P/Q-R)*(S+T)$ Converting $(P/Q-R)$: push $($, output $P$, push $/$, output $Q$ (so far $PQ$), on seeing $-$ pop $/$ to output ($PQ/$) then push $-$, output $R$ ($PQ/R$), on $)$ pop $-$ ($PQ/R-$). Converting $(S+T)$: output $ST+$. Combine with $*$: $PQ/R- \;\; ST+ \;\; *$ Postfix: $PQ/R-ST+*$
Q2(ii)2 marks · NumericalOpen: A matrix N[11][8] is stored in the memory with each element requiring 2 bytes…

Answer the following.

A matrix N[11][8] is stored in the memory with each element requiring 2 bytes of storage. If the base address at N[2][3] is 2140, find the address of N[7][5] when the matrix is stored in Row Major Wise.
Show answer

Answer

Row Major formula relative to a known base address: $Address(N[i][j]) = Base(N[2][3]) + W \times [(i-2)\times C + (j-3)]$, where $C$ = number of columns = 8, $W$ = 2 bytes For $N[7][5]$: $= 2140 + 2 \times [(7-2)\times 8 + (5-3)]$ $= 2140 + 2 \times [40+2]$ $= 2140 + 84$

Final answer: 2224 bytes (address)

Q2(iii)3 marks · Case basedOpen: void Solve(int n) { int a=1,b=1; for (int i=n;i>0;i=i/10) { int d=i%10; if…

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);
}
With reference to the code given below answer the questions that follow.
(a)[2]
What will the function Solve( ) return when the value of n=3269?
(b)[1]
What is the method Solve( ) computing?
Show answer

Answer (a)

Solve() is void, so it returns nothing, but it displays "12 27" (verified by running the code for real). Dry run for n=3269: i=3269, d=9 (odd) -> b=1*9=9; i=326, d=6 (even) -> a=1*6=6; i=32, d=2 (even) -> a=6*2=12; i=3, d=3 (odd) -> b=9*3=27; i=0, loop ends. Output: 12 27

Answer (b)

Taking the digits of n one at a time (from the units digit upward), the method computes the product of all the even digits (stored in a) and, separately, the product of all the odd digits (stored in b), and then displays both products.
Q2(iv)3 marks · Case basedOpen: int quiz( int n) { if ( n <= 1 ) return n; else return (--n % 2) + quiz(n/10)…

Answer the questions on the code given below.

int quiz( int n)
{
    if ( n <= 1 )
        return n;
    else
        return (--n % 2) + quiz(n/10);
}
The following function quiz( ) is a part of some class. Assume ‘n’ is a positive integer, greater than 0. Answer the given questions along with dry run / working.
(a)[2]
What will the function quiz( ) return when the value of n=36922?
(b)[1]
State in one line what does the function quiz( ) do, apart from recursion?
Show answer

Answer (a)

quiz(36922) returns 3 (verified by running the code for real). Dry run: quiz(36922) = (36921%2) + quiz(3692) = 1 + quiz(3692) quiz(3692) = (3691%2) + quiz(369) = 1 + quiz(369) quiz(369) = (368%2) + quiz(36) = 0 + quiz(36) quiz(36) = (35%2) + quiz(3) = 1 + quiz(3) quiz(3) = (2%2) + quiz(0) = 0 + quiz(0) quiz(0) = 0 (base case, n<=1) Unwinding: quiz(3)=0, quiz(36)=1, quiz(369)=1, quiz(3692)=2, quiz(36922)=3 Return value: 3

Answer (b)

Apart from recursion, at each call the function decrements n by 1 and, if that decremented value is odd, adds 1 to a running total; it then continues on the value obtained by discarding the last digit of the decremented value (integer division by 10), repeating until the remaining value is <= 1. It finally returns the total count of decremented values that were odd along this chain.
Q3(i)5 marks · Case basedOpen: Given the Boolean function F(A, B, C, D) = Σ(0, 1, 2, 3, 4, 6, 9, 11, 13)…

Reduce the following using a Karnaugh map.

Given the Boolean function $F(A, B, C, D) = \Sigma(0, 1, 2, 3, 4, 6, 9, 11, 13)$.
(a)[4]
Reduce the above expression 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

Must show: variables and their complements as inputs

Show answer

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

Two quads {0,2,4,6} = A'D' and {1,3,9,11} = B'D, and a pair {9,13} = AC'D.

Answer (b)

Logic gate diagram for $F = A'D' + B'D + AC'D$: two 2-input AND gates and one 3-input AND gate feeding a 3-input OR gate.
Diagram for this answer
Q3(ii)5 marks · Case basedOpen: Given the Boolean function F(A, B, C, D) = π(0, 1, 3, 5, 6, 7, 9, 11, 13, 14…

Reduce the following using a Karnaugh map.

Given the Boolean function $F(A, B, C, D) = \pi(0, 1, 3, 5, 6, 7, 9, 11, 13, 14, 15)$.
(a)[4]
Reduce the above expression 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

Must show: variables and their complements as inputs

Show answer

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)

Grouping the 0s: octet {1,3,5,7,9,11,13,15} = D', quad {6,7,14,15} = (B' + C'), pair {0,1} = (A + B + C).

Answer (b)

Logic gate diagram for $F=(A+B+C)\cdot(B'+C')\cdot D'$: a 3-input OR gate (A, B, C) and a 2-input OR gate (B', C') feed a 3-input AND gate together with D'.
Diagram for this answer
Q4(i)5 marks · Truth tableOpen: A family intends to purchase a smart phone depending on the criteria given…

Answer the following using a truth table.

A family intends to purchase a smart phone depending on the criteria given below: • Quad core processor with internal memory of 64 GB or more but not a resale phone OR • Resale phone with quad core processor but without warranty OR • Processor is not a quad core but with a warranty of 1 year and the internal memory is of 64 GB or more The inputs are:
INPUTS
PQuad core processor
MInternal memory of 64 GB or more
RResale phone
WWarranty of 1 year
(In all the above cases, 1 indicates yes and 0 indicates no.) Output: X [1 indicates purchased, 0 indicates not purchased for all cases] Draw the truth table for the inputs and outputs given above and write the SOP expression
Show answer

Answer

PMRWP.M.R'P.R.W'P'.M.WP.M.R' + P.R.W' + P'.M.W
00000000
00010000
00100000
00110000
01000000
01010011
01100000
01110011
10000000
10010000
10100101
10110000
11001001
11011001
11100101
11110000

SOP: X = P.M.R' + P.R.W' + P'.M.W

X = PMR' + PRW' + P'MW (minterms 5, 7, 10, 12, 13, 14).
Q4(ii)3 marks · Long answerOpen: What is a half adder? Draw the logic circuit for the SUM and CARRY expression…

Answer the following.

What is a half adder? Draw the logic circuit for the SUM and CARRY expression of a half adder using only NAND gates.
Show answer

Answer

A half adder is a combinational logic circuit that adds two single binary digits A and B, producing two outputs: SUM ($A \oplus B$) and CARRY ($A \cdot B$); it does not take any carry-in from a previous stage. Using only NAND gates (5 NAND gates, verified logically): NAND1: inputs A, B -> $N_1=(AB)'$ NAND2: inputs A, $N_1$ -> $N_2=(A \cdot N_1)'$ NAND3: inputs B, $N_1$ -> $N_3=(B \cdot N_1)'$ NAND4: inputs $N_2$, $N_3$ -> SUM $=(N_2 \cdot N_3)' = A \oplus B$ NAND5: inputs $N_1$, $N_1$ (tied together, acting as an inverter) -> CARRY $=N_1'=AB$
Diagram for this answer
Q4(iii)2 marks · Short answerOpen: Simplify the following expression using Boolean laws: F = PQ + ( P + Q ) · ( P…

Answer the following.

Simplify the following expression using Boolean laws: $F = PQ + ( P + Q ) \cdot ( P + PR ) + Q$
Show answer

Answer

$F = PQ + (P+Q)\cdot(P+PR) + Q$ $P+PR = P(1+R) = P$ (since $1+R=1$) So $(P+Q)\cdot(P+PR) = (P+Q)\cdot P = P$ (Absorption law: $P\cdot(P+Q)=P$) $F = PQ + P + Q$ $PQ+P = P$ (Absorption law) $F = P + Q$ (verified with the boolean tool) Final simplified expression: $F = P+Q$
Q5(i)5 marks · Long answerOpen: What is a decoder? How is it different from a multiplexer? Draw the logic…

Answer the following.

What is a decoder? How is it different from a multiplexer? Draw the logic circuit for a 2 to 4 decoder and explain its working.
Show answer

Answer

A decoder is a combinational circuit that converts n coded/binary input lines into a maximum of $2^n$ unique output lines, with exactly one output activated (HIGH) for each unique combination of inputs - it decodes a binary code into one active line among many. Difference from a multiplexer: A multiplexer (MUX) works the other way round - it has $2^n$ data input lines, n select lines, and a SINGLE output; it selects and routes ONE of its many data inputs to that single output based on the select-line combination (many-to-one). 2-to-4 decoder: 2 inputs A, B; 4 outputs D0, D1, D2, D3; built from 2 NOT gates (for A' and B') and 4 two-input AND gates: $D0 = A'B'$, $D1 = A'B$, $D2 = AB'$, $D3 = AB$
Diagram for this answer
Q5(ii)3 marks · Truth tableOpen: Verify if the following proposition is valid: ( P ⇒ Q ) ∧ ( P ⇒ R ) = P ⇒ ( Q ∧…

Answer the following using a truth table.

Verify if the following proposition is valid: $( P \Rightarrow Q ) \wedge ( P \Rightarrow R ) = P \Rightarrow ( Q \wedge R )$
Show answer

Answer

PQRP => QP => R(P => Q).(P => R)Q.RP => (Q.R)(P => Q).(P => R) <=> P => (Q.R)
000111011
001111011
010111011
011111111
100000001
101010001
110100001
111111111
Both sides agree in every row, so the proposition is valid (a tautology).
Q5(iii)2 marks · Short answerOpen: Write the maxterm and minterm for the function F(A, B, C, D) when, A=1, B=1…

Answer the following.

Write the maxterm and minterm for the function $F(A, B, C, D)$ when, $A=1, B=1, C=0$ and $D=1$.
Show answer

Answer

For $A=1, B=1, C=0, D=1$: reading ABCD as binary $1101 = 13$ in decimal. Minterm ($m_{13}$): uncomplemented literal for 1, complemented for 0: $m_{13} = ABC'D$ Maxterm ($M_{13}$): complemented literal for 1, uncomplemented for 0 (reverse convention): $M_{13} = A'+B'+C+D'$
Q610 marks · ProgramOpen: Design a class Pronic to check if a given number is a pronic number or not. [ A…

Write the program described below.

Design a class Pronic to check if a given number is a pronic number or not. [ A number is said to be pronic if the product of two consecutive numbers is equal to the number] Example: 0 = 0 × 1 2 = 1 × 2 6 = 2 × 3 12 = 3 × 4 thus, 0, 2, 6, 12... are pronic numbers. Some of the members of the class are given 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
Specify the class Pronic giving details of the constructor( ), void acceptnum( ), boolean ispronic(int) and void check( ). Define a main( ) function to create an object and call the functions accordingly to enable the task.
Show answer

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."
Q710 marks · ProgramOpen: Design a class OddEven to arrange two single dimensional arrays into one single…

Write the program described below.

Design a class OddEven to arrange two single dimensional arrays into one single dimensional array, such that the odd numbers from both the arrays are at the beginning followed by the even numbers. Example: Array 1: { 2, 13, 6, 19, 26, 11, 4 } Array 2: { 7, 22, 4, 17, 12, 45 } Arranged Array = { 13, 19 11, 7, 17, 45, 2, 6, 26, 4, 22, 4, 12 } Some of the members of the class are given 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
Specify the class OddEven giving details of the constructor( ), void fillarray( ), OddEven arrange(OddEven, OddEven) and void display( ). Define a main( ) function to create objects and call the functions accordingly to enable the task.
Show answer

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.
Q810 marks · ProgramOpen: A class Encrypt has been defined to replace only the vowels in a word by the…

Write the program described below.

A class Encrypt has been defined to replace only the vowels in a word by the next corresponding vowel and forms a new word. i.e. A → E, E → I, I → O, O → U and U → A Example: Input: COMPUTER Output: CUMPATIR Some of the members of the class are given 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
Specify the class Encrypt giving details of the constructor( ), void acceptword( ), void freqvowcon( ), void nextVowel( ) and void disp( ). Define a main( ) function to create an object and call the functions accordingly to enable the task.
Show answer

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.
Q95 marks · Case basedOpen: Holder is a kind of data structure which can store elements with the…

Answer the questions on the class described below.

Holder is a kind of data structure which can store elements with the restriction that an element can be added from the rear end and removed from the front end only. The details of the class Holder is given 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
(i)[4]
Specify the class Holder giving details of the functions void addint(int) and int removeint( ). 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)

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)

The entity described is a Queue (Linear Queue). It works on the principle of FIFO (First In First Out) - the element added first (at the rear) is the element removed first (from the front).
Q105 marks · ProgramOpen: A super class Bank has been defined to store the details of the customer in a…

Write the program described below.

A super class Bank has been defined to store the details of the customer in a bank. Define a subclass Interest to calculate the compound interest. The details of the members of both the classes are given 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
Assume that the super class Bank has been defined. Using the concept of inheritance, specify the class Interest giving the details of the constructor(...), double calculate( ) and void display( ). The super class, main function and algorithm need NOT be written.
Show answer

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.
Q11(i)2 marks · ProgramOpen: A linked list is formed from the objects of the class: class Node { int num…

Write the program described below.

A linked list is formed from the objects of the class:
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 )
Show answer

Answer

Assuming a class-level Node reference 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.
Q11(ii)3 marks · Binary treeOpen: 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]
Write the in-order traversal of the above tree structure.
(b)[1]
Name the children of the nodes B and G.
(c)[1]
State the root of the right sub tree.
Show answer

Answer (a)

From the figure: A is the root with children B (left) and F (right); B has left child D only; F has right child G only; G has children E (left) and H (right). In-order (Left, Root, Right): D, B, A, F, E, G, H

Answer (b)

Node B has only one child: D (its left child); B has no right child. Node G has two children: E (left child) and H (right child).

Answer (c)

The root of the right subtree (of A) is F.

About this specimen paper

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.

By kind of question

KindQuestionsMarks printed*
Program537
Case based521
Long answer28
Truth table28
Short answer57
MCQ55
Binary tree13
One word22
Conversion12
Numerical12

By chapter

ChapterQuestionsMarks printed*
Boolean Algebra1127
Arrays, Strings322
Data structures513
Objects110
Computer Hardware39
Inheritance, Interfaces and Polymorphism48
Methods13
Recursion13

* 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 2023 Specimen Paper?

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

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

By number of questions: Boolean Algebra (11), Data structures (5), Inheritance, Interfaces and Polymorphism (4) and Arrays, Strings (3).

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