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

ISC Computer Science 2017 Question Paper with Answers

The ISC Computer Science 2017 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 · Truth tableOpen: State the law represented by the following proposition and prove it with the…

Answer the following using a truth table.

State the law represented by the following proposition and prove it with the help of a truth table:
Show answer

Answer

PP ∨ PP ∨ P <=> P
001
111
It is the Idempotent law (for OR): $P + P = P$. The columns for $P \lor P$ and $P$ are the same in both rows, so $P \lor P = P$ is proved.
Q1(b)1 mark · Short answerOpen: State the Principle of Duality.

Answer the following question.

State the Principle of Duality.
Show answer

Answer

Principle of Duality: if a Boolean equation or theorem is true, then its dual is also true. The dual is obtained by interchanging every OR (+) with AND (.) and every 0 with 1, while the variables (and their complements) are left unchanged. Example: $A + 0 = A$ has the dual $A \cdot 1 = A$.
Q1(c)1 mark · Short answerOpen: Find the complement of the following Boolean expression using De Morgan’s law…

Answer the following question.

Find the complement of the following Boolean expression using De Morgan’s law: $F(a,b,c) = (b' + c) + a$
Show answer

Answer

$F' = a'bc'$ $F = (b' + c) + a$ $F' = [(b' + c) + a]' = (b' + c)' \cdot a'$ (De Morgan's law) $= (b'' \cdot c') \cdot a' = b \cdot c' \cdot a'$ (De Morgan's law, involution law) So $F' = a'bc'$ (verified with the boolean tool).
Q1(d)1 mark · DrawingOpen: Draw the logic diagram and truth table for a 2 input XNOR gate.

Draw the following.

Draw the logic diagram and truth table for a 2 input XNOR gate.

Draw: Logic diagram and truth table for a 2-input XNOR gate

Show answer

Answer

A 2-input XNOR gate gives output 1 when both inputs are equal: $F = A \odot B = AB + A'B' = (A \oplus B)'$. Logic diagram: the XOR gate symbol with a small bubble (NOT) at its output, inputs A and B, output F. Truth table:
ABF
001
010
100
111
Diagram for this answer
Q1(e)(i)0.5 marks · Short answerOpen: If (~ P ⇒ Q) then write its inverse.

Answer the following question.

If $(\sim P \implies Q)$ then write its inverse.
Show answer

Answer

Given $\sim P \Rightarrow Q$. Inverse: negate both the antecedent and the consequent. Inverse: $\sim(\sim P) \Rightarrow \sim Q$, i.e. $P \Rightarrow \sim Q$.
Q1(e)(ii)0.5 marks · Short answerOpen: If (~ P ⇒ Q) then write its converse.

Answer the following question.

If $(\sim P \implies Q)$ then write its converse.
Show answer

Answer

Converse: interchange the antecedent and the consequent of $\sim P \Rightarrow Q$. Converse: $Q \Rightarrow \sim P$.
Q2(a)2 marks · Short answerOpen: What is an interface? How is it different from a class?

Answer the following question.

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 method declarations (no method bodies) and constants (public static final fields). It specifies what a class must do, and any class that implements it (using the keyword implements) must define all its methods. Difference from a class: a class contains data members and complete method definitions and can be instantiated with new, whereas an interface has no instance variables, no method bodies and cannot be instantiated. A class can inherit from only one class (extends) but can implement many interfaces, so interfaces give a form of multiple inheritance.
Q2(c)2 marks · NumericalOpen: A matrix P[15][10] is stored with each element requiring 8 bytes of storage. If…

Answer the following question.

A matrix $P[15][10]$ is stored with each element requiring 8 bytes of storage. If the base address at $P[0][0]$ is 1400, determine the address at $P[10][7]$ when the matrix is stored in Row Major Wise.
Show answer

Answer

Row Major: $Address(P[i][j]) = B + W[(i - L_r) \times N + (j - L_c)]$, with $B = 1400$, $W = 8$ bytes, $N = 10$ columns, $L_r = L_c = 0$. $Address(P[10][7]) = 1400 + 8[(10 - 0) \times 10 + (7 - 0)]$ $= 1400 + 8 \times 107 = 1400 + 856$

Final answer: 2256

Q2(d)(i)1 mark · Short answerOpen: What is the worst case complexity of the code segment?

Answer the following question.

What is the worst case complexity of the code segment?
Show the code
for (int x = 1; x <= a; x++)
{
    statements;
}
for (int y = 1; y <= b; y++)
{
    for (int z = 1; z <= c; z++)
    {
        statements;
    }
}
Show answer

Answer

$O(a + b \times c)$ The first loop runs a times and the nested loops run b x c times; the two segments are sequential, so their costs add.
Q2(e)2 marks · DifferentiateOpen: Differentiate between a constructor and a method of a class.

Differentiate between the following.

Differentiate between a constructor and a method of a class.
Show answer

Answer

1. A constructor has the same name as the class and no return type (not even void); a method has any valid name and must have a return type (or void). 2. A constructor is invoked automatically when an object is created with new and is used to initialise the data members; a method is invoked explicitly by the object (object.method()) and performs an operation on the data.
Q35 marks · OutputOpen: The following function magicfun() is a part of some class. What will the…

What is the output of the following code?

The following function magicfun() is a part of some class. What will the function magicfun() return, when the value of $n=7$ and $n=10$, respectively? Show the dry run/working:
int magicfun(int n)
{
    if (n == 0)
        return 0;
    else
        return magicfun(n / 2) * 10 + (n % 2);
}
Show answer

Answer

The function returns the binary equivalent of n (written as a decimal number). Verified by running the code: magicfun(7) = 111 and magicfun(10) = 1010. Dry run for n = 7: magicfun(7) = magicfun(3)*10 + 7%2 = magicfun(3)*10 + 1 magicfun(3) = magicfun(1)*10 + 3%2 = magicfun(1)*10 + 1 magicfun(1) = magicfun(0)*10 + 1%2 = magicfun(0)*10 + 1 magicfun(0) = 0 (base case) Unwinding: magicfun(1) = 0*10 + 1 = 1; magicfun(3) = 1*10 + 1 = 11; magicfun(7) = 11*10 + 1 = 111 Return value for n = 7: 111 Dry run for n = 10: magicfun(10) = magicfun(5)*10 + 10%2 = magicfun(5)*10 + 0 magicfun(5) = magicfun(2)*10 + 5%2 = magicfun(2)*10 + 1 magicfun(2) = magicfun(1)*10 + 2%2 = magicfun(1)*10 + 0 magicfun(1) = magicfun(0)*10 + 1 = 1 Unwinding: magicfun(2) = 1*10 + 0 = 10; magicfun(5) = 10*10 + 1 = 101; magicfun(10) = 101*10 + 0 = 1010 Return value for n = 10: 1010
Q4(a)(i)4 marks · K-mapOpen: 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 the extract
Given the Boolean function $F(A, B, C, D) = \Sigma (2, 3, 4, 5, 6, 7, 8, 10, 11)$.
Show answer

Answer

Groups: (4, 5, 6, 7) → A'B; (2, 3, 10, 11) → B'C; (8, 10) → AB'D'

Reduced expression: F = A'B + B'C + AB'D'

Quad ($m_4, m_5, m_6, m_7$): $A'B$ Quad ($m_2, m_3, m_{10}, m_{11}$): $B'C$ Pair ($m_8, m_{10}$): $AB'D'$ Hence $F(A,B,C,D) = A'B + B'C + AB'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.

Draw: Logic gate diagram for the reduced expression

Show answer

Answer

Logic gate diagram for $F = A'B + B'C + AB'D'$: three AND gates with inputs (A', B), (B', C) and (A, B', D') feed one 3-input OR gate whose output is F. The complemented inputs A', B', D' are taken directly as inputs.
Diagram for this answer
Q4(b)(i)4 marks · K-mapOpen: 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 the extract
Given the Boolean function $F(P, Q, R, S) = \pi(0, 1, 2, 4, 5, 6, 8, 10)$.
Show answer

Answer

Groups: (0, 1, 4, 5) → (P + R); (0, 2, 4, 6) → (P + S); (0, 2, 8, 10) → (Q + S)

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

The 0s are grouped (POS): Quad ($M_0, M_1, M_4, M_5$): $(P + R)$ Quad ($M_0, M_2, M_4, M_6$): $(P + S)$ Quad ($M_0, M_2, M_8, M_{10}$): $(Q + S)$ Hence $F(P,Q,R,S) = (P + R)(P + S)(Q + S)$
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.

Draw: Logic gate diagram for the reduced expression

Show answer

Answer

Logic gate diagram for $F = (P + R)(P + S)(Q + S)$: three 2-input OR gates with inputs (P, R), (P, S) and (Q, S) feed one 3-input AND gate whose output is F.
Diagram for this answer
Q5(a)5 marks · Truth tableOpen: A school intends to select candidates for an Inter-School Essay Competition as…

Answer the following using a truth table.

A school intends to select candidates for an Inter-School Essay Competition as per the criteria given below: • The student has participated in an earlier competition and is very creative. OR • The student is very creative and has excellent general awareness, but has not participated in any competition earlier. OR • The student has excellent general awareness and has won prize in an inter-house competition. The inputs are:
INPUTS
Aparticipated in a competition earlier
Bis very creative
Cwon prize in an inter-house competition
Dhas excellent general awareness
(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(A, B, C, D)$.
Show answer

Answer

ABCDX
00000
00010
00100
00111
01000
01011
01100
01111
10000
10010
10100
10111
11001
11011
11101
11111

POS: (A+B+C+D)(A+B+C+D')(A+B+C'+D)(A+B'+C+D)(A+B'+C'+D)(A'+B+C+D)(A'+B+C+D')(A'+B+C'+D)

From the criteria, $X = AB + A'BD + CD$. X is 0 in rows 0, 1, 2, 4, 6, 8, 9 and 10. POS expression: $X(A,B,C,D) = \Pi(0,1,2,4,6,8,9,10)$ $= (A+B+C+D)(A+B+C+D')(A+B+C'+D)(A+B'+C+D)(A+B'+C'+D)(A'+B+C+D)(A'+B+C+D')(A'+B+C'+D)$
Q5(b)3 marks · DrawingOpen: State the application of a Half Adder. Draw the truth table and circuit diagram…

Draw the following.

State the application of a Half Adder. Draw the truth table and circuit diagram for a Half Adder.

Draw: Circuit diagram for a Half Adder

Show answer

Answer

Application: a Half Adder adds two single-bit binary numbers and gives a Sum bit and a Carry bit; it is the basic building block of adders (a Full Adder is made from two Half Adders) and of the arithmetic circuits in the ALU. It cannot take a carry-in from a previous stage. Truth table:
ABSumCarry
0000
0110
1010
1101
$Sum = A \oplus B = A'B + AB'$ and $Carry = A \cdot B$. Circuit diagram: inputs A and B go to an XOR gate (output Sum) and to an AND gate (output Carry).
Diagram for this answer
Q5(c)2 marks · ConversionOpen: Convert the following Boolean expression into its canonical POS form: F(A, B…

Convert the following notation as directed.

Convert the following Boolean expression into its canonical POS form: $F(A, B, C) = (B + C') \cdot (A' + B)$
Show answer

Answer

$F(A,B,C) = (B + C') \cdot (A' + B)$. Add the missing variable to each term using $X \cdot X' = 0$: $(B + C') = (B + C' + A \cdot A') = (A + B + C') \cdot (A' + B + C')$ $(A' + B) = (A' + B + C \cdot C') = (A' + B + C) \cdot (A' + B + C')$ Combining and removing the repeated term $(A' + B + C')$: $F(A,B,C) = (A + B + C') \cdot (A' + B + C) \cdot (A' + B + C')$ $= \pi(1, 4, 5)$ (verified with the boolean tool).
Q6(a)5 marks · DrawingOpen: What is a Multiplexer? How is it different from a decoder? Draw the circuit…

Draw the following.

What is a Multiplexer? How is it different from a decoder? Draw the circuit diagram for an 8:1 Multiplexer.

Draw: Circuit diagram for an 8:1 Multiplexer

Show answer

Answer

Multiplexer: a combinational circuit that has $2^n$ data input lines, n select (control) lines and a single output. It selects one of the data inputs, according to the select lines, and passes it to the output (many-to-one, a data selector). Difference from a decoder: a decoder has n input lines and $2^n$ output lines, has no data inputs, and activates exactly one output line for each input combination (one-to-many); a multiplexer has $2^n$ data inputs with select lines and only one output line that carries the selected data. 8:1 Multiplexer: 8 data inputs D0 to D7, 3 select lines S2 S1 S0 and one output Y. $Y = S_2'S_1'S_0'D_0 + S_2'S_1'S_0D_1 + S_2'S_1S_0'D_2 + S_2'S_1S_0D_3 + S_2S_1'S_0'D_4 + S_2S_1'S_0D_5 + S_2S_1S_0'D_6 + S_2S_1S_0D_7$ Circuit: eight 4-input AND gates (each data input with one select combination) feed one 8-input OR gate giving Y.
Diagram for this answer
Q6(b)3 marks · DerivationOpen: Prove the Boolean expression using Boolean laws. Also, mention the law used at…

Prove the following using Boolean laws.

Prove the Boolean expression using Boolean laws. Also, mention the law used at each step. $F = (x' + z) + [(y' + z) \cdot (x' + y)]' = 1$

Given: $(x' + z) + [(y' + z) \cdot (x' + y)]'$

To show: 1

Show answer

Answer

To prove: $(x' + z) + [(y' + z) \cdot (x' + y)]' = 1$. Verified with the boolean tool: the expression is a tautology (always 1).
  1. Start: $(x' + z) + [(y' + z) \cdot (x' + y)]'$
  2. $= (x' + z) + (y' + z)' + (x' + y)'$ (De Morgan's law on the complement of the product)
  3. $= x' + z + yz' + xy'$ (De Morgan's law on each complemented sum, and involution law $y'' = y$, $x'' = x$)
  4. $= x' + z + y + xy'$ (Absorption/redundancy law: $z + yz' = z + y$)
  5. $= x' + y' + z + y$ (Absorption/redundancy law: $x' + xy' = x' + y'$)
  6. $= x' + (y' + y) + z$ (Associative and commutative laws)
  7. $= x' + 1 + z$ (Complement law: $y' + y = 1$)
  8. $= 1$ (Null/annulment law: $A + 1 = 1$)
Q6(c)2 marks · Short answerOpen: Define maxterms and minterms. Find the maxterm and minterm when: P = 0, Q = 1…

Answer the following question.

Define maxterms and minterms. Find the maxterm and minterm when: $P = 0$, $Q = 1$, $R = 1$ and $S = 0$
Show answer

Answer

Minterm: a product (AND) term in which every variable of the function appears exactly once, in complemented or uncomplemented form; it is 1 for exactly one combination of inputs. Maxterm: a sum (OR) term in which every variable appears exactly once, in complemented or uncomplemented form; it is 0 for exactly one combination of inputs. For $P = 0, Q = 1, R = 1, S = 0$ (binary 0110 = 6): Minterm ($m_6$): $P'QRS'$ (a variable with value 0 is complemented, value 1 is uncomplemented) Maxterm ($M_6$): $P + Q' + R' + S$ (a variable with value 1 is complemented, value 0 is uncomplemented)
Q710 marks · ProgramOpen: A class Palin has been defined to check whether a positive number is a…

Write the program described below.

A class Palin has been defined to check whether a positive number is a Palindrome number or not. The number ‘N’ is palindrome if the original number and its reverse are same. Some of the members of the class are given below: Class name : Palin Data members/instance variables: num : integer to store the number revnum : integer to store the reverse of the number Methods/Member functions: Palin( ) : constructor to initialize data members with legal initial values void accept( ) : to accept the number int reverse(int y) : reverses the parameterized argument ‘y’ and stores it in ‘revnum’ using recursive technique void check( ) : checks whether the number is a Palindrome by invoking the function reverse( ) and display the result with an appropriate message Specify the class Palin giving the details of the constructor( ), void accept( ), int reverse( int ) and void check( ). 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 Palin
{
    int num;      // number to be checked
    int revnum;   // reverse of the number

    Palin()
    {
        num = 0;
        revnum = 0;
    }

    void accept()
    {
        Scanner sc = new Scanner(System.in);
        System.out.print("Enter a positive number: ");
        num = sc.nextInt();
    }

    // reverses y recursively and stores the result in revnum
    int reverse(int y)
    {
        if (y == 0)
            return revnum;
        revnum = revnum * 10 + y % 10;
        return reverse(y / 10);
    }

    void check()
    {
        revnum = 0;
        reverse(num);
        if (num == revnum)
            System.out.println(num + " is a Palindrome number");
        else
            System.out.println(num + " is not a Palindrome number");
    }

    public static void main(String args[])
    {
        Palin obj = new Palin();
        obj.accept();
        obj.check();
    }
}
Explanation: the constructor sets num and revnum to 0. reverse(y) takes the last digit of y (y % 10), appends it to revnum (revnum * 10 + digit) and calls itself with y / 10 until y becomes 0, when it returns revnum. check() resets revnum, calls reverse(num) and compares num with revnum. Tested by running: input 12321 printed "12321 is a Palindrome number".
Q810 marks · ProgramOpen: A class Adder has been defined to add any two accepted time. Example: Time A -…

Write the program described below.

A class Adder has been defined to add any two accepted time. Example: Time A - 6 hours 35 minutes Time B - 7 hours 45 minutes Their sum is - 14 hours 20 minutes ( where 60 minutes = 1 hour) The details of the members of the class are given below: Class name : Adder Data member/instance variable: a[ ] : integer array to hold two elements (hours and minutes) Member functions/methods: Adder( ) : constructor to assign 0 to the array elements void readtime( ) : to enter the elements of the array void addtime( Adder X, Adder Y) : adds the time of the two parameterized objects X and Y and stores the sum in the current calling object void disptime( ) : displays the array elements with an appropriate message (i.e. hours = and minutes = ) Specify the class Adder giving details of the constructor( ), void readtime( ), void addtime(Adder, Adder) and void disptime( ). Define the main( ) function to create objects and call the functions accordingly to enable the task.
Show answer

Answer

import java.util.Scanner;

class Adder
{
    int a[] = new int[2];   // a[0] = hours, a[1] = minutes

    Adder()
    {
        a[0] = 0;
        a[1] = 0;
    }

    void readtime()
    {
        Scanner sc = new Scanner(System.in);
        System.out.print("Enter hours: ");
        a[0] = sc.nextInt();
        System.out.print("Enter minutes: ");
        a[1] = sc.nextInt();
    }

    void addtime(Adder X, Adder Y)
    {
        a[1] = X.a[1] + Y.a[1];
        a[0] = X.a[0] + Y.a[0] + a[1] / 60;   // carry of minutes goes to hours
        a[1] = a[1] % 60;
    }

    void disptime()
    {
        System.out.println("hours = " + a[0] + " and minutes = " + a[1]);
    }

    public static void main(String args[])
    {
        Adder A = new Adder();
        Adder B = new Adder();
        Adder C = new Adder();
        System.out.println("Enter Time A:");
        A.readtime();
        System.out.println("Enter Time B:");
        B.readtime();
        C.addtime(A, B);
        System.out.println("Sum of the two times:");
        C.disptime();
    }
}
Explanation: addtime() adds the minutes of X and Y, adds the hours plus the carry (minutes / 60) and keeps the remainder (minutes % 60) as the minutes of the calling object. Tested by running: 6 h 35 min + 7 h 45 min gives hours = 14 and minutes = 20.
Q910 marks · ProgramOpen: A class SwapSort has been defined to perform string related operations on a…

Write the program described below.

A class SwapSort has been defined to perform string related operations on a word input. Some of the members of the class are as follows: Class name : SwapSort Data members/instance variables: wrd : to store a word len : integer to store length of the word swapwrd : to store the swapped word sortwrd : to store the sorted word Member functions/methods: SwapSort( ) : default constructor to initialize data members with legal initial values void readword( ) : to accept a word in UPPER CASE void swapchar( ) : to interchange/swap the first and last characters of the word in 'wrd' and stores the new word in 'swapwrd' void sortword( ) : sorts the characters of the original word in alphabetical order and stores it in 'sortwrd' void display( ) : displays the original word, swapped word and the sorted word Specify the class SwapSort, giving the details of the constructor( ), void readword( ), void swapchar( ), void sortword( ) 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 SwapSort
{
    String wrd, swapwrd, sortwrd;
    int len;

    SwapSort()
    {
        wrd = "";
        swapwrd = "";
        sortwrd = "";
        len = 0;
    }

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

    void swapchar()
    {
        if (len > 1)
            swapwrd = wrd.charAt(len - 1) + wrd.substring(1, len - 1) + wrd.charAt(0);
        else
            swapwrd = wrd;
    }

    void sortword()
    {
        char ch[] = wrd.toCharArray();
        for (int i = 0; i < len - 1; i++)
        {
            for (int j = 0; j < len - 1 - i; j++)
            {
                if (ch[j] > ch[j + 1])
                {
                    char t = ch[j];
                    ch[j] = ch[j + 1];
                    ch[j + 1] = t;
                }
            }
        }
        sortwrd = new String(ch);
    }

    void display()
    {
        System.out.println("Original word : " + wrd);
        System.out.println("Swapped word  : " + swapwrd);
        System.out.println("Sorted word   : " + sortwrd);
    }

    public static void main(String args[])
    {
        SwapSort obj = new SwapSort();
        obj.readword();
        obj.swapchar();
        obj.sortword();
        obj.display();
    }
}
Explanation: swapchar() builds the new word as last character + middle part + first character. sortword() copies the word into a char array and sorts it with bubble sort, then stores it as a String in sortwrd. Tested by running: input HELLO gives swapped word OELLH and sorted word EHLLO.
Q105 marks · ProgramOpen: A super class Product has been defined to store the details of a product sold…

Write the program described below.

A super class Product has been defined to store the details of a product sold by a wholesaler to a retailer. Define a sub class Sales to compute the total amount paid by the retailer with or without fine along with service tax. Some of the members of both the classes are given below: Class name : Product Data member/instance variable: name : stores the name of the product code : integer to store the product code amount : stores the total sale amount of the product (in decimals) Member functions/methods: Product(String n, int c, double p) : parameterized constructor to assign data members name=n, code=c and amount = p void show( ) : displays the details of the data members Class name : Sales Data member/instance variable: day : stores number of days taken to pay the sale amount tax : to store the service tax (in decimals) totamt : to store the total amount (in decimals) Member functions/methods: Sales(…) : parameterized constructor to assign values to data members of both the classes void compute( ) : calculates the service tax @ 12·4% of the actual sale amount calculates the fine @ 2·5% of the actual sale amount only if the amount paid by the retailer to the wholesaler exceeds 30 days calculates the total amount paid by the retailer as (actual sale amount + service tax + fine) void show( ) : displays the data members of super class and the total amount Assume that the super class Product has been defined. Using the concept of inheritance, specify the class Sales giving the details of the constructor(…), void compute( ) and void show( ). The super class, main function and algorithm need NOT be written.
Show answer

Answer

class Sales extends Product
{
    int day;
    double tax, totamt;

    Sales(String n, int c, double p, int d)
    {
        super(n, c, p);   // assigns name, code and amount of the super class
        day = d;
        tax = 0.0;
        totamt = 0.0;
    }

    void compute()
    {
        double fine = 0.0;
        tax = amount * 12.4 / 100;          // service tax @ 12.4%
        if (day > 30)
            fine = amount * 2.5 / 100;      // fine @ 2.5% only if paid after 30 days
        totamt = amount + tax + fine;
    }

    void show()
    {
        super.show();
        System.out.println("Total amount: " + totamt);
    }
}
Explanation: the constructor uses super(n, c, p) to set the data members of Product and then sets day. compute() calculates the service tax, the fine only when day > 30, and the total amount as amount + tax + fine. show() calls the super class show() and then displays totamt. Tested by running with amount 1000: 25 days gives total 1124.0 and 40 days gives total 1149.0.
Q115 marks · ProgramOpen: Queue is an entity which can hold a maximum of 100 integers. The queue enables…

Write the program described below.

Queue is an entity which can hold a maximum of 100 integers. The queue enables the user to add integers from the rear and remove integers from the front. Define a class Queue with the following details: Class name : Queue Data Members / instance variables: Que[ ] : array to hold the integer elements size : stores the size of the array front : to point the index of the front rear : to point the index of the rear Member functions: Queue (int mm) : constructor to initialize the data size = mm, front = 0, rear = 0 void addele(int v ) : to add integer from the rear if possible else display the message “Overflow” int delele( ) : returns elements from front if present, otherwise displays the message “Underflow” and return -9999 void display ( ) : displays the array elements Specify the class Queue giving details of ONLY the functions void addele(int) and int delele( ). Assume that the other functions have been defined. The main function and algorithm need NOT be written.
Show answer

Answer

void addele(int v)
{
    if (rear == size)
        System.out.println("Overflow");
    else
    {
        Que[rear] = v;
        rear++;
    }
}

int delele()
{
    if (front == rear)
    {
        System.out.println("Underflow");
        return -9999;
    }
    else
    {
        int v = Que[front];
        front++;
        return v;
    }
}
Explanation: elements are added at the rear and removed from the front. The queue is full when rear == size (Overflow) and empty when front == rear (Underflow, returning -9999). Tested by running with a queue of size 3: adding a 4th element printed Overflow, deleting 10, 20, 30 worked and a 4th delete printed Underflow and returned -9999.
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 count the nodes that contain only odd integers from an existing linked list and returns the count. The method declaration is as follows:
int CountOdd( Node startPtr )
Show answer

Answer

int CountOdd(Node startPtr)
{
    int count = 0;
    Node ptr = startPtr;
    while (ptr != null)
    {
        if (ptr.num % 2 != 0)
            count++;
        ptr = ptr.next;
    }
    return count;
}
Explanation: start at the first node, visit every node until ptr becomes null, add 1 to count whenever the value of num is odd (num % 2 != 0, which also works for negative numbers) and finally return count. Tested by running: the list 5, 8, -3, 12, 7 gives 3 and an empty list gives 0.
Q12(b)(i)1 mark · Binary treeOpen: Write the postorder traversal of the above tree structure.

Answer the following questions from the binary tree.

Write the postorder traversal of the above tree structure.
Show answer

Answer

W F Y N R Z D G M Postorder (left, right, root): left subtree of M is N with W, then Y (with its left child F): W F Y N; right subtree G with Z (right child R), then D: R Z D G; then the root M.
Q12(b)(ii)1 mark · Binary treeOpen: State the level numbers of the nodes N and R if the root is at 0 (zero) level.

Answer the following questions from the binary tree.

State the level numbers of the nodes N and R if the root is at 0 (zero) level.
Show answer

Answer

Level of N = 1 and level of R = 3. Root M is at level 0; N is a child of M (level 1); R is a child of Z, which is a child of G, a child of M (M 0, G 1, Z 2, R 3).
Q12(b)(iii)1 mark · Binary treeOpen: List the internal nodes of the right sub-tree.

Answer the following questions from the binary tree.

List the internal nodes of the right sub-tree.
Show answer

Answer

G, Z The right sub-tree has root G with nodes Z, D and R. Internal (non-leaf) nodes are those with at least one child: G and Z. D and R are leaf nodes.

About this board paper

The ISC Computer Science 2017 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*
Program642
Drawing511
Short answer89
K-map28
Truth table26
Output15
Conversion24
Binary tree33
Derivation13
Differentiate12
Numerical12

By chapter

ChapterQuestionsMarks printed*
Boolean Algebra1326
Arrays, Strings322
Data structures612
Objects212
Computer Hardware39
Inheritance, Interfaces and Polymorphism27
Recursion15
Complexity and Big O notation22

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

By number of questions: Boolean Algebra (13), Data structures (6), Arrays, Strings (3) and Computer Hardware (3).

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