• Home
  • Courses
  • School
  • Programs
  • Problems
  • Contact Us
  • My account
  • Register

Have any question?

(+91) 98222 16647
info@simplycoding.in
RegisterLogin
Simply Coding
  • Home
  • Courses
  • School
  • Programs
  • Problems
  • Contact Us
  • My account
  • Register

Uncategorized

ISC Class 12 Computer Science previous year paper (2019)

  • Categories Uncategorized

COMPUTER SCIENCE
PAPER 1

(THEORY)
(Maximum Marks: 70)
(Time allowed: Three hours)

(Candidates are allowed additional 15 minutes for only reading the paper. They must NOT start writing during this time.)

——————————————————————————————————————————-
Answer all questions in Part I (compulsory) and six questions from Part-II, choosing two

questions from Section-A, two from Section-B and two from Section-C.
All working, including rough work, should be done on the same sheet as the

rest of the answer.

The intended marks for questions or parts of questions are given in brackets [ ].
———————————————————————————————————————
PART I (20 Marks)

Answer all questions. While answering questions in this Part, indicate briefly your working and reasoning,

wherever required.

Question 1

(a) 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

Ans. XORgate

(b) Write the canonical POS expression of: F(P, Q) = Π(0, 2) 
Ans.  (A + B).(A’ + B)

(c) Find the dual of: X.Y+X.Y’ = X + 0
Ans. (X + Y).(X + Y’) = X.1

(d) If F(A, B, C) = A’.B’.C’ + A’.B.C’ then find F’ using De Morgan’s Law.
Ans. (AB’C + ABC’) (∵x’ + y’ = x’.y’)
           = (AB’C’)’. (A’.B.C’)’ (∵(x’.y’) = x’ + y’)
           = ((A’B’)’ + (C)’. ((A’B)’ + (C’)’)
           = ((A’)’ + (B’)’) + C).((A’)’ + (B)’ + C)
           = (A + B + C).(A + B’ + C)
           = AA + AB’ + AC + BA + BB’ + BC + CA + CB’ + CC (∵x.x = x)
           = A + AB’ + C + AC + AB + B’C + BC

(e) If A = “It is cloudy” and B = “It is raining”, then write the proposition for
          (i) Contrapositive
         (ii) Converse
Ans. 
         (i) If it is not raining then it is not cloudy.
        (ii) If it is raining then it is cloudy.

XORgate
Question 2.

(a) What is an Interface? How is it different from a class?
Ans.  An interface is just like Java Class, but it only has static constants and abstract method. Java uses Interface to implement multiple inheritances.
An interface is syntactically similar to a class, but it lacks in field declaration and the methods inside an interface do not have any implementation.
A class can be instantiated but an interface not.

(b) A matrix ARR[-4 ….. 6, 3 ……. 8] 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. 
Ans. Given, Address of ARR[3] [6] = 1430
         According to row-major,
        Address = B + w(n(p – L1) + (q – L2)
        B = 1430, w = 4 bytes
        p = 3, q = 6,U1 = 6, U2 = 8, L1 = -4, L2 = 3
        Number of columns n = U2 – L2 + 1
               ⇒ n = 8 – 3 + 1 = 6
       Address of ARR[3][6] = 1430 + 4(6 (3 – (-4))+ (6 – 3))
              = 1430 + 4(6 × 7 + 3)
              = 1430 + 180
              = 1610

(c) Convert the following infix notation to postfix form: 
              (A + B * C) – (E * F / H) + J
Ans.
               (c) (A + B * C) – (E * F / H) + J
                   = (A + (BC*)) – ((EF*) / H) + J
                   = (ABC *+) – (EF * H/) + J
                   = (ABC *+ EF * H/-) + J
                   = ABC*+ EF * H / – J*

(d) Compare the two complexities O(n2) and O(2n) and state which is better and why. 
Ans. O(n2) is better than O(2n)
Let us see with the help of an example.
Suppose n = 8
         n2 = 82 = 64
        2n = 28 = 256
Therefore, the complexity in 2n is higher than n2. If n increases, 2n increases much more than n2. Therefore, the time complexity is O(n2) is better than O(2n).

(e) State the difference between internal nodes and external nodes of a binary tree structure. 
Ans. Internal nodes are not leaf nodes whereas external nodes are leaf nodes.

Question 3.

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);
   }
}

Ans.
Given n = 43629, x = 3, y = 4

Stepnumxynum<10zz%2return
14362934false9136+Mystery(4362,5,4)
2436234false206+Mystery(436+3,4)
343634false6018+Mystery(43,3,4)
44334false3112+Mystery(4,3,4)
5434

Step 5 returns 4
Step 4 returns 12 + 4 = 16
Step 3 returns 18 + 16 = 34
Step 2 returns 6 + 34 = 40
Step 1 returns 36 + 40 = 76

Part- II (50 Marks)

Answer six questions in this part, choosing two questions from Section A, two from Section B and two from Section C.

Section – A
Answer any two questions.

Question 4.

(a) Given the Boolean function F(A, B, C, D) = Σ (0, 2, 3, 4, 5, 8, 10, 11, 12, 13).

(i) Reduce the above expression by using 4-variable Karnaugh map, showing the various groups (i.e. octal, quads and pairs).
(ii) Draw the logic gate diagram for the reduced expression using only NAND gates. Assume that the variables and their complements are available as inputs.

Ans. (i) F(A, B, C, D) = Σ (0, 2, 3, 4, 5, 8, 10, 11, 12, 13)

F(A, B, C, D)

(b) Given the Boolean function : F(P, Q, R, S) = π (0, 1, 2, 8, 9, 11, 13, 15).

(i) Reduce the above expression by using a 4-variable Karnaugh map, showing the various groups (i.e, octal, quads and pairs).
(ii) Draw the logic gate diagram for the reduced expression using only NOR gates. Assume that the variables and their complements are available as inputs.

Ans. i . F(P,Q,R,S) = π(0,1,2,8,9,11,13,15)

F(P, Q, R, S) 1
Question 5.

(a) 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.

Ans.  A multiplexer is a device which consists of multiple input channels through a single line while decoder consists of multiple inputs passing through multiple outputs.
Multiplexer converts inputs from unary codes (initial) to binary codes while decoder converts binary codes to inputs.

InputsOutputs
x y zD0 D1 D2 D3 D4 D5 D6 D7
0 0 01 0 0 0 0 0 0 0
0 0 10 1 0 0 0 0 0 0
0 1 00 0 1 0 0 0 0 0
0 1 10 0 0 1 0 0 0 0
1 0 00 0 0 0 1 0 0 0
1 0 10 0 0 0 0 1 0 0
1 1 00 0 0 0 0 0 1 0
1 1 10 0 0 0 0 0 0 1

multiplexer

The circuit is designed with AND and NAND logic gates. It takes 3 binary inputs and activates one of the eight outputs. 3 to 8 line decoder circuit is also called as binary to an octal decoder.

(b) 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.

logic circuit diagram

Ans. 

decoder 2

(c) Using a truth table, state whether the following proposition is a Tautology, Contradiction or Contingency: 
        ~(P =>Q)<=>(~P∨Q)
Ans. 

decoder1

The last column contains only True values. Therefore, it is Tautology.

Question 6.

(a) The owner of a company pays the bonus to his salesmen as per the criteria are 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).
Ans.

OFHUOUTPUT
Works overtime for more than 4 hoursFestival sales are onWorking on an off day/olidayUpdates shoroo arrangements
10000
10010
10100
10110
11000
11011
11101
11111
00001
00011
00100
00110
01001
01011
01101
01111

X(O,F,H,U )= π(0,1,2,3,4,10,11)

(b) What is a half adder? Write the truth table and derive an SOP expression for sum and carry for a half adder. 
Ans. The half adder is an example of a simple, functional digital circuit built from two logic gates. The half adder adds two one-bit binary numbers (AB). The output is the sum of the two bits (S) and the carry (C).
The truth table for a half-adder is:

XYCS
0000
0101
1001
1110

‘x’ and ‘y’ are the two inputs, and S (Sum) and C (Carry) are the two outputs.
The Carry output is ‘O’ unless both the inputs are 1.
‘S’ represents the least significant bit of the sum.
The simplified sum of products (SOP) expressions is:
S = x’y + xy’, C = xy

(c) Simplify the following expression, using Boolean laws:
(X + Z).(X.Y + Y.Z’) + X.Z + Y
Ans.
 (X + Z).(X.Y + Y.Z’) + X.Z + Y
= (X + Z).(Y.Z’) + X.Z + Y (a.b = 0)
= X.Y.Z’ + Z.Z’ + X.Z + Y (a.a’ = 0) and (a.c = 0)
= 0.Z’ + 0 + 0 + Y
= Y

Section – B
Answer any two questions.

Each program should be written in such a way that it clearly depicts the logic of the problem.
This can be achieved by using mnemonic names and comments in the program.
Flowcharts and Algorithms are not required.
The programs must be written in Java.

Question 7.

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 = 33 + 73 + 13
1634 = 14 + 64 + 34 + 44
54748 = 55 + 45 + 75 + 45 + 85
Thus, 371, 1634 and 54748 are all examples of Armstrong numbers.
Some of the members of the class are given below:

Class nameArmNum
Data members/instance variables:
nto store the number
lto 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 32 + 42 (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.
Ans.

import java.io.*;
import javautil.*;
class ArmNum
{
   private int n;
   private int 1;
   public ArmNum(int num)
   {
      n = num;
      i = 0;
      for(int i = n; i! = 0; i/= 10)
         i++;
      }
      public int sumPow(int i)
      { 
if(i < 10) return (int)Math.pow(i, 1); return (int)Math.pow(i % 10, 1) + sumPow(i/10); } public void isArmstrong() { if(n == sumPow(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[])throws IOException{ Scanner sc = new Scanner(System.in); System.out.print("N ="); int num = sc.nextInt(); ArmNum obj = new ArmNum(num); obj.isArmstrong(); } }
Question 8.

Design a class MatRev to reverse each element of a matrix.
Example:

MatRev

Some of the members of the class are given below:

Class nameMatRev
Data members/instance variables:
arr[ ][ ]to store integer elements
mto store the number of rows
nto 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.
Ans.

import java.io.*;
import java.util.*;
class MatRey{
   private int arr[][];
   private int m;
   private int n;
   public MatRev(int mm, int nn) {
      m=mm;
      n = nn;
      arr=newint[m][n];
   }
   public void fillArray( )throws IOException{
     Scanner sc = new Scanner(System.in);
     System.out.println("Enter matrix elements::");
     for(int i = 0; i < m; i++) {
        for(int j = 0; j < n; j++) {
           arr[i][j] = sc.nextInt();
        }
     }
  }
  public int reverse(int x) {
     int rev = 0;
     for(int i = x; i != 0; i /= 10)
       rev = rev * 10 + i % 10;
     return rev;
  }
  public void revMat(MatRev p) {
     for(int i = 0; i < m; i++) {
       for(int j = 0; j < n; j++) {
          this.arr[i] [j] = reverse(p.arr[i] [j]);
       }
     }
  }
  public 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[])throws IOException{
     Scanner sc = new Scanner(System.in);
     System.out.print("Enter number of rows::");
     int x = sc.nextInt();
     System.out.print("Enter number of columns::");
     int y = sc.nextInt();
     MatRev obj 1 = new MatRev(x, y);
     MatRev obj2 = new MatRev(x, y);
     obj1.fillArray();
     obj2.revMat(obj 1);
     System.out.println("Original Matrix is::");
     obj1.show();
     System.out.println("Matrix with reversed elements");
     obj2.show();
  }
}
Question 9.

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 nameRearrange
Data member/instance variable:
wrdto store a word
newwrdto 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.
Ans.

import java.io.*;
import java.util.*;
class Rearrange {
   private String wrd;
      private String newwrd;
      public Rearrange() {
         wrd = new String();
         newwrd = new String();
      }
      public void readword() throws IOException {
        Scanner sc = new Scanner(System.in);
        System.out.print("Enter the word:");
        wxd = sc.next();
     }
     public void freq_vow_con() {
       wrd = wrd.toUpperCase();
       int v = 0;
       int c = 0;
       forint i = 0; i < wrd.length(); i++) {
         char ch = wrd. char At(i);
         if(Character.isLetter(ch)) {
            switch(ch) {
               case 'A':
               case'E':
               case T:
               case 'O':
               case 'U':
               v++;
               break;
               default:
               C++;
           }
         }
      }
      System.out.println("Frequency of vowels: "+v);
      System.out.println("Frequency of consonants: "+c);
    }
    public void arrange() {
       String v = new String();
       String c = new String();
       wrd = wrd.toUpperCase();
       for(int i = 0; i < wrd. length(); i++) {
          char ch = wrd.charAt(i);
          if(Character.isLetter!ch)) {
             switch(ch) {
                case 'A':
                case'E':
                case T:
                case 'O':
                case 'U':
                v += ch;
                 break;
                default:
                c + = ch;
            }
          }
       }
       newwrd = v + c;
   }
   public void display() {
      System.out.println("Original word:" + wrd);
      System.out.prfntln("Rearranged word:" + newwrd);
   }
   public static void main(String args[])throws IOException {
      Rearrange obj = new Rearrange();
      obj.readword();
      obj.freq_vow_con();
      obj.arrange();
      obj.display();
   }
}

Section – C
Answer any two questions.

Each program should be written in such a way that it clearly depicts the logic of the problem stepwise.
This can be achieved by using comments in the program and mnemonic names or pseudo-codes for algorithms.
The programs must be written in Java and the algorithms must be written in general/standard form, wherever required/specified.
Flowcharts are not required.

Question 10.

A superclass Record contains names and marks of the students in two different single dimensional arrays. Define a subclass Highest to display the names of the students obtaining the highest mark 
The details of the members of both classes are given below:

Class nameRecord
Data member/instance variable:
n[ ]array to store names
m[ ]array to store marks
sizeto 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:
indto 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( )display( ) : displays the array elements along with the names
and marks of the students who have obtained the highest mark

Assume that the superclass 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 superclass, main function and algorithm need NOT be written.
Ans.

class Record
{
   protected String n[];
   protected int m[];
   protected int size;
   public Recordfint cap) {
   }
   public void readarray() {
   }
   public void display() {
   }
} class Highest extends Record { private int ind; public Highest(int cap) { super(cap) } public void find() { ind = 0; for (int i = 0; i < size; i++) {
if(m[i]>m[ind]){ ind = i; } } } public void display() { super.display(); System.out.println("Highest marks are::" +m[ind]); System.out.println("Students who score the highest marks are::"); for (int i = 0; i < size; i++) } if(m[i] == m[ind]) { System.out.println(n[i]); } } } }
Question 11.

A linear data structure enables the user to add an address from rear end and remove address from front. Define a class Diary with the following details :

Class nameDiary
Data members / instance variables:
Q[ ]array to store the addresses
sizestores the maximum capacity of the array
startto point the index of the front end
endto 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( )void show( ) : displays all the addresses in the diary

(a) 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.
Ans.

class Diary {
    public void pushAdd(String n) {
       if(Q[0].equals(""))
          Q[0] = n;
       else if(end + 1 < size) Q[end + 1] = n; 
else System.out.println("NO SPACE");
} public String popadd() { if(start -1 >= 0) return Q[start--]; else return "?????"; } }

(b) Name the entity used in the above data structure arrangement. 
Ans. (b) Queue

Question 12.

(a) 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)
Ans.

void sumEvenNode(Node str) { 
if(str = null)
return 0;
else if(str.num % 2 == 0)
return str.num + sumEvenNode(str.next);
else return 0 + sumEvenNode(str.next);

(b) Answer the following questions from the diagram of a Binary Tree given below:

Binary Tree

     (i) Write the pre-order traversal of the above tree structure. 
     (ii) State the size of the tree.
    (iii) Name the siblings of the nodes E and G 
Ans.
     (i) A → E → G → I → C → H → B → D → F
    (ii) The size of the tree is 4.
   (iii) Sibling of E is B.
           Sibling of G is C.

  • Share:
author avatar
Simply Coding

Previous post

Questions on Encapsulation
July 10, 2021

Next post

ICSE Class 10 Sample Paper 2021-2022 Answer sheet
July 14, 2021

You may also like

XML Prolog
XML Prolog
20 July, 2021
XML Elements, Tags and Attributes
XML Elements, Tags and Attributes
20 July, 2021
Scratch 3.0 – Writing a Script
Scratch 3.0 – Writing a Script
20 July, 2021

Leave A Reply Cancel reply

You must be logged in to post a comment.

Categories

Recent Posts

  • ISC Class 12 Computer Science previous year paper (2020)
  • ISC Class 12 Computer Science previous year paper (2017)
  • CBSE Class 12 Computer Science Marking Scheme (2020-21)
  • ICSE Class 10 COMPUTER APPLICATIONS previous year paper (2017)
  • ICSE Class 10 COMPUTER APPLICATIONS previous year paper (2016)
Simply Coding Computer Courses for School                Privacy Policy     Terms of Use     Contact Us

© 2021 Simply Coding

Login with your site account

Lost your password?

Not a member yet? Register now

Register a new account

Are you a member? Login now