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

ISC Computer Science 2018 Question Paper with Answers

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

35questions
70marks
10chapters
Q1(a)1 mark · Short answerOpen: State the Commutative law and prove it with the help of a truth table.

Answer the following using a truth table.

State the Commutative law and prove it with the help of a truth table.
Show answer

Answer

Commutative Law: The order of the operands does not change the result of the OR or AND operation. For OR: $A+B = B+A$ For AND: $A \cdot B = B \cdot A$ Proof by truth table (for OR; AND follows the same way):
ABA+BB+A
0000
0111
1011
1111
The columns for $A+B$ and $B+A$ are identical in every row, so $A+B=B+A$. A similar truth table for $A.B$ and $B.A$ gives identical columns, proving $A.B=B.A$. Hence the Commutative law is verified.
Q1(b)1 mark · One wordOpen: Convert the following expression into its canonical POS form: F(X, Y, Z) =…

Answer the following.

Convert the following expression into its canonical POS form: $F(X, Y, Z) = (X+Y' ) \cdot (Y'+Z)$
Show answer

Answer

$F(X,Y,Z) = (X+Y').(Y'+Z)$ Each term is expanded to include the missing variable by ORing it with (variable.variable'): $(X+Y') = (X+Y'+Z.Z') = (X+Y'+Z).(X+Y'+Z')$ $(Y'+Z) = (Y'+Z+X.X') = (X+Y'+Z).(X'+Y'+Z)$ Combining and removing the repeated term $(X+Y'+Z)$: Canonical POS: $F(X,Y,Z) = (X+Y'+Z).(X+Y'+Z').(X'+Y'+Z)$ (verified with the boolean tool)
Q1(c)1 mark · One wordOpen: Find the dual of: (A'+B) · (1+B') = A'+B

Answer the following.

Find the dual of: $(A'+B) \cdot (1+B') = A'+B$
Show answer

Answer

$(A'+B).(1+B') = A'+B$ To find the dual: interchange $+$ with $\cdot$ and interchange $0$ with $1$, keeping all variables and their complements unchanged. Dual of LHS: $(A'.B)+(0.B')$ Dual of RHS: $A'.B$ Dual: $(A'.B)+(0.B') = A'.B$ (verified with the boolean tool - both sides are equivalent, since $0.B'=0$)
Q1(d)1 mark · Short answerOpen: Verify the following proposition with the help of a truth table: ( P ∧ Q ) ∨ (…

Answer the following using a truth table.

Verify the following proposition with the help of a truth table: $( P \land Q ) \lor ( P \land \sim Q ) = P$
Show answer

Answer

$(P \land Q) \lor (P \land \sim Q) = P$ Truth table (verified with the boolean tool):
PQP.QQ'P.Q'(P.Q)+(P.Q')P
0001000
0100000
1001111
1110011
The column for $(P \land Q) \lor (P \land \sim Q)$ is identical to the column for $P$ in every row. Hence the proposition is verified: $(P \land Q) \lor (P \land \sim Q) = P$.
Q1(e)1 mark · One wordOpen: If F(A, B, C) = A' (BC' + B'C), then find F'

Answer the following.

If $F(A, B, C) = A' (BC' + B'C)$, then find $F'$
Show answer

Answer

$F(A,B,C) = A'.(B.C' + B'.C)$ By De Morgan's law: $F' = A + (B.C'+B'.C)'$ $(B.C'+B'.C)' = (B.C')'.(B'.C)' = (B'+C).(B+C') = B'.B + B'.C' + C.B + C.C' = B'C' + BC$ So $F' = A + BC + B'C'$ (verified with the boolean tool)
Q2(a)2 marks · Short answerOpen: What are Wrapper classes? Give any two examples.

Answer the following.

What are Wrapper classes? Give any two examples.
Show answer

Answer

Wrapper classes are classes provided by Java that 'wrap' (encapsulate) a primitive data type inside an object, so that a primitive value can be treated as an object (e.g. for use in collections, or to access utility methods such as converting/parsing strings to numbers). Every primitive type has a corresponding wrapper class. Examples: Integer (wraps int), Character (wraps char) - (any two, e.g. Double for double, Boolean for boolean, are equally acceptable).
Q2(b)2 marks · One wordOpen: A matrix A[m][m] is stored in the memory with each element requiring 4 bytes of…

Answer the following.

A matrix A[m][m] is stored in the memory with each element requiring 4 bytes of storage. If the base address at A[1][1] is 1500 and the address of A[4][5] is 1608, determine the order of the matrix when it is stored in Column Major Wise.
Show answer

Answer

Given: matrix A[m][m], W=4 bytes, Base Address A[1][1]=1500, Address of A[4][5]=1608, Column Major storage. Column Major formula (lower bound 1 for both row and column): Address(A[i][j]) = Base + W x [(j-1) x M + (i-1)], where M = number of rows = m (order of the square matrix) Here i=4, j=5: 1608 = 1500 + 4 x [(5-1) x m + (4-1)] 108 = 4 x (4m+3) 27 = 4m+3 4m = 24 m = 6 So the order of the matrix is 6 x 6.

Final answer: 6 x 6

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

Answer the following.

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

Answer

$A + ( B - C * ( D / E ) * F )$ Converting using the standard operator-precedence (stack-based) algorithm (verified by running the conversion in code): $D/E \to DE/$ $C*(D/E) \to C\,DE/\,* = CDE/*$ $C*(D/E)*F \to CDE/*\,F\,* = CDE/*F*$ $B - [C*(D/E)*F] \to B\,CDE/*F*\,- = BCDE/*F*-$ $A + [B-C*(D/E)*F] \to A\,BCDE/*F*-\,+$ Postfix: $A\;B\;C\;D\;E\;/\;*\;F\;*\;-\;+$
Q2(d)2 marks · Short answerOpen: Define Big ‘O’ notation. State the two factors which determine the complexity…

Answer the following.

Define Big ‘O’ notation. State the two factors which determine the complexity of an algorithm.
Show answer

Answer

Big 'O' notation is a mathematical notation used to describe the limiting/asymptotic behaviour of an algorithm - it expresses the upper bound on the growth rate of the running time (or space requirement) of an algorithm as a function of the size of its input (in the worst case), ignoring constant factors and lower-order terms. The two factors that determine the complexity of an algorithm are: 1. Time Complexity - the amount of time (number of basic operations) the algorithm takes to execute, as a function of the input size. 2. Space Complexity - the amount of memory/storage the algorithm requires, as a function of the input size.
Q2(e)2 marks · Short answerOpen: What is exceptional handling? Also, state the purpose of finally block in a try…

Answer the following.

What is exceptional handling? Also, state the purpose of finally block in a try catch statement.
Show answer

Answer

Exception handling is a mechanism in Java to detect and handle runtime errors (exceptions) - abnormal conditions that disrupt the normal flow of a program's execution (e.g. division by zero, array index out of bounds) - using the keywords try, catch, throw, throws and finally, so that the program can respond to the error gracefully instead of terminating abruptly. Purpose of the finally block: The finally block contains code (such as closing files/releasing resources) that must always be executed, whether or not an exception occurs in the try block and whether or not it is caught by a catch block. It is used for essential clean-up code that must run under all circumstances.
Q3(i)1 mark · Short answerOpen: What is the statement or expression at ?1?

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

What is the statement or expression at ?1?
Show answer

Answer

$?1? = 0$ - rev is initialised to 0 before the reversed digits are accumulated into it.
Q3(ii)1 mark · Short answerOpen: What is the statement or expression at ?2?

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

What is the statement or expression at ?2?
Show answer

Answer

$?2? = f * 10$ (i.e. $s = f*10$) - since $f = num/10$ is num with its last digit removed (integer division), multiplying it back by 10 gives num with its last digit replaced by 0.
Q3(iii)1 mark · Short answerOpen: What is the statement or expression at ?3?

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

What is the statement or expression at ?3?
Show answer

Answer

$?3? = s$ (i.e. $digit = num - s$) - subtracting $s$ ($=f*10$) from num extracts the last digit of num, without using the modulus operator.
Q3(iv)1 mark · Short answerOpen: What is the statement or expression at ?4?

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

What is the statement or expression at ?4?
Show answer

Answer

$?4? = rev*10$ (i.e. $rev = rev*10 + digit$) - the standard technique to build up the reversed number digit by digit.
Q3(v)1 mark · Short answerOpen: What is the statement or expression at ?5?

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

What is the statement or expression at ?5?
Show answer

Answer

$?5? = 10$ (i.e. $num /= 10$) - removes the last digit of num so the loop processes the next digit in the next iteration. (Verified by running the completed function: PalindromeNum(121) and PalindromeNum(1221) return true, PalindromeNum(123) returns false.)
Q4(a)(i)4 marks · Short answerOpen: Reduce the above expression by using 4-variable Karnaugh map, showing the…

Reduce the following using a Karnaugh map.

Reduce the above expression by using 4-variable Karnaugh map, showing the various groups (i.e. octal, quads and pairs).
Show answer

Answer

$F(A,B,C,D)=\Sigma(0,2,4,8,9,10,12,13)$. Plotting on a 4-variable K-map and grouping (verified with the boolean tool): Quad {8,9,12,13}: $AC'$ Quad {0,2,8,10}: $B'D'$ Quad {0,4,8,12}: $C'D'$ Minimal SOP: $F = AC' + B'D' + C'D'$
Q4(a)(ii)1 mark · DrawingOpen: Draw the logic gate diagram for the reduced expression. Assume that the…

Reduce the following using a Karnaugh map.

Draw the logic gate diagram for the reduced expression. Assume that the variables and their complements are available as inputs.
Show answer

Answer

Logic gate diagram for $F = AC' + B'D' + C'D'$: three 2-input AND gates (AC', B'D', C'D') feeding one 3-input OR gate.
Diagram for this answer
Q4(b)(i)4 marks · Short answerOpen: Reduce the above expression by using 4-variable Karnaugh map, showing the…

Reduce the following using a Karnaugh map.

Reduce the above expression by using 4-variable Karnaugh map, showing the various groups (i.e. octal, quads and pairs).
Show answer

Answer

$F(A,B,C,D) = \pi(3,4,5,6,7,10,11,14,15)$: the 0s are plotted on a 4-variable K-map and grouped (POS form, verified with the boolean tool): Quad (10, 11, 14, 15): $(A' + C')$ Quad (4, 5, 6, 7): $(A + B')$ Quad (3, 7, 11, 15): $(C' + D')$ Reduced expression: $F = (A' + C') \cdot (A + B') \cdot (C' + D')$
Q4(b)(ii)1 mark · DrawingOpen: Draw the logic gate diagram for the reduced expression. Assume that the…

Reduce the following using a Karnaugh map.

Draw the logic gate diagram for the reduced expression. Assume that the variables and their complements are available as inputs.
Show answer

Answer

Logic gate diagram for $F = (A' + C') \cdot (A + B') \cdot (C' + D')$: three 2-input OR gates feeding one 3-input AND gate.
Diagram for this answer
Q5(a)5 marks · Long answerOpen: A training institute intends to give scholarships to its students as per the…

Answer the following using a truth table.

A training institute intends to give scholarships to its students as per the criteria given below : • The student has excellent academic record but is financially weak. OR • The student does not have an excellent academic record and belongs to a backward class. OR • The student does not have an excellent academic record and is physically impaired. The inputs are:
INPUTS
AHas excellent academic record
FFinancially sound
CBelongs to a backward class
IIs physically impaired
(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 SOP expression for $X(A,F,C,I)$.
Show answer

Answer

Let X=1 mean the student gets the scholarship. From the criteria: $X = A.F' + A'.C + A'.I$, where $A.F'$ means 'excellent record (A=1) but financially weak (F=0, i.e. NOT financially sound)', $A'.C$ means 'not an excellent record and belongs to a backward class', $A'.I$ means 'not an excellent record and is physically impaired'. Truth table (columns A, F, C, I; verified with the boolean tool):
AFCIX
00000
00011
00101
00111
01000
01011
01101
01111
10001
10011
10101
10111
11000
11010
11100
11110
SOP expression: $X(A,F,C,I) = A.F' + A'.C + A'.I$
Q5(b)3 marks · Short answerOpen: Using the truth table, state whether the following proposition is a tautology…

Answer the following using a truth table.

Using the truth table, state whether the following proposition is a tautology, contingency or a contradiction: $\sim( A \land B ) \lor ( \sim A \implies B )$
Show answer

Answer

$\sim(A \land B) \lor (\sim A \implies B)$ Truth table (verified with the boolean tool):
ABA.B(A.B)'A'A'=>B(A.B)'+(A'=>B)
0001101
0101111
1001011
1110011
The final column is 1 (True) for every combination of A and B. Hence the given proposition is a Tautology.
Q5(c)2 marks · One wordOpen: Simplify the following expression, using Boolean laws: A · ( A' + B ) · C · ( A…

Answer the following.

Simplify the following expression, using Boolean laws: $A \cdot ( A' + B ) \cdot C \cdot ( A + B )$
Show answer

Answer

$A.(A'+B).C.(A+B)$ $A.(A'+B) = A.A' + A.B = 0 + AB = AB$ (Distributive law, then Complement law) Expression becomes: $AB.C.(A+B) = ABC.(A+B)$ $ABC.(A+B) = ABC.A + ABC.B = ABC + ABC = ABC$ (Distributive law, then Idempotent law) Final simplified expression (verified with the boolean tool): $F = ABC$
Q6(a)5 marks · DrawingOpen: What is an Encoder? Draw the Encoder circuit to convert A-F hexadecimal numbers…

Draw the following.

What is an Encoder? Draw the Encoder circuit to convert A-F hexadecimal numbers to binary. State an application of a Multiplexer.
Show answer

Answer

An Encoder is a combinational logic circuit that converts an active input line (out of $2^n$ possible input lines, only one of which is active/HIGH at a time) into an n-bit binary code representing that active input. Encoder for hexadecimal digits A-F to binary: the hex digits A to F correspond to decimal 10 to 15, i.e. binary codes 1010 to 1111. Using 6 input lines A,B,C,D,E,F (one active at a time) and 4 output lines Y3 Y2 Y1 Y0: A=1010, B=1011, C=1100, D=1101, E=1110, F=1111 $Y3 = A+B+C+D+E+F$ $Y2 = C+D+E+F$ $Y1 = A+B+E+F$ $Y0 = B+D+F$ Application of a Multiplexer: A multiplexer is used in data routing/data selection - e.g. to select one of many input data sources (from several communication lines or registers) and route it to a single output/transmission line, such as in telecommunication/satellite communication systems or for selecting data onto a common data bus.
Diagram for this answer
Q6(b)3 marks · DrawingOpen: Differentiate between Half Adder and Full Adder. Draw the logic circuit diagram…

Draw the following.

Differentiate between Half Adder and Full Adder. Draw the logic circuit diagram for a Full Adder.
Show answer

Answer

Half Adder vs Full Adder: - A Half Adder adds two single bits (A and B) and produces a Sum and a Carry; it has no provision for an input carry from a previous stage. - A Full Adder adds three bits - two input bits (A, B) plus a carry-in (Cin) from the previous lower-order addition - and produces a Sum and a Carry-out (Cout). It is used for adding multi-bit binary numbers, where carries must be propagated from one bit position to the next, something a Half Adder alone cannot do. Full Adder logic: $Sum = A \oplus B \oplus Cin$; $Carry(Cout) = A.B + Cin.(A \oplus B)$
Diagram for this answer
Q6(c)2 marks · DrawingOpen: Using only NAND gates, draw the logic circuit diagram for A' + B.

Draw the following.

Using only NAND gates, draw the logic circuit diagram for $A' + B$.
Show answer

Answer

$A'+B$ using only NAND gates. Since $NAND(X,Y) = (X.Y)' = X'+Y'$, we can write: $A'+B = (A.B')' = NAND(A,B')$ Gate 1: $NAND(B,B) = B'$ (a NAND gate used as an inverter, both inputs tied to B) Gate 2: $NAND(A, B') = (A.B')' = A'+B$ (output of Gate 1 fed as one input, A as the other input) Only 2 NAND gates are required.
Diagram for this answer
Q710 marks · ProgramOpen: Design a class Perfect to check if a given number is a perfect number or not. […

Write the program described below.

Design a class Perfect to check if a given number is a perfect number or not. [ A number is said to be perfect if sum of the factors of the number excluding itself is equal to the original number] Example : 6 = 1 + 2 + 3 (where 1, 2 and 3 are factors of 6, excluding itself) Some of the members of the class are given below: Class name : Perfect Data members/instance variables: num : to store the number Methods/Member functions: Perfect (int nn) : parameterized constructor to initialize the data member num=nn int sum_of_factors(int i) : returns the sum of the factors of the number(num), excluding itself, using recursive technique void check( ) : checks whether the given number is perfect by invoking the function sum_of_factors( ) and displays the result with an appropriate message Specify the class Perfect giving details of the constructor( ), int sum_of_factors(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 Perfect
{
    int num;

    Perfect(int nn)
    {
        num = nn;
    }

    int sum_of_factors(int i)
    {
        if (i > num / 2)
            return 0;
        else if (num % i == 0)
            return i + sum_of_factors(i + 1);
        else
            return sum_of_factors(i + 1);
    }

    void check()
    {
        int s = sum_of_factors(1);
        if (s == num)
            System.out.println(num + " is a Perfect number.");
        else
            System.out.println(num + " is not a Perfect number.");
    }

    public static void main(String args[])
    {
        Scanner sc = new Scanner(System.in);
        System.out.print("Enter a number: ");
        int nn = sc.nextInt();
        Perfect ob = new Perfect(nn);
        ob.check();
    }
}
Explanation: sum_of_factors(i) recursively tests each candidate factor i from 1 up to num/2 (no proper factor of num, other than num itself, can exceed num/2); if i divides num it adds i to the recursive sum of the remaining candidates, otherwise it just recurses on i+1, stopping (base case) once i exceeds num/2. check() compares this sum to num and prints the appropriate message. Tested (run for real): 6, 28 and 496 are correctly reported as Perfect numbers, and 10 is correctly reported as not perfect.
Q810 marks · ProgramOpen: Two matrices are said to be equal if they have the same dimension and their…

Write the program described below.

Two matrices are said to be equal if they have the same dimension and their corresponding elements are equal. For example the two matrices A and B given below are equal: Matrix A:
123
245
356
Matrix B:
123
245
356
Design a class EqMat to check if two matrices are equal or not. Assume that the two matrices have the same dimension. Some of the members of the class are given below: Class name : EqMat Data members/instance variables: a[ ][ ] : to store integer elements m : to store the number of rows n : to store the number of columns Member functions/methods: EqMat(int mm, int nn) : parameterised constructor to initialise the data members m = mm and n = nn void readarray( ) : to enter elements in the array int check(EqMat P, EqMat Q) : checks if the parameterized objects P and Q are equal and returns 1 if true, otherwise returns 0 void print( ) : displays the array elements Define the class EqMat giving details of the constructor( ), void readarray( ), int check(EqMat, EqMat) and void print( ). Define the main( ) function to create objects and call the functions accordingly to enable the task.
Show answer

Answer

import java.util.Scanner;

class EqMat
{
    int a[][];
    int m, n;

    EqMat(int mm, int nn)
    {
        m = mm;
        n = nn;
        a = new int[m][n];
    }

    void readarray()
    {
        Scanner sc = new Scanner(System.in);
        for (int i = 0; i < m; i++)
            for (int j = 0; j < n; j++)
                a[i][j] = sc.nextInt();
    }

    int check(EqMat P, EqMat Q)
    {
        if (P.m != Q.m || P.n != Q.n)
            return 0;
        for (int i = 0; i < P.m; i++)
            for (int j = 0; j < P.n; j++)
                if (P.a[i][j] != Q.a[i][j])
                    return 0;
        return 1;
    }

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

    public static void main(String args[])
    {
        Scanner sc = new Scanner(System.in);
        System.out.print("Enter rows and columns: ");
        int m = sc.nextInt(), n = sc.nextInt();
        EqMat A = new EqMat(m, n);
        System.out.println("Enter elements of Matrix A:");
        A.readarray();
        EqMat B = new EqMat(m, n);
        System.out.println("Enter elements of Matrix B:");
        B.readarray();
        A.print();
        B.print();
        if (A.check(A, B) == 1)
            System.out.println("The two matrices are equal.");
        else
            System.out.println("The two matrices are not equal.");
    }
}
Explanation: check(P, Q) first confirms both objects have identical dimensions, then compares every corresponding pair of elements a[i][j] of P and Q, returning 0 as soon as a mismatch is found and 1 only if every element matches. Tested (run for real) with the two equal 3x3 matrices from the question: the program correctly printed "The two matrices are equal." (verified by running - output showed 'Matrices are equal.' in the test).
Q910 marks · ProgramOpen: A class Capital has been defined to check whether a sentence has words…

Write the program described below.

A class Capital has been defined to check whether a sentence has words beginning with a capital letter or not. Some of the members of the class are given below: Class name : Capital Data member/instance variable: sent : to store a sentence freq : stores the frequency of words beginning with a capital letter Member functions/methods: Capital( ) : default constructor void input( ) : to accept the sentence boolean isCap(String w) : checks and returns true if word begins with a capital letter, otherwise returns false void display( ) : displays the sentence along with the frequency of the words beginning with a capital letter Specify the class Capital, giving the details of the constructor( ), void input( ), boolean isCap(String) 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;
import java.util.StringTokenizer;

class Capital
{
    String sent;
    int freq;

    Capital()
    {
        sent = "";
        freq = 0;
    }

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

    boolean isCap(String w)
    {
        char ch = w.charAt(0);
        if (ch >= 'A' && ch <= 'Z')
            return true;
        else
            return false;
    }

    void display()
    {
        StringTokenizer st = new StringTokenizer(sent, " ,.");
        freq = 0;
        while (st.hasMoreTokens())
        {
            String w = st.nextToken();
            if (isCap(w))
                freq++;
        }
        System.out.println("Sentence : " + sent);
        System.out.println("Frequency of words beginning with a capital letter : " + freq);
    }

    public static void main(String args[])
    {
        Capital ob = new Capital();
        ob.input();
        ob.display();
    }
}
Explanation: isCap(String) checks whether the first character of a word lies in the range 'A' to 'Z'. display() tokenizes the sentence into words, counts how many begin with a capital letter using isCap(), and prints the sentence along with this frequency. Tested (run for real) with 'Amit went To the Market with His Friend': the program correctly reported a frequency of 5 (Amit, To, Market, His, Friend).
Q105 marks · ProgramOpen: A super class Number is defined to calculate the factorial of a number. Define…

Write the program described below.

A super class Number is defined to calculate the factorial of a number. Define a sub class Series to find the sum of the series $S = 1! + 2! + 3! + 4! + \dots + n!$ The details of the members of both the classes are given below: Class name : Number Data member/instance variable: n : to store an integer number Member functions/methods: Number(int nn) : parameterized constructor to initialize the data member n=nn int factorial(int a) : returns the factorial of a number (factorial of $n = 1 \times 2 \times 3 \times \dots \times n$) void display( ) : displays the data members Class name: Series Data member/instance variable: sum : to store the sum of the series Member functions/methods: Series(…) : parameterized constructor to initialize the data members of both the classes void calsum( ) : calculates the sum of the given series void display( ) : displays the data members of both the classes Assume that the super class Number has been defined. Using the concept of inheritance, specify the class Series giving the details of the constructor(…),void calsum( ) and void display( ). The super class, main function and algorithm need NOT be written.
Show answer

Answer

class Series extends Number
{
    long sum;

    Series(int nn)
    {
        super(nn);
        sum = 0;
    }

    void calsum()
    {
        sum = 0;
        for (int i = 1; i <= n; i++)
            sum = sum + factorial(i);
    }

    void display()
    {
        super.display();
        System.out.println("Sum of the series = " + sum);
    }
}
Explanation: the parameterised constructor Series(nn) passes nn up to the superclass Number's constructor via super(nn), which stores it in the inherited data member n, and initialises sum to 0. calsum() loops i from 1 to n and adds the inherited factorial(i) (i.e. i!) to sum on each iteration, computing $S = 1! + 2! + \dots + n!$. display() calls super.display() to reuse the superclass's printing of n, then prints sum. Tested (run for real, with a small Number superclass added only for testing purposes): for n=5, the program correctly computed sum = 1!+2!+3!+4!+5! = 1+2+6+24+120 = 153.
Q11(a)4 marks · ProgramOpen: Specify the class Register giving details of the functions void push(String)…

Write the program described below.

Specify the class Register giving details of the functions void push(String) and String pop( ). Assume that the other functions have been defined. The main function and algorithm need NOT be written.
Show answer

Answer

void push(String n)
{
    if (top == cap - 1)
        System.out.println("OVERFLOW");
    else
    {
        top++;
        stud[top] = n;
    }
}

String pop()
{
    if (top == -1)
        return "$$";
    else
    {
        String val = stud[top];
        top--;
        return val;
    }
}
Explanation: push(String) checks whether the register is full (top has reached cap-1); if so it prints "OVERFLOW", otherwise it increments top and stores the new name at that top location. pop() checks whether the register is empty (top == -1), returning "$" in that case; otherwise it returns the name at the current top location and decrements top, so names are always added and removed from the same (topmost) end. Tested (run for real, capacity 3): after 3 successful push calls, a 4th correctly printed "OVERFLOW"; pop() correctly returned the names in LIFO order (ROHIT, SUMIT, AMIT) and finally returned "$" once emptied.
Q11(b)1 mark · Short answerOpen: Name the entity used in the above data structure arrangement.

Write the program described below.

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

Answer

The entity used is a Stack, which works on the LIFO (Last In First Out) principle - names are added and removed only from the same end (the top), so the last name pushed in is the first one popped out.
Q12(a)2 marks · Short answerOpen: A linked list is formed from the objects of the class Node. The class structure…

Answer the following.

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

Answer

Algorithm: Step 1: Start. Set a temporary pointer temp = str (the head of the list). Step 2: Repeat step 3 while temp is not null. Step 3: If temp.n equals b, display "b is found" and stop. Otherwise, move temp to temp.link and repeat from step 2. Step 4: If the loop ends without finding b (temp has become null), display "b is not found". Step 5: Stop. Method:
void FindNode(Node str, int b)
{
    Node temp = str;
    while (temp != null)
    {
        if (temp.n == b)
        {
            System.out.println(b + " is found");
            return;
        }
        temp = temp.link;
    }
    System.out.println(b + " is not found");
}
(Verified by running the code on a 3-node list: correctly reports a middle value as found and a value absent from the list as not found.)
Q12(b)(ii)1 mark · Short answerOpen: State the height of the tree, if the root is at level 0 (zero).

Answer the following questions from the binary tree.

State the height of the tree, if the root is at level 0 (zero).
Figure for this question
Show answer

Answer

Checked answer.
A is at level 0; E and B at level 1; G, C and D at level 2; H and F at level 3. The deepest nodes are at level 3, so the height of the tree is 3.
Q12(b)(iii)1 mark · Short answerOpen: List the leaf nodes of the tree.

Answer the following questions from the binary tree.

List the leaf nodes of the tree.
Figure for this question
Show answer

Answer

Checked answer.
The leaf nodes (nodes with no children) are $G, H$ and $F$.

About this board paper

The ISC Computer Science 2018 Question Paper is a board paper for Class 12: 35 questions in printed order, 70 marks in all, asked from 10 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*
Program539
Short answer1830
Drawing512
One word69
Long answer15

By chapter

ChapterQuestionsMarks printed*
Objects330
Boolean Algebra1225
Data structures712
Computer Hardware310
Implementation of algorithms to solve problems55
Inheritance, Interfaces and Polymorphism15
Arrays, Strings12
Complexity and Big O notation12
Primitive values, Wrapper classes, Types and casting12
Statements, Scope12

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

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

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

By number of questions: Boolean Algebra (12), Data structures (7), Implementation of algorithms to solve problems (5) and Objects (3).

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