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

ISC Computer Science 2019 Question Paper with Answers

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

32questions
70marks
8chapters
Q1(a)1 mark · DrawingOpen: Name and draw the logic gate represented by the following truth table, where A…

Draw the following.

Name and draw the logic gate represented by the following truth table, where A and B are inputs and X is the output.
ABX
000
011
101
110

Draw: The logic gate represented by the truth table

Must show: name of the gate, inputs A and B, output X

Show answer

Answer

XOR (Exclusive-OR) gate: the output is 1 only when the inputs differ.
Diagram for this answer
Q1(b)1 mark · Short answerOpen: Write the canonical POS expression of: F(P, Q) = Π( 0,2 )

Answer the following in short.

Write the canonical POS expression of: $F(P, Q) = \Pi( 0,2 )$
Show answer

Answer

$F(P,Q)=\pi(0,2)$ means F=0 for minterms 0 (P=0,Q=0) and 2 (P=1,Q=0); each maxterm is $(P+Q)$ for row 0 and $(P'+Q)$ for row 2 (complement the variable that is 1 in that row). Canonical POS: $F(P,Q) = (P+Q).(P'+Q)$
Q1(c)1 mark · Short answerOpen: Find the dual of: X.Y + X.Y' = X + 0

Answer the following in short.

Find the dual of: $X.Y + X.Y' = X + 0$
Show answer

Answer

The dual of an expression is obtained by interchanging AND (.) with OR (+) and interchanging 0 with 1, keeping the variables unchanged. $X.Y + X.Y' = X + 0$ Dual: $(X+Y).(X+Y') = X.1$
Q1(d)1 mark · Short answerOpen: If F(A, B, C) = A'.B'.C' + A'.B.C' then find F' using De Morgan’s Law.

Answer the following in short.

If $F(A, B, C) = A'.B'.C' + A'.B.C'$ then find $F'$ using De Morgan’s Law.
Show answer

Answer

$F(A,B,C) = A'.B'.C' + A'.B.C'$ By De Morgan's Law, $F' = (A'.B'.C')'.(A'.B.C')'$ Applying De Morgan's Law again to each term: $(A'.B'.C')' = A+B+C$ and $(A'.B.C')' = A+B'+C$ $F' = (A+B+C).(A+B'+C)$ (this can be further simplified using the distributive law: $(A+C)+B.B' = (A+C)+0 = A+C$, so $F' = A+C$)
Q1(e)(i)0.5 marks · Short answerOpen: Contrapositive

Write the proposition asked for.

Contrapositive
Show the case
If A= “It is cloudy” and B= “It is raining”, then write the proposition for:
Show answer

Answer

Taking the underlying proposition as "If A, then B" (i.e. "If it is cloudy, then it is raining"): Contrapositive ($\sim B \Rightarrow \sim A$): "If it is not raining, then it is not cloudy."
Q1(e)(ii)0.5 marks · Short answerOpen: Converse

Write the proposition asked for.

Converse
Show answer

Answer

Converse ($B \Rightarrow A$): "If it is raining, then it is cloudy."
Q2(a)2 marks · Short answerOpen: What is an Interface? How is it different from a class?

Answer the following in short.

What is an Interface? How is it different from a class?
Show answer

Answer

An interface in Java is a reference type that contains only abstract methods (method signatures with no body/implementation) and constants (implicitly public, static and final fields). It defines a contract that any class implementing it must fulfil by providing the actual code for every one of its methods. It is declared with the keyword 'interface' and a class uses it via the keyword 'implements'. Difference from a class: A class defines both the data (instance variables) and the actual implementation (method bodies) of its behaviour, and objects can be created directly from it using 'new'. An interface has no instance variables and no method bodies (only method headers) and cannot be instantiated on its own - it must be implemented by a class. Also, a class can extend only one superclass (single inheritance), whereas a class can implement any number of interfaces, so interfaces are used to achieve a form of multiple inheritance in Java.
Q2(b)2 marks · NumericalOpen: A matrix ARR[-4…6, 3…8] is stored in the memory with each element requiring 4…

Solve the following.

A matrix $ARR[-4\ldots6, 3\ldots8]$ is stored in the memory with each element requiring 4 bytes of storage. If the base address is 1430, find the address of $ARR[3][6]$ when the matrix is stored in Row Major Wise.
Show answer

Answer

Row range $-4$ to $6$ $\to$ number of rows $M = 6-(-4)+1 = 11$ Column range $3$ to $8$ $\to$ number of columns $N = 8-3+1 = 6$ Each element $W = 4$ bytes; Base address $=1430$; target $ARR[3][6]$ Row Major formula: $Address(ARR[i][j]) = Base + W \times [(i - L_r) \times N + (j - L_c)]$ Here $i=3, j=6, L_r=-4, L_c=3$ $= 1430 + 4 \times [(3-(-4)) \times 6 + (6-3)]$ $= 1430 + 4 \times [42 + 3]$ $= 1430 + 4 \times 45$ $= 1430 + 180$

Final answer: 1610

Q2(c)2 marks · Short answerOpen: Convert the following infix notation to postfix form: ( A + B * C ) - ( E * F /…

Answer the following in short.

Convert the following infix notation to postfix form: $( A + B * C ) - ( E * F / H ) + J$
Show answer

Answer

$(A+B*C) - (E*F/H) + J$ Using operator precedence ($*$, $/$ before $+$, $-$) and left-to-right evaluation, and converting bracket by bracket: $(A+B*C) \to A\ B\ C\ *\ +$ $(E*F/H) \to E\ F\ *\ H\ /$ Combining with $-$ and then $+J$: Postfix: $A\ B\ C\ *\ +\ E\ F\ *\ H\ /\ -\ J\ +$
Q2(d)2 marks · DifferentiateOpen: Compare the two complexities O(n²) and O(2ⁿ) and state which is better and why.

Differentiate between the following.

Compare the two complexities $O(n^2)$ and $O(2^n)$ and state which is better and why.
Show answer

Answer

$O(n^2)$ is quadratic time complexity: the running time grows in proportion to the square of the input size $n$, typically produced by a nested loop (one loop inside another, both running about $n$ times). $O(2^n)$ is exponential time complexity: the running time doubles for every unit increase in $n$, typically produced by algorithms that try all possible subsets/combinations of the input. $O(n^2)$ is the better (more efficient) complexity, because exponential growth ($2^n$) increases far more rapidly than polynomial growth ($n^2$) as $n$ increases. For even moderately large $n$, $2^n$ becomes astronomically larger than $n^2$, making an $O(2^n)$ algorithm impractical for large inputs, whereas an $O(n^2)$ algorithm remains comparatively usable.
Q2(e)2 marks · DifferentiateOpen: State the difference between internal nodes and external nodes of a binary tree…

Differentiate between the following.

State the difference between internal nodes and external nodes of a binary tree structure.
Show answer

Answer

An internal node of a binary tree is any node that has at least one child, i.e. it is not a leaf - it may have one or two children and lies within the body of the tree. An external node (also called a leaf node) is a node that has no children at all (both its left and right child pointers are null) - it lies at the boundary/end of a branch of the tree.
Q35 marks · OutputOpen: The following function Mystery( ) is a part of some class. What will the…

What is the output of the following code?

The following function Mystery( ) is a part of some class. What will the function Mystery( ) return when the value of num=43629, x=3 and y=4 respectively? Show the dry run/ working.
int Mystery( int num, int x, int y)
{
    if(num<10)
        return num;
    else
    {
        int z = num % 10;
        if( z % 2 == 0 )
            return z*x + Mystery( num/10,x,y);
        else
            return z*y + Mystery( num/10,x,y);
    }
}
Show answer

Answer

num=43629, x=3, y=4 (verified by running the code for real: it returns 76) Dry run (z is the last/units digit of num at each call): Mystery(43629,3,4): num≥10, z=43629%10=9 (odd) → return 9*4 + Mystery(4362,3,4) = 36 + Mystery(4362,3,4) Mystery(4362,3,4): z=4362%10=2 (even) → return 2*3 + Mystery(436,3,4) = 6 + Mystery(436,3,4) Mystery(436,3,4): z=436%10=6 (even) → return 6*3 + Mystery(43,3,4) = 18 + Mystery(43,3,4) Mystery(43,3,4): z=43%10=3 (odd) → return 3*4 + Mystery(4,3,4) = 12 + Mystery(4,3,4) Mystery(4,3,4): num=4<10 → return 4 (base case) Unwinding: Mystery(43,3,4)=12+4=16 Mystery(436,3,4)=18+16=34 Mystery(4362,3,4)=6+34=40 Mystery(43629,3,4)=36+40=76 Return value: 76
Q4(a)(i)4 marks · K-mapOpen: Reduce the above expression by using 4-variable Karnaugh map, showing the…

Answer the following for the given Boolean function.

Reduce the above expression by using 4-variable Karnaugh map, showing the various groups (i.e. octal, quads and pairs).
Show the case
Given the Boolean function $F(A, B, C, D) = \Sigma ( 0, 2, 3, 4, 5, 8, 10, 11, 12, 13 )$.
Show answer

Answer

Groups: (4, 5, 12, 13) → BC'; (2, 3, 10, 11) → B'C; (0, 4, 8, 12) → C'D'

Reduced expression: F = BC' + B'C + C'D'

Quad ($m_4, m_5, m_{12}, m_{13}$): $BC'$ Quad ($m_2, m_3, m_{10}, m_{11}$): $B'C$ Quad ($m_0, m_4, m_8, m_{12}$): $C'D'$ Hence $F(A,B,C,D) = BC' + B'C + C'D'$
Q4(a)(ii)1 mark · DrawingOpen: Draw the logic gate diagram for the reduced expression using only NAND gates…

Answer the following for the given Boolean function.

Draw the logic gate diagram for the reduced expression using only NAND gates. Assume that the variables and their complements are available as inputs.

Draw: Logic gate diagram of the reduced expression using only NAND gates

Show answer

Answer

NAND-only (NAND-NAND) implementation of $F = BC' + B'C + C'D'$: one 2-input NAND gate for each product term, and a 3-input NAND gate combining them. By De Morgan's law, $[(BC')' \cdot (B'C)' \cdot (C'D')']' = BC' + B'C + C'D'$.
Diagram for this answer
Q4(b)(i)4 marks · K-mapOpen: Reduce the above expression by using 4-variable Karnaugh map, showing the…

Answer the following for the given Boolean function.

Reduce the above expression by using 4-variable Karnaugh map, showing the various groups (i.e. octal, quads and pairs).
Show the case
Given the Boolean function: $F(P, Q, R, S) = \pi ( 0, 1, 2, 8, 9, 11, 13, 15 )$.
Show answer

Answer

Groups: (0, 1, 8, 9) → (Q + R); (9, 11, 13, 15) → (P' + S'); (0, 2) → (P + Q + S)

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

The 0s are grouped (POS): Quad ($M_0, M_1, M_8, M_9$): $(Q + R)$ Quad ($M_9, M_{11}, M_{13}, M_{15}$): $(P' + S')$ Pair ($M_0, M_2$): $(P + Q + S)$ Hence $F(P,Q,R,S) = (Q + R)(P' + S')(P + Q + S)$
Q4(b)(ii)1 mark · DrawingOpen: Draw the logic gate diagram for the reduced expression using only NOR gates…

Answer the following for the given Boolean function.

Draw the logic gate diagram for the reduced expression using only NOR gates. Assume that the variables and their complements are available as inputs.

Draw: Logic gate diagram of the reduced expression using only NOR gates

Show answer

Answer

NOR-only (NOR-NOR) implementation of $F = (P'+S') \cdot (P+Q+S) \cdot (Q+R)$: one NOR gate for each sum term, and a 3-input NOR gate combining them. By De Morgan's law, $[(P'+S')' + (P+Q+S)' + (Q+R)']' = (P'+S') \cdot (P+Q+S) \cdot (Q+R)$.
Diagram for this answer
Q5(a)5 marks · Long answerOpen: How is a decoder different from a multiplexer? Write the truth table and draw…

Answer the following.

How is a decoder different from a multiplexer? Write the truth table and draw the logic circuit diagram for a 3 to 8 decoder and explain its working.
Show answer

Answer

A decoder is a combinational circuit with n input lines and up to $2^n$ output lines; for each input combination it activates exactly one unique output line, i.e. it converts (decodes) a binary code into an individual output signal. A multiplexer (MUX) is a combinational circuit with $2^n$ data input lines, n select lines and a single output line; based on the binary value on the select lines it selects one of the many data inputs and routes it to the single output. So a decoder is a 1-input-code-to-many-output device, while a multiplexer is a many-input-to-1-output (selector) device - they perform opposite (complementary) operations. 3-to-8 decoder truth table (inputs A2 A1 A0; outputs D0..D7, only one output is 1 for each input row):
A2A1A0D0D1D2D3D4D5D6D7
00010000000
00101000000
01000100000
01100010000
10000001000
10100000100
11000000010
11100000001
Logic circuit: Inputs A2, A1, A0 and their complements A2', A1', A0' (obtained via NOT gates) are fed into eight 3-input AND gates, one per output line, each wired to the unique combination of true/complemented inputs matching its minterm, e.g. $D0=A2'.A1'.A0'$, $D1=A2'.A1'.A0$, $D2=A2'.A1.A0'$, ..., $D7=A2.A1.A0$. Working: For any given 3-bit binary input on A2 A1 A0, only the one AND gate whose input combination exactly matches that pattern produces an output of 1; all other AND gates output 0 because at least one of their inputs is 0. Thus the decoder 'decodes' the binary value present on its 3 input lines by activating exactly the corresponding one of its 8 output lines.
Q5(b)3 marks · DrawingOpen: From the logic circuit diagram given below, derive the Boolean expression and…

Study the circuit diagram and answer the question.

From the logic circuit diagram given below, derive the Boolean expression and simplify it to show that it represents a logic gate. Name and draw the logic gate.

Draw: The logic gate that the simplified expression represents

Must show: name of the gate, inputs, output

Figure for this question
Show the figure
Logic circuit diagram: inputs X and Y go to an OR gate; input X is also joined to one input of an AND gate whose other input is Z; the outputs of the OR gate and the AND gate go to a final AND gate whose output is F.
Show answer

Answer

From the circuit: X and Y feed an OR gate giving $(X+Y)$; X (branched) and Z feed an AND gate giving $X.Z$; the outputs $(X+Y)$ and $(X.Z)$ feed the final AND gate. $F = (X+Y).(X.Z) = X.X.Z + X.Y.Z = X.Z + X.Y.Z = X.Z.(1+Y) = X.Z$ (verified with the boolean tool) So the circuit reduces to $F = X.Z$, i.e. it represents a 2-input AND gate with inputs X and Z (input Y has no effect on the output).
Diagram for this answer
Q5(c)2 marks · Truth tableOpen: Using a truth table, state whether the following proposition is a Tautology…

Answer the following using a truth table.

Using a truth table, state whether the following proposition is a Tautology, Contradiction or Contingency: $\sim(P =>Q) <=> (\sim P \lor Q)$
Show answer

Answer

PQP => Q~(P => Q)~P~P ∨ Q~(P => Q) <=> (~P ∨ Q)
0010110
0110110
1001000
1110010

Result: Contradiction

The last column is 0 in every row, so the proposition is a Contradiction (since $P \Rightarrow Q \equiv \sim P \lor Q$, it compares a statement with its own negation).
Q6(a)5 marks · Truth tableOpen: The owner of a company pays bonus to his salesmen as per the criteria given…

Answer the following using a truth table.

The owner of a company pays bonus to his salesmen as per the criteria given below: • If the salesman works overtime for more than 4 hours but does not work on off days/holidays. OR • If the salesman works when festival sales are on and updates showroom arrangements. OR • If the salesman works on an off day/holiday when the festival sales are on. The inputs are:
INPUTS
OWorks overtime for more than 4 hours
FFestival sales are on
HWorking on an off day/holiday
UUpdates showroom arrangements
(In all the above cases 1 indicates yes and 0 indicates no.) Output : X [1 indicates yes, 0 indicates no for all cases] Draw the truth table for the inputs and outputs given above and write the POS expression for $X(O,F,H,U)$.
Show answer

Answer

OFHUX
00000
00010
00100
00110
01000
01011
01101
01111
10001
10011
10100
10110
11001
11011
11101
11111

POS: (O+F+H+U)(O+F+H+U')(O+F+H'+U)(O+F+H'+U')(O+F'+H+U)(O'+F+H'+U)(O'+F+H'+U')

From the criteria, $X = OH' + FU + FH$. X is 0 in rows 0, 1, 2, 3, 4, 10 and 11. POS expression: $X(O,F,H,U) = \Pi(0,1,2,3,4,10,11)$ $= (O+F+H+U)(O+F+H+U')(O+F+H'+U)(O+F+H'+U')(O+F'+H+U)(O'+F+H'+U)(O'+F+H'+U')$
Q6(b)3 marks · Long answerOpen: What is a half adder? Write the truth table and derive an SOP expression for…

Answer the following.

What is a half adder? Write the truth table and derive an SOP expression for sum and carry for a half adder.
Show answer

Answer

A half adder is a combinational circuit that adds two single binary digits A and B, producing a SUM output and a CARRY output (with no provision for an incoming carry). SUM = A'B + AB', CARRY = A.B
  1. 1. Definition: A half adder takes two single-bit inputs A and B and produces two outputs, SUM (the least significant bit of A+B) and CARRY (the carry generated, if any).
  2. 2. Truth table (by simple binary addition of A and B): A=0,B=0 -> SUM=0,CARRY=0; A=0,B=1 -> SUM=1,CARRY=0; A=1,B=0 -> SUM=1,CARRY=0; A=1,B=1 -> SUM=0,CARRY=1.
  3. 3. From the truth table, SUM=1 for the rows (A=0,B=1) and (A=1,B=0), giving the minterms A'B and AB'.
  4. 4. By the Sum-of-Products (SOP) rule (OR together the minterms where the output is 1): SUM = A'B + AB'.
  5. 5. From the truth table, CARRY=1 only for the row (A=1,B=1), giving the single minterm AB.
  6. 6. By the SOP rule: CARRY = AB.
  7. 7. Final result: SUM = A'B + AB' , CARRY = A.B
Q6(c)2 marks · Short answerOpen: Simplify the following expression, using Boolean laws: ( X + Z ) . ( X.Y + Y.Z'…

Answer the following in short.

Simplify the following expression, using Boolean laws: $( X + Z ) . ( X.Y + Y.Z' ) + X.Z + Y$
Show answer

Answer

$(X+Z).(X.Y+Y.Z') + X.Z + Y$ $X.Y+Y.Z' = Y.(X+Z')$ (Distributive law - factor out Y) $(X+Z).(X.Y+Y.Z') = (X+Z).Y.(X+Z') = Y.(X+Z).(X+Z')$ $(X+Z).(X+Z') = X+Z.Z' = X+0 = X$ (Distributive law, then Complement law $Z.Z'=0$, then Identity law) So $(X+Z).(X.Y+Y.Z') = Y.X = XY$ Expression becomes: $XY + XZ + Y$ $XY+Y = Y$ (Absorption law), so $XY+XZ+Y = (XY+Y)+XZ = Y+XZ$ Final simplified expression (verified with the boolean tool): $F = Y + XZ$
Q710 marks · ProgramOpen: Design a class ArmNum to check if a given number is an Armstrong number or not…

Write the program described below.

Design a class ArmNum to check if a given number is an Armstrong number or not. [A number is said to be Armstrong if sum of its digits raised to the power of length of the number is equal to the number] Example : $371 = 3^3 + 7^3 + 1^3$ $1634 = 1^4 + 6^4 + 3^4 + 4^4$ $54748 = 5^5 + 4^5 + 7^5 + 4^5 + 8^5$ Thus 371, 1634 and 54748 are all examples of Armstrong numbers. Some of the members of the class are given below: Class name : ArmNum Data members/instance variables: n : to store the number l : to store the length of the number Methods/Member functions: ArmNum (int nn) : parameterized constructor to initialize the data member n=nn int sum_pow(int i) : returns the sum of each digit raised to the power of the length of the number using recursive technique eg. 34 will return $3^2 + 4^2$ (as the length of the number is 2) void isArmstrong( ) : checks whether the given number is an Armstrong number by invoking the function sum_pow( ) and displays the result with an appropriate message Specify the class ArmNum giving details of the constructor( ), int sum_pow(int) and void isArmstrong( ). 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 ArmNum
{
    int n;
    int l;

    ArmNum(int nn)
    {
        n = nn;
        l = String.valueOf(n).length();
    }

    int sum_pow(int i)
    {
        if (i == 0)
            return 0;
        else
        {
            int digit = i % 10;
            return (int) Math.pow(digit, l) + sum_pow(i / 10);
        }
    }

    void isArmstrong()
    {
        int s = sum_pow(n);
        if (s == n)
            System.out.println(n + " is an Armstrong number.");
        else
            System.out.println(n + " is not an Armstrong number.");
    }

    public static void main(String args[])
    {
        Scanner sc = new Scanner(System.in);
        System.out.print("Enter a number: ");
        int nn = sc.nextInt();
        ArmNum obj = new ArmNum(nn);
        obj.isArmstrong();
    }
}
Explanation: the constructor stores the number n and its length l (number of digits, found via String.valueOf(n).length()). sum_pow(i) recursively strips the last digit of i at each call (i%10), raises it to the power l (the length of the original number, a fixed value throughout the recursion), and adds it to the recursive call on the remaining digits (i/10), stopping when i becomes 0. isArmstrong() compares this sum to n and prints the appropriate message. Tested (run for real): for n=371, sum_pow computes 3^3+7^3+1^3=371 and the program correctly printed "371 is an Armstrong number."
Q810 marks · ProgramOpen: Design a class MatRev to reverse each element of a matrix. Some of the members…

Write the program described below.

Design a class MatRev to reverse each element of a matrix. Some of the members of the class are given below: Class name : MatRev Data members/instance variables: arr[ ][ ] : to store integer elements m : to store the number of rows n : to store the number of columns Member functions/methods: MatRev(int mm, int nn) : parameterised constructor to initialise the data members m = mm and n = nn void fillarray( ) : to enter elements in the array int reverse(int x) : returns the reverse of the number x void revMat( MatRev P) : reverses each element of the array of the parameterized object and stores it in the array of the current object void show( ) : displays the array elements in matrix form Define the class MatRev giving details of the constructor( ), void fillarray( ), int reverse(int), void revMat(MatRev) and void show( ). Define the main( ) function to create objects and call the functions accordingly to enable the task.
Figure for this question
Show answer

Answer

import java.util.Scanner;

class MatRev
{
    int arr[][];
    int m, n;

    MatRev(int mm, int nn)
    {
        m = mm;
        n = nn;
        arr = new int[m][n];
    }

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

    int reverse(int x)
    {
        int rev = 0;
        while (x != 0)
        {
            rev = rev * 10 + x % 10;
            x = x / 10;
        }
        return rev;
    }

    void revMat(MatRev P)
    {
        for (int i = 0; i < m; i++)
            for (int j = 0; j < n; j++)
                arr[i][j] = reverse(P.arr[i][j]);
    }

    void show()
    {
        for (int i = 0; i < m; i++)
        {
            for (int j = 0; j < n; j++)
                System.out.print(arr[i][j] + "\t");
            System.out.println();
        }
    }

    public static void main(String args[])
    {
        MatRev A = new MatRev(3, 3);
        A.fillarray();
        MatRev B = new MatRev(3, 3);
        B.revMat(A);
        System.out.println("Original matrix:");
        A.show();
        System.out.println("Reversed matrix:");
        B.show();
    }
}
Explanation: reverse(x) reverses the digits of a single integer x using the standard while-loop technique. revMat(P) takes another MatRev object P as a parameter, and for every cell (i,j) stores in the current object's arr the reverse of P's corresponding element, leaving P itself unchanged. Tested (run for real) with the example matrix {{72,371,5},{12,6,426},{5,123,94}}: the program correctly produced the reversed matrix {{27,173,5},{21,6,624},{5,321,49}}, matching the example exactly.
Q910 marks · ProgramOpen: A class Rearrange has been defined to modify a word by bringing all the vowels…

Write the program described below.

A class Rearrange has been defined to modify a word by bringing all the vowels in the word at the beginning followed by the consonants. Example: ORIGINAL becomes OIIARGNL Some of the members of the class are given below: Class name : Rearrange Data member/instance variable: wrd : to store a word newwrd : to store the rearranged word Member functions/methods: Rearrange( ) : default constructor void readword( ) : to accept the word in UPPER case void freq_vow_con( ) : finds the frequency of vowels and consonants in the word and displays them with an appropriate message void arrange( ) : rearranges the word by bringing the vowels at the beginning followed by consonants void display( ) : displays the original word along with the rearranged word Specify the class Rearrange, giving the details of the constructor( ), void readword( ), void freq_vow_con( ), void arrange( ) 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 Rearrange
{
    String wrd, newwrd;

    Rearrange()
    {
        wrd = "";
        newwrd = "";
    }

    void readword()
    {
        Scanner sc = new Scanner(System.in);
        System.out.print("Enter a word in UPPER CASE: ");
        wrd = sc.nextLine();
    }

    void freq_vow_con()
    {
        int vcount = 0, ccount = 0;
        for (int i = 0; i < wrd.length(); 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 arrange()
    {
        String vowels = "";
        String consonants = "";
        for (int i = 0; i < wrd.length(); i++)
        {
            char ch = wrd.charAt(i);
            if (ch == 'A' || ch == 'E' || ch == 'I' || ch == 'O' || ch == 'U')
                vowels = vowels + ch;
            else
                consonants = consonants + ch;
        }
        newwrd = vowels + consonants;
    }

    void display()
    {
        System.out.println("Original word   : " + wrd);
        System.out.println("Rearranged word  : " + newwrd);
    }

    public static void main(String args[])
    {
        Rearrange obj = new Rearrange();
        obj.readword();
        obj.freq_vow_con();
        obj.arrange();
        obj.display();
    }
}
Explanation: freq_vow_con() scans wrd once and counts vowels and consonants, printing both counts. arrange() scans wrd character by character, appending each vowel to a separate 'vowels' string and each consonant to a 'consonants' string (preserving their original relative order within each group), then sets newwrd = vowels + consonants so all vowels come first followed by all consonants. Tested (run for real): for wrd="ORIGINAL" the program printed "Number of vowels: 4", "Number of consonants: 4", and Rearranged word "OIIARGNL", matching the example in the question exactly.
Q105 marks · ProgramOpen: A super class Record contains names and marks of the students in two different…

Write the program described below.

A super class Record contains names and marks of the students in two different single dimensional arrays. Define a sub class Highest to display the names of the students obtaining the highest mark. The details of the members of both the classes are given below: Class name : Record Data member/instance variable: n[ ] : array to store names m[ ] : array to store marks size : to store the number of students Member functions/methods: Record(int cap) : parameterized constructor to initialize the data member size = cap void readarray() : to enter elements in both the arrays void display( ) : displays the array elements Class name: Highest Data member/instance variable: ind : to store the index Member functions/methods: Highest(…) : parameterized constructor to initialize the data members of both the classes void find( ) : finds the index of the student obtaining the highest mark and assign it to ‘ind’ void display( ) : displays the array elements along with the names and marks of the students who have obtained the highest mark Assume that the super class Record has been defined. Using the concept of inheritance, specify the class Highest giving the details of the constructor(…),void find( ) and void display( ). The super class, main function and algorithm need NOT be written.
Show answer

Answer

class Highest extends Record
{
    int ind;

    Highest(int cap)
    {
        super(cap);
        ind = 0;
    }

    void find()
    {
        ind = 0;
        for (int i = 1; i < size; i++)
        {
            if (m[i] > m[ind])
                ind = i;
        }
    }

    void display()
    {
        super.display();
        find();
        System.out.println("Student(s) with the highest mark:");
        for (int i = 0; i < size; i++)
        {
            if (m[i] == m[ind])
                System.out.println(n[i] + "\t" + m[i]);
        }
    }
}
Explanation: the parameterised constructor passes cap up to the superclass via super(cap) so that Record's constructor allocates the n[] and m[] arrays of the given size, then initialises ind. find() scans the inherited marks array m[] (indices 0 to size-1) and stores in ind the index of the largest mark. display() first calls super.display() to reuse the superclass's printing of all the array elements, then calls find() and prints the name(s) and mark of the student(s) with the highest mark (handling ties, i.e. more than one student sharing the highest mark). Tested (run for real, with a small Record superclass and main added only for testing) with names/marks {AMIT:78, SUMIT:95, ROHIT:95, MOHIT:60}: the program correctly identified and printed both SUMIT and ROHIT (95) as the students with the highest mark.
Q11(a)4 marks · ProgramOpen: Specify the class Diary giving details of the functions void pushadd(String)…

Answer the following about the data structure described.

Specify the class Diary giving details of the functions void pushadd(String) and String popadd( ). Assume that the other functions have been defined. The main function and algorithm need NOT be written.
Show the case
A linear data structure enables the user to add address from rear end and remove address from front. Define a class Diary with the following details: Class name : Diary Data members / instance variables: Q[ ] : array to store the addresses size : stores the maximum capacity of the array start : to point the index of the front end end : to point the index of the rear end Member functions: Diary (int max) : constructor to initialize the data member size=max, start=0 and end=0 void pushadd(String n) : to add address in the diary from the rear end if possible, otherwise display the message “ NO SPACE” String popadd( ) : removes and returns the address from the front end of the diary if any, else returns “?????” void show( ) : displays all the addresses in the diary
Show answer

Answer

void pushadd(String n)
{
    if (end == size)
        System.out.println("NO SPACE");
    else
    {
        Q[end] = n;
        end++;
    }
}

String popadd()
{
    if (start == end)
        return "?????";
    else
    {
        String val = Q[start];
        start++;
        return val;
    }
}
Explanation: pushadd(String) checks whether end has reached size (diary full) before storing the address n at index end and incrementing end; otherwise it prints "NO SPACE". popadd() checks whether the diary is empty (start==end), returning "?????" in that case; otherwise it returns the address at index start and advances start, so addresses always leave from the front in the order they were added. Tested (run for real, capacity 3): after 3 successful pushadd calls a 4th correctly printed "NO SPACE"; popadd() correctly returned the addresses in FIFO order and finally returned "?????" once the diary was emptied.
Q11(b)1 mark · Short answerOpen: Name the entity used in the above data structure arrangement.

Answer the following about the data structure described.

Name the entity used in the above data structure arrangement.
Show answer

Answer

The entity used is a Queue (Linear Queue), which works on the FIFO (First In First Out) principle - the address added first (from the rear) is the first one removed (from the front).
Q12(a)2 marks · ProgramOpen: A linked list is formed from the objects of the class Node. The class structure…

Write the program described below.

A linked list is formed from the objects of the class Node. The class structure of the Node is given below:
class Node
{
    int num;
    Node next;
}
Write an Algorithm OR a Method to find and display the sum of even integers from an existing linked list. The method declaration is as follows: void SumEvenNode( Node str )
Show answer

Answer

Algorithm: Step 1: Start. Set a temporary pointer temp = str (the head of the list) and sum = 0. Step 2: Repeat step 3 while temp is not null. Step 3: If temp.num is even (temp.num % 2 == 0), add it to sum (sum = sum + temp.num). Move temp to temp.next. Step 4: When temp becomes null (end of list reached), display the value of sum. Step 5: Stop. Method:
void SumEvenNode(Node str)
{
    int sum = 0;
    Node temp = str;
    while (temp != null)
    {
        if (temp.num % 2 == 0)
            sum = sum + temp.num;
        temp = temp.next;
    }
    System.out.println("Sum of even integers = " + sum);
}
(Verified by running the code: for a list 3->4->7->10->5, the method correctly printed "Sum of even integers = 14", i.e. 4+10.)
Q12(b)(ii)1 mark · Binary treeOpen: State the size of the tree.

Answer the following questions from the binary tree.

State the size of the tree.
Show answer

Answer

Size of the tree (total number of nodes) = 9 (nodes A, E, B, G, C, D, I, H, F).
Q12(b)(iii)1 mark · Binary treeOpen: Name the siblings of the nodes E and G.

Answer the following questions from the binary tree.

Name the siblings of the nodes E and G.
Show answer

Answer

Sibling of E = B (both are children of the root A). Sibling of G = C (both are children of E).

About this board paper

The ISC Computer Science 2019 Question Paper is a board paper for Class 12: 32 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
Short answer911
K-map28
Long answer28
Truth table27
Drawing46
Output15
Differentiate24
Binary tree33
Numerical12

By chapter

ChapterQuestionsMarks printed*
Objects330
Boolean Algebra1223
Data structures814
Computer Hardware412
Inheritance, Interfaces and Polymorphism27
Recursion15
Arrays, Strings12
Complexity and Big O notation12

* 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 2019 Question Paper?

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

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

By number of questions: Boolean Algebra (12), Data structures (8), Computer Hardware (4) and Objects (3).

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