ISC 2008 Computer Science Paper 1 Theory
ISC 2008 Computer Science Paper 1 Theory
a) State the two complement properties of Boolean Algebra. Verify any one of them using the truth table. b) Simplify the following Boolean expression stating clearly the laws used for simplification at each step. X ! X" ! X " c) #ind the complement of$ X.% &"& ! ") d) 'on(ert the following )roduct of Sum form into its corresponding Sum of )roduct form$* #%X+ +"), -%.+/+0+1) e) 2raw the truth table of the propositional logic expressions p3q and p4q. [ 2 x 5 10! Question 2. a) 5ention two points which distinguish a static data member from an ordinary data member in a class. b) 'on(ert the following infix expression to its postfix form$* A 6 %B!') !2 7 %8*#) c) 9hat do :;#< and #;#< stand for= >ame a data structure that follows :;#< principle and one that follows #;#< principle. d) A two dimensional array defined as x?@A0+ *.A.B requires . bytes of storage space for each element. ;f the array is stored in row maCor order+ determine the address of X?D+1B+ gi(en the base address as 1.EE. e) :ist the nodes in the tree gi(en below in $ i) )reorder ii) )ostorder
[ 2 x 5 10!
Question ". a) Fhe following is a function of some class. ;t returns 1 if the number is a perfect number otherwise it returns E. 67 A perfect number is a number which is equal to the sum of its factors other than the number itself. 76 intperfect>o%int n) G int =1=H for%int C,1H=.=HC!!) G if%=@=) sum =/=H I if%=D=) return 1H else return EH I 9hat is the expression at =1= i) ii) 9hat is the expression at =.= iii) 9hat is the expression at =@= 9hat is the expression at =/= i() () 9hat is the expression at =D= [ 1 x 5 5! b) Fhe following functions show%) and calling%) are a part of some class. Assume that the parameter n is greater than 1 when the function is in(oJed. ;t returns the (alue 1when true otherwise it returns E. Show the dry run6worJing.
(oid calling%) G int f,.H show%n+f)H I int show%int n+ int f) G if%n,,f) return 1H if%nKf,,E LL n,,1) return EH else return%show%n+f!1))H I i) ii) iii) 9hat will the function show%) return when the (alue of n is 11= 9hat will the function show%) return when the (alue of n is .1= ;n one line state what function show%) is doing= [2! [2! [1!
P#$tII
Answer any se(en questions in this part+ choosing three questions from Section A and four questions from Section B. Se%tion A Answer any three questions. Question &. a) Mi(en #%A+B+'+2), N%D+0+1+O+P+1E+1/) Qse Rarnaugh map to reduce the gi(en function # using the S<) form. 2raw a logic gate diagram for the reduced S<) form. ou may use gates with more than two inputs. Assume that the (ariables and their complements are a(ailable as inputs. b) X%A+B+'+2), -%E+.+0+O+1E+1/) Qse Rarnaugh map to reduce the gi(en function X using the )<S form. 2raw a logic gate diagram for the reduced )<S form. ou may use gates with more than two inputs. Assume that the (ariables and their complements are a(ailable as inputs. [ 5 x 2 10!
Question 5. Fhe immigration rules of a country allow the issue of worJ cum stay permits to an applicant only if the applicant satisfies any one of the following conditions$* Fhe spouse of the applicant is a permanent resident of that country+ ha(ing li(ed there for at least fi(e years. <S Fhe applicant possesses certain special sJills as specified in the TsJill requirement listU of that country and is sponsored by a permanent resident of that country.
Fhe inputs are$* A $ Fhe spouse or sponsor has permanent residence status. B $ Fhe spouse has li(ed in the country for D or more years. ' $ Fhe applicant possesses the required special sJills. 2 $ Sponsorship by a permanent resident. <utput$* X $
2enotes eligible for permit issue. ? 1 indicates es and E indicates >o in all casesB
a) 2raw the truth tables for the inputs and outputs gi(en abo(e and write the S<) expression for X%A+B+'+2). [5! b) Seduce X%A+B+'+2) using Rarnaugh&s map.
2raw the logic gate diagram for the reduced S<) expression for X%A+B+'+2) using A>2 V <S gates. ou may use gates with more than . inputs. Assume that (ariables and their complements are a(ailable as inputs. [5!
Question '. a) Wow is an X<S gate different from an <S gate= 2raw a truth table representing a @ input X<S operation. 2eri(e its S<) expression and draw the logic gate diagram for the S<) expression.n [&! b) 9hat is the purpose of a multiplexer= 5ention any two applications of a multiplexer. [ " ! c) 2raw the logic gate diagram for the following three input function #%X+ +") using ><S gates only. #%X+ +"), N%E+1+@+/+1) ["! Question (. a) Seduce the following expression using the laws of Boolean Algebra. 2raw the logic gate diagram for the simplified expression$* #,A.%A&!B). '. %A!') [&! b) State the principles of duality. Mi(e an example. ["! c) 'on(ert AB ! B'& to its canonical S<) form using Boolean Algebra. ["!
Question 8. a) 2raw the truth table and logic circuit diagram for a @ x O decoder. State the difference between a multiplexer and a decoder. b) Seduce the following Boolean expression to the simplest form$* A.?B!'%AB!A')&B c) Mi(en #%X+ +"), N%1+@+1) )ro(e #%X+ +"), - % E+.+/+D+0)
Se%tion ) Answer any / questions. 8ach program should be written in such a way that it clearly depicts the logic of the problem. Fhis can be achie(ed by using mnemonic names and comments in the program. %#lowcharts and algorithms are not required) T*e +$o,$#-s -ust .e /$itten in C0012#3#
Question 4. >;' institute&s resource manager has decided to networJ the computer resources liJe printer+ storage media+ etc. so that minimum resources and maximum sharing could be a(ailed. Accordingly printers are linJed to a centraliXed system and the printing Cobs are done on a Yfirst come first ser(ed basis+ only. Fhis is liJe the first person&s printing Cob will get done first and the next person&s Cob will be done as the next Cob in the list and so on. ;n order to a(oid collision+ the restriction is that no more than .E printing Cobs can be added. 2efine the class P$int5o. with the following details$
C6#ss n#-e 7#t# -e-.e$s Cob?B >ewCob 'apacity #ront Sear Me-.e$ 8un%tions )rintCob%)
$ $ $ $ $ $
)rintCob array of integers to hold the printing Cobs. to add a new printing Cob into the array. the maximum capacity of the integer array. to point out to the index of the front. to point out to the index of the last.
$ $
(oid remo(eZob%)
constructor to initialiXe data members. 'apacity,.E+ #ront , Sear,*1 and call the function createZob%). to create an array to hold the printing Cobs. adds the new printing Cob to the end of the last printing Cob+ if possible+ otherwise displays the message T)rintCob is full+ cannot add any moreU. Semo(es the printing Cob from the front if the printing Cob is not empty+ otherwise displays the message T)rintCob is emptyU.
a) Specify the class )rintCob gi(ing details of the constructor and the function (oid addZob%)+ (oid createZob%) and (oid remo(eZob%) only. ou do not need to write the main function. [8! [1! b) 9hat is the common name of the entity described abo(e= c) State one of its applications [1!
Question 10. A special number is a number in which the sum of the factorial of each digit is equal to the number itself. #or example$* 1/D , 1[ ! /[ ! D[ , 1 ! ./ ! 1.E 2esign a class S+e%i#6 to checJ if a gi(en number is a special number. Some of the members of the class are gi(en below$ C6#ss n#-e 7#t# -e-.e$s > Me-.e$ 8un%tions Special%) Special%int) (oid sum%) (oid isSpecial%) $ $ Special ;nteger
$ $ $ $
constructor to assign E to n )arameteriXed constructor to assign a (alue to Yn& calculate and display the sum of the first and last digit of n. checJ and display if the number n is a special number.
Specify the class Special gi(ing details of the constructor+ (oid sum%) and (oid isSpecial%). ou need not write the main function. [ 10 !
Question 11. A class 'ollection contains an array of 1EE integers. Qsing the following class description create an array with common elements from two integer arrays. Some of the members of the class are gi(en below$ C6#ss n#-e 7#t# -e-.e$s arr?B len Me-.e$ 8un%tions 'ollection%) 'ollection%int) $ $ $ 'ollection integer array length of the array
$ $
(oid arrange%)
(oid display%)
default constructor parameteriXed constructor to assign the length of the array. to accept the array elements. returns a 'ollection containing the common elements of current 'ollection obCect and the 'ollection obCect passed as a parameter. sort the array elements of the obCect containing common elements in ascending order using any sorting technique. displays the array elements.
Specify the class 'ollection gi(ing the details of the constructors+ (oid inparr%) and (oid arrange%). 'ollection common%'ollection). ou need not write the main #unction. [ 10 ! Question 12. A class E-+6o9ee contains employee details and another class Salary calculates the employee&s net salary. Fhe details of the two classes are gi(en below$ C6#ss n#-e $ 8mployee 7#t# -e-.e$s emp>o $ stores the employee number. emp>ame $ stores the employee name emp2esig $ stores the employee&s designation. Me-.e$ 8un%tions: 8mployee%) 8mployee%A) (oid display%) 'lass name 2ata members basic 5ember functions Salary%A)
$ $ $ $ $
default constructor. parameteriXed constructor to assign (alues to data members. display the employee details. Salary float (ariable to store the basic pay.
members. (oid calculate%) $ calculates the employee&s net salary according to the following rules$ 2A , 1EK of basic WSA , 1DK of basic Salary , basic ! 2A !W SA )#, O K of Salary >et Salary , Salary \)# 2isplay the employee details and the >et salary. Specify the class 8mployee gi(ing details of the constructors and member function (oid display%). Qsing the concept of inheritance specify the class Salary gi(ing details of the constructor and the member function (oid calculate%). Fhe main function need not be written. [ 10 !
Question 1". A class Re3st$ defines a recursi(e function to re(erse a string and checJ whether it is a palindrome. Fhe details of the class are gi(en below$ C6#ss n#-e $ Se(str 7#t# -e-.e$s Str $ stores the string. Se(st $ stores the re(erse of the string. 5ember functions (oid getStr%) $ to accept the string. (oid recSe(erse%int) $ to re(erse the string using recursi(e technique. (oid checJ%) $ to display the original string+ its re(erse and whether the string is a palindrome or not. Specify the class Se(str gi(ing details of the functions (oid getStr%)+ (oid recSe(erse%int) and (oid checJ%). Fhe main function need not be written. [ 10 !
Question 1&. A class Mo;i89 has been defined with the following details$ C6#ss n#-e $ 5odify 7#t# -e-.e$s St $ stores a string len $ to store the length of the string. Me-.e$ 8un%tions (oid read%) $ to accept the string inuppercase alphabets. (oid putin%int + char) $ to insert a character at the specified position in the string and display the changed string. (oid taJeout%int) $ to remo(e character from the specified position in the string and display the changed string. (oid change%) $ to replace each character in the original string by the character which is a t a distance of . mo(es ahead. #or example$* TAB'2U becomes T'28#U+ TX "U becomes T"ABU. Specify the class 5odify gi(ing details of the functions (od read%)+ (oid putin%int+char)+ (oid taJeout%int) and (oid change%). Fhe main function need not be written. [ 10 !