Trending ▼   ResFinder  

ComputerTheorySpecimen 2016

6 pages, 30 questions, 6 questions with responses, 6 total responses,    0    0
Megha Sharma
Zydus School for Excellence (ZSE), Vejalpur, Ahmedabad
+Fave Message
 Home > mememe >

Formatting page ...

Computer Science Specimen Paper 2016 Part I Answer all questions Question 1. a) State the Associative Law and prove it with a truth table. b) Draw the truth table to prove a propositional expression. (x y) ^ (y x) = (x y) c) Find the dual for the Boolean equation : AB + BC +1 =1 d) Convert the Boolean expression F(X,Y,Z) = X Y Z + X YZ + XYZ into its cardinal form. e) Minimise F= XY + (XZ) + XY Z using Boolean laws. [ 1 x 5 = 5] Question 2. a) Differentiate between Stack data structure and Queue data structure. b) Convert the following infix notation to postfix: A * ( B / C) / E + F c) Define Interface. How is it different from a class? d) Each element of an array arr[15][20] requires W bytes of storage. If the address of arr[6][8] is 4440 and the base address at arr[1][1] is 4000, find the width W of each cell in the array arr[][] when the array is stored as Column major wise. e) Define Big O notation. State the 2 factors which determine the complexity of an algorithm. [ 2 x 5 =10] Question 3. The following is a function of some class. What will be the output of the function test( ) when the value of count is equal to 4?Show the dry run / working. class Sample { public void test( int count) { if(count == 0) System.out.println(" "); else { System.out.println("Bye " +count); test(--count); System.out.println(" "+ count); } } } [5] 1 Part II Answer six questions in this part, choosing two questions from Section A, two from Section B and two from Section C. Section A Answer any two questions Question 4. a) Given F(A,B,C,D)= (0,2,3,6,8,10,11,14,15) i) Reduce the above expression by using 4 variable Karnaugh map, showing the various groups( i.e. octal, quads and pairs). [4] ii) Draw the logic gate diagram for the reduced expression. Assume that the variables and their complements are available as inputs. [1] b) Given F(P, Q, R, S)= (5, 7, 8, 10,12, 14, 15) i) Reduce the above expression by using 4 variable Karnaugh map, showing the various groups( i.e. octal, quads and pairs). [4] ii) Draw the logic gate diagram for the reduced expression. Assume that the variables and their complements are available as inputs. [1] Question 5. a) Draw the logic diagram and truth table to encode the decimal numbers ( 2,3,5,7,8) and briefly explain its working. [5] b) Simplify the following Boolean expression and draw the gate for the reduced expression. F = A B + AB C +A [2] c) Define Universal gates. Give one example and show how it works as an OR gate. [ 3 ] Question 6. a) Draw a truth table with a three input combination which outputs 1 if there are odd number of 0 s. Also derive an SOP expression using Karnaugh map. [5] b) Define proposition. How does tautology differ from contradiction? [2] c) Briefly explain the working of a 4:1 multiplexer. Also draw the logic diagram of 4:1 multiplexer. [3] 2 Section B Answer two questions Each program should be written in such a way that it clearly depicts the logic of the problem. This can be achieved by using mnemonic names and comments in the program. ( Flowcharts and algorithms are not required ) The programs must be written in Java. Question 7. A class Composite contains a two dimensional array of order [m x n ]. The maximum valuespossible for Composite to fill the array with the first (m x n) composite numbers in column wise. The details of the members of the class are given below:Class name Data members arr[][] m n Member functions Composite(int mm , intnn) : Composite : : : stores the composite number columnwise integer to store the number of rows integer to store the number of columns : to initialize the size of the matrix m=mm and n=nn returns 1 if number is composite otherwise returns 0 to fill the elements of the array with the first (m x n) composite numbers in column wise displays the array in a matrix form. int isComposite(int p) : void fill() : void display( ) : Specify class Composite giving details of the constructor(int, int), intisComposite(int), void fill( ) and void display(). Define a main () function to create an object and call the functions accordingly to enable the task. [ 10 ] Question8. 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:Class Name Data Members str len Member functions Sort ( ) voidreadword( ) void arrange( ) void display() : Sort : : stores a word to store the length of the word : : : : default constructor to accept the word to arrange the word in alphabetical order using any standard sorting technique. displays the original word along with the sorted word. Specify class Sort giving details of the constructor, void readword(), void arrange() and void display(). Define the main function to create an object and call the functions accordingly to enable the task. [ 10 ] 3 Question 9. A Special number is a number in which the sum of the factorial of its digits is equal to the number. Example 1445 ( 1! + 4! + 5!= 145). Thus, 145 is a special number. Design a class Special to check if the given number is a Special number or not. Some of the members of the class are given below: Class name Data members n Member functions Special() void read() int factorial(int x) : Special : integer to store the number : : : default constructor to accept the number return the factorial of a number using recursion technique checks for the special number by invoking the function factorial() and returns true if Special, otherwise returns false. to show the result with an appropriate message booleanisSpecial() : void display() : Specify the class Sort giving details of the constructor, void readword(), void arrange() and void display(). Define the main function to create an object and call the functions accordingly to enable the task. [ 10 ] Section C Answer any two questions Each program should be written in such a way that it clearly depicts the logic of the problem step wise. This can also be achieved by using comments in the program and mnemonic names or pseudo codes for algorithms. The program must be written in Java and the algorithms must be written in general/ standard form, wherever required/ specified. ( Flowcharts are not required. ) Question 10. A super class Account contains employee details and a class Simple calculates the employee s simple interest. The details of the two classes are given below: Class name Data members name pan principal acc_no Member functions Account( ) : Account : : : : stores the employee name stores the employee pan number stores the principal amount in decimals stores the employee bank account number : void display() : parameterized constructor to assign values to data members to display the employee details Class name Data members : Simple 4 time rate interest : : : stores the time duration stores the rate of interest stores the simple interest Member functions Simple ( ) : parameterized constructor to assign values to data Members of both classes void calculate() : void display() : calculates the simple interest as (principal x time x rate)/100 displays the employee details along with the rate time and interest. Assume that the super class Account has been defined. Uisng the concept of inheritance specify the class Simple giving details of the constructor, void calculate() and void display(). The super class and the main function need not be written. Question 11. A dequeue enables the user to add and remove integers from both the ends i.e. front and rear. Define a class DeQueue with the following details: Class name Data members ele[] cap front rear Member functions Dequeue(int max) : Dequeue : : : : array to hold integer elements. stores the maximum capacity of the array. to point the index of the front. to point the index of the rear. : constructor to inititalize the data member cap = max, front = rear = 0 and create the integer array. to add integers from the front index, if possible else display the message ( full from front ). to remove and return element from front. If array is empty then return -999. to add integers from the front index if possible else display the message( full from rear ). to remove and return elements from rear. If the array is empty then return -999. voidpushfront(int v) : intpopfront() : voidpushrear(int v) : intpoprear() : Specify the class Dequeue giving details only the constructor(int), void pushfront(int) and intpoprear(). Assume that other functions have been defined. The main function need not be written. [5] Question 12. a) A linked list is formed from the objects of the class: class Node { 5 Intnum; Node next; } Write an algorithm OR a method to insert a node at the beginning of an existing linked list. The method declaration is as follows:void InsertNode(Nodes starPtr, int n) b) Answer the following questions from the diagram of a binary tree given below:- i) ii) iii) Name the root and leaves of the tree. Write the post order traversal of the tree. Separate the internal nodes and the external nodes of the tree. 6 [1] [1] [1]

Formatting page ...

Formatting page ...

Top Contributors
to this ResPaper
(answers/comments)


Megha Sharma

(6)

Formatting page ...

Formatting page ...

Formatting page ...

 

  Print intermediate debugging step

Show debugging info


 

 


© 2010 - 2025 ResPaper. Terms of ServiceContact Us Advertise with us

 

mememe chat