You are on page 1of 12

I GATE - 1997 I of I.!

It=:::=COMPUTER
-.- SCIENCE & ENGINEERING
B Quick Son
SEcnON·A C Minimum I'Ctght Sjlannong tree
This question conulins 10 subparts, each D. Connected Components
cat•ryin.g I mou·k. Each subJUU1 routains a LisrlJ
multiple cltoice qu~tion. \VIite in youo· nnsw.,o· I Greedy
book the subpar1 numbet· and !be leUe~· A, B, C 2. Depth- First Senrcl1
o,. n corresponlling to the most a ppt·opliate 3. Dynamic l'rogmmming
answer·. ~. Dh•ide and Conquer
(Marks: 10 x I = 10) Codes;
/\ 13 c D
The probabi hly tllat it 1\111 rain loda) is a. 2 4 I 3
0 5. Tile probability lhal it 1\ m rain b. 3 4 I 2
tomorro\\ 1s 0.6 The probability thnt it c. 3 -1 2 I
" i.U min either tod~ or tomorrow is 0,7 d 4 I 2 3
What is th~ probabilit) 1h:u it \\ill r:u•• (i In ~~• follo11·1ng grammur
today wtd tomorrow? X : : •XfBYIY
a 0.3
b () '25 y :: - Z 0YIZ
c. 0.35
II o,.J z :: ·id
2. The Ne\\1on-'Raphson oneU10d 1s used to Which of !11e followUlg is true?
find the root of th~ equation ,..J - 1 = tl. II a •e- is left. associative \l hile ~' 1s
the Iterations are starled from - 1. the righl assodati ve
itera11ons will b. Bolb -e· and •j;i· are le11. assoc13dve
a converge to -I c. -Ell - 1s roght nssOclath'e \\'hde -EJ· ts
b, con' erge to ../2 left associatl\·e
d None of the above
c C()ll\•erge 10 - ../2
7 Wl1tch ol tile. f0IJOMny IS essennal for
d. not com erga
converting an iunx expression to the
3. The delem1inru11of the 1113LIJX
_g postfiX form efficiently'/
I I
n. An operator stack

r: u 0
(J
2

()
-1
-1II
0 -I
li b An operand stack
c. A n operand stack tllld ·m1 ope•ntor sl:1ck
d. A par.;e tree
A language L allows declam11011 of arril) s
IS whose sizes 11re not known during
a. I I compilatiO!l 11 is rcquued to m:tl.e
b -~S efficient use of memO!)' Which one of the
c ()
following 1s true'/
tl -24 a A compiler usi ng static memory
4. The concatenation of two lists is t<l be allocation can be writlen for L
pcrfonued in 0 (1 )'time. Which of tbe b A compiler Clll100t be "nuen ro,· L an
a, singly li nbed list interpreter must he used
b doubly linked list c. A compiler us1ng dynnnuc memory
c. c1rculnr doubly linked lisL allocanon can be written lor L
cL urra" 11rtpleonen1.111on oflist d. None of the above
s. The co'rrocl matching for the following 'I The cond.iuonal e.xpans10n fQdihy or
poirs IS macro processors i:s provided lo
Llsll a. test n condition d.uring, the execuuon of
A All poirs shortest paths the expanded progtam
lo1 IZ
b. 10 e.\"f>aruJ -.:at.ain model SIUJem~uts 2. Disk
de~ndin& upon !be v;tlue ~f • 3, Printer
QOndition during ll1.: e~~:Nulioo of dt< 4. ALU
cxpandtd program c,, d~:

o, l() implom<nl r<~Ufl;[tlll


d. to expand certain rilodd •tatcmonts
depending upcn tlle \fnlu~ uf :a
.. "
b.
A

2
B
J
I
c
I
J
2
4
D

conditi<lu durjn~ lltc process ur rmtcru ~. 4 3 2 l


-:xpansiou d. 2 3 4 I
l 0. HMp allo.:ation is rcquirtd tor lnngunscs 15. Au N-bit ClUJ)' loolt alt~ud odder. whcr< N
I t.b al $Upport reour<iQo is a multiple of~ employ~ !C.• 74181 (4 bh
2, that support dynamic da~n Struclures ALLI) t~~~d 741$2 (4 bit C11CT)' tool ubeod
1. thatLL<e dynnmi<' <<Qpe nile-~ g~ne rbtor).
4. ll\lllC orthe UboVO TI11> minimum Udditiont fntr liSlO!! the t>~
aM>it«:lur• lo rrhis adder i$
Thl~ qu<S111Nr ~o nloln• 5 ~ ubpurtli, t•ut·h •· proporri<~naltu N
•~•rrying I nmrk. Ench s ubp;u1 rontains " h. pmportionnlto log N
i nultf]rle d 10kc questlun. W "''" lu yulll' nnswer c:. u. oonslaot
book the snbpnr1 numbl.'r and tltc lelior A. 8, d. nun!! ufth~ a bow
C..:, or 0 con-esponding to lbt• most upproprinte
This question cont11im 10 subpo rts. Each
(S " 1 = 5) t.'llt'ryin g l murk. l!:nrh subpart n mtalns u
multi pie cholre qucst.io n. W rll.e In yo11r nnswor
I I. Let • b.! dell ned ru. .~ • y= r - y r ~ t l.~ b<luk the subpl&rt number nnd ilre Idler A. B.
x • y Vnlu\! nfr. • :-,.is C'. ur D. CtUT<'l!POmllug lu file m ost uptrr·upriu t..
lL x .... y

b. !\ (JO X L- 10)
..:.. 0
<l 1 l(>. Let (Z.*) be. ~~~ nlg~brat" struclu~ wber~
12. RS1' 7.5 iJtlcn"pt iJt ~0~5 uiic'rltrr,wes•or Z rs tb.e. sol of integers :tnd the oper.1tion •
<l(l:l:ut<R Ute lul<rrupl ~erviu~ nwtirte rm111 is <lefined by n•ru= maxunPot{n.m).
interrupt \'oetl;)r h>talinn \\1tich Qf the following slat.:ments Is lrue
:L O!!OOH fllr cz.•)?
b. 0075H a. (7. ') i~ u monoid
u. 003Cil b. (7- 11 ) is :UJ Abel inn grouf1
d. OOJ4H .:. (7. • ) rs u gruup
Purpos~ uf a stan bit in R8232 •~rilrl d,. Non~ or tho nh<IVO
C()Jtimunicotion prol&.'OI is. 17. Wluch of tbc fo lJmvl.ng pro[>f'sit il'flll is n
,,, In !.\·ynchronji!1i rr:c¢h~r lhr re..:eiving tnuto!Qgy?
cv.:ry 1))1c :L (pvq)-+f'
h1 to ~)rJ·ichrqnie:s l'l:Cc:iVttr ror I>Cedving U b. pv(q4fl)
><'Jli<I!C< tlf byt05
~. • ,purity bit ..-. pv(p ->tf)
d. hl t$1~hroulo:S r·.:.:~iv« tor N,.._>J.vi~~g
d- P_.(p-+q )
the lust byte
14. l11~ COITt<ll m :U d1iog for ~1.: jO.,Jiowfug 1~. lo the l~ltioc defined by the Hnsse dlugram
gjv~n in Fig 3, 3, how mJtny complemeniS
pai111 is
ooes tho d<tmlll ' c. bnve't
List I
A. DM•..I, JIO a
Fl Cuche
C lnlcmJptllt)
U. C'orrditioo Code Register
Lisl ll
L ll1sb $JlCCd RAM
:ctr
•• 1
r
~ uf 12
b, 3 d m•Y cltonge $Uite of interrupted
c. 0 process to ·~lo~ktjj' and schedule
<L I another pi'CicCss
19. Givrm I: ~ Ill. b). 11hicl1 one of the 24. Titroshins
following ~cts ih not ~ount~ble'l "· reduce;; J»Sd 110
~. Se1 of all string• over t h. dt:CfeMe.. th~ do:grt:e of
or
b. Set. ~lllonguoges OY... $ IUUitipiOgr.tmm iug
c, Set of all reiular langllllgtS ove1 ~ c:. implies CJ(o!e!Joivc poge 110
d. Set of oU l•ngullJ!"" ow:r 1: ncc=oJltc-d by d. improv~ Ihe <ystem p<llfomi:lnce
Turing mochiu>'S 25. Dirty hit for a page in o page tahk
a. help> • void unuccessllr,\ 11 rite>; uu ~
20. Locality of reference impli<:~< that the page
n-fcrcnce beirt~ made bV ~ proces~ paging device
" · 11 ill all\ ays Jlu tl) lhe page u.~od '" Ute
h. help< mnin(nin l,Rt J informntiun
preVious PJige relcrcnce c. niJows o~ ly re:ul on • Jl"S»
h, i~ likely to be to (>ne of the pnges u•ed d. non~ m~1e above:
in tho l>$t Cow page refc:rence$
"-. will •lwoyK be to one •Jr the pag"' l'his <JOOSt ion contuins 10 so bpart<. cnch
~ ting in mt'tnory carrr lng '2 mnrks. Each subpiU't rontnios a
d. will alway> rood Inn JIOl!e limh muJti ple,tt choir" quesHoo. \Vritt:! in vuu.c aornV('r
Zl. rlie <XJ[rc<:l nJ"lching fo•· tbe fo llowing book the subpart oumb<.r mullbo l~tlcy A. B. C
pairs u or 0 corresponding lo lhc n1ost anproprial•
l.istl
A. Disk scheduling
.B• .Botcb pro.:essing
C. Time shnrine 26. What ts Ute maximum nlue of dte
D, Interrupt pr~ing r
func.tivn (.X J=.4" - lr-t (> io the tntt:rVlll
List II IO, 217
1.. 1tound robin 3, 6
2. SCAN b. 10
.1. UFO c. l2
4. FIFO d. S.5
Codes: 27. l.et A = ( fiij) be an n-rO\\ed square matri\
.\ il c D and r,l be the molri.~ f1btainod by
"· J 4 2 1 int.,rcl••nging tbc 11,.,1 """ second tow• or
I>. 4 3 2 J the n-rowed ldenti~y mntri-'\. 111en Al 1: i~
c.. 2 + 1 3 •uch thhl il~ tiA<t
cl 3 -l 2 ~ roll i1 Ut c$ame ._, il< ~oeond ro"
22. vo redirection b. row i< tb ¢ same M11le second rOW of 4
u. impli<!!! cll~ngms the namu or"' IIJ;, c. t (liumn is the sa me :l!l the o;eeond
b. """ be cmpluycd to u.~c "" oxl<ting lllc eolunut of A
liM input Gle for •t J
lrogram d. row is aU ~=
c impliet; connecting 2 progmm~ through ;!8. Using Uto fonvord 1Iuler rue\hod 10 solve
a 11ipc y "(I) : J (II.y(O) = Owitb ~ 1tep size of
tL none of the •bove
\Vhen 411 Tnterrupt occu..-, lm operatin& It. we obloin U1c following volu~ of y in
Um firstfour iternlion.:
iYSlem
u. ignon:::l lhe int<.Tl'upl "· tl. /if'(O). !t(f(O)-t J (/l))and
b. nlw•y5 chJlugt:. • t11Le of iutcr1'uplcd 1!(.1'(11)-/(f,} -t f (2h))
proceM !Q 'l>lncked' nnd •ch~dulc.
3nothcr pmet:ss h, O,tl./lf/(11) •n•l 211 1; (0) , J( h)
c, alw~ys .-..ume5 cx«:ulion of c. O.tl.lr' (( n)cmd31r'f(O)
interrupted process nllcr ptoe<.lssiug the
d, 0.0, 11/'(0) 1 lt'J(O)nnd
interrupt
IV (01- h' /(0) - lif(/1)
-1 oil:.'
29. A polytlomiol p(x) I• •uc:Jt lhnt p(O) = 5,
p(l ) -1. p(:!) 9 and p(3) 20. 'Ill~
minimum dcgree.Jtcmn hn\•c i$ I : illlqcr ;
0. .,

h. 2 Sl
0'. :t l:llll. c ;
d. 4
~0. A bmaey '"""'b tree QOtltnirul U1e volu\:!1 t. end A;
2. 3. 4, 5. 6. 7. 8, 'Tho ln-.. is trnv~'T!cd In The vuri•blcs ~""Ol<l>ible u1 SJ and S2 ""'
pre-order llnd the vnln"" nre printed out. a. 11 ofA. ) ••~ ofB aod.z in SJ and
Which of H1e foiiQ'ving sequences IS 11 x of B. y nnduu S2
vnlid output? b. x of B. y nodz in Sl nod
a. 5312.1786 " of B. i and z in S2
b. 53126487 c. x of B. l. andy in S l and
"· 532-l t67S x or A. i u.od in S2
,1. 5312.176~ d. None of lhe nbovc
~t. t.et l'(n) be the function deiined hy 34. The CKpl"s~1on (n•b)~ o op .....
T(l) • l.T (t•)- 2T(l nl2j)+ v'il for whc:ro ·op' is ona of ·+·. ·•· nnd ·1"
" ? 2 . \V111cJt o f lh~ following glu(cmcnU! (oxp<ll)entintion) coo he evaluated on o
i~ uue2 CPl with A single regi.<ter without , l.oring
l11e value of (o"' b) if
"' T(n) =0( .Jn) a. •.,p· ;~· 'i ·or ·•·
h. r(n )=Oi n) b. 'np· is •T· or._..
c. ·op"is'l 'or-·"-'
"- T(n )= O!Logll) 'l nul IX"'$ihl~ to evl\lu111e \\'ilho\11 •tortng
<l N(!lle of th" ahllVc: .;s. rrw tn•pe7.oicL1I method lo numerioally
32, A priorily IJUC:Uc Q is used to it11ph:menl•• •
obtain J.f(-<) dx hos on error E bounded
stnok S thnl >101'<:> chlllWlm. PUSH (C) i.
implcruJcnted os L'ISERT (Q. C. K) whore •
K is nn approp<inle intogcr L:"Cy chOlien by
the implementnlion. POP is implemented
by 12'" mW< ["(.r).<e l.r,bJ
b-<1

"~ OELm'EMIN (Q), For o se<tucncc or where h IS the w1dth oflhe tmpe-A'lids. t he
opc:.rutions, the kcy.s chQ!.'tn •n: in minimum numh<roftmpcZoids guanmlecd
1
"- Non-jnc=s-ul{! ortlor to enstii'C E S I() in computmg In 7 us •ng
b. Non-~lng or<kir I .
c. strictly incruasin,g order f .r :: - iS,

d. striaLiy dccreo.sing order o. GO


~3. ('fh·en the follol\i ng Pnscol-like progrom b. IOU
gegrue111
o. 600
p·r(H'ed UJ'l' A ;
d. 10.000
-t. Jl : illlqer;
ProcalunB : ' l'his qu<stion contains 5 <ubparts, •ach
t'lU1;)'1ng 2 marks. £~~<:b subpart t:ontains a
niUitlple rbol<c qu<'Jillon. Writ• in your nnsw<r
Sl book thu ubpnr1 numb<r ruul HI< lener A. B. C
or 0 cort·..-poowling 10 thO! most :opJII'o(IMatr
.llllf 8 ; attSWt'r.

36. Let f ( ~·.J-.:) =x+Y.h .c bea ~witchiog


function. Wluob on~ of t11e following is
valid?
"- }.\' 1s n pnme implicant of r
5 of 17
b. sds a minterm of[ or D corrospondin g to the 01011 •ppropriatc
u, :o. i~ an implicant M[
<L y i3 3 prime im j>licanl ofj: (ltl X 2=20)
37. Cont.mt.l of.'\ regisi~r afld ~lc <>Xc.:ution
of the follilwing 80S5 microproct550r .n. A llortial prd.:r ~ i3 dofinud on. lho •et
progrnm is S-=- {x.,a.,a1 ....a,._ - vl as .t _ ar iOr all i nnd
M\ ' 1 A.55Ii
tviV.I C. :!Sfl o, ~ ,. ror .- II i. whel~ 11 ~ is
ADD C •· n l
UAA b. n ~2
a. 7A H c. ll

b. SOH d.
D. 5011 4l Let G ha: :a .groph wilh I00 verliees
d. :!2 H numb<:rcd I 1<1 IQ\1. TwQ vertic"-' i ontl j
38, A nucro inuruction intfl be d""igned to It-
are ndjuccnl iJr 11: Mfll ' 1•-tl:
n . 11te.
~pecify numt>.:r of connected eompcmenl~ in G t•
(b) non~ or one of lhe lhrec mioro a. R
oper01tioM of one kind and b. 4
(h ) none or upto si.~ mkm operation~ c. 1:!
uf ono~u:r kind d.. :3
The minimum uumboe.· of bits .in Ote .uticro- -1~. The numl>er or equivalen.,.; relation~ on
inMnaction is lhe •et [1, 2.3. 4} t~
a !) n. 15
b. 5 h. 16
.). 8 CJ 2 ..
d. none vr ilte obov~ d. -1
>9 Given J n4), • 13),. ·14. \VhiOh one of the foUo1ving rcgulut
The va lue nPUac rnd~ r is: expression~ over {0. I} denotes d>e "'"' of
(L til aU <trittgs n11l containing l(l(J as a
h. ~ sub.striJ>g?
c, 5 a. o•p'O)*
d. 6 b. tl* IOlO•
~0 Consider Ute lo&io oireuia sho" n in fig. c. 0• 1 ~0 1 *
5.5. ·n,e
function~Jt.Ji 1111dj (an canonical d. 0•(1011)'
~um of pi'Ciducls lbnu in decim:al nolalioul -IS. Wbiob one of tbe foUow(ug i~ nut
lilt dcoidable1
,, ~. Given a turning maobane M o ·string s

" --Dr.,====D>-=-'-
and an integer k. M """'"PL s wiU1ln k
,A•I _ _ __. steps
b. r!qoivalenae of lwo gh••'Tl ruming
J; (II',X,J' 7)• ~ &,9.10 mach met;
}~( tr, ,~:,y. 7 )~ ~ 7,8, 1.!, I ~. 14, 1S c. Language aa:cepteid by a given finite
>Idle macllind U. non empty'
J'( .....~.)'.%)= ~ 7.9 <1. Language generated b) a urmlel(l fn:e
fhe functlon/1 is gptmmt1r il'i non. empty
n. I:9. ltl 46. Which of U1e following language$ •11't:r (u.
b. !Q ~. cl i.s a.:oq>ted b) det.,nninJ!tic
c~ ~l8. 9 pu.•hdown nutu mom1
cL l: 8. lO. IS =
a. {w w•l w eqa.bj•}

Thl• q u <'H tlun cl,lnl:~ln~ 10 su hll llrll!. L>fJdl b. {ww•lwE {n.b,cJ•l


earrylue 2 murks. Euda su bparl •'Ontulns u c. (a''hV I ~t ~ O}
multipll' choice qut'sti-on. Write in your an~wcr
h<1n~ thesuht>Urt numher nnll t h~ lctlt•r A, ll, C d. { 1v l it i.s a p•llndrome Ol'<r (a. b. u}I
(I ..n~

NQte· ,,. i~ th~ .'>triug !'blllfneJ b) a. None of ( I ). (2). (3) ur (4) M n onu!lc it>
rc\'CTNing. ·w·, l'iulation
47 /In apcraling :;ySiom cl)ntains 3 user b. All uf ( I ~ (2). (3) uncJ (4) cuu cullse ot~
pmces.<es each roquirin11 2 uniiS ot' violjJJjon
1'\lS(Iurce R 'nto minimum numbilr of unitW e. Both ( l) aml (4) can causa itl1 violatiQn
"f R such thnt no deadlocks \\ill ever nnso d. Bo!lt t2) uuJ (.3) can cause ilsviolatiQn
is 5l AD llfp-llop is I(> be connected ''~ au 8085
8; J mil.1l)proces~r dill' us u l·l:ii t Output [l(Jn
b. 5 witlr a pon. address ot' FF h<;X. Dlllll bit 0,
o. " should be ini'OI\'od in the .datu Irunsfcr
d. 6 frvm CPU to the llip-Ootl. rlt• lllp-llop
48. l:.aoh process l'f+ 1 - J ... JJ IS coded as should be ole.ute.d on powor ON,
fi>llows a. Usin~ 11nly one NAND ~lllc (Ian in of
repeal 10). one NOT gate and <Jne l) Uip-tlop.
P(mut~x) draw lhe requrred interiitce log1c
toritlc~l $Cction) otr<ut t (only tl~e relevunt Sl!lllWli ~hvuld
yfututeX) be shown)
fi>rever !3)
b. Wri1e it program to y_t!nerme -0 squnre
'1he 0<1da for l>lft is idcnlioul except thul it wm con the output o l' tbe Ilip-nop. ON
uses 1 (mutex) 111 pluct u( l'(mut~x). Wl>Ut and OFF pcrin<h< of the sq uure wul'c
1s the largt.st numbt-'1' .,r processes tbaJ c:m should be 7 bus c~•cles each
he inside the oriucal section at uuy (:!),
mllm<nt? l.et I. - (na .111.. .... ..a. ) n <:. 0 be a hsl
:t. 1 whose f>ascnl reprc:;enilltir.m is
b. 2 type list - reoord
c. J ne:o t list. val • ulle8er end
d. none o(abo\"c 'l'he f<,lle>Will~ l'uuetion return~ b li51 in
49 l'or n dutnbase relation R(u.. b. c. J ), where
the domwus ot' 11, b. c. d include m~y
al01mc vulues. only 1he folio\\ mg
wh1ch Ill• and II};. f. I sr:sl;J me
mtoiVhong:cd Comnlctc the functlon bV
function31 dej)endenctes untllhose that c~n l1lllug in tbe boxes. Write tl1e line nilull~r
be inJ'errod !'rom them holtl: aud .the content of Lhc box. in your answer
• ..,c
sheet.
b-o tl ~ ct..p (p : f lioi,) ; t WI ;
The rclutinn i•
2 •ar,,t: f lUI :
a. In firsl oon11~l f(Jrtn but nol in second
nomull fnrm
J """'
b. in second oormnt lorm but no~ in ~tird
unn11ul fnrm
4
S
lfp·nU-~ :-,.
doelfp T. -- aillhmcltooac o•c=:::J
.
~. 111 tl1ird norllllll filrm 6 .... bq:in
J. none nftho above
7 q : ... pt.neJCf :
50 Lei R (a, b, c) nnd S: (J. e, f) be two
relation£ in whi~h d is tbo fore1gn key of S 8 t:=:J :=f l
thai relct:S It> ~1e primary !<ey of ~ v , ; cq f.-r ;
Coo.•ider die following four opemtions on 10 I::=:J : •p t
R and S II I::=:J r• - , ..(I)
J. lnsen mlo R
12 ....
2, lnserllnlo S
3. Oelctc from R B cad
..j Delete fruw S (5)
Wlucb or the Ibllowing stalcmentS is true 53 . Consider a grnpb whose ~ertices dte pOints
ubout tho r~fellltttlnl itUettriiY oonstrnlnt j,l Ihe plone 11 ith int.,gcr co-ordinntes (x;.
ntx>ve? - ' >l such tlrut LS ;r S Jr aud lsys u. where
n ~ 2 is an mteger. Two vertices ~•. Yl) S-+ bSe
nnd (..:,.y~) ltr~ ndjoc"<:nt !f:fl.~- .fl i :> L S -+PQR
The weil!hl of 1m edge {(x,. }1 ),( .<1 .~·,)f P--obPc

U. ~( ·'; -"t )' I (,1', )'d · P-+c


a. Wbot is dtc wetghl of a m mmmm Q-+cQd
wetghl spanning tree ln this graph'! Q-+c
Wnto only the unswer \\ilhoot any
explanntions. R-+dRe
(2) R-u
1), Wltat i• Ute weight ur u nmxiDtum where S, P, Q, R ore nQn-tenninol ~ymlx•l•
\letght spaOJting IJ'I:e in llu~ gruph? with S being tho <lnrt symbol: h, o. d, e""'
Write OW)' the 311JiWt'f \\lUIOUI uny tenninnl <ym bois nnd '£' i~ the empty
e)(pl<ll16tiOII;. Klnng, T~L> grnmm3r generate~ •lfin.l!• of
(3) thd l'onn t.1 cl dt .!'' fonome I. j , k. m ~ 0.
5~. Comidcr Uto followmg program in a. \Vhnt is th;; oondition on the vulucs of
f.>scudD-Pnsools.ynta:<; i.j . k. nl'l
l~rnm whnt: (3)
vv z. : inteacr ! b. Find tb~ • malles.l -string. Ut•l bus 1\vo

pam: ln:cs.
procecl- recur (.r) :
(21
beain if " $ 40 then SECTION - a
bqin ... :"X +r, ,\ n•wt r un)' 'r.t;N que,·Hon~ lhm>, thh
,_a (lC) ; • ....-lion. ,\11 qu""t lon• ,.,.•.,, eqtrul
mm·ks.
J :-x + 10
end 56. Coosider • hnsb toble with n buckets.
where cxtcmal (overflow) obainins is used
end (. m:1lr • ) to resolve colllsions. 'The hush funot.ioo ;.
be&in (. whit • ) such tbot Lhc probobilily that o key value ;.
hushed to o purtio.ulnr bucket is 1/n" tho
.. :- 10:
ltnsb table 18 initiAlly empty nod K di•tinot
no= (I) ; va.lues ardnsened m the Ulblc.
a. Wh~l is tlte probabilit)' that bucket
writeln(z)
number I i• empty al1er the K Ut
end insertfatf!
a. Suppose tbc pnrruneter to the (I)
t>roaedu"' ·recur' is pa..-ed by YRiue. b. Wltal is tlu: pt·ulmbility thnt no
(i) Whnt \'alue is printe<l by the collision htlll ooourred tu any of Ute K
rmgrnm1 ittS.crtiott"?
(ii) How many limes i~ ·n:cur· cnlle<l? {2)
b. What vulue i• printed by !be prognma if "· \Vltot is the probability Utol th~ ftn l
lltc panunctt:r ls il'IS.~ed b)' rct~-n:ttoe? oollision occul'!! at dte K llt insertion?
(2) (2)
ss. Corn<id..'T th.e grammar 57. Let I' be the- set of one-to-one functions
from tltll ' et (1.2....."n I to the ~et
11.2.. ..... m: . Where Ill ~ n ~ I.
a. Hllw mon y l'un•tions are m~mb<:n~ I'll'
F'l
(I )
b. Ho\1' many fum:li11ns lin f ~Wtisfy the
projJ...-t)' 1\i) ~ Llbnom~ i. l.S. iS. n'l
g urn
(2) n. Prove. by ~ing induction on h, that o
c , How many ·nmctinns fin F •ntis fy the ~ i·ze·balanoed binary tree nf height h
property f( i) <. llj) for aII I _ i < J~ n'l contains :~I least !h nc;des.
(:!) (3)
5·3. l:Gt R l>c u refkxivc nn4 trun• itive reluti6n h. rn n ~ize·b~bnucd binary ltt:o: of hcighL
on n $ Ill ' ' D~fine :o new rei at ion Eon A. h ~ I, how muny nndcts ~trc nt di.11 tnm:c.
tL'i h·l f~nm the root? Writ• only the
If' = Ita, bj I (a. b) :.R n11d tb. a} E R} &i..O.SWdt' \\ lthOUl artr .:Xplnna.tion~.
n. Prove Utal F is an .:qulvokoce relation
Cl!l A. 61. An array A contains n ~ 1 positive integer$
(2) In th.: locati<ms A[ll. APf, ........ AlnJ. The
b. Deline n relotj!ln ~ on Dte equivalence foiJr,wing prosram lrugment prinl~ the
classes of E as E1 ~ F2• u· 3u,b such length of u short<~L $e<1uonce of
con.~ecntivo elcmenl> of A. AliJ. A[i IJ,
that oE6,.b .: E, and (u.l>) e R. l'rove
, ...... AliJ such tbat the s u111 of their
that _ i~ u JM!'1inl order. vnlue• i< .! 1\l • given pu~llive numher, II
(3) prml$ 'n ·1- l' if no ~uch sequence exists.
59 t'Otatder'lbe followtn!! ·!Unction. CompMe the pro&J'Im by filling in the
Function F (ll, "' : inlqel') : l!lf.Cief ; boxes In each ca5e use rh~ simples!
tlil!;~ibl• "Xpl'e~•ion . Wrill: only the lin<>
bqln
uumb..-c and Ill~ coule.nb ofllt~ box.
If (II oo 0) OC'(., o 0) then F:• I (5)
ebc
2 1:• 1:}:• 1:
F -:-F (11-l . ;,) + F(11. If-I )~
end : 3 Swn ,.I
Usc U1e:: recurrence re!nlion
4 min ""II ;finish := faJK ;
(nk )=l"-k )+('k-'-l)
1
1
to answer the
s While not finish do
foUowing yuc•Lions.
A.<>ume th~t n. in are pOllilive int.egers. 6 If I then
\\'rift only the ltn.SWC!ll wilh11111 ony 7 Iff • " !hen. flllisb :- true.
t:.~ laollllilln.
IC

It
Whot i8 the value ofF(u. 2)1

What is the value of F(n.m )'~


(2) • else
9 bc&ill
(:!)
1:- Haw mll11)' rccurrivc calls ore tnnde to 10 j :•j+ l ;
lhe function f . including tho originnl
c.1ll. when wnluoting F (n., m)'t 11 -.:-1, I:

6(1. t\ ~lze ~nl•nccd biniU)' tree ;.. • utnary


tree in wblllh for C\ll'n' node, the
dil'l'e-rcnce between the nllmb,r or nodes Jn
the fell uud ri!!)lt gub~·ee is at mo•L 1. The
disiJutcc of • uod<> from lltu root is th<>
(I)
12
13

IC
..... Clld

length of tl1e patl1 fro m tl1e root t·o tho


node. The beigbt nf D bill<lry lri!i> ls th..
maximum dilrton"" <lr il le~~f node flllm Ute
ruut.
to !be node. All leaves we at the""'I"
srune
IS JfQ - i) <aoiDI~auu :•j- t; dismuce from we root llre heJ~Lu of tbe
16 tree ts the dlsmnce of11 lcuf from tile. root
- ,_...., - Alll :
a. What is the toral number of key values

..
17

19
1:e-J + "l ;

wrboiD (lllin + I) :
in the lnrell\lll nodes. of a a•-tree. with
IICO\'Cs(/ 2:l)1
12\
h. WIIJU Is rile maximum ~tnnbe.- of
20 ead
internnl nodes m n a·-ITI:e of order I
('onRider rile fhllnwrn~t piece. of 'C' ~ode 0
'"'" S2 lcii\"C\
frltgmem thnl removes dupltaucs rrmn WI ( I)
ordered list of huegers. C. wtraJ IS l~t:' llliiH111111.11 11\llttbco- Of
Node · · -.... I j 5 •= (J'Iodo 0 ...... irrl •j) lt.'a\ olS In a
~Ct!hl
a•-tree of onkr d w1d
II (It ~ I ,.
I
'Node . ,·~ •12 ;
t2l
65 ConStrUc:l a fintrc stmc mac~l,\c '"'h
•)•0 ; 1111 lnmmn number of ;,1atcs.. ncccptmg ull
I I - """" ;
&~nng,' ove1 (a. bl ~t•ch tltar the II umber nf
if(tt !: NUU.)/ 2 = I I .. - ; a's ts dl\~sihle b)' rwo and the nwnber of
b's ts dJVisJble by rhrce,
dx mum lococl : IS)
• /• 1; OIVL'fl L IS ~ lnnl!uugc ncccpt<d by n
thul
if v2 - ~ NUU.I caam 1at1 ; llni1e swe <UJ1Chine, show· lbru. L1' ood L~
ill'~: also accepr«l by some liJ1ile •une
...W• (t 21 • 1'1ULL)
1 111\tlunc~. where
J!' = {., j.1~· e I for some suing s' f
l~ : j., l ' obtainable ~ reVet1ling some
b1t urg111 I f
(5)

I
_
I' ....
---t +NIIIL
A language 1.. is u subsCl ofPasca·l "~th rhe
following CotiSIJllti.S:
n t:\pr~$~1011) IIIVOIVIIljl the O(lC!lltOU
• •· and '<" only
63 Assume tbe li>'t contains li elements (n~l b. Assignment staternt:~lb
in the foJI()winf! questions. c. ' while" srmemcnts nnd
rr. How muny nmcs Is tile rompnn><llt 111 II Couttll)uud ~wlcrlll:llll> \\1lh 1hc ~y11IR'
stAtement Sl made? beglll ' •• ~-·-c:nil '
111 Grve an un3Dlbib'llotts l!flmunar for L
b, Wl~u is rhc lltluilllunr null the 6!1. The lon~:un~:e L defined b)' d1c folio.-11111
ma_"unuln uw11b.:1 of 1imc:s stuiC1111ellt!i J!fiU1111lUr nil ow~ ul!t' of renlllr h1 le~::er dntn
mar\(<'(] $2 got C'CCLJI~~ in e.:pres~ion~ and assigrun~t star~menL\.
l21 (•cn-111111) :: - (LHS) :• (E)
"· Wlt;u i5 th~ slttniH~uuc~ or thiHnluc m
Ut" mrcger poinred to, by j when the (E) ; ; s (£) +(7)1{1)
funcrfon cmnpleres?
(2) (7) : : - (7) • (J'} !(Y)
A tf - IR:e or 111\lc:t 11 I~ H It« Ill whrclt
ench inremul node has bel'\'""" d and 2d (r) . : : • ld I<(£)>
k.ev valul!$. An maernal node -.irh M kl!)
vaiues M 1 I childreJL The root (if h isoo (LliS) ; : - id
huemnl lllld~) hli> lx:I W~Cll I Olld 2d ~") h ~ n:quir11d lu couvert e.\pressiOit w1d
Vnlues The distance of a node from the
~SSIIlUJllt!U stnn1!5 of L mto po;.il:ix stnogs
roor Is 1h~ lcng11r of the pmh from lhe rOO!
ItI ot' I~
th.11 use the type-spectfic operators (+, i), nb<we. 11 1~ known that al w me J"'llll nf
(.... r), (' , i\, ('. r), (:=, i) and( .=. r). time Juring Ute execution of this program
Write a !lyllltcX dirtctc.ltranslati<\n $Cherne fil'<: och\'lltion records txiS1 on the run-
to convert CJo.llfession and llSSij!!lmco t tjmc stock. Describe tbc nm·t.imc stntk- nt
strings llllll the JKlSt.fix form You mny Otis point Of lime by olcady indict~tins. the
llliswnc that the ownc lllld type uf u llllluw~ We top nf 0Jc stnok, Otc
wriabh• cun be ''blllinl'd by mukml,l th~ COntent~ Of Lhc stutic lml; mltl dvnonlio
function coiL~ ' p.ive-typc (tJ)' tmd 'give· 11nk. llncl ulli'Oalion of O>e locnl v~rinblcs
nltm11j,id)' reSJl!>"'tiwly. In ~.ach rccmd.
(5) 15\
Consider the followm[l rr<>!.llllnl l'rn[liiiCIII 70. h 1llowintt IS a stale table for some l"inlle
in I'OSI)lll state tllJJchinc.
..,_ Non s-. Outp.&t
sc.
JS tucA : input - U itlpUI • I

vwJ' : ~; A B. I II. I
~8 ~ B r,t D. l
-z,.....,; c 0 ,0 f. I
p .......... C; 0 c.o F. I

varZ: Iaqoor : £ D. I (,', I

lqjo(•p 'cC • ) F C l C. I
G (', I D. I
H (',0 A. I
end ( •p C·)
begin ( • Jl<OC<'du~ 9 •I a. 1'intl cho e-tLuYalMce part.ition on the
~tJJtcs of the machine.
(2)
C: t• callto C · ) b Give Ute stotc table for tllo mini.mnl
A :( • allloA •l mncb.ioc. (Use upprtlpriut~ nomcs fot
the cquivulent stotcs. For ~-xnmplo tf
~t11tes X und Y aro cqm\'ulcnt the.l use
end ( • proce<lu"' 1.1 • 1 XY ns the ttltme tl>r the equivnlem ~tnte
in the minmilll machine),
- -'·:·lilaill (• ~A •) (JI
71 Let f •(iii+v)(HJ')\ ••·+-1' ~z)(ih.::)(H:)
a. W<prcs~ j "" th,· minmml sum of
8 ;( • call10 8 • ) producl,s. Write onl)' thennswer.
l3)
b. II the uutpul linc is s tuck. ul 0. for llo"
aid {• procedure A • ) mnn)- input eombinaLi<lns will the
l'llluoM}'be iuet>rrect'J
lqjn ( • Main • ) (2)
72 . Folltlii1US ilftating point number l'cmmnl •~
[liven
A ;(ocal110A •) f is n frnction roproseotcd by ~ 6-bit
mrtnlis.~u (include:; ~iW> ~it) in sign
; mttgnitudc fonn u is u 4-~io. e,\1)1>nont
{incloJ~s si!!Jl hll) m Stgn. mugnitudc fom>
end ( . Main • ) n ~ (/, C) "'-j 2' JS 3 fi<llltlng pOU1lllUJnbcr,
Assume. thm Otere ore no e<~Jls m till~ Let /1. = $4.75 in decimal tlnd
procedures mhor tlum 01e 11nes uJtlioutetl B = 9.75 iudecimnl
I t >JI 1:!
tL .Reprt$Cn.lA n nd a ~ Oonbn ~ pQinL procedllre ~-R (priariiY) ;
numbers an I he above (onnoL
(2) P ( muiAOlt} ;
b. 'Show the steps in,·o lvcd m llo~bns
poi·nt oddI~on M A llftd. B. if busy = uue tbeo
(2)
c. \Vha.tas d1e p~·rc:eutnge en·o1 {upto one R_teqUCIIed (prioriJy) := lnle :
poSJlu>n beyond dccunru pomt) m the
adrution operotlon in (b)'l else
( I)
begin
73. A cotlcurrcnt ~..stem consists of 3
processes usu'IJ!, n sluU'ed resource R tn n
II (proceed (priority]) ;
Jtan ..precmpUble nnd 1\lUtunlly cxclusn·e
nltt1lllef1 The pr~s!i~ hflve w1ique
priorities on lhe rnnge I . , 3 , 3 bcing the busy :- uue ;
lushest pnotit,y ll is rcqu1rcd to
synebronlze tb c processes suc.h thnl [he end
resource IS alway$ olloctlted to U)e Jughes1
).monty rcque:stc-r, The pseudo code ror tbc f•{ mulex) ;'
S\'Stcm is as follows~ Chvc the J:>Selldo cod.: fo1 the pn.lCC."dllft':
Slo~rcd dol~ n:: Icrn;c_ R
(5)
A p ougmm P ret~ds and procc,sses J()O(j
CQusecuii\'C records from a set1uentt,al fi le
It ,..l\."q\\1:$:\~d Pi - hook'"lln"' fBl!i\::: t .. :aU fnlu:aru,.:d hi r~lse • t
f stored on dovitc D \\ tlhoul usmg no~
~~·-; l-1Pie:ltt • r:~lll!.' ! I ~ intdaU7o:d In (;a~ • I tile system facilities. Gh·eu tbe following
Cod e- for processes - 11110..,...,.
bel\ln proccss
•nr- rri"Ti\)' • tn1~:~~r :.
-linleflfO -10-
......rc.- of 0 - - M Ut' hyoal-
llola
m_y-priorit~ . =
l epelll
••• : /• in dtcl"llnJr,-c l···;l• t
au.U.&o _ _ _ ·J-
rr:qucsc_R(my-pri()rity); W hnt is the clopsed time of P of
111 F eownins unbloc:.ked recordo; nnd P
r (proceed [my..,..iorityj): does fi.'Ol use liuO'eritlS'~

t usc shared resource R} (J)


b P conlfllns unblocked records and P
refease_ R (my-priorfly) ;
uses one bu iTI!l' (i.e., 11 atwa' s. reads
nhead ' 1010 Ihe bu[ferl'l
forever
(21
end process ~
c. records o f F are or_gnnizcd using a
Pr.:occdtr rc~ blockmg (oo;tor of 2 lt.e,. each b lock on
D conlams 11vo records of FJ nnd P
uses one bufft:r1
(2)
You ota\ assume lhol the CPU time
tO U11t15 fet a 1ccord front a buffer 10
uecdcxl
o Jocnl vru:iable o[ P is negltgiblc,
ll oi J2
75 An operathtg ~.)'Stem handle$ reque-<ts to 76. Coruider the fo!Mwing fGiolionlll datnba•e
r.:souroes :tS foilo,•$. schema:
A proces• (whkiJ il!!ks for some '"sou..ce•. EMP (Cll\0 1\lllllU, Ugd)
ll$c« them fQr some lim~ ;md then e:<:it" lhc
• a~Stgn ed n umcrue
• ' PROJ lpnn n•me)
system) 1$ I
hmestamp
1\ hen il stru1s. The tirne•Uimps ir't INVOLVED (cno.1moJ
nwnot<>nically i11orcu~ius wit!\ time, Lct u~ BMP con.t•ios mfonnation nbout
(lenote tbe timesmmp Hf • pri>Ces~ P by employees. PRO.I about projects ond
l'S( P). . INVOLVED about wbiccb ~mployccs •rc
When " 1""'""'!1~ P re<Juc~ts f01• • •·c~''"'"" involved in which pmjed•. l'he underlined
1he OS doc'!! the li>Jlnwinj!! attributes ore. Ure primary keys Cor ihe.
I'OSpe..:tive relations.
(i) If no oUter pl'o~c&s is currently
holding U1o r<Sourc~. tho OS a: \Vhnl L• the relational algebr11
award~ tl1ere•ource to P. express1oll containing. one or mon:: or
lfT, ll',.t.ri,- } whi<;h i~ equ1v•l<nl lo
(ii) If lOme pro~ Q '~lilt
TS(Q}<:'fS(f>) is holding the the SQL query
resoure\1, the O!i mak<S P wait for sclcd euo
u.eresource.
fivm F.Ml>. JN\ OI,VIW
(iii) If • om0c process Q 1villt
1'S(Q)~TS(P) i• holdin! the wb~ro EMP.cmo INVOLVED.<lno
resource. Ute OS r.:sllltls Q oud lllld INVOLVEID.Ilno =3.
ownrds Utes resource: toP.
( 1)
(Relltofling mean• !~king hack the
resources he ld b ~· a process. killing h. Sta le in g ng lish (in nnt more th:m 15
it ttnd stot·ting it again with tho word~)

same timeshunp) (~)

Wben. A process 1tknses • ff:l;ource. lh~ Wh3t tiKI CoUowing relational nlg1:1brJS
process wiUJ tbe smoJJ~-.t linlcstamp ( if c!.'<:pr.:ssioos "'" d~signud to dctllrDlinc
oP)") nmonl;'t those woiting fnr the
li ) 11al(~ INVOLVHD)-,.,.( (x..,
r<:!'Ource is ~warded the r.:sour""'·
(INVOI,VJ'.I)) ' "t"'{f'R\) .1))·
n_ Con • d~o.dlook over arise? II yes. INVOl-VE!))
3h ow how. If not. pro"" it.
(i i) n..,.(EMP)·n~m-11'.•••
(3)
((~1'.1-!Pl E;\[P)),
lr, Cnn a process P ever stn~ If yes.
!<how how. u·not. pr·ove it. (2) (Notc;pe{EMPl QOnccptWIUy m•k<-~ •
C<lp of EMP AUd nanH;'!I it K (p is ;:;illcd
the rana me o par:rt0r )

You might also like