Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

THE HERITAGE, SCHOOL

PR.EBOARD EXAMINATION - 2018-2019


SUBJEL-T - COMPL]]-ER SC}ENCE Downloaded from TestPaperz.com
CI,ASS - xII
F1JLL MARKS*7[) llME:3 Flours
CO\{PUTER SCIENCE
Paper -I
(THEORY)
Tlhree Hours
(Candidates ore {rllou,ecl additional } 5 minutes for onl"y reading the paper.
Tlte y* rnu.tt NOT start writitlg dttring this time).

Answer all que,stions in Parl I icompulsory) and slx queslion-t.from Part II, choosing lwo
qtrcstbnsfroru Section - .4, twofrom Section - B ond tnofram Sectirtn - (1.
All working, inclur.ling roul:h vnrk shaultl he done iin the same sheet {}s the rest af the

m
afisy:er.
The inlended rnarksfor qttes{ions or parls of questions nre given in llrc brockets IJ.

co
PART I (20 Llarks)

z.
Answer all questittns
er
f4/hile cnst$,ering questions in this Part, indic{tte hriefly' 3,our warkinp; and reasoning.
v,herever required.
ap

QUESTTON r
tp

(a) State the laws i) x*xy:x ii) p+qr:(p*qXp+r) lll


(b) Drarv )C|.JOR gate using NAND gates only.
es

t1l
(c) Show that the dual o1 A'BC'+AB'C+A'B'C is equal to the cornplernent of
AR',C+8.(A',C',+AC',) IU
//t

(d) If X-"Y ihen write its contrapositive and inverse" tU


(e) Given F(A,I]"C):AB+BC'tei its canonical SOP tbrm. Ill
s:

QUESTTON 2
tp

(a) Convert the fbllowing inf,rx exprression to its postfir forrn t2I
NOT (A OR B) AND (A NOT(B AND C))
ht

(h) A two dimensional array defined as X[2...7,-2....7) requires 4 b3,tes of storage space I2l
for each element. If the array is st-ored in column ma.lor r-rrder. determine the address
of X[5,11, given the base address as 1200.
(c) Iixplain two types of pol,vrnorphism in java. I2l
(d) Deline the terms Best-Case and Average-Case Complexities. l2l
(e) Why is it not a gr:od idea to apply binary search on a sorted linked list r:f values? l2l
Downloaded from TestPaperz.com

, Ll7
This question paper consists of 7 printed pages
QUESTTON 3
Fill in ihe '?.-?' r,vith the appropriate aitslver, Atrso sho* the dry run&vorking. tsl
Pollowing is the code for l+(2*3)+(485*6)...n
Downloaded from TestPaperz.com
int series(int past int presenl. int n)
{
i
int i, cur =' ? 1?:

if(present:: n - l)
rcturn ?2?:

fbr (i : past: i < past + present; i**)


our x: ?3?:
relurn ?4? * series(i. ?-5?+ i, n);

m
I
t

co
PAR.T II
(50 Marks)
Answer sLt que stions in lhis part, choo.rittg two que,stions frrxn Section A. tw,o frr:m Sectiort B

z.
and lwo fronr St,tlion C.

Sf,CTION - A
er
.Anxt,er {*?y llra r1ueslian,t
ap

QUESTION.$
tp

(a) Given a Boolean Function F(A-B,C,D):I($,1.6,7.8.9.10.14"15). tJse Karnaugh NIap to reduce the
function F, using SOP fomr. l)rarv a logic gate diagram for the reduced SOP fonn.
es

You may use gates rvith more than two inputs. Assume that the variables and their complements are
available as inputs. tsl
//t

(b) Given a Boolean Function X(A,B.C.D):L(2,3,4,5,11.12,13). Use Karnaugh Map to reduce the function
X, using POS form. Drarv a logic gate diagram for the reduced pOS form.
s:

You may use gates w'ith more than two inputs. Assume that the variables and their complements are
available as inputs. tsl
tp

QUESTTON s
ht

(a) i) Prove that A(B+B'C]-B'C'):A [2+31


ii) Construct a fulladder using two half adder circuits.
(b) Define cardinal and canonical furm of a hoolean expression. tzl
(c) Apply De Morgan's theorem io the given expressions:
13l
i) (AB(CrD+EF))',
Downloaded from TestPaperz.com
ii) (A+8,+c+D,),+(ABCD')'

217
This question paper consists of 7 printed pages
QUESTION 6
(ai An insura.nce company issues a policl'to an applicant trnlr when the applicant satis{ies atleast one of the
lbllowing conditions:
The applicant is a married maie of age 35 1'ears or abLr\ e.
The applicant is a female lvlro ner,er had a car accident. Downloaded from TestPaperz.com
T'he applicant is a married female and had a car accident.
The applicant is a male below 25 1'ears.
The applicant is not below 25 years and has never had a car accident.

The inputs are:

M The applicant is nrarried


S The applicant is a male
C The applicant had a car accident

m
Y The applicant is below 25 l ears

co
The outputs are:
I: denotes, issue of policy I I indicates res and 0 indicates no]

z.
Draw the truth table fbr the inputs an,j outputs given abor e ancl write the SOP expression fbr
r(M,s.c.Y).
er
tsl
(b) Drarv the trogic gate diagram tirr ihe -rlivcn Boolean function. making use of only NAND gates.
ap
F(A,B,C): (A+B'XB'+C) l2l
(c) What is an encoder? State its application, t3l
tp

Downloaded from TestPaperz.com


es
//t
s:
tp
ht

il :r ,'' 317
This question paper consists of 7 printed pages
SECTION - B
In,:sw*er efiy ltt{) qu€,tti{}rltt
Each progran should be written in such & way that it clearly depicts the togic of the problem.
This can be achiewd by using mnemonic names and commcnts in the program.
(Flowcharts and Algorithms are not required.)
Downloaded from TestPaperz.com
The prngrnms mu$i be writtcn in Java.

QUESTTON 7 [101

A h*ppy nlirnber is a numtrer in *'hieh the eventual sunr of the square of the disits of the
number is equal tol.

Example:

/$:"t2-yg2:4+64:68

m
68:62+82:36+64: t 00
100:12+02+02: 1 + 0 + 0 : I

co
Hence" 28 is a happ.v number.

*4 :

z.
Example; 11 - 12+22: i 5

Hence, 12 is not a happy number.


er
ap
Design a class hupp." to check if a given nurrber is a happy nurnber. Some of the rnembers of
the class are given belorv:
tp

Class name : rHappy


es

Data memhers/instance variatlle

n : stcrres the number


//t

Mernher filnctions :
s:

Happy( ) : consir-uctor to assign 0 to n


tp

void getnum(int nn) : to assign the parameter value to


ht

lhenumbern:nn

int sum_sq_digits(int x) : returns the sum ofthe square of


the digits of the number x.
using the recursive teehnique
void ishappy( ) : checks if the given number is a
happy number by calling the
tunction surn_sq _digits(int) and
displays an appropriate message.
Downloaded from TestPaperz.com , 417
This question paper consists of 7 printed pages
Downloaded from TestPaperz.com

l Specify the class Happy giving details of the constructor( ), void getnum(int), int
sum*sq_digits(int) and void ishappy{ ). Aiso define a main( ) function to create an object
and call the methods to check for happy' number.

QUESTTON I ll0l
Design a class lileight tc accept sentence and calculate the frequency of words that have
weight greator than 600

Class name: :\Ueight


Data memtlers/instancs variatrle
str : stores the sentence
f,req : stores the count of the number
of words having weight greater
than 600

Member functions :

m
Weight0 : to initialize str and freq
void readstr() : to readthe sentence

co
void fieq_word(String) : to count the number of words
rvith weight greater than 600.

z.
void display() : to display the frequency of the
words greater than 600.
er
Specift the class Weight giving details of all the methods. Also write the main function.
ap
QUESTTON I [10]

A class FlaneA defines coordinaies of rrvo points in a plane. -fhe details of the class is given
tp

belou':
es

Class name :PlaneA


Data Members
double x,y To store the x and y coordinates
//t

Functions/lVlethods
PlaneA0
s:

constructor to assign 0.0d to x and y.


PlaneA(doutrle nx, douhle nyi eonstructor to assign nx to x and ny to y.
tp

double distancc2d{PlaneA b) to re.turn the distance between the point b and


the current point in the plane.
ht

if xl, x2" yl,yZ are the cocrdinates of the two points. then the distance between the points

intheplarreis@.
Specif,, the class PlaneA giving details *f all the methods. AIso write the main function.

SECTION. C
,4nswer arc.t| twa question^;
Downloaded from TestPaperz.com

This question paper consists of 7 printed pages


Eaeh pragram should be writted in sach a way thst it cleaily d*picts the logic of the problem
stepwise.
This can be achieved by tsing comments in the program and mnemonic names or pseudo codes for
algorithms. The programs must ba w,'itten in Jary and the algorithms must be writlen in generol /
standardform, whereyer required / specified.
(Flowchans are not required.) Downloaded from TestPaperz.com

QUE$TfOItil I0 tsl

Define a class Calculate and a deriyed class HllF tr; i'rnil the HCF of tw-o rlunlbers.
The details of both the classes are given below:
Class narne Calculate
Data Members
nl. n2 inteEers whose H(lF is to be detennined
Member Frnctions
void accept() to accept integer nl and n2

m
void display$ to display nl and n2 r.vith suitable Inessages

co
Class nirme :HCF
Data Members

z.
h : to store the HCF
Memtrer Functions
void findHCF0 :
er
to find and store I-ICF of n1.nl in h
'r,oid show0 : to display h witir suitable message.
ap

Using the concept of inheritance specify the class HCF. giving details of the function
void findl-[CF0 and void show.$. Do not write the nrain functinn.
tp

lt
es

QUESTTO|{ tsl

Define a class Auditcriur-n which allo*'s the user to add elements fronr one end(rear) and
//t

remove elements fiom the other end (front) only.


The f*llowing <.letails of the clzrss Auditorium are given Lreiorv:
s:

Class Name : Auditorium


tp

Data Members
at[] r an arra,v tt hold a maximum of i 00 inteser
ht

lements
cap stores the cepacitlv of the array
f to point to the front
T to point to the rear
Member Functions
Auditorium(int m) constru*tr:r to initialize the data meinbers
cap:rn,FCi,r0 and to create the integer array
Downloaded from TestPaperz.com
617
This question paper consists of 7 printed pages
Downloaded from TestPaperz.com

void pushvalue(int v) : to add integers from the rear index if'possible


else dispiay' the message("Overflow'')
int popvalue$ : to retnove and return the elernent from the
tiont.
lf anal is emPtY then return -9999'
void display() : display s the elements present in the list'

mfinber function void


Specify the class Auditorium giving details of the ctustructon(int)'
need not be written'
pushvalue(int), int popvaluel) and r oid displayo. The main function

QUESTTON 12
(a) What Iixplain brief)y w-ith an example'
is ttie role of constants in cornpleriry?
13t
12)
iUi fto* the given binary tree ans*er the following questions

m
i) External nodes
ii) Postorder Traversal

co
z.
er
Downloaded from TestPaperz.com
ap
tp
es
//t
s:
tp
ht

t';1 . 717

This question paper consists of 7 printed pages

You might also like