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

ISC Computer Science 2023 Question Paper with Answers

The ISC Computer Science 2023 Question Paper for Class 12: all 30 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.

30questions
70marks
8chapters
Q1(i)1 mark · MCQOpen: According to De Morgan’s law (a + b + c')' will be equal to:

Answer the following.

According to De Morgan’s law $(a + b + c')'$ will be equal to:
  • (a)$a' + b' + c'$
  • (b)$a' + b' + c$
  • (c)$a' \cdot b' \cdot c'$
  • (d)$a' \cdot b' \cdot c$
Show answer

Answer

Correct option: (d)

Answer: (d) $a' \cdot b' \cdot c$ By De Morgan's law the complement of a sum is the product of the complements: $(a + b + c')' = a' \cdot b' \cdot (c')' = a' \cdot b' \cdot c$.
Q1(ii)1 mark · MCQOpen: The dual of (X' + 1) · (Y' + 0) = Y' is:

Answer the following.

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

Answer

Correct option: (c)

Answer: (c) $X' \cdot 0 + Y' \cdot 1 = Y'$ For the dual, interchange $+$ and $\cdot$ and interchange 0 and 1, leaving the variables and their complements unchanged.
Q1(iii)1 mark · MCQOpen: The reduced expression of the Boolean function F(P, Q) = P' + PQ is:

Answer the following.

The reduced expression of the Boolean function $F(P, Q) = P' + PQ$ is:
  • (a)$P' + Q$
  • (b)$P$
  • (c)$P'$
  • (d)$P + Q$
Show answer

Answer

Correct option: (a)

Answer: (a) $P' + Q$ $P' + PQ = (P' + P)(P' + Q) = 1 \cdot (P' + Q) = P' + Q$ (distributive law, then complement law).
Q1(iv)1 mark · MCQOpen: If (~ p ⇒ ~ q) then its contra positive will be:

Answer the following.

If $(\sim p \Rightarrow \sim q)$ then its contra positive will be:
  • (a)$p \Rightarrow q$
  • (b)$q \Rightarrow p$
  • (c)$\sim q \Rightarrow p$
  • (d)$\sim p \Rightarrow q$
Show answer

Answer

Correct option: (b)

Answer: (b) $q \Rightarrow p$ The contrapositive of $a \Rightarrow b$ is $\sim b \Rightarrow \sim a$; here $a = \sim p$, $b = \sim q$, so it is $\sim(\sim q) \Rightarrow \sim(\sim p)$, i.e. $q \Rightarrow p$.
Q1(v)1 mark · MCQOpen: The keyword that allows multi-level inheritance in Java programming is:

Answer the following.

The keyword that allows multi-level inheritance in Java programming is:
  • (a)implements
  • (b)super
  • (c)extends
  • (d)this
Show answer

Answer

Correct option: (c)

Answer: (c) extends A class inherits from another class with extends; a chain such as class B extends A and class C extends B gives multi-level inheritance.
Q1(viii)1 mark · Short answerOpen: State any one purpose of using the keyword this in Java programming.

Answer the following.

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

Answer

The keyword this refers to the current object. It is used to tell an instance variable apart from a local variable or parameter with the same name, e.g. this.num = num; in a constructor. (It can also be used to call another constructor of the same class or to pass the current object as an argument.)
Q1(ix)1 mark · Short answerOpen: Mention any two properties of the data members of an Interface.

Answer the following.

Mention any two properties of the data members of an Interface.
Show answer

Answer

1. Data members of an interface are implicitly public, static and final, i.e. they are constants. 2. They must be initialised at the point of declaration and their values cannot be changed by the implementing class.
Q1(x)1 mark · Short answerOpen: What is the importance of the reference part in a Linked List?

Answer the following.

What is the importance of the reference part in a Linked List?
Show answer

Answer

The reference (link) part of a node stores the address of the next node in the list. It connects the nodes together, so the list can be traversed from the first node to the last; the last node's reference is null, marking the end of the list.
Q2(i)2 marks · ConversionOpen: Convert the following infix notation to prefix notation. (A - B) / C * (D + E)

Answer the following.

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

Answer

$(A - B) / C * (D + E)$; / and * have equal priority and are evaluated left to right, so it is $((A - B) / C) * (D + E)$. Step 1: $(A - B) \to -AB$ and $(D + E) \to +DE$ Step 2: $(-AB) / C \to /-ABC$ Step 3: $(/-ABC) * (+DE) \to */-ABC+DE$ Prefix: $* \, / \, - \, A \, B \, C \, + \, D \, E$
Q2(ii)2 marks · NumericalOpen: A matrix M[-6… 10, 4… 15] is stored in the memory with each element requiring 4…

Answer 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

Column Major formula: Address(M[I][J]) = Base + W × [ (J - LC) × NR + (I - LR) ] LR = -6, UR = 10, so NR = 10 - (-6) + 1 = 17; LC = 4; W = 4, Base = 1025, I = 4, J = 8. Address(M[4][8]) = 1025 + 4 × [ (8 - 4) × 17 + (4 - (-6)) ] = 1025 + 4 × [ 68 + 10 ] = 1025 + 4 × 78 = 1025 + 312

Final answer: 1337

Q2(iii)3 marks · Case basedOpen: boolean num(int x) { int a=1; for (int c=x; c>0; c/=10) a *= 10; return…

Answer the following.

boolean num(int x)
{ int a=1;
for (int c=x; c>0; c/=10)
a *= 10;
return (x*x%a)==x;
}
With reference to the code given below, answer the questions that follow along with dry run / working.
(a)[2]
What will the function num() return when the value of $x=25$?
(b)[1]
What is the method num() performing?
Show answer

Answer (a)

Dry run for $x = 25$:
ca
2510
2100
0loop ends
$x*x = 625$, $625 \% 100 = 25$, and $25 == 25$ is true. The function returns true.

Answer (b)

It checks whether x is an Automorphic number, i.e. whether the square of the number ends with the number itself (a is 10 raised to the number of digits of x).
Q2(iv)3 marks · Case basedOpen: int task(int m, int n) { if(m==n) return m; else if(m>n) return task(m-n, n)…

Answer the following.

int task(int m, int n)
{ if(m==n)
return m;
else if(m>n)
return task(m-n, n);
else
return task(m, n-m);
}
The following function task() is a part of some class. Assume ‘m’ and ‘n’ are positive integers, greater than 0. Answer the questions given below along with dry run / working.
(a)[2]
What will the function task() return when the value of $m=30$ and $n=45$?
(b)[1]
What function does task( ) perform, apart from recursion?
Show answer

Answer (a)

task(30, 45): m < n, so it calls task(30, 45 - 30) = task(30, 15) task(30, 15): m > n, so it calls task(30 - 15, 15) = task(15, 15) task(15, 15): m == n, so it returns 15 The function returns 15.

Answer (b)

It finds the HCF (GCD) of m and n by repeated subtraction.
Q3(i)5 marks · Case basedOpen: Given the Boolean function F(A,B,C,D) = Σ(2, 3, 6, 7, 8, 10, 12, 14, 15)…

Answer the following.

Given the Boolean function $F(A,B,C,D) = \Sigma(2, 3, 6, 7, 8, 10, 12, 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: (8, 10, 12, 14) → AD'; (2, 3, 6, 7) → A'C; (6, 7, 14, 15) → BC

Reduced expression: F = AD' + A'C + BC

Quad (8, 10, 12, 14) gives AD'. Quad (2, 3, 6, 7) gives A'C. Quad (6, 7, 14, 15) gives BC. There is no octet.

Answer (b)

Logic gate diagram for $F = AD' + A'C + BC$: three 2-input AND gates feeding one 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, 2, 4, 5, 8, 10, 11, 14, 15)…

Answer the following.

Given the Boolean function $F(A,B,C,D) = \pi(0, 1, 2, 4, 5, 8, 10, 11, 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: (10, 11, 14, 15) → (A' + C'); (0, 1, 4, 5) → (A + C); (0, 2, 8, 10) → (B + D)

Reduced expression: F = (A' + C')(A + C)(B + D)

Quad (10, 11, 14, 15) gives (A' + C'). Quad (0, 1, 4, 5) gives (A + C). Quad (0, 2, 8, 10) gives (B + D). There is no octet.

Answer (b)

Logic gate diagram for $F = (A' + C')(A + C)(B + D)$: three 2-input OR gates feeding one 3-input AND gate.
Diagram for this answer
Q4(i)5 marks · Truth tableOpen: A shopping mall allows customers to shop using cash or credit card of any…

Answer the following.

A shopping mall allows customers to shop using cash or credit card of any nationalised bank. It awards bonus points to their customers on the basis of criteria given below: • The customer is an employee of the shopping mall and makes the payment using a credit card OR • The customer shops items which carry bonus points and makes the payment using a credit card with a shopping amount of less than ₹10,000/- OR • The customer is not an employee of the shopping mall and makes the payment not through a credit card but in cash for the shopping amount above ₹10,000/- The inputs are:
INPUTS
CPayment through a credit card
AShopping amount is above ₹10,000/-
EThe customer is an employee of the shopping mall
IItem carries a bonus point
(In all the above cases, 1 indicates yes and 0 indicates no.) Output: X [1 indicates bonus point awarded, 0 indicates bonus point not awarded for all cases] Draw the truth table for the inputs and outputs given above and write the POS expression for $X (C, A, E, I)$.
Show answer

Answer

CAEIX
00000
00010
00100
00110
01001
01011
01100
01110
10000
10011
10101
10111
11000
11010
11101
11111
Condition 1: C.E. Condition 2: I.C.A'. Condition 3: E'.C'.A. So X = CE + CA'I + C'AE'. X(C, A, E, I) = Π(0, 1, 2, 3, 6, 7, 8, 12, 13) POS expression: X = (C + A + E + I)(C + A + E + I')(C + A + E' + I)(C + A + E' + I')(C + A' + E' + I)(C + A' + E' + I')(C' + A + E + I)(C' + A' + E + I)(C' + A' + E + I') The minimal POS is X = (C + A)(C + E')(C' + A' + E)(A + E + I).
Q4(ii)3 marks · Long answerOpen: Differentiate between half adder and full adder. Write the Boolean expression…

Answer the following.

Differentiate between half adder and full adder. Write the Boolean expression and draw the logic circuit diagram for the SUM and CARRY of a full adder.
Show answer

Answer

Half adder: adds two bits (A, B) and gives SUM and CARRY; it has no input for a carry from a previous stage. Full adder: adds three bits (A, B and the carry-in C) and gives SUM and CARRY; it can be cascaded to add multi-bit numbers. Full adder expressions: $SUM = A'B'C + A'BC' + AB'C' + ABC = A \oplus B \oplus C$ $CARRY = AB + BC + AC$
Diagram for this answer
Q5(i)5 marks · Long answerOpen: What is an encoder? How is it different from a decoder? Draw the logic circuit…

Answer the following.

What is an encoder? How is it different from a decoder? Draw the logic circuit for a 4:1 multiplexer and explain its working.
Show answer

Answer

Encoder: a combinational circuit that converts one of $2^n$ active input lines into an n-bit binary code (e.g. octal to binary encoder: 8 inputs, 3 outputs). Difference: an encoder has $2^n$ inputs and n outputs and converts a signal into a code, while a decoder does the reverse: it has n inputs and $2^n$ outputs and activates the one output line selected by the n-bit input code. 4:1 multiplexer: it has four data inputs $I_0, I_1, I_2, I_3$, two select lines $S_1, S_0$ and one output Y. $Y = S_1'S_0'I_0 + S_1'S_0I_1 + S_1S_0'I_2 + S_1S_0I_3$ Working: the select lines choose which input is passed to the output.
$S_1$$S_0$Y
00$I_0$
01$I_1$
10$I_2$
11$I_3$
Only the AND gate whose select combination matches is enabled, so the output Y equals the selected data input.
Diagram for this answer
Q5(ii)3 marks · Short answerOpen: From the logic diagram given below, write the Boolean expression for (1) and…

Answer the following.

From the logic diagram given below, write the Boolean expression for (1) and (2). Also, derive the Boolean expression (F) and simplify it.
Figure for this question
Show answer

Answer

From the diagram: gate (1) is a NAND gate with inputs X and Y, gate (2) is a NOR gate with inputs Y and Z, and their outputs go into an OR gate giving F. (1) $= (X \cdot Y)'$ (2) $= (Y + Z)'$ $F = (X \cdot Y)' + (Y + Z)' = X' + Y'$
  1. 1. Output of the NAND gate: (1) $= (X \cdot Y)'$
  2. 2. Output of the NOR gate: (2) $= (Y + Z)'$
  3. 3. The OR gate adds them: $F = (X \cdot Y)' + (Y + Z)'$
  4. 4. By De Morgan's laws: $F = X' + Y' + Y' \cdot Z'$
  5. 5. By the absorption law ($Y' + Y'Z' = Y'$): $F = X' + Y'$
  6. 6. By De Morgan's law this can also be written $F = (X \cdot Y)'$, so $F = X' + Y'$
Q5(iii)2 marks · ConversionOpen: Convert the following cardinal expression to its canonical form: F(P, Q, R) =…

Answer the following.

Convert the following cardinal expression to its canonical form: $F(P, Q, R) = \pi(0, 1, 3, 4)$
Show answer

Answer

$F(P, Q, R) = \pi(0, 1, 3, 4)$: write each maxterm in binary; a 0 bit gives the variable as it is and a 1 bit gives its complement, and the variables within a term are added. $0 = 000 \to (P + Q + R)$ $1 = 001 \to (P + Q + R')$ $3 = 011 \to (P + Q' + R')$ $4 = 100 \to (P' + Q + R)$ Canonical form: $F(P, Q, R) = (P + Q + R) \cdot (P + Q + R') \cdot (P + Q' + R') \cdot (P' + Q + R)$
Q610 marks · ProgramOpen: Design a class NumDude to check if a given number is a Dudeney number or not…

Write the program described below.

Design a class NumDude to check if a given number is a Dudeney number or not. (A Dudeney number is a positive integer that is a perfect cube, such that the sum of its digits is equal to the cube root of the number.) Example: $5832 = (5+8+3+2)^3 = (18)^3 = 5832$ Some of the members of the class are given below:
Class name:NumDude
Data member/instance variable:
num:to store a positive integer number
Methods / Member functions:
NumDude( ):default constructor to initialise the data member with legal initial value
void input( ):to accept a positive integer number
int sumDigits(int x):returns the sum of the digits of number ‘x’ using recursive technique
void isDude( ):checks whether the given number is a Dudeney number by invoking the function sumDigits() and displays the result with an appropriate message
Specify the class NumDude giving details of the constructor( ), void input( ), int sumDigits(int) and void isDude( ). 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 NumDude
{
    int num;   // the number to be checked

    // default constructor
    NumDude()
    {
        num = 0;
    }

    // accepts a positive integer
    void input()
    {
        Scanner sc = new Scanner(System.in);
        System.out.print("Enter a positive integer: ");
        num = sc.nextInt();
    }

    // returns the sum of the digits of x using recursion
    int sumDigits(int x)
    {
        if (x == 0)
            return 0;
        return (x % 10) + sumDigits(x / 10);
    }

    // checks whether num is a Dudeney number
    void isDude()
    {
        int s = sumDigits(num);
        if (s * s * s == num)
            System.out.println(num + " is a Dudeney number");
        else
            System.out.println(num + " is not a Dudeney number");
    }

    public static void main(String args[])
    {
        NumDude ob = new NumDude();
        ob.input();
        ob.isDude();
    }
}
sumDigits() adds the last digit (x % 10) to the sum of the remaining digits (x / 10) until x becomes 0. isDude() cubes that sum: if the cube equals the number, the sum is its cube root, so the number is a Dudeney number. Sample run:
Enter a positive integer: 5832
5832 is a Dudeney number
Q710 marks · ProgramOpen: A class Trans is defined to find the transpose of a square matrix. A transpose…

Write the program described below.

A class Trans is defined to find the transpose of a square matrix. A transpose of a matrix is obtained by interchanging the elements of the rows and columns. Example: If size of the matrix = 3, then
ORIGINALTRANSPOSE
11571181
81395136
16207920
Some of the members of the class are given below:
Class name:Trans
Data members/instance variables:
arr[ ][ ]:to store integers in the matrix
m:integer to store the size of the matrix
Methods / Member functions:
Trans(int mm):parameterised constructor to initialise the data member $m = mm$
void fillarray( ):to enter integer elements in the matrix
void transpose( ):to create the transpose of the given matrix
void display( ):displays the original matrix and the transposed matrix by invoking the method transpose()
Specify the class Trans giving details of the constructor( ), void fillarray( ), void transpose( ) and void display(). 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 Trans
{
    static Scanner sc = new Scanner(System.in);
    int arr[][];   // the matrix
    int m;         // size of the matrix

    // parameterised constructor
    Trans(int mm)
    {
        m = mm;
        arr = new int[m][m];
    }

    // accepts the elements of the matrix
    void fillarray()
    {
        System.out.println("Enter " + (m * m) + " elements:");
        for (int i = 0; i < m; i++)
            for (int j = 0; j < m; j++)
                arr[i][j] = sc.nextInt();
    }

    // transposes the matrix in place by swapping arr[i][j] and arr[j][i]
    void transpose()
    {
        for (int i = 0; i < m; i++)
        {
            for (int j = i + 1; j < m; j++)
            {
                int t = arr[i][j];
                arr[i][j] = arr[j][i];
                arr[j][i] = t;
            }
        }
    }

    // prints the matrix row by row
    void print()
    {
        for (int i = 0; i < m; i++)
        {
            for (int j = 0; j < m; j++)
                System.out.print(arr[i][j] + "\t");
            System.out.println();
        }
    }

    // displays the original matrix, then the transposed matrix
    void display()
    {
        System.out.println("ORIGINAL MATRIX");
        print();
        transpose();
        System.out.println("TRANSPOSE");
        print();
    }

    public static void main(String args[])
    {
        System.out.print("Enter the size of the matrix: ");
        int size = sc.nextInt();
        Trans ob = new Trans(size);
        ob.fillarray();
        ob.display();
    }
}
transpose() swaps each element above the main diagonal with its mirror element below it (arr[i][j] with arr[j][i]), so rows become columns. display() prints the original matrix, invokes transpose() and prints the result. Sample run:
Enter the size of the matrix: 3
Enter 9 elements:
11 5 7
8 13 9
1 6 20
ORIGINAL MATRIX
11	5	7	
8	13	9	
1	6	20	
TRANSPOSE
11	8	1	
5	13	6	
7	9	20	
Q810 marks · ProgramOpen: A class SortAlpha has been defined to sort the words in the sentence in…

Write the program described below.

A class SortAlpha has been defined to sort the words in the sentence in alphabetical order. Example: Input: THE SKY IS BLUE Output: BLUE IS SKY THE Some of the members of the class are given below:
Class name:SortAlpha
Data members/instance variables:
sent:to store a sentence
n:integer to store the number of words in a sentence
Methods / Member functions:
SortAlpha( ):default constructor to initialise data members with legal initial values
void acceptsent( ):to accept a sentence in UPPER CASE
void sort(SortAlpha P):sorts the words of the sentence of object P in alphabetical order and stores the sorted sentence in the current object
void display( ):displays the original sentence along with the sorted sentence by invoking the method sort()
Specify the class SortAlpha giving details of the constructor( ), void acceptsent( ), void sort(SortAlpha) and void display(). 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 SortAlpha
{
    String sent;   // the sentence
    int n;         // number of words in the sentence

    // default constructor
    SortAlpha()
    {
        sent = "";
        n = 0;
    }

    // accepts a sentence in upper case and counts its words
    void acceptsent()
    {
        Scanner sc = new Scanner(System.in);
        System.out.print("Enter a sentence in UPPER CASE: ");
        sent = sc.nextLine().trim().toUpperCase();
        n = sent.split("\\s+").length;
    }

    // sorts the words of P's sentence alphabetically and stores the result in this object
    void sort(SortAlpha P)
    {
        String w[] = P.sent.split("\\s+");
        int len = w.length;
        // bubble sort on the words
        for (int i = 0; i < len - 1; i++)
        {
            for (int j = 0; j < len - 1 - i; j++)
            {
                if (w[j].compareTo(w[j + 1]) > 0)
                {
                    String t = w[j];
                    w[j] = w[j + 1];
                    w[j + 1] = t;
                }
            }
        }
        sent = "";
        for (int i = 0; i < len; i++)
            sent = sent + w[i] + " ";
        sent = sent.trim();
        n = len;
    }

    // displays the original sentence and the sorted sentence
    void display()
    {
        SortAlpha ob = new SortAlpha();
        ob.sort(this);
        System.out.println("Original sentence: " + sent);
        System.out.println("Sorted sentence: " + ob.sent);
    }

    public static void main(String args[])
    {
        SortAlpha obj = new SortAlpha();
        obj.acceptsent();
        obj.display();
    }
}
sort() splits the sentence of object P into words, arranges them with bubble sort using compareTo(), and joins them back into the current object's sent. display() creates a second object, calls sort(this) on it so the original sentence is kept unchanged, and prints both. Sample run:
Enter a sentence in UPPER CASE: THE SKY IS BLUE
Original sentence: THE SKY IS BLUE
Sorted sentence: BLUE IS SKY THE
Q9(i)4 marks · ProgramOpen: A double ended queue is a linear data structure which enables the user to add…

Answer the following.

A double ended queue is a linear data structure which enables the user to add and remove integers from either ends i.e., from front or rear. The details of the class deQueue are given below:
Class name:deQueue
Data members/ instance variables:
Qrr[ ]:array to hold integer elements
lim:maximum capacity of the dequeue
front:to point the index of the front end
rear:to point the index of the rear end
Methods / Member functions:
deQueue(int l):constructor to initialise $lim = l$, $front = 0$ and $rear = 0$
void addFront(int v):to add integers in the dequeue at the front end if possible, otherwise display the message “OVERFLOW FROM FRONT”
void addRear(int v):to add integers in the dequeue at the rear end if possible, otherwise display the message “OVERFLOW FROM REAR”
int popFront( ):removes and returns the integers from the front end of the dequeue if any, else returns -999
int popRear( ):removes and returns the integers from the rear end of the dequeue if any, else returns -999
void show( ):displays the elements of the dequeue
Specify the class deQueue giving details of the functions void addFront(int) and int popFront( ). Assume that the other functions have been defined. The main( ) function and algorithm need NOT be written.
Show answer

Answer

class deQueue
{
    int Qrr[];   // array holding the elements
    int lim;     // maximum capacity
    int front;   // front end index
    int rear;    // rear end index

    deQueue(int l)
    {
        lim = l;
        front = 0;
        rear = 0;
        Qrr = new int[lim];
    }

    // adds v at the front end if there is room before front
    void addFront(int v)
    {
        if (front > 0)
        {
            Qrr[front] = v;
            front--;
        }
        else
            System.out.println("OVERFLOW FROM FRONT");
    }

    // removes and returns the element at the front end, or -999 if empty
    int popFront()
    {
        if (front == rear)
            return -999;
        front++;
        return Qrr[front];
    }
}
The elements occupy positions front + 1 to rear, so the dequeue is empty when front == rear (both start at 0, as the constructor sets). addFront() stores the value at index front and moves front one step left; when front is 0 there is no room at the front, so it reports overflow. popFront() moves front one step right and returns the element there, or -999 if the dequeue is empty. (addRear() correspondingly does rear++ then Qrr[rear] = v while rear < lim - 1.) Tested with the other functions filled in: after addRear(10), addRear(20), addRear(30), popFront() returned 10 and then 20; addFront(15) then put 15 in front of 30; popFront() gave 15, 30 and then -999.
Q9(ii)1 mark · DifferentiateOpen: Differentiate between a stack and a queue.

Answer the following.

Differentiate between a stack and a queue.
Show answer

Answer

Stack: a linear data structure that works on the LIFO (Last In First Out) principle; insertion (push) and deletion (pop) take place at the same end, called the top. Queue: a linear data structure that works on the FIFO (First In First Out) principle; insertion takes place at the rear end and deletion at the front end.
Q105 marks · ProgramOpen: A super class Demand has been defined to store the details of the demands for a…

Write the program described below.

A super class Demand has been defined to store the details of the demands for a product. Define a subclass Supply which contains the production and supply details of the products. The details of the members of both the classes are given below:
Class name:Demand
Data members/instance variables:
pid:string to store the product ID
pname:string to store the product name
pdemand:integer to store the quantity demanded for the product
Methods / Member functions:
Demand(...):parameterised constructor to assign values to the data members
void display( ):to display the details of the product
Class name:Supply
Data members/instance variables:
pproduced:integer to store the quantity of the product produced
prate:to store the cost per unit of the product in decimal form
Methods / Member functions:
Supply(...):parameterised constructor to assign values to the data members of both the classes
double calculation( ):returns the difference between the amount of demand (rate $\times$ demand) and the amount produced (rate $\times$ produced)
void display( ):to display the details of the product and the difference in amount of demand and amount of supply by invoking the method calculation()
Assume that the super class Demand has been defined. Using the concept of inheritance, specify the class Supply giving the details of the constructor(...), double calculation( ) and void display( ). The super class, main function and algorithm need NOT be written.
Show answer

Answer

class Supply extends Demand
{
    int pproduced;   // quantity produced
    double prate;    // cost per unit

    // parameterised constructor for both classes
    Supply(String id, String name, int d, int p, double r)
    {
        super(id, name, d);
        pproduced = p;
        prate = r;
    }

    // difference between amount of demand and amount produced
    double calculation()
    {
        return (prate * pdemand) - (prate * pproduced);
    }

    // displays all details and the difference
    void display()
    {
        super.display();
        System.out.println("Quantity produced: " + pproduced);
        System.out.println("Rate per unit: " + prate);
        System.out.println("Difference in amount of demand and supply: " + calculation());
    }
}
Supply inherits pid, pname and pdemand from Demand. Its constructor passes the first three values to the super class constructor with super(...). display() overrides the super class method: it first calls super.display() for the product details, then prints its own data and the value returned by calculation(). Tested with a small Demand class: Supply("P101", "Pen", 500, 420, 12.5) printed the product details and "Difference in amount of demand and supply: 1000.0" ($12.5 \times 500 - 12.5 \times 420 = 1000$).
Q11(i)2 marks · ProgramOpen: A linked list is formed from the objects of the class given below: class Node {…

Answer the following.

A linked list is formed from the objects of the class given below:
class Node
{
    double sal;
    Node next;
}
Write an Algorithm OR a Method to add a node at the end of an existing linked list. The method declaration is as follows:
void addNode(Node ptr, double ss)
Show answer

Answer

// adds a node with value ss at the end of the existing list that starts at ptr
void addNode(Node ptr, double ss)
{
    Node temp = new Node();   // create the new node
    temp.sal = ss;
    temp.next = null;         // it will be the last node
    while (ptr.next != null)  // move to the last node
        ptr = ptr.next;
    ptr.next = temp;          // link the new node after the last node
}
Algorithm: 1. Create a new node temp; set temp.sal = ss and temp.next = null. 2. Starting from ptr, move ptr = ptr.next while ptr.next is not null, so ptr reaches the last node. 3. Set ptr.next = temp. 4. End. Tested: starting with a one-node list (1000.0), addNode(head, 2000.5) and addNode(head, 3000) gave the list 1000.0 2000.5 3000.0.
Q11(ii)3 marks · Case basedOpen: Answer the following questions from the diagram of a Binary Tree given below…

Answer the following.

Answer the following questions from the diagram of a Binary Tree given below:
Figure for this question
(a)[1]
Write the pre-order traversal of the above tree structure.
(b)[1]
Name the parent of the nodes D and B.
(c)[1]
State the level of nodes E and F when the root is at level 0.
Show answer

Answer (a)

Pre-order (Root, Left, Right): A, F, D, G, B, H, E

Answer (b)

Parent of D: F Parent of B: A

Answer (c)

With the root A at level 0: F is at level 1 and E is at level 3.

About this board paper

The ISC Computer Science 2023 Question Paper is a board paper for Class 12: 30 questions in printed order, 70 marks in all, asked from 8 chapters. The board paper is the exam itself: the question paper CISCE set for that year’s ISC candidates. Solve it in one sitting, in the time allowed, to see how questions are worded and how hard the real paper is.

The layout of the current Computer Science paper (sections, marks, choices) is in the paper pattern guide.

By kind of question

KindQuestionsMarks printed*
Program641
Case based519
Long answer28
Truth table27
Short answer46
MCQ55
Conversion24
One word22
Numerical12
Differentiate11

By chapter

ChapterQuestionsMarks printed*
Boolean Algebra1228
Arrays, Strings322
Data structures613
Objects110
Computer Hardware28
Inheritance, Interfaces and Polymorphism37
Methods24
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 Question Paper?

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

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

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

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