ISC computer science class XII sample paper 3
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) Write the truth table for a 2 input disjunction in a propositional logic.
A) Write the truth table for a 2 input disjunction in a propositional logic.
B) Using a truth table verify the following
expression: (X+Y). Z=/=(Z.X)+Y
C) Find the complement of
X.(Y.Z’+ Y’X) using De Morgan’s law. Do not reduce the expression.
D) State and verify the
Distributive law using the truth table.
E) Reduce the following
expression to its simplest form using law of Boolean algebra. At each step
clearly state the law used for simplification.
C.D’ +A +A+C’D’+A.B
Question
2.
[2 x 5 =10]
a) What
is the use of implements keyword?
b) Convert
the following infix notation to postfix:
p+q*r- s/t
p+q*r- s/t
c) State
the differences between throw and throws keyword?
d) A
matrix of 2D array defined as A[4,….7][-1….3] requires 2 bytes of storage space
for each element. Calculate the address of x [6,2], if x [0] [0] is stored in
location 100 in the row major order.
e) What is
the difference between the best case and worst case complexity of an algorithm?
Question3.
The following function month() is a part of a class. What will be the output of the following function month() when the value of n is ‘January ‘ and the value of R is 5? Show the dry run/working.
void month(String n, int R)
{
If(R<0)
System.out.print(“
“);
else
{
System.out.println
(n.charAt(R) +” .”);
month(n,
R-1);
}
}
Part II
Answer six questions in this part, choosing two questions from Section A, two from Section B and twofrom Section C.
Section A
Answer any two questions
Answer six questions in this part, choosing two questions from Section A, two from Section B and twofrom Section C.
Section A
Answer any two questions
Question 4.
a) Given F(P,Q,R,S)= Σ(0,1,2,3,5,7,8,9,10,11)
a) Given F(P,Q,R,S)= Σ(0,1,2,3,5,7,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 andtheir complements are available as inputs. [1]
ii) Draw the logic gate diagram for the reduced expression. Assume that the variables andtheir complements are available as inputs. [1]
b) Given P(A,B,C,D)= ABC’D’ + A’BC’D’+ A’BC’D+ ABC’D+A’BCD+ABCD
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 theircomplements are available as inputs. [1]
ii) Draw the logic gate diagram for the reduced expression. Assume that the variables and theircomplements are available as inputs. [1]
Question 5
a)
Draw the truth table and logic circuit diagram for a 3X 8 decoder. [5]
b)
What do you understand by a multiplexer? State any one application of a
multiplexer circuit. [2]
c) Draw the logic gate
diagram to implement the AND gate by using NOR gate and NAND gate. [3]
Question 6.
a) Draw a
logic diagram for the following function using only NAND gate. [3]
F(A,
B, C, D)=(A’+B’). (B+C’)(C’+A)
b) A
combinational logic circuit with three inputs P, Q, R produces output 1 if
there are odd number of 0’s as inputs. [5]
1. Draw
its truth table and write its SOP expression.
2. Find
the complement of the above derived expression using De Morgan’s theorem.
c)
What is an abstract class? [2]
Section
B
Answer two questions
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. [ 10 ]
A class RecFact defines a recursive function to
find the factorial of a number.
The details of the class are given below:
|
|
Class
name
|
RecFact
|
Data
members
|
|
n
|
stores the number whose factorial is required.
|
r
|
stores an integer
|
Member
functions
|
|
RecFact( )
|
default constructor
|
void readnum( )
|
to enter values for ‘n’ and ‘r’
|
int factorial(int)
|
returns the
factorial of the number using the Recursive Technique.
|
void factseries( )
|
to calculate and display the value of
n! +(r-2)!
_ (n - r) !
|
Specify the class RecFact
giving the details of the constructor and member functions void readnum( ), int
factorial(int) and void factseries( ). Also define the main function to create
an object and call methods accordingly to enable the task.
Question8.
A
Transpose of any array is obtained by interchanging the elements of the rows
and columns.
A class
Transarray contains a two dimensional integer array of order [ m x n]. The
maximum value possible for both ‘m’ and ‘n’ is 20. Design a class Transarray to
find the transpose of a given matrix. The details of the members of the class
are given below :
Class
name : Transarray
Data
members
arr[][] : stores the matrix elements
m : integer to store the number of rows
n : integer to store the number of
columns
Member functions :
Transarray() : default constructor
Transarray(int
mm, int nn) : to initialize the size of the matrix,
m=mm, n=nn
void
fillaray() : to
enter the elements of the matrix
void
transpose(Transarray A) : to
find the transpose of a given matrix
void
disparray() : displays the array in a matrix form
Specify
the class Transarray giving the details of the constructor and other member
functions. You need not to write the main function. [10]
Question 9.
Class ChaArray contains an array of n characters
(n<=100). You may assume that the array contains only the letters of the
English alphabet. Some of the member functions/methods of ChaArray are given
below:
Class Name ChaArray
Data Members/instance variables :
char ch[] :
An array of characters
int size : The size of array of characters
Member
functions/methods:
ChaArray() :
Constructor to assign to initialize instance
variables to null.
ChaArray(char
c[]) :
Constructor to assign character array c to
the instance variable.
void displayArray() :
to display the list of n characters.
void
move()
: to move all the upper case letters to the right side of the array and the lower case letters to the left side of the array
without using any standard sorting
technique.
Example:
Input: t D f s X v d
Output: t d f s v X D
Specify the class ChaArray giving the details of the two
constructors and the functions void displayArray(), and void move() only. You
do not need to write the main function.
[10]
Section C
Answer any two questions
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 foralgorithms. 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
consumer wants to computerized his electricity bill calculations for his/her
own purpose. There is class meter which contains meter details and another
class ElectricityBill which calculates the bill amount. The details of both the
classes are as given below:
Class name : Meter
Data members :
meternum : long
integer data to store meter number.
name : string data to store name of
consumer.
mcharge : double
type data to store meter rental charges.
prRead : long
integer data to store previous meter reading.
Member functions :
Meter(long m, double ch, long p) : a
constructor to assign m to meternum, ch to mcharge
and
p to prRread.
void readname() : to accept name of consumer.
Class name : ElectricityBill
Data members :
crRead : long
integer data to store current meter reading.
rate : stores rate per unit.
units : stores
total units consumed
amt : stores total bill amount
Member functions :
ElectricityBill(……..) : constructor
to initialize the data members and assign 3.50 to rate.
double calculations() : to
find total units consumed and returns the bill amount (units * rate
per
unit) to be paid by the consumer.
void dispBill() : to
display electricity bill in the following format
Meter Name Rental Previous Current Rate Total Bill
Number Charge Reading Reading Per Unit Units Amount
[5]
Question 11.
Link is an entity which can hold a maximum of 100 integers. Link enables to add elements from the rear end and remove integers from the front end of the entity. Define a class Link with the following details:
Link is an entity which can hold a maximum of 100 integers. Link enables to add elements from the rear end and remove integers from the front end of the entity. Define a class Link with the following details:
Class name Link
Data
members
lnk[] entity
to hold the integer elements.
max stores
the maximum capacity of the entity.
begin to point
to the index of the front end.
end to
point to the index of the rear end.
Member functions
Link(int
nn) constructor
to initialize max=mm, begin=0, end=0.
void addLink(int
v) to add an element from
the rear index if possible otherwise display
the
message “OUT OF SIZE”.
int
dellink() to
remove and return an element from the front index, if possible
Otherwise
display the message “EMPTY…” and return -99.
void display() displays the elements of the
entity.
Specify the class Link giving details of all the
functions.
[5]
Question
12.
A)A Linked List is formed from the objects of
the class, [2]
Class Node
{
Int num;
Node next;
}
Write the algorithm OR a method
for inserting a node in the end of the list.
The method declaration is given below:
Void insertnode(node start, int x)
b) Answer the following questions from the diagram of a binary tree given
below:-
List the nodes in the tree given below using: [3]
List the nodes in the tree given below using: [3]
(i)
Preorder Traversal
(ii)
Postorder Traversal
(iii)
Inorder traversal

F
H
G
J P M
I
K L O N
No comments:
Post a Comment