Vous êtes sur la page 1sur 8

ISC 2009 COMPUTER SCIENCE PAPER 1 THEORY PART I Answer all questions in this part Question 1.

a) Obtain the truth table to verify the following expression: X(Y+Z) XY + XZ! Also na"e the law state# above! b) Answer the following questions relate# to the gate given below:

i) $hat is the output of the above gate if input A %& ' 1 ii) $hat are the values of the inputs if output is 1( )) *iven + A +(' ,) !( -.+/) ! +in# +. an# show the relevant wor0ing in steps! #) 1tate the #ual for the following expression an# also #raw the logi) gate #iagra" for the #ual expression obtaine# using 2O3 gate only! 4 A!' + ,!e) +or the given truth table where A&'&, are inputs an# X is the output& A % % % % 1 1 1 1 ' % % 1 1 % % 1 1 , % 1 % 1 % 1 % 1 X 1 % % 1 1 % 1 %

$rite i) ,anoni)al 1u" of 4ro#u)t expression ii) ,anoni)al 4ro#u)t of 1u" expression [ 2 x 5 10!

Question 2. a) 1tate a #ifferen)e between linear an# non linear #ata stru)ture! *ive one exa"ple of ea)h! b) ,onvert the following infix expression to its postfix for":5 ((467) 8 (381 +9)) + : )) 1i"plify the following expression by using the 'oolean laws! 1how the wor0ing in steps an# also "ention the laws use#!: X.Y.Z. + X.Y.Z+ X.YZ+X.YZ.+ XY.Z+ XY.Z

#) /a)h ele"ent of an array A<;%=<1%= requires ; bytes of storage! >f the a##ress of A<?=<@= is A%%%& fin# the base a##ress at A<%=<%= when the array is store# row "aBor wise! e) -efine inheritan)e! Cow is it useful in progra""ing( [ 2 x 5 10!

Question ". a) 9he following fun)tion trial() an# perfor"() are a part of so"e )lass! Answer the following parts given below! 1how the #ry run8wor0ing! int trial() D if(n 1) return ;E else if(n ;) return FE else return trial(n5;) + trial(n51)E G voi# perfor"(int p) D int xE for(int i 1EiH pEi++) D x trial(i)E 1yste"!out!print(x+I J)E G G $hat will the fun)tion trial() return when the value of n is A( i) ii) $hat will be the output of the fun)tion perfor"() when the value of p is K( iii) >n one line state what the fun)tion trial() is #oing& apart fro" re)ursion( b) Answer the following fro" the #iagra" of a binary teee given below:

[2! [2! [1!

i) ii) iii) iv) v)

3oot of the tree! /xternal no#es of the tree! List the no#es in the tree using inor#er traversal! Left subtree Ceight of the tree [ 1 # 5 5! P$%t II Se&tion A Answer any three questions

Question '. a) +(4&7&3&1) 4.7.31. + 4.731. + 47.3.1+47.31.+47.31+473.1+4731.+4731 :se Marnaugh "ap to re#u)e the given fun)tion + using the 1O4 for"! -raw a logi) gate #iagra" for the re#u)e# 1O4 for"! You "ay use gates with "ore than two inputs! Assu"e that the variables an# their )o"ple"ents are available as inputs! b) +(A&'&,&-) N(%&1&;&F&K&O&P&1F) :se Marnaugh "ap to re#u)e the given fun)tion + using the 4O1 for"! -raw a logi) gate #iagra" for the re#u)e# 4O1 for"! You "ay use gates with "ore than two inputs! Assu"e that the variables an# their )o"ple"ents are available as inputs! [ 5 x 2 10!

Question 5. A provisional store announ)es a spe)ial #is)ount on all its pro#u)ts as a festival offer only to those who satisfy any one of the following )on#itions: >f he8she is an e"ployee of the store an# has a servi)e of "ore than ten years O3 >f he8she is a regular )usto"er of the store whose age is less than ?K years an# is not an e"ployee of the store O3 >f he8she is a senior )itiQen but not a regular )usto"er of the store 9he inputs are: / : /"ployee of the store 3 : 3egular )usto"er of the store 1 : 1ervi)e of the e"ployee is "ore than 1% years , : 1enior )itiQen of ?K years or above Output X :

-enotes eligible for #is)ount< 1 in#i)ates Y/1 an# % in#i)ates 2O in all )ases=

a) -raw the truth table for the inputs an# outputs given above an write the 1O4 expression for X(/&3&1&,) b) 3e#u)e X(/&3&1&,) using Marnaugh.s "ap! -raw the logi) gate #iagra" for the re#u)e# 1O4 expression for X(/&3&1&,) using A2- & O3 gates ! You "ay use gates with "ore than ; inputs! Assu"e that the variables an# their )o"ple"ents are available as inputs! [ 5 x 2 10! F

Question (. a) -raw a truth table representing a ; input X2O3 gate an# #erive its 1O4 expression along with its logi) gate #iagra"! ["! b) 1i"plify the following expression an# )onvert it to its )anoni)al 4O1 for": (X!Y+Z)(Y+Z.!X) ["! )) +ro" the logi) )ir)uit #iagra" given below& na"e the parts (1)& (;)& (F) an# finally #erive the 'oolean expression an# si"plify it:

['! Question ). a) 4rove that the )o"ple"ent of A(A+')!'('+,.) is a universal gate! b) Rini"ise the following expression! At ea)h step state )learly the law use#! Y (A+'.)!('+,-). )) -raw the truth table an# logi) )ir)uit #iagra" for a #e)i"al to binary en)o#er!

[2! ["! [5!

Question *. a) 1tate a #ifferen)e between "ultiplexers an# #e)o#ers! Also state a use of ea)h! b) Serify the following 'oolean expression with the help of truth table! A (B C) = A (B C)

[2! ["! [5! [5!

)) $rite the 1O4 expression& truth table an# the logi) )ir)uit of full a##er!

Se&tion + Answer any A questions! /a)h progra" shoul# be written in su)h a way that it )learly #epi)ts the logi) of the proble"! 9his )an be a)hieve# by using "ne"oni) na"es an# )o""ents in the progra"! (+low)harts an# algorith"s are not require#) T,e -%o.%$/s /ust 0e 1%itten in C2234$5$

Question 9. A "agi) nu"ber is a nu"ber in whi)h the eventual su" of #igits of the nu"ber is equal to 1! +or exa"ple& 1O; 1 + O + ; 1% 1% 1 + % 1 9hen 1O; is a "agi) nu"ber! -esign a )lass Ragi) to )he)0 if a given nu"ber is a "agi) nu"ber! 1o"e of the "e"bers of the )lass are given below: ,lass na"e -ata "e"bers n Re"ber fun)tions Ragi)() voi# getnu"(intnn) int 1u"TofT#igits(int) voi# is"agi)() : : : : : : Ragi) stores the nu"ber )onstru)tor to assign % to n to assign the para"eter value to the nu"ber& n nn return the su" of the #igits of nu"ber )he)0s if the given nu"ber is a "agi) nu"ber by )alling the fun)tion 1u"TofT#igits(int) an# #isplays appropriate "essage!

1pe)ify the )lass Ragi) by giving #etails of the )onstru)tor& voi# getnu"(int)& int1u"TofT#igits(int) an# voi# is"agi)()! You nee# not write the "ain fun)tion! [ 10 !

Question 10. A transpose of an array is obtaine# by inter)hanging the ele"ents of rows an# )olu"ns! A )lass 9ransarray )ontains a two #i"ensional integer array of or#er < " x n=! 9he "axi"u" value possible for both U". an# Un. is ;%! -esign a )lass 9ransarray to fin# the transpose of a given "atrix! 9he #etails of the "e"bers of the )lass are given below: ,lass na"e -ata "e"bers arr<=<= " n Re"ber fun)tions 9ransarray() : : : : 9rasarray stores the "atrix ele"ents integer to store the nu"ber of rows! integer to store the nu"ber of )olu"ns!

: K

#efault )onstru)tor!

9ransarray(int""&intnn) voi#fillarray() voi# transpose(9ransarray A) voi##isaparray()

: : : :

to inititaliQe the siQe of the "atrix& " ""&n nn! to enter ele"ents into the "atrix! to fin# the transpose of a given "atrix! #isplays the array in a "atrix for"!

1pe)ify the )lass 9ransarray giving #etails of the )onstru)tors& voi# fillarray()& voi# transpose(9ransarray) an# voi# #isparray()! You nee# not write the "ain fun)tion! [ 10 ! Question 11. A library issues boo0s on a rental basis at a ;V )harge on the )ost pri)e of the boo0 per #ay! As per the rules of the library& a boo0 )an be retaine# for O #ays without any fine! >f the boo0 is returne# after O #ays& a fine will also be )harge# for the ex)ess #ays as per the )hart given below: 2u"ber of ex)ess #ays +ine per #ay 1 to K ;!%% ? to 1% F!%% Above 1% #ays K!%% -esign a )lass Library an# another )lass ,o"pute to perfor" the tas0! 9he #etails of the ; )lasses are given below: ,lass na"e -ata "e"bers na"e author p Re"ber fun)tions Library(W) voi# show() )lass na"e -ata "e"bers # f Re"ber fun)tions ,o"pute(W) voi# fine() voi# #isplay() : : : : Library na"e of the boo0 author of the boo0 pri)e of the boo0 in #e)i"als

: : : : :

para"eteriQe# )onstru)tor to assign values to #ata "e"bers! #isplay the boo0 #etails ,o"pute nu"ber of #ays ta0en in returning the boo0! to store the fine!

: : :

para"eteriQe# )onstru)tor to assign values to #ata Re"bers of both )lasses! )al)ulate the fine for ex)ess #ays! #isplays the boo0 #etails along with the nu"ber of #ays& fine an# total a"ount to be pai#! 9otal a"ount is )al)ulate# as: (;V of pri)e of boo0 6 total no! of #ays) + fine

1pe)ify the )lass Library giving #etails of the )onstru)tors an# voi# show()! :sing the )on)ept of inheritan)e& spe)ify the )lass ,o"pute giving #etails of the )onstru)tor& voi# fine() an# the voi# #isplay() fun)tion! You nee# not write the "ain fun)tion! [ 10 !

Question 12. A )lass 4ri"e+a) )ontains an array of K% integers! 1o"e of the "e"bers of the )lass are given below: ,lass na"e -ata "e"bers nu"<= freq<= : : : 4ri"e+a) array to store integers! array to store the frequen)y of pri"e fa)tors of nu"bers!

Re"ber fun)tions 4ri"e+a)() voi# enter() voi#frefa)() voi##isp()

: : : :

)onstru)tor to inititaliQe array ele"ents to %! to enter values into array nu"<= to #eter"ine the frequen)y of pri"e fa)tors of the nu"bers store# in nu"<= an# assign it to freq<=! to #isplay both the arrays!

1pe)ify the )lass4ri"e+a) giving #etails of the )onstru)tor& voi# enter()& voi# frefa)() an# voi# #isp()!You nee# not write the "ain fun)tion! [ 10 ! Question 1". ,lass 'inary )ontains an array of n integers (nH 1%%) that are alrea#y arrange# in as)en#ing or#er! 9he subs)ripts of the array ele"ents vary fro" % to n51! 9he #ata "e"bers an# "e"ber fun)tions of )lass 'inary are given below: ,lass na"e -ata "e"bers A<= n l u Re"ber fun)tions: 'inary(intnn) voi#rea##ata() : : : : 'inary integer array of 1%% ele"ents siQe of array lo)ation of the lower boun# lo)ation of the upper boun#

: :

)onstru)tor to initialiQe the siQe n to nn an# the other instan)e variables! to fill the ele"ents of the array in as)en#ing or#er! O

intbinaryTsear)h(int v)

returns the lo)ation of the value(v) to be sear)he# in the list by binary sear)h "etho# using the re)ursive te)hnique! 9he fun)tion returns 51 if the nu"ber is not present in the given list!

a) 1pe)ify the )lass 'inary giving #etails of the )onstru)tor& voi# rea##ata() an# intbinaryTsear)h(int)! youne## not write the "ain fun)tion! b) 1tate the base )ase in the re)ursive te)hnique binaryTsear)h()! )) $hat are the #rawba)0s of using the re)ursive te)hnique!

[*! [1! [1!

Question 1'. A )lass 1ort$or# has been #efine# with the following #etails: ,lass na"e : 1ort$or# -ata "e"bers txt : stores the wor#! len : stores the length of the wor#! Re"ber fun)tions 1ort$or#() : #efault )onstru)tor voi#rea#9xt() : to a))ept the wor# in lower )ase! voi#sort9xt() : to sort the wor# in alphabeti)al or#er of )hara)ters using bubble sort te)hnique an# #isplay it! voi#)hange9xt() : to )hange the )ase of vowels in the wor# to upper )ase! +or exa"ple :5 s)hool be)o"es s)hool! voi##isp() : to #isplay the )hange# string! 1pe)ify the )lass 1ort$or# giving the #etails of the fun)tions )onstru)tor& voi# rea#9xt()& voi# sort9xt()& voi# )hange9xt() an# voi# #isp()! You nee# not write the "ain fun)tion! [ 10 !

Vous aimerez peut-être aussi