Formatting page ...
father leblond school COMPUTER SCIENCE PAPER 1 (Theory) (Maximum marks: 70) (Time allowed: Three hours) (Candidates are allowed additional 15 minutes for only reading the question paper. They must NOT start writing during this time.) --------------------------------------------------------------------------------------------------------------------------------------------Answer all questions in Part I(compulsory)and six questions from Part II, choosing two questions from Section A, two from Section B and two from Section C. All working, including rough work, should be done on the same sheet as the rest of the answer. The intended marks for questions or parts of question are given in brackets [ ]. ---------------------------------------------------------------------------------------------------------------------------------------------Part I (20 Marks) Attempt all questions While answering questions in this Part , indicate briefly your working and reasoning, wherever required. Question 1 (a) State Associative law and prove it with the help of truth table. (b) Draw the truth table to prove the following propositional logic expression. (c) Find the dual of the Boolean equation: AB + BC + 1 = 1 (d) Find the complement of F(P,Q,R) = PQ R + Q(P R +PR ) (e) Minimize: F = XY + (XZ) + XY Z using Boolean laws. [1] [1] [1] [1] [1] Question 2 (a) Explain the insertion and deletion technique in the queue data structure. (You can also use algorithm to illustrate your point) (b) Convert the given infix expression to postfix expression: a+b*c%d/e+f (c) Each element of an array X[ -5 15, 10 35] requires 8 bytes of storage. If the array is stored in Row major wise and the beginning location 2500, then determine the address of X[15,30]. (d) What do you understand by interface? Explain its differences with the class. (e) Consider a set of numbers 8,9,10,11,12,7,8. Explain the concept of push and pop in the data structure. [2] [2] [2] [2] [2] --------------------------------------------------------------------------------------------------------------------------------------------XII/SELECTION THIS PAPER CONSISTS OF 5 PRINTED PAGES AND 1 BLANK PAGE TURN OVER Question 3 Find the output considering the following code: void check (int k) { if(k>=2) { System.out.print(((k*k) -1) + ); check(k-1); System.out.print(((k*k)-2) + ); } } i) check(4) ii) check (7) [5] Part II (50 Marks) Answer six questions in this part, choosing two questions from Section A, two questions from Section B and two questions from Section C. Section A (20 Marks) Attempt any two questions. Question 4 (a) Given the following Boolean function : F(A,B,C,D) = (0,1,2,3,4,5,6,9,11). (i) Reduce the above expression by using 4 variable Karnaugh map, showing the various groups ( ie octal, quad and pairs). (ii) Draw the logic gate diagram for the reduced expression. Assume that the variables and their complements are available as input. (b) [4] [1] Given the following Boolean function : F(A,B,C,D) = (2,3,5,7,8,12,14) (i) Reduce the above expression by using 4 variable Karnaugh map, showing the various groups (ie octal , quad and pairs). (ii) Draw the logic gate diagram for the reduced expression. Assume that the variable and their complements are available as input. [4] [1] Question 5 (a) Differentiate between Multiplexer and decoder. (b) Design the truth table and circuit diagram of Hexadecimal to Binary Encoder . (c) Design 2 input AND gate using NAND gate. Also draw the truth table. [2] [5] [3] Question 6 (a) Draw a truth table with 3 input combinations which outputs 1 if there are odd numbers 0 s. Also derive an SOP expressions for the output. Reduce the expression using Karnaugh map. (b) Define proposition. How does tautology differs from contradiction. (c) Draw the logic diagram of 4:1 multiplexer. [5] [3] [2] ---------------------------------------------------------------------------------------------------------------------------------------XII/SELECTION 2 TURN OVER Section B(20 Marks) Attempt any two questions Each program must be written in such a way that it clearly depicts the logic of the problem. This can be achieved by using mnemonics names and comments in the program. (Flowcharts and Algorithm are not required) The programs must be written in Java. Question 7 A prime number is a number that is divisible by 1 and that number only. Twin prime number are those number where the differences between two prime number is 2. Example (3,5), (5,7) etc. The sum of reciprocal of twin prime numbers numbers are known as Brun s Constant. Example: 1 3 1 +5 + 1 5 1 + 7 + nth term Declare a class named Brun with one data member double sum and three member functions int prime_check(int,int), double sumtwinprime(int) and void brun_constant( ). Write a Java program, to declare the above class with its member functions. Use recursive technique in prime_check ( ) method. Specify the main ( ) method to create an object of the above mentioned class and call the functions accordingly. [10] Question 8 A class Unique displays unique digits integers. A unique digit integers is a positive integers (without leading zero) with no duplicate digits. For example: 7, 157, 234 etc are unique integers where as 223, 151, 100 are non unique integers. The details are as follows: instance variables: m : integer to store start limit n : integer to store end limit count :integr to the count of unique digit integers member finctions/methods: unique ( ) : default constructor to initialize the data members with initial values. unique(int x, int y) :parameterized constructor to m = x, n=y. void generate( ) : to generate and print all unique digit integers between m and n(both inclusive) if m < n and also store the occurance of unique digit integers in count. If m > n then print out of range. Define a main( ) method to create an object and call the methods accordingly. [10] Question 9 Design a class Sort which enables a word to be arranged in alphabetical order. The details of the members of the class are given below: [10] Class name : Sort Data members/ instance variables : str : stores a word len : to store the length of the word Member methods/functions Sort ( ) : default constructor void readword( ) : to accept the word void arrange ( ) : to arrange the word using standard sorting technique void display( ) :display original word and sorted words ------------------------------------------------------------------------------------------------------------------------------------XII/SELECTION 3 TURN OVER Section- C( 10 Marks) Attempt any two questions Each program must be written in such a way that it clearly depicts the logic of the problem stepwise. This can also be achieved by using comments in the program and mnemonics or pseudocode for the algorithm. The programs must be written in Java and the algorithm must be written in general /standard form, wherever required/specified. (Flowcharts not required) Question 10 An interface Shape is defined with a method area ( ) which returns the area of the implementing shape. Create the classes Circle & Rectangle which implement the interface Shape. These classes have attributes which reflect their dimensions(radius of a circle, height and width for a rectangle) which are set by their constructors. The detail of the members of the interface and both the classes are given below: Interface name: Shape Methods: double area( ): returns of the implementing shape Class name: Circle Data members / instance variables: radius: to store the radius of the circle in decimal Member methods/functions: Circle(int r): parameterized constructor double area( ): to calculate the area of the circle Class name: Rectangle Data members/instance variables length: to store the value of length breadth: to store the value of breadth Member methods/functions: Rectangle( int l, int b): parameterized constructor double area( ): to calculate the area of the rectangle Assume that the interface Shape has been defined. Using the concept of inheritance, specify the classes Circle and Rectangle giving the details of the constructor and double area ( ) respectively. The interface, algorithm and main function need NOT to be written. [5] Question 11 A superclass Bank has been defined to store the details of a customer. Define a sub-class Account that enables transactions for the customer with the bank. The details of both the classes are given below: [5] Class name: Bank Data members/instance variables: name: stores the name of the customer accno: stores the account number P: stores the principal amount in decimals Member functions/methods: Bank( .): parameterized constructor to assign values to the instance variables void display (): displays the details of the customer -----------------------------------------------------------------------------------------------------------------------------------------XII/SELECTION 4 TURN OVER Class name: Data member/instance variable: amt: Member functions/methods: Account( ): Account stores the transaction amount in decimals parameterized constructor to assign values to the instance variables of both the classes void deposit(): accepts the amount and updates the principal as p=p+amt void withdraw(): accepts the amount and updates the principal as p=p-amt If the withdrawal amount is more than the principal amount, then display the message INSUFFICIENT BALANCE . If the principal amount after withdrawal is less than 500, then a penalty is imposed by using the formula. p=p-(500-p)/10 void display(): displays the details of the customer Assume that the superclass Bank has been defined. Using the concept of Inheritance; specify the class Account giving details of the constructor( ), void deposit(), void withdraw() and void display() . The superclass and the main function need not be written. Question 12: Read the diagram and answer the following question: i) Write the inorder traversal of the tree. ii) Write the subnodes of B and C. iii) Name the leaves of the right sub tree. iv) Define binary tree with example. [2] [1] [1] [1] -------------------------------------------------------------------------------------------------------------------------------------------XII/SELECTION 5 END
|