Friday, September 30, 2016

ISC computer science class XII Sample paper 2



ISC computer science class XII sample paper 2


Answer all questions in Part I (compulsory) and seven 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

Answer all questions

Question 1.
A) Verify if, P.(~P+Q’)=(P→Q) using truth table.
B) Find the complement of
F(A,B,C,D)= [A + { ( B+C) . (B’+ D’)}]
C) Find the dual for the Boolean equation.
AB’ + BC’ +1 =1
D) If A=1, B=0, C=1 and D=1 find its
            i) maxterm
            ii) minterm
E) Simplify the following expression by using the Boolean laws. Show the working in steps and also mention the laws used.:

X’Y’Z’ + X’Y’Z+ X’YZ+X’YZ’+ XY’Z’+ XY’Z                                        [ 1 x 5 = 5]
Question 2.
a)State the different applications of stack.
b) Convert the following infix notation to postfix:
(A+ ( B*C)) / (C-(D*B))
c) Explain any two standard ways of traversing a binary tree.
d) A two dimensional array defined as X[3…6, -2…2] requires 2 bytes of storage space for each element. If the array is stored in row major order, determine the address of X[5,1], given the base address as 1200.
e)
i) What is the worst-case complexity of the following code segment :
  for(int i=0;i<N;i++)
  {
  Sequence of statements
  }
  for(int j=0;j<M; j++)
  {
  Sequence of statements
  }
ii) How would the complexity change if the second loop went to N instead of M?
                                                                                                                      [ 2 x 5 =10]

Question 3.
The following is a function of some class. What will be the output of the function recs( ) when the value of num is equal to 4?Show the dry run / working.
int recs(int num)
{
if(num==0)
return 0;
else
return num+ recs(num-1);
}
                                                                                                                               [ 5 ]

Part II
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 F(P,Q,R,S)= Σ(0,1,3,4,5,6,7,9,10,11,13,15)
i) Reduce the above expression by using 4 variable Karnaugh map, showing the various groups( i.e. octal, quads and pairs).                                                                                                                   [ 4 ]
ii) Draw the logic gate diagram for the reduced expression. Assume that the variables and their complements are available as inputs.                                                                                                           [ 1 ]

b) Given G(X,Y,Z,W)= π(0,2,4,6,8,9,10,11)
i) Reduce the above expression by using 4 variable Karnaugh map, showing the various groups(i.e.octal, quads and pairs).                                                                                                                      [ 4 ]
ii) Draw the logic gate diagram for the reduced expression. Assume that the variables and their complements are available as inputs.                                                                                                          [ 1 ]

Question 5.
a) Differentiate between XNOR and XOR gates. Draw the truth table and logic diagrams of three input XNOR gates.                                                                                                                         
4 ]
b) Differentiate between proposition and wff.                                                                      [ 2 ]
c) Define half adder. Construct the truth table and logic diagram of a half adder.                    [ 4 ]

Question 6.
           a) Draw the logic gate diagram for the Boolean function F(A,B,C)= (A’+B).(B’+C) making use of NOR                   gates only.                                                                                                                [ 3 ]
          b) Define proposition. How does tautology differ from contradiction?                          [ 2 ]
          c) Convert (X’+Y+Z’).(X+Y’+Z).(X+Y+Z’).(X+Y+Z) into SOP form.                               [ 2 ]
  d) Briefly explain the working of a 4:1 multiplexer. Also draw the logic diagram of 4:1 multiplexer.[ 3 ]

Section B
Answer 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.
A class Matrix contains a two dimensional integer array of order [ m x n ]. The maximum value possible for both m and n is 25. Design a class Matrix to find the difference of the two matrices. The details of the members of the class are given below:

Class name : Matrix
Data members
arr [][] : stores the matrix element
m :                   integer to store the number of rows
n :                    integer to store the number of columns
Member functions:
Matrix(int mm, intnn) :    to initialize the size of the matrix m=mm and n=nn
Void fillarray() :             to enter the elements of the matrix
Matrix SubMat(Matrix A) :          subtract the current object from the matrix of parameterized object and return the resulting object.
void display() :              display the matrix elements.

Specify the class Matrix giving details of the constructor Matrix(int,int), void fillarray(),Matrix SubMat(Matrix) and void display(). Define the main() function to create an object and call the functions accordingly to enable the task.
[10]
Question8.
A class Modify has been defined with the following details:
Class name : Modify
Data members
St :       stores a string
len :      to store the length of the string.
Member functions
void read() :                  to accept the string in uppercase alphabets.
Void putin(int , char) :     to insert a character at the specified position in the string and display the changed string.
void takeout(int) :          to remove character from the specified position in the string and display the changed string.
void change() :              to replace each character in the original string by the character which is at a distance of 2 moves ahead. For example:- “ABCD” becomes“ CDEF”, “XYZ” becomes “ZAB”.

Specify the class Modify giving details of the functions void read(), void putin(int,char), void takeout( int )and
void change(). The main function need not be written.
                                                                                                                                                        [ 10 ]
Question 9.
A Special number is a number in which the sum of the factorial of its digits is equal to the number.
Example 1445 ( 1! + 4! + 5!= 145). Thus, 145 is a special number.

Design a class Special to check if the given number is a Special number or not. Some of the members of the class are given below:
Class name : Special
Data members
n : integer to store the number
Member functions
Special() : default constructor
void read() : to accept the number
int factorial(int x) : return the factorial of a number using recursion technique
Boolean isSpecial() : checks for the special number by invoking the function factorial() and returns true if Special, otherwise returns false.
void display() : to show the result with an appropriate message

Specify the class Special giving details of the constructor, void read(), int factorial() , Boolean isSpecial ()and void display().
Define the main function to create an object and call the functions accordingly to enable the task.
                                                                                                                                                                     [ 10 ]

Section C
Answer any two questions

Each program should be written in such a way that it clearly depicts the logic of the problem step wise. This can also be achieved by using comments in the program and mnemonic names or pseudo codes for algorithms. The program 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 Super class Student defines the personal data of a student while another class Marks defines the register number, name of subject and marks obtained by the student. The details of both the classes are given below:
Class name : Student
Data members
name : string to store name.
sex : string to store sex
age : integer to store age
Member functions
Void inpdetails() : to accept values for data members.
void show() : to display personal data of student.

Class name : Marks
Data members
regnum :int to store registration number.
marks :int to store marks.
subject : String to store subject name.
Member functions
Void inpdetails() : to accept values for data members.
void show() : to display exam and student details.

Assume that the super class Student has been defined. Using the concept of inheritance specify the class marks giving details of the constructor, void inpdetails() and void show().The super class and the main function need not be written.                                                                                                                                      [ 5 ]  


Question 11.
Define a class Repeat which allows the user to add elements from one end (rear) and remove elements from the other end (front) only. The following details of the class Repeat are given below:
Class name : Repeat
Data members
st[] :     an array to hold a maximum of 100 integer elements
cap :     stores the capacity of the array
f :         to point to the index of the front
r :         to point to the index of the rear
Member functions
Repeat(int m) : constructor to initialize the data members cap=m, f=0, r=0 and to create the integer array
Void pushvalue(int v) : to add integers from the rear index if possible else display the message “overflow”
Int popvalue() : to remove and return element from the front, if array is empty then return -9999
Void disp() : displays the elements present in the list

Specify the class Repeat giving details of the constructor Repeat(int), member function void pushvalue(int), int popvalue().Assume that other functions have been defined.The main function need not be written.                                                                                                                                                                                             [ 5 ]
Question 12.
A) linked list is formed from the objects of the class,
class Node
{
int info;
Node link;
}
Write an algorithm OR a method for deleting a node from a linked list. The method declarationis given below:
void deletenode(Node start)                                                                                                                      [ 2 ]
b) Answer the following questions from the diagram of a binary tree given below:-


http://algoviz.org/OpenDSA/Books/OpenDSA/html/_images/BinExamp.png


ii) Write the post order tree traversal.                                                                                           [ 1 ]
iii) Write the internal nodes of the tree.                                                                                         [ 1 ]
iv) State the level of the root of the tree.                                                                                      [ 1 ]

ISC computer science class XII Sample paper 1

ISC computer science class XII sample paper 1


Answer all questions in Part I (compulsory) and seven 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

Answer all questions

Question 1.                                                                 [1X5=5]

(a) State the difference between an interface and a class.

 (b)Verify using the truth table, if (X=>Y).(Y=>X) is a tautology, contradiction or contingency.
(c) What is an abstract class?
(d) Show how a NAND gate can be used to construct an OR gate.
(e) Define inheritance. How is it useful in programming?

Question 2.                                                                                               [2 x 5=10]
  (a)    State the difference between Function Overloading and Function Overriding.   
       (b)   Convert the following expression F(X,Y,Z)=XY+Y’Z into minterms. 
       (c)    Simplify the following expression using law of Boolean algebra. At each step clearly state the law used for simplification.  xy+xz+xyz
      (d)   State the differences between a constructor and a function.
      (e)   For an array of real numbers x [-15….10, 15….40] find the address of x [5,20 ], if x [0] [0] is stored in location 1500 in the column major order. Assume that each element requires 1 bytes.
                   
Question3. 
The following is a function of some class. What will be the output of the function display( ) when the value of
val is equal to 6?Show the dry run / working.          [5]

int display (int val)

{
if(val==0)
return 0;
else
returnval+ display(val-1);
}
&nbsp                      
Part II

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, 1, 2, 5, 8, 9, 10)

(i) Reduce the above expression by using 4 - variable K-Map, showing the various groups (i.e.; octal, quads and pairs).                                                       [4] 
(ii) Draw the Logic gate diagram of the reduced expression. Assume that the variable and their complements are available as inputs.                                                     [1]
b) Given G(X,Y,Z,W)= π(0,2,4,6,8,9,10,11)
(i) Reduce the above expression by using 4 variable Karnaugh map, showing the various groups (i.e. Octal, quads and pairs).                                                                            [4]
(ii) Draw the logic gate diagram for the reduced expression. Assume that the variables and their complements are available as inputs.                                                             [1]



Question 5
(a)        Draw a logic diagram for the following function using only NOR gates:               [3]
(A, B, C) = (A’ + B’) . (B + C’)
(b)         Convert the following expression into canonical Sum-Of-Product form:             [3]
(X, Y, Z) = X’.Y + X’.Y’ + Y.Z’
(c)      What is a half adder? Draw the truth table, derive its Boolean expression and draw a logic diagram for half adder.                                                                       [4]

Question 6
(a) Draw the truth table to prove the following proportional logic expression: A <=> B = (A <=> B) ^ (B => A)                                                                             [3]
(b) State a difference between a Tautology and Contradiction.                [2]
(c) Draw the truth table and a logic gate diagram of Octal to Binary Encoder.       [5]


Section B

Answer two questions

Each program should be written in such a way that it clearly depicts the logic of the problem. This can beachieved by using mnemonic names and comments in the program. (Flowcharts and algorithms are notrequired)

The programs must be written in Java.


Question 7                                                                                                         [10]
A class Composite contains a two dimensional array of order [m x n]. The maximum values possible for both ‘m’ and ‘n’ is 20.
Design a class Composite to fill the array with the first (m x n) composite numbers in column wise.
The details of the members of the class are given below:
Class name : Composite
Data members /instance variables :
arr[ ][ ] :                               stores the composite numbers column wise
m :                                          integer to store the number of rows
n :                                           integer to store the number of columns
Member functions :
Composite(int mm, intnn ) :        to initialize the size of the matrix m=mm and n=nn
IntisComposite(int p ) : returns 1 if number is composite otherwise returns 0.
void fill ( ) :                          to fill the elements of the array with the first (m × n) composite numbers in column wise
void display( ) :                  displays the array in a matrix form.
Specify the class Composite giving details of the constructor Composite (int,int), intisComposite(int), void fill( ) and void display( ).
Define a main( ) function to create an object and call the functions accordingly to enable the task.

Question8.

In “Piglatin” a word such as KING is replaced by INGKAY, while TROUBLE becomes OUBLETRAY and so on. The first vowel of the original word becomes the start of the translation, any preceding letters being shifted towards the end and followed by AY.Words that begin with a vowel or which do not contain any vowel are left unchanged.
Design a class Piglatin using the description of the data members and member functions given below:
Specify the class Piglatin giving the details of the constructor, void readstring( ), void convert( ) and void consonant( ). Also define the main function to create an object and call methods accordingly to enable the task.                                                    [10]



Question 9.

A class Hifact has been defined to find the HCF of two numbers using the recursive technique. This HCF is used to find the LCM of two numbers. Some members of the class are given below:-
Class name                                         :                               Hifact
Data members
a, b ,hcf, lcm                                       :                               integers
Member functions
Hifact()                                                 :                               constructor to assign initial values to data members
Voidgetdata()                                    :                               to input values of a and b
void change()                                    :                               to swap a and b if a> b
intrechcf(int, int)                              :                               to find hcf using recursive technique
intfn_lcm(int,int,int)                       :          to find lcm using a,b and hcf
void result()                                        :     to invoke rechcf() and fn_lcm() and to print lcm, hcf of  the two numbers a and b.
Specify the class Hifact giving details of constructor, void getdata(), void change(), intrechcf() and intfn_lcm(). Write the main function and find the hcf and lcm of any two integers a and b.                                                                                               [10]

Section C
Answer any two questions

Each program should be written in such a way that it clearly depicts the logic of the problem step wise.This can also be achieved by using comments in the program and mnemonic names or pseudo codes for algorithms. The program 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 class Student defines the personal data of a student while another class Marks defines to the roll number, name of subject and marks obtained by the student.
The details of classes are as:
Class name: Student
Data members/instance variables:
name, sex : string variables to store name and gender male/female
age : integer variable to store age of the student.
Member functions/methods :
Student( ) : constructor to assign initial values to the data members.
void show( ) : to print personal data of student.

Class Name : Marks
Data members/instance variables :
rollno, marks : integers to store roll number and marks.
subject : string variable to store name of subject
Member functions/methods :
Marks( ) : constructor to assign initial values to the data members of the child and Base class.
int point() : to return the point obtained according to the following:
Marks                   Point
>=90                      1
70 - 89                   2
50 - 69                   3
40 - 49                   4
< 40                        5
void show( ) : to display name, sex, age, roll number, marks, subject and point of the student by invoking suitable function.
Specify the class Student giving the details of the constructor, function void show(). Using the concept of inheritance, specify the class Marks giving the details of the constructor,intpoint() and void show( ) function. You do not need to write the main() function.                                                                                 [5]


Question 11.
Rack is a kind of data structure which can store utmost 20 books. The Rack restriction is that a book can be kept into the rack or removed only at one end and i.e., on the top. The class Rack has the following details.


Class name: Rack
Data members
book[] : an array of string of maximum 50 locations to store books.
limit :     stores the capacity of the array
name :  String variable to store name of the book.
top:        integer to indicate topmost book in the rack.
Member functions
Rack():constructor to store blank in the array book[].
Rack(int m) : constructor to initialize the data members m to limit and -1 to top.
voidputthebook() : input name of the book into variable name and adds it on the top into the array[],if possible else display the message “overflow”
void removebook() : to remove a book from the top of the rack, if array is empty then display the message “Rack underflow”
void disp() : displays the books present in the list
Specify the class Rack giving details of only the constructor Rack(int), member function void putthebook(int), void removebook().Assume that other functions have been defined.The main function need not be written.              [5]


Question 12.
A magic number is a number in which the eventual sum of digits of the number is equal to For example,                                          172 = 1 + 7 + 2 = 10

                10 = 1 + 0 = 1
Then 172 is a magic number.
Design a class Magic to check if a given number is a magic number. Some of the members of the class are given below:
Class name                                         : Magic

Data members
n                                                           : stores the number
Member functions
Magic()                                                : constructor to assign 0 to n
voidgetnum(intnn)                      :   to assign the parameter value to the number,  n=nn
intsum_of_digits(int)                :  return the sum of the digits of  number void ismagic() checks if the given number  is a magic number  by calling the function sum_of_digits(int) and displays appropriate messag                                                                      [5]