Vous êtes sur la page 1sur 7

ISC 2011 COMPUTER SCIENCE PAPER 1 THEORY Question 1. a) State the two absorption laws.

Verify any one of them using truth table. b) Reduce the following expression : F( !"!#)$ %(&!1!'!(!)!*!+!,) lso find the complement of the reduced expression. c) -ame the logic gate for the following circuit diagram and write its truth table.

d) .sing truth table! /erify whether the following is true or false: (p 01) $ (120p2) e) 3f $1! "$&! #$1 and 4$1 find its i) maxterm ii) minterm [2 x 5 =10 Question 2. a) 5ow can we o/erride a method in inheritance6 b) s1uare matrix 7m x m8 is stored in the memory with each element re1uiring ' bytes of storage. 3f the base address 718718 is 1&9: and the address at 7)87*8 is 11))! determine the order of the matrix 7mxm8 when the matrix is stored column ma;orwise. c) <hat is "ig = -otation6 d) <hat is an exception6 e) #on/ert the infix expression to its postfix form: >"?#@4AB [ 2 x 5 =10 Question !. a) Che following is a part of some class. <hat will be the output of the function mymethod( ) when the /alue of counter is e1ual to (6 Show the dry runA worDing. /oid mymethod(int counter) E if(counter$ $&) System.out.println(F F)G else E System.out.println(F5ello F> counter)G mymethod(@ @counter)G System.out.println(F F> counter)G H H [5 1

b) Che following function is a part of some class which computes and returns the greatest common di/isor of any two numbers. Chere are some places in the code marDed by 616! 6'6! 6(6! 6)6! and 6*6 which must be replaced by statementAexpression so that the function worDs correctly. int gcd(int a! int b) E int rG while(616) E r$6'6G b$6(6G a$6)6G H if(a$$&) return 6*6G else return @1G H <hat is the expression or statement at 616 i) ii) <hat is the expression or statement at 6'6 <hat is the expression or statement at 6(6 iii) i/) <hat is the expression or statement at 6)6 /) <hat is the expression or statement at 6*6 [1x5=5

P"#t II nswer se/en 1uestions in this Iart! choosing three 1uestions from Section Section " and two 1uestions from Section #.

and two 1uestions from

Section A
nswer any three 1uestions from this Section Question $. a) State the principle of duality. Ji/e the dual of the following: ( 2")>(#.1)$( 2>#)(">#) b) Reduce the following "oolean expressions to their simplest forms:@ i) E(#4)2> H > > #.4 > ." ii) .E">#( ." > .#)2H c) Verify using a truth table if: ( " #)2 $ " #

[!

[$ [!

'

Question 5. a) Ji/en F(I!K!R!S)$ L('!(!+!,!9!11!1'!1(!1)!1*) Reduce the abo/e expression using four /ariable M@map. 4raw the logic gate diagram of the reduced expression using -=R gates only. [5 b) Ji/en F( !"!#!4)$ 2"2#242 > 2"2#24 > "2#242> "2#24 > 2"#242 > 2"#42. Reduce the abo/e expression by using four /ariable M@map. 4raw the logic gate diagram of the reduced expression using - -4 gates only. [5

Question %. a) Show with the help of a logic diagram how a - -4 gate is e1ui/alent to an =R gate. [! b) Verify if the following is /alid: ( 0") N ( 0#)$ 0("N#) [! c) <hat is a decoder6 4raw the truth table and logic circuit diagram for a ' to ) decoder. [ $

Question &. a) <hat is a Full dder6 4raw the truth table for a Full dder. lso deri/e S=I expression for the Full dder and draw its logic circuit. [$ b) State how a decoder is different from a multiplexer. lso state one use of each. [! c) #on/ert the following cardinal expression into its canonical form and reduce it using "oolean laws: F(O!P!=!I) $ L(&!'!:!1&) [!

Se'tion ( nswer any ' 1uestions. Bach program should be written in such a way that it clearly depicts the logic of the problem. Chis can be achie/ed by using mnemonic names and comments in the program. Question ). 3nput a sentence from the user and count the number of times! the words FanQ and FandQ are present in the sentence. 4esign a class Fre1uency using the description gi/en below: C*"ss n"+e : Fre1uency ,"t" Me+-e#s text : stores the sentence countand : to store the fre1uency of the word and. countan : to store the fre1uency of the word an. len : stores the length of the string.

Me+-e# .un'tions Fre1uency() /oid accept(String n)

: constructor to initialiRe the data /ariables. : to assign n to text where the /alue of the parameter should be in lowercase. /oid checDandfre1() : to count the fre1uency of and. /oid checDanfre1() : to count the fre1uency of an. /oid display() : to display the fre1uency of FanQ and FandQ with suitable messages. Specify class Fre1uency gi/ing details of the constructor()! /oid accept(String)! /oid checDand fre1() and /oid display(). lso define the main function to create an ob;ect and call methods accordingly to enable the tasD. [ 10 Question /. class 4eci=ct has been defined to con/ert a decimal number into its e1ui/alent octal number. Some of the members of the class are gi/en below: C*"ss n"+e : 4eci=ct ,"t" +e+-e#s n : stores the decimal number oct : stores the e1ui/alent octal number Me+-e# .un'tions0 4eci=ct() : constructor to initialiRe the data members to & /oid getnum(int nn) : assigns nn to n /oid deciSoct() : calculates the octal e1ui/alent of n and stores it in oct using the recursi/e techni1ue /oid show() : displays the decimal number n calls the function deciSoct() and displays its octal e1ui/alent a) Specify the class 4eci=ct! gi/ing details of the constructor()! /oid getnum(int)! /oid deciSoct() and /oid show(). lso define a main function to create an ob;ect and call the functions accordingly to enable the tasD. [) b) State any two disad/antages of using recursion. [2

Question 10. Tou are gi/en a se1uence of n integers! which are called pseudo arithmetic se1uences ( se1uences that are in arithmetic progression). Se1uence of n integers : '! *! +! :! 9! 1' <e obser/e that ' > 1' $ * > 9 $ + >: $ 1) Che sum of the abo/e se1uence can be calculated as 1) x ( $ )' For se1uence containing an odd number of elements the rule is to double the middle element! for example '! *! ,! 9! 1' $' >1' $ * >9 $ , >, $ 1) 1) x ( $ )' 7 middle element $ ,8 class pseudoarithmetic determines whether a gi/en se1uence is pseudo@arithmetic se1uence. Che details of the class are gi/en below:@

default constructor to assign nn to n and to create an integer array. Fill in the elements of the array. boolean checD( ) : return true if the se1uence is a pseudo@arithmetic se1uence otherwise return false. Specify the class Iseudoarithmetic! gi/ing details of the constructor()! /oid accept(int) and "oolean checD(). lso define the main function to create an ob;ect and call methods accordingly to enable the tasD. [ 10

C*"ss n"+e ,"t" +e+-e#s n a7 8 ans! flag sum r Me+-e# .un'tions Iseudoarithmetic( ) /oid accept(int nn )

: : : : : : : : :

Iseudoarithmetic to store the siRe of the se1uence integer array to store the se1uence of numbers to store the status to store the sum of se1uence of numbers to store the sum of ' numbers

Se'tion C Ans1e# "n2 2 3uestions. Bach programAalgorithm should be written in such a way that it clearly depicts the logic of the problem step wise. Chis can also be achie/ed by using pseudo codes. (Flowcharts are not re1uired) T4e 5#o6#"+s +ust -e 1#itten in 7"8". T4e "*6o#it4+ +ust -e 1#itten in 6ene#"* st"n9"#9 .o#+ 14e#e8e# #e3ui#e9.

Question 11. super class Record has been defined to store the names and ranDs of *& students. 4efine a sub class RanD to find the highest ranD along with the name. Che details of both classes are gi/en below: C*"ss n"+e ,"t" +e+-e#s name78 rnD78 Me+-e# .un'tions0 Record() /oid read/alues() /oid display() '*"ss n"+e ,"t" +e+-e#s index Me+-e# .un'tions RanD() /oid highest() : : : : : : : : : : Record to store the names of students to store the ranDs of students constructor to initialiRe data members to store names and ranDs displays the names and the corresponding ranDs RanD integer to store the index of the topmost ranD constructor to in/oDe the base class constructor and to initialiRe index to &. finds the index location of the topmost ranD and stores it in index without sorting the array *

displays the name and ranDs along with the name ha/ing the topmost ranD. Specify the class Record gi/ing details of the constructor()! /oid read/alues()! /oid display(). .sing the concept of inheritance! specify the class RanD gi/ing details of constructor()! /oid highest() and /oid display(). Che main function and algorithm need not be written.

/oid display()

Question 12. StacD is a Dind of data structure which can store elements with the restriction that an element can be added or remo/ed from the top only. Che details of class StacD are gi/en below: C*"ss n"+e : StacD st78 : the array to hold names. siRe : the maximum capacity of the string array top : the index of the topmost element of the stacD ctr : to count the number of elements of the stacD Me+-e# .un'tions StacD() StacD(int cap) /oid pushname(String n) String popname()

: : : :

/oid display()

default constructor constructor to initialiRe siRe$cap and top$@1 to push a name into the stacD. 3f the stacD is full! display the message Fo/erflowQ. remo/es a name from the top of the stacD and returns it. 3f the stacD is empty! display the message FunderflowQ. 4isplay the elements of the stacD.

a) Specify class StacD gi/ing details of the constructors()! /oid pushname(String n)! String popname() and /oid display(). Che main function and algorithm need not be written. b) .nder what principle does the abo/e entity worD6

Question 1!. a) linDed list is formed from the ob;ects of the class! class -ode E int infoG -ode linDG H <rite an algorithm =R a method for deleting a node from a linDed list. Che method declaration is gi/en below: /oid deletenode(-ode start) b) 4istinguish between worst@case and best@case complexity of an algorithm. c) nswer the following from the diagram of a "inary tree gi/en below:

i) ii) iii) i/)

<rite the postorder tree tra/ersal -ame the lea/es of the tree 5eight of the tree Root of the tree

Vous aimerez peut-être aussi