You are on page 1of 8

LA MARTINIERE FOR BOYS,

KOLKATA
REHEARSAL EXAMINATION 2023-24
SUBJECT: Computer Science (Theory) TIme: 3 hours + 15 mins. Reading time
CLASS: XIl Full marks: 100

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 si questions from Part- II, choosing two
questions from Section - A, bvo from Section - Band hwo from Section -C.
All working, inciuding rough work, should be done on the same sheet as the
The intended marks for questions or parts of questions are given in brackets [].

PARTI 20 marks
Answer all questions
(Whle anSwering questions in this Part, indicate your working and reasoning briefly
whenever required.)
Question 1) (10x1=10"

The logic gate that provides high output for same inputs

a). NOT
b). X-NOR
c). AND
d). XOR

i). The canonical sum of product form of the function Y{A,B) =A+Bis
a). AB + BB + A'A
b). AB + AB' + A'B
c). AB + A'B' + A'B
d). AB' +A'B +A'B'

ii). Which of these access specifiers can be used for an interface?


a). Public
b). Protected
c). Private
d). All of the mentioned

12- Computer Sc.-1/8 (LMB)


expression:
the Boolean
iv). Simplification of
s:
A'B'C'D +A'B'C'D'E
A+A'B + A'B'C +
A'D + A'E
a). A+A'B + A'C +
b). AB + BC +CD + DE
c). A+ B+C+D+E
d). None of the above.
derived classes in Inheritane?
mode ln the definition of
v). What is meant by visibility
F(a,b,c,d) =(b'+c.d)ad'+c.(b+a')
vi). Find the complement of: keyword extends.
vii). What Is the relevance of the
vii). What is the use of super keyword?
F(A,B,C)= Z(0,1,4,5)
ix). Write the Canonical expression of and an Encoder.
of Decoder
x). State any one application each
(2+2+3+3=10]
Question 2)
notation:
a) Convert the following infix notation to postfix
(AB/C) - (D +E/F) -K
is stored in the memory. If the base
b) Asquare matrix of integer data type, A [mm] of the
determine the order
address A [1] [1] is 1098 and the address at A[4] (S] is 1144,
Column Major wise.
rmatrix A(m x m]) when the matrix is stored

Find Output:

vold funlint n)

If(n> 0){
fun(n -1);
System.out.priot(n +" ");
fun(n - 1);

}
fun(3):

d) Find Output :
int fun(int n)
(Intm=1,k=n/2,d=n;
while(k>=1)
{memkd;
k-;
d--;

12- Computer Sc.-2/3 (LMB)


pn

)
m=(n%2ee 1)(n+1/2:1;
return m;

i) na S W) n=6 ii) Purpose of the code

50 MARKS
PART ! Sectlon A, two from
(Answer six questions in this part, choosing two questlons from
Section 8 and two from Section C).

SECTION-A
Answer any two questions.

Question 3)

A premier Engineering institute enrols a student for a course In Engineering


based on the
EET the
merit list of Engineering Entrance Test (EET). Apart from the score of a student In
institute has set the following eligibility criteria for admission. A candldate is eligible for
admission if he/she qualifies any one of the following conditlons:

He/she secures more than 60% in class Xll examination of a recognized board and must
be above 16 years of age at the time of taking admission.

He/she belongs to reserved category and has secured up to 60% marks in class XIl
examination of a recognized board.
or
examination of a
Candidate is a female who secures more than 60% marks in class XIl
recognized board but does not belong to reserved category.

The inputs are:


board.
M: Candidate scores up to 60% in class XIl examination of a recognized
B: Candidate belongs to reserved category.
C: Candidate is a male.
A: Candidate is above 16 years of age.
Output:
E-Denotes eligible for admission.
(1 Indicates Yes and Oindicates No in all cases]

a). Draw the truth table for the Inputs and output glven above and write the SOP
expresslon for E(M,B,C,A) (S)
b). If x: Ihave a cell phone and y: Icannot study, then find inverse and converse of the
conditional x=>y. (2]
c), Using two half adder and an OR gate construct a full adder. (3]

12- Computer Sc.-3/8 (LMB)


Question 4)

a) Given F(P, Q, R, S) =I (2, 3, 6, 7, 9, 11, 12, 13, 14, 15).


Reduce the above expression by using four variable Karnaugh's Map. Draw the t
gate diagram of the reduced expression using NOR gate only.
b). Drawa logic circuit of an8:1 Multiplexer. (3)
c). State the dual form of the following: XY(XYZ+X+X*Z"). (2)
Question S)

a) Given F(AB,C,D) =n(0, 1, 2,3, 4, 6,9, 11, 13)


Reduce the above expression by using four variable Karnaugh's Map. Draw the logic gate
diagram of the reduced expression using NAND gate only. (5)
b) Verify if the following Boolean expression is valid: (2)
(a => b)Na => c)=a => (b^c)
c) What is a Decoder? Draw the truth table and logic circult diagram for a 2 to 4 Decoder.(3]

SECTION-B
Answer any two questions.
Each program should be written In such a way that It cearly deplcts the logic of the
problem. This can be achieved by using mnemonic narhes and comrhents in the program.
Question 6)

Design a class Nadam to check and print the type of humber. Some of the
members of the
class are given below:. (10)

Class name : Nadam


Data members/instance variables:
num :to store a positive integer number

Methods/ Member functions:


Nadam() :default constructor to initialize the data member with legal initial
value
Nadam(int x) :to store the value of xto num
int SumOfFactors (int x): to return the sum of factors using recursion
vold display( ) :to check and display the number with an appropriate message

Number Sum Message


25 1+5+25 = 31 <2num Deficient
28 1+2+4+7+14+28 = 56 =2num Perfect
30 1+2+3+5+6+10+15+30=72 >2num Abundant

12- Computer Sc.-4/8 (LMB)


Specify the cdass Nadam giving details of the constructors (), Int SumOfFactors (Int x), and
vold display ( ). Define a main () function to create an object and call the functions
accordingly to enable the task.

Question 7) (10]

Acass SetZero contains a two-dimensional array of order (m x n]. The maximum values
possible for both "m' and 'n' is 20. Design a class SetZero to input numbers Into the array
and if an element is O, set lts entre row and column to O's.

Example: 1

m=3: n3
1 1 1
0 |0
1 1 |1 0

Example: 2

m=4 ;n=5
|02 570 0oo0
1 8 693 086 90
5 1 1 41 o
774 28 07420
The details of the members of the class are given below:

Class name: SetZero


Data members/instance variables:
arrl] [] :to store numbers in the array
m: integer to store the number of rowS
n:integer to store the number of columns

Member functions/methods:
SetZero (int mm, int nn ): to initialize the size of the matrix, m=mm and n=nn
void input() :To input and store numbers in the array
vold Set() : If an element Is 0, set ts entire row and column to 0's
void display( ) : To display the array in a matrix form

Specify the class SetZero giving detalls of the constructor (int, Int), void input(), void Set( )
and void dlsplay ). Define a main () function to create an object and call the functions
accordingly to enable the task.

12- Computer Se.-s/8 (LMB)


Question 8)
(10|
Aclass Arrange has been defined to accept a string from the user and
formed out of the first letter of each word of the string. After creating create
a
the neW new word
the word, alphabetically and print it. Word
Example: Input: IF IT DOESN't CHALLENGE YOU IT DOES NOT CHANGE YOU.
Output: IDCYIDNCY
Sorted: CCDDIINYY

Some of the members of the class are given below:

Class name: Arrange


Data members/instance variables:
str :to store a string
nstr :to store the new word formed
Sortstr :to store the sorted word

Methods/ Member functions:


Arrange( ) : default constructor to initialize data
members with initial values
void accept() :toaccept a string in upper case and store in str.
void extract() :to store the first letter of each
word In nstr
void sort( ) : to store the sorted letters in
sortstr
void display{) :to display the new word
formed along with the sorted word
Specify the class Arrange giving details of the
void sort) and void display( ). Define a main constructor( ), void accept( ), void extract( ),
( ) function to create
functions accordingly to enable the task. object and call the

SECTION-C
Answer any two questions.
Each program should be written in such a
way that it clearly depicts the logic of
problem stepwise. This can be achleved by using the
names or pseudo codes for algorithms. The comments in the program and mnemonle
programs
algorithms must be written in general /standard form, must be written in Java and the
wherever required / specified.
Qiuestion 9)
(5)
A SUperclass Employee has been defined to store the details of a
Wages to compute the annual income of the worker. The worker. Define a subclass
classes are given below: details/specifications of both the

12- Col, uter Sc.-6/8 (LMB)


Class narme :Employee
Data Members/instance variables:
Name :to store the name of the worker
Address :to store the address of the worker
Monthly_salary :to store the Monthly salary in decimals
Member functlons:
Employee (-.) : Parameterised constructor to assign valves to the instance varlables
vold display () : displaythe Employee's details
Class name :Waças
Data Members/instance varlables:
Tax :stores the income tax in %
Member functlons:
Wages (..) :Parameterised constructor to assign values to the Instance variables of both
the classes
double taxcalc() :Calculates and returns the annual Income tax of the employee.
void display() :Calculates the annual pay using the fornula,
Annual pay =Annual salary - tax and display anhual pay along with
other details.

Using the concept of inheritance, specify the class Wages glving details of constructor ().
double taxcalc() and vold display (). The maln () function need not be written.
Question 10)

Register is an entity which can holda maximum of 50 integers. Register enables the user to
add elements from the rear end and remove integers from the front end of the entity.
Define a class Register with the following details:

Class Name : Register


Data members
reg[) :entity to hold the integer elements.
max : stores the maxlmum capacity of the entity.
begin :to point to the index of thefront end.
end : to point to the index of the rear end.

Member functlons
Register(int mm) : constructor to initialize max=mm, begin=0, end=0.
otherwise
void addregister(int v) :to add an element from the rear index If possible
display the message" OUT OF SIZE".
: to remove and return an element from the
front index, if
int delregister()
possible otherwise display the message " EMPTY..." and
return -99.

vold display() : displays the elements of the entity.

12- Computer Sc.-7/8 (LMB)


details of the constructor(int), vold addregister(int L int
a) Specify the class Register giving [4
delregister() [1)
b) What type of data structure is the above entity?
Question 11)
(1]
() What are the factors affecting time complexity. (1]
(i) What is Big O notation?

following questions from the diagram of a Binary Tree given below:


(0) Answer the
(15)

12) 20 30

(1j
(a) Name the internal nodes of the tree. [1
(b) State the level and the order of the node 11.
[1]
(c) Write the pre-order traversal of the above tree structure.

12-Compu MB

You might also like