Answer all questions in Part I (compulsory) and seven questions from Part-II, choosing three 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.

———————————————————————————————————————————————————————-

PART I

Answer all questions

 Question 1.                                                                                                                                                        [1 X 5=5]

  1. State the two compliment laws of Boolean Algebra. Verify any one using truth table.
  2. What do you understand by combinational circuit?
  3. What is Big O notation?
  4. Obtain the truth Table to verify the following expression: x.(y+z)=xy+xz. Also name the law stated above.
  5. Given, F(X,Y,Z)=(X’+Y’).(Y+Z’) write the function in canonical product-of-sum form.

 Question 2.                                                                                                                                                       [2 x 5 =10]

  1. Define a Queue. How is dequeue different from queue
  2. State two ways in which linked lists are different from arrays.
  3. Each element of an array A[-20……20,15…..45] requires 2 bytes of storage. If the array is stored row major wise determine the location of A[2,18].
  4. What do you understand by time complexity and space complexity?
  5. Convert the following infix notation to postfix form: (B+D)*(G+H/K).

 Question 3                                                                                                                                                                   [5]

The following function trial() perform are a part of some class. Show dry run/working. What will be the output of the function perform() when the value of p is 5?

int trial(int n)

{           if(n==1)

return 2;

else if(n==2)

return 3;

return trial(n-2)+trial(n-1);

}

void perform(int p)

{           int x;

for(inti=1;i<=p;i++)

{           x=trial(i);

System.out.print(x+” ”);

}

}

Part II
Answer six questions in this part, choosing two from Section A, two from Section B and two from Section C
Section A
Answer any two questions

Question 4.

  1. Given F(A,B,C,D) = Σ (0,2, 6,8,10,11,14,15)

(i) Reduce the above expression by using 4 – Variable K-Map, showing the various groups

(i.e octal , quads and pairs).                                                                                                                                                           [4]

(ii) Draw the Logic gate diagram of the reduced expression using NAND Gate only.                                                       [1]

  1. b) Given F(A,B,C,D) = π (5,7,8,10,12,14,15).

(i) Reduce the above expression by using 4 – Variable K-Map, showing the various groups

(i.e octal , quads and pairs).                                                                                                                                                           [4]

(ii) Draw the Logic gate diagram of the reduced expression.                                                                                                  [1]

Question 5.

(a)What is Full adder? Write the SOP expressions for sum and carry. Simplify the expressions

algebraically using Boolean algebra.                                                                                                                                            [5]

(b)  Draw the truth table and logic circuit diagram for a Decimal to Binary encoder.                                                     [5]

Question 6.                                                    

  1. Write the equivalent Boolean expression for the propositions F=X→Y and F=X↔Y.                                           [2]
  2. Minimize the following expression. At each step state clearly the law used

Y=(A+B’).(B+CD)’                                                                                                                                                    [3]

(c)  Draw the truth table and logic circuit diagram for a 3×8 decoder.

What is the difference between a multiplexer and a decoder?                                                                                               [5]
 

Section B
Answer two questions

Each program should be written in such a way that it clearly depicts the logic of the problem. use mnemonic names and comments in the program. (Flowcharts and algorithms are not required)
The programs must be written in Java.

Question 7.                                                                                                                                        [10]

A happy number is a number in which the eventual sum of the square of the digits of the number is equal to 1.

Example:         28        =          (2)2             +          (8)2

4          +          64        =          68

68        =          (6)2             +          (8)2

36        +          64        =          100

100      =          (1)2      +          (0)2      +          (0)2

=          1          +          0          +          0          =          1

Here 28 is a happy number

Design a class Happy to check if a given number is a happy number. Some of the members of the class are given below:

 Class name                                         :           Happy

Data members

N                                                          :           stores the number

Member functions

Happy()                                               :           constructor to assign 0 to n.

void getnum(int nn)                              :     to assign the parameter value to the number n=nn.

int sum_sqdigits(int x)                          :     returns the sum of the square of the digits of the number x,using the                                                                                         recursive technique.

void ishappy()                                        :    checks if the given number is a happy number by calling the function                                                                                         sum_sq_digits(int) and displays an appropriate message.

Specify the class Happy giving details of all the functions also define a main() function to create an object and call the methods to check for Happy number.

 Question 9.                                                                                                                                                                        [10]

 A class stringop is designed to handle string related operations. Some members of the class are given below:

Data member               

txt                                     :                               to store the given string of maximum length 100.

Member function

stringop()                       :                               constructor

void readstring()          :                               to accept the string

char caseconvert(int):                              to convert the letter to other case

void circulardecode() :  to decode the string by replacing each letter by converting it  to opposite case and then by the next character in a circular way. Hence “AbZ” will decode “bCa”.

Specify the class giving details of all member functions. You do not need to write function main().

Question 10.                                                                                                                                                                         [10]

A class Rearrange has been defined to insert an element and to delete an element from an array. Some of the members of the class are given below:

Class name                                                         :               Rearrange

Data members

a[]                                                        :           integer type array

n                                                          :           size of array (integer)

pos1                                                    :           position of insertion (integer)

pos2                                                    :           position of deletion

item                                                     :           item to be inserted (integer)

Member functions

void enter() :                                                                     to enter size, array elements and to display the entered  elements.

void insert()                                                       :               to accept element (item) to be inserted, position of

insertion and insert the element (item) at the position  of insertion.

void disp1()                                                        :               to display the array after item is inserted.

void disp2()                                                        :               to display the array after item is deleted.

void remove() : to accept the position of deletion and delete  element(item) at the position of deletion.

Specify the class Rearrange giving details of the functions void enter(), void insert(), void disp1(),  void disp2() and void remove(). The main function need not be written.

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.                                                                                                                                                                    [5]

A class Personal contains employee details and another class Retire calculates the employee’s provident Fund and Gratuity. The details of the two classes are given below:

Class name                            Personal                                

Data Members:

Name                          stores the employee name

Pan                              stores the employee PAN number

basic_pay                    stores the employee basic salary

acc_no                                    stores the employee bank account number

 Member functions:                                      

Personal( …. )             parameterized constructor to assign value to data members

void display( )              to display the employee details

Class name                            Retire                         

Data Members:

Yrs                                           stores the employee years of service

Pf                                            stores the employee provident fund amount

Grat                                         stores the employee gratuity amount

member functions:                                      

Retire ( …. )                parameterized  constructor  to  assign  value  to  data members of both the classes.

void provident( )          calculates the PF as (2% of the basic pay) * years of  service.

void gratuity( )             calculates the  gratuity  as  12  months’  salary,  if  the years of service is more than or equal to 10 years    else the gratuity amount is nill.

void display1( )            Displays  the  employee  details  along  with  the  PF and gratuity amount.

Assume that the super class Personal has been defined. Using the concept of inheritance specify the class Retire giving details of the constructor, void provident() and void gratuity().The super class and the main function need not be written.

Question 11.                                                                                                                                                                       [5]
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   :  Dequeue

Data members

ele[]    :  array to hold integer elements.

cap    :  stores the maximum capacity of the array.

front    :  to point the index of the front.

rear    :  to point the index of the rear.

Member functions

Dequeue(int max)          :  constructor to initialize the data member cap = max, front = rear = 0 andcreate the integer array.

Void pushfront(int v)    :  to add integers from the front index, if possible else  display the message (“full from front”).

Int popfront()                :  to remove and return element from front. If array is empty then return-999.

Void pushrear(int v)    :  to add integers from the front index if possible else  display the message(“full from rear”).

Int poprear()                :  to remove and return elements from rear. If the array is empty then return -999.

Specify the class Dequeue giving details only the constructor Dequeue(int), void pushfront(int) and int poprear(). Assume that other functions have been defined. The main function need not be written.

Question 12.

(a) A linked list is formed from the objects of the class.                                                       [2]

class Node

{

int info;

Node link;

}

Write an algorithm OR a method for deleting a node from a linked list. The method declaration is given:   void deletenode(Node start).

(c) Answer the following from the diagram of a binary Tree                                                            [3]

 

 

 

 

 

 

 

 

  • Write the Inorder tree traversal.
  • Name the Leaves of the tree
  • Height of the tree.

 

 

 

 

LEAVE A REPLY

Please enter your comment!
Please enter your name here