0% found this document useful (0 votes)
48 views9 pages

Adobe Scan 10 Dec 2024

Heritage prelim paper computer class 12

Uploaded by

sneh agarwalla
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views9 pages

Adobe Scan 10 Dec 2024

Heritage prelim paper computer class 12

Uploaded by

sneh agarwalla
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

, he I lcril" ~" :-..

c h ool
Pr'i' U onrd F,11m in111l on 2 0 2 4- 25
C:om pu t i'r ~d,·n ,·..- I h c or) l'n p c r - Grnu p 4
C ln,s "-11

Fu ll :\ l nrl.., : 7 0
Time :3 hour- .
Purr I
(20 :\ ta r !...~)
(All q11t•stio11~ urc cm11p11/:wry)

QUE STIO N 1

i) \fa clu::.s impkm ent!> an imcrfa ce. \\hat must 1t do'.'


A) lmplcm cll\ .1\1 mctho Js of the intcrfa le Ill
B\ b,t,m d th.: interfa ce
~) \)ec:\nre 1hc in1c1 face llS a , t1riahh:
11)) \lt..\ \. ,\.\c "'1..un.._\ru c\nr f o r the intc, f.h,.c:

11 I ·' "" r11 0 11 : \ cl.1.s , that 1mplcm,.,nh .lfl i111crfacc muM implem
,.,nl all o f 1b rnctho J, Il l
R,·:.-n nin2: It j d:i" doc, not implem ent :111 method , . it can ~till
be in~tuntimcd .
A) lloth .1"cruu 1, and reasot11ng arc 11ue.
8 ) Both a,~nio n and reason ing arc fobe.
C l 1 he as,cr11on 1> ,rue. hut the rea5on mg i, false.
Dl 1 he :i,;sc·rtion i, lulse. hut the reason ing is true.

iii) .b , l'rtion : The time complt:~it~ for in;,cni ng a node :n the begmn
iny ofu li11l-.ed h,1 is 0( 11
Rt."11,o nin i:: l hi~ i, bec.1u~e \\C onl~ need tn dmngc .1 le\\ p<llnter
.\ J ffolh J".:rti on jllJ re:ison ing jf.: tru,:.
.-. 111
13) Both a~,c11,nn anJ rcasnn mg are 1',1lsc.
Cl The j ,~,:rtion 1~ tru<:. hul lh.: rea5on ing b false
l) , l he :i,~.:rti ur 1, false. h ut the rea~on ing" true.

i, ) \,w rlion: l"nco.k r-; can on!~ \\ Ori-. "ilh hinar) inputs.
Rcuw ninl!: Thi,- l1111ilaliu11 mak~~ lhcm un~u11able lur oth,:r numl,,. Ill
,r syst.: m,
,, \ 1 B th a".:rtion JnJ r.::iso111ng Jrc true
U t 11<,th a ~-crt 1<>n and n.:a~,,n i ng .ire lals.:.
Cl ·n,c n"cnin n i, true. hut 1hc rca,oning i~ falsc
O I The .1, n ior i, fjl,,:. but the r,:a,on ing b true.

THIS QUESTION PAPER CONSISTS OF 9 PRINTED PAGES


, 1 \\ nil' thl' Jitk,cnH· 121
1 1h,1 ,, I d o" nnd inter foe.-
• 111 c,1.-,nnl 11nd 111tc:rnnl 1111tlc, ofo hirtnr> tree.
, 1I \\ hut ,, thl' II,~ ( l complc \lt ) for th<.' foll11w ing 1.odt· \CJ•mcnl'' fl I
lort111t I. 0.1..• n. l.. t • I
,, -1.. .
)I') O (n ) c)()(n' ) d)O{ I l
' 11) \\ tt h n:krcncc ll>the fullo,,inl' Jlfnj!rnm w dc ,inw,cr the 11uc,1111n
, 011..I tri1.l..(m1 11.1111 hJ

lllffl I.
for(int j - I ,j~<hj-. .p• o)
~} " tern 1>111.prinrln (p):

\\ hjl ,, ill he the , jluc of method Lrid,() when 11 1 and b"-1'>


Jj 12 b):!7 l1 d) b4 ?
, 111) Assertion : A complete binary lrcc is a binnl')' lrec in ,,lt ich all lcvcb j n: full) filled c,ccpt
ros~ibl) the la,1 le, cl. II I
Rca,.onin g: Ihe la5t level j,. filled from right 10 lcfi.
A) Both asi.cnion and rco,oning ore true.
Ill Both as,cnion and rcm,omng arc false.
,. l I I he as!>Cnio11 is true. but the rca:.oning is fob~.
Di I he as~crr,on is fal!.C, hu1 the reasoning Is lruc.

~) "h;u i'> an C\CCplion' '


I11
<) l ' F:ST ION 2

1) C.om en the follo\\ 111g inlh notution 10 pcdi>. form.


121
(A/B+CJ /(D • ( E - F)) 'if... • (I f •
ii )Diffcrcnt iu1e hct,\ ccn Din:1:1 Recur!.ion and Indirect Recursion
,ii)Write 1hc urJcr ofcomple xit) for an ildsc statement.
Pl
111
"Jl he folio\\ 111g program con, cm !.fl 111g 10 lnu:ger using n.:cur!.i on
I ill up 1he 11ue,1ion marh v. i1h 1111.: upprupnu le un ~wcr
151
! lI i-, t-- l ., ,r I •
• • 1 JC !!ii lfl!.rlSL t lll<J !:i i I )

' :, l t . l •• IICJ' L I I
, J r r1
,.. ... ~ •;r I • :l 11 A1 (( ...
• I l
I;

2
d o u b le y = l n
d o u b le x : ., ?te ( st r 5 ub .
. s tr 1n g ( l ) ) ;
X = X ♦ ?4
'> .
3 •
• ,
• • + y;
re tu rn ( i n t l (X
) ;

p u b l i c s ta ti c
l v o id
~~ in (S tr i ng {\
ar gs )
S tr in g st ~ = "
12 35 ";
S ys ~e m .o u t. p ri
n t {? 5? ) ;
L rl t ( rJ..,-\

Part U
(SO M ar ks)

Se ct io n A
(2 0 Marks )
(A ns we r any two qu
a tio ns )
~ es ti on 3

a ) ?i = n lh c Bo
ol ea n fu nct io n: F(
1) Re du cc •he :ib ov A. B. C.D )= ~( 5.6 .7.
e ex pr es si on by us in &. 9.1 0. 11.14 ,1 5)
oc te t, qu ad s an g 4- va riahlc K map.
d pa irs ) ..,e> ,. & i. 'i,. 6 1"1 sho" ing lhe ,ar io os gr
ou s (i
c .•
P
ii) D ra w th e lo gi c ga 1-t I
te J ia gr am fo r th e re
co m pl em en ts or e av duce d expression. As
ai la bl e as input~. su m e th111 th<! variables
and their
\I \
b l G iv en th e Bo ol
ea n fu nc tio n : r (A ,
- ( A-t-B ~C + D) (A ..- B. C O l
8- C +D )( A+ B.._C"
0

+D "X A+ B+ C"..-D XA +B '+ C -D


D )(A · ...a..c· + o) 0
)(A+8 °+C' +D )(A ' ... 8➔
i)Rcr.lu ce th e ab ov C•
e ex pr es si on hy us in
· ). g 4 variable K- ma p sh l4l
quads and po,rs > , ' owin g lhc vario us gr
· • ·• ' I t ~\ ou ps (i.e .. octet,

ii) D ra ,, th e lo gi c g at
e di og r:i m for the l"\
!duccd expression. As
co m pl em en ts arc a, su m.: th at the variab\
ai lo bh : a,, in pu ~ .:s n™1 their
II I

3
'
~
1

i
'
\
0¥$tioa ,.
/ a) Dra" rhc losic circui1 ro dl-code the binary numbt-rs
(00 I0.0IO1 .0111. 1000, IOI0.1 100.1 11 0.1111 ). Also stare the hexadecimal
cquivaJ t>nts of
given binlU) numbers.
lhl" • ~ .,, i I I f51
b) Vmf) the follo"in g proposirion is valid using truth lahlr
[JI
A= >(B \ C)= (A=>B ) \ (B=>C ) • rJ.) . ~, µ
c) Fmn, lht' fo llo"ing diagram answt"t' the following

;) \\'h;<1, n,la,;on ;n propo,;1;on,J logk ;, dq,kto d b, th, •bo>< got,?


•- • (II
H) ll'rit<, th< boolean ,......, ;.., and dr.uv the log;, >) mbol ro, th< obov,
ga1< (I(
Question 5

a) A .Jx I M UX is shown in the figure below:Wri1e the output


of Z us ing exclusi ve gates.

(3\

C
12
11 MUX z
C
IO SI S2
··· 11-
AB
b) Simpli fy the boolean express ion (A+B)(ATB')( A ·-rq
(J J
A sponso r p311llCC .mtcn ds Lo sponso
• · . r a music compan y to invite Bl)un Ada.ms
for a li\e
c) rhe follo~ ing cnten a: . . .
•concert as per
The music compan Y has orgnmz . ed 1·iv.... concerts earhrr and is H'I) c:-r eatl\c
Or .
• The music compa ny .,s very cn:ative Md is highly rated, but has not organiL
cd &n) II\~
concert s earlier Or

• The music compa ny .is highly rated and has \\ on pria!s .


The inputs are:
Inputs .
A. Orgam'zed live concerts earlier
B - Is very creative
C - Won prizes
D - Is highly rated
( ln all the above cases I indicates yes and O indicates no).
Output: X [ I indicates yes and O indicates no for all cases) .
Draw the truth table for the inputs and outputs given above. 141

Section B
(20 Marks)
(Answer any two questions)

7ESTlON6 (IOI

Destgn a class Duplicate to remove all duplicate characters from the string and find the resultant
string.The details of the members of the class are given below:
C\ass name : Duplicate
Oata members/instance variables:
WYd : stores a String
OW : stores the modified string
/en : to store the length of the word
Methods/Member functions:
Duplicate() : default constructor
void acceptword( ) : to accept lhe string
String remvDup (String,String,int ) : to remove all duplicate characters from the string
and find the resultant string using recursion
void display( ) : displays the modified string along wilh
an appropriate message.

Specify the class Duplicate giving details of the constructor, void acceptword( ), String
remvDup( ) and void display( ). Define the main( ) function to create an object and call the
functions accordingly to enable the task.

QUESTION 7 (10)

A class Join has been, defined to concat two numbers numerically (without using any string
operations) and produce a merged number.
Example: The two numbers 65 and 723 become 65723
Input: 65 and 723
Output: 65723

, f ~ . ':t t
.. ..-- .
_,
.
,
. .. ., f "' •
,
"' . .
Cius Naml'
: Join
Data Mem ~~ lnstanc:t Varbiblcs
num
:integer lo store n numhcr
Member Functions/ Mctbod5
Join()
: constructor lo initioli,c tfatn member with
legal initial value
.,,oid rcadNumbcr()
: lo occcpl the in teger number in num
Join JoinNum(Join X. Join V)
: concat the num ber, contained in
parumcterizcd objects X and V numerically (S
Lring
OJ)Cf'lltions :m: not allowed) and produces a merg
ed
numb er and returns lht.: object cont ainin g lhc
merg ed num ber.
"o id show()
: 10 displ ny the merg ed number
and the odd
posit ione d dii;it rrom the merg ed num ber
w11h tm
appr opria te mcs:su~e .
Spec if)• rhe class J o in givin g dem its
o r th e eon~1ruc1or Join () . void rc udN umn
Join Y) and void ~h o ,.,( ). Deli ne th c<( ) . .lo,n~.lo,n X.
e ma.in ( ) func 1ion to creo le nn obje ct and
acco rdin gly 10 enab le the en\\ lhc fun.c\ion s
task.

QU EST ION 8
(10 /
A clas s Swirl cont ains a 20 M::u rix of o
rder NxM . It print s the K ·th elem ent in the
the matr ix. spira l fonn of
Inpu t: arr{}!\ =
lt\ .2. 3. 41
1s.6. 1, s1
(9. 10, 11. 12}
113, 14, 15. 16) J
k=7
Output: 16
Explanation: The clements in spirol order is
I, 2, 3, 4, 8. 12. 16. 15 ...so the 7th e\c:mcnl
is 16.

Class Name : Swirl


D11ta Membcrs /lns111nc:e V11ri11bk-s
al'TjJII
:10 ~tore i111ci;c:r numbers
M
. 10 store: number of rows

6
~ n II
An int erf ace SrafT is def
ine d with u me tho d vo id dis
\5\
ina em en tin g em ployee . Cr plo y( ) to print lhc req uir ed
dct ai\ s of the
Staff. Th e cla sse s ha ve 111 eat e the clo sse s wo rke r and wo ges wh ich im ple me
tributes wh ich rep res ent the nt the int erf ace
Woticer and wo rki ng ho urs nam e of the sta ff, b asi c sal
, rar e pe r ho ur and tou il wa ary for c\a s~
con str uct or. ge s or cln ss Wa ge s wh ich
arc SC \ by \l\c, r
h,t erf ac c Na me : Sta ff
MC1Dbc:r Mc t_b od s

vo id dis pla y () : to dis pla


y the req uir ed detail s ofl he
em plo yee.
Cl ass Na me : W ork er

Data m cm ~n

nam e : to sto re the nam e


of the wo rke r
basic : to sto re the basic pay
in decimals
M em bu MelliO<ls

Wo rker ( String ns, double


bs): param eterized construct
variables. or to assign orguments to ins
tance
void display ( ) : to display
the worke r det ails
Class Na me : Wa ges

Data me mb en

8
hours : to store hours work
rate : to store rate in decimals

wage : to store the overall wages of the worker in decimals


Member Methods

Wages(... ) parameterized constructor to a.ssign values to


the instance variables of the sub class
and also the super class

double overtime ( ) : calculates and returns the overtime


amount as hours into rate
void display () : to calcul ate the wages using the fonnula
( wages = over-time amount + basic
pay) and print all data members.

Specify the interface giving details of data members and


method. Using the concept of inheritance,
specify th.e classes giving details of the methods. Define
main( ) to create objects and call the
methods accord ingly to enable the task.

9
N : lo store number of columns
k : lo store lho K '1h c lement
Member Functio n/ Method~
Swirl() : construc tor to initiali1,c dota member with
lcgol iniliel vuluc
void read() : to accept the integer numbers and store in mat
void elemen1_ k() : returns the K ' th element in the spiral form of the
metrix.
void show() : to d isplay the K 'th element with an appropri ate
message .
Specify the class Swirl giving details of the construc tor, void read(), int clcment_
k() and void
show(). Define the main() function to create nn object and call the function
s accordingly to
enable the task .

Section C
(10 Marks)
(Answe r any two questio ns)
Questio n 9
/51
A linlced list is fonned from rhe objecls of the class Node. The details of
lhc class Node is as
follows:
Class Node
(
S tring str;
Node link;}
Write an algorithm O R a Method to delete the start/fi rst node containing str
of an existinK linked
list . The prototyp e oflhe method is : void deleteNode(Node first)

~estio n 10

a) ls binary tree a recursiv e data structure? Justify your answer.


12)
b) Write the Postorde r traversal , depth of node 10 and size for the followi ng
binary tree. 13)

You might also like