 nswer all questions in Part I (compulsory) and seven 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 questions are given in brackets [ ].

PART I

Question1.                                                                                                [ 1 x 5 = 5]

1. a) State the two distributive laws of Boolean Algebra. Prove any one of them with the help of truth tabl
2. b) Using truth table, verify whether the following is true or false:

(p →q) = (q’→p’)

1. c) Find the complement of the following: [(xy)’.x][(xy)’.y]
2. d) Simplify the following Boolean expression using laws of Boolean Algebra. At each step, clearly state the law used for simplification. z(z+x).x(y+y’)
3. e) Given F(x,y,z)= xz+xy +yz Write the function in canonical sum of product form.

Question 2.                                                                                   [ 2 x 5 = 10]

1. a) What do LIFO and FIFO stand for?
2. b) For an array of real numbers x[-6…8, -12…. 20], find the address of x , if x is stored in location 100 in the column major order. Assume that each element requires 4 bytes.
3. c) State the difference between an abstract class and an interface.
4. d) Convert the following infix expression to its postfix form.             b*[(a/d) – (c * (e-f))]
5. e) Define a binary tree.

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);

}

}

}

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(P,Q,R,S)= ∏(0,1,2,3,5,7,8,9,10,11)

1. i) Reduce the above expression by using 4 variable Karnaugh map, showing the various groups( i.e. octal, quads and pairs). 
ii) Draw the logic gate diagram for the reduced expression. Assume that the variables and their complements are available as inputs.                                          
2. b) Given P(A,B,C,D)= ABC’D’ + A’BC’D’+ A’BC’D+ ABC’D+A’BCD+ABCD
3. i) Reduce the above expression by using 4 variable Karnaugh map, showing the various groups (i.e. octal, quads and pairs).                 
ii) Draw the logic gate diagram for the reduced expression. Assume that the variables and their complements are available as inputs.                       

Question 5

1. Draw the truth table and logic circuit diagram for a 3X 8 decoder.         
2. What do you understand by a multiplexer? State any one application of a multiplexer circuit. 
3. Draw the logic gate diagram to implement the AND gate by using NOR gate and NAND gate. 

Question 6

The main safe in the nationalize bank can be opened by means of a unique password consisting of three parts.  Different parts of the password are held by the  chairman, Regional Manager, Bank Manager and Head Cashier of the bank, respectively.

In order to open the safe any one of the following conditions must be satisfied:

The password of the chairman, together with passwords of any two other officials, must be entered.

OR

The password of all three bank officials, excluding the chairman, must be entered.

The inputs are: INPUTS

A                          Denotes the chairman’s password

B                          Denotes the Regional Manager’s password

C                          Denotes the Bank Manager’s password

Output

X                          Denotes the safe can be opened [ 1 indicates YES ad 0 indicates NO in all cases]

1.  Draw the truth table for the inputs and outputs given above and write the SOP expression for X(A,B,C,D).
2. Reduce X(A,B,C,D) using Karnaugh’s map, if possible.

Draw the logic gate diagram for the reduced SOP expression for X(A,B,C,D) using AND and OR gates. You may use gates with two or more inputs. Assume that the variable and their complements are available as inputs.                                                              

Section B

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.

A perfect square is an integer which is the square of another integer. For example, 4,9,16… are perfect squares. Design a class Perfect with the following description:

Class Name                            :                           Perfect

Data members

n                                              :        stores an integer number

Member functions

Perfect()                                :          default constructor

Perfect(int)                            :          parameterized  constructor  to  assign  value to n

void perfect_sq()                  :         to display the first 5 perfect squares larger than

‘n’ (if n=15, the next 3 perfect squares are  16,25,36).

void sum_of()                         :      to display all combinations of consecutive integers  whose  sum  is  =  n.  (The       number  n=15 can be expressed as     :

1 2 3 4 5

4 5 6

7 8

Specify the class Perfect giving details of the constructors, void perfect_sq() and void sum_of(). Also define the main function to create an object and call methods accordingly to enable the task.                                                                                               [ 10 ]

Question 8.

In a class VowelWord to accept sentence and calculate the frequency of words that begin with a vowel. The words in the input string are separated by a single blank space and terminated by a full stop. The description of the class is given below:

Class name                                      VowelWord

Data members

str                                                        to store the sentence

freq                                                    store the frequency of the words beginning with a vowel

Member functions

VowelWord()                                 constructor to initialize data members to legal initial value.

void readstr()                                 to accept a sentence

void freqvowel()                           counts the frequency of the words that begin with a vowel

void display()                                  to display the original string and the frequency of the                                                        words that begin with a vowel.

Specify the class VowelWord giving details of the constructors and all the functions. Also write the main function.                                                                                

Question 9.

A Transpose of any array is obtained by interchanging the elements of the rows and columns.

A class Transarray contains a two dimensional integer array of order [ m x n]. The maximum value possible for both ‘m’ and ‘n’ is 20. Design a class Transarray to find the transpose of a given matrix. The details of the members of the class are given below :

Class name                                                      :               Transarray

Data members

arr[][]                                                    :               stores the matrix elements

m                                                            :               integer to store the number of rows

n                                                             :               integer to store the number of columns

Member functions       :

Transarray()                                                       :               default constructor

Transarray(int mm, int nn)                           :               to initialize the size of the matrix, m=mm, n=nn

void fillaray()                                                      :               to enter the elements of the matrix

void transpose(Transarray A)                     :               to find the transpose of a given matrix

void disparray()                                                               :                displays the array in a matrix form

Specify the class Transarray giving the details of the constructor and other member functions. You need not to write the main function.          

Section C

Answer any 2 questions.

Each program/algorithm 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 pseudo codes.

(Flowcharts are not required)

The programs must be written in Java.

The algorithm must be written in general standard form wherever required.

Question 10.

A class Author contains details of the author and another class BookList contains details of the books written by him. The details of the 2 classes are given below:

Class name                   :                           Author

Data members

authorno                      :                           stores the author’s number

name                            :                           stores the author’s name Member functions

Author()                       :                           default constructor

Author(…..)                  :                           parameterized constructor to assign values to                                                                   author number and name.

void show()                  :                           to display the author’s details.

Class name                  :                           Booklist

Data members

bookno                          :                           long type variable to store the book number.

bookname                   :                           stores the book name

price                              :                           float variable to store price

edition                         :                           integer type variable to store the edition number

Member functions

Booklist(…..)                  :       parameterized constructor to assign values to data                                                           members of both the classes.

void show()                      :     to display all the details.

Specify the class Author giving details of the constructors and member function void show(). Using the  concept of  inheritance, specify  the  class  Booklist giving  details  of  the  constructor  and  the member function void show(). Also define the main function to create an object and call methods accordingly to enable the task.                               [ 5 ]

Question 11.

In a computer game, a vertical column and a pile of rings are displayed. The objective of the game is to pile up rings on the column till it is full. It can hold 10 rings at the most. Once the column is full, the rings have to be removed from the top till the column is empty and the game is over. Define the class RingGame with the following details:

Class Name                                     :              RingGame

Data members

ring[]                               :              array to hold rings (integer)

max                                 :              integer  to hold  maximum  capacity of ring array

upper                              :              integer to point to the uppermost element

Member functions

RingGame(int m)           :            constructor to initialize, max = m & upper to -1.

void jump-in(int)           :            adds   a   ring   to   the   top   of   the column, if possible, otherwise, displays a message “Column full. Start removing rings”.

void jump-out()             :          removes the ring from the top, if column   is   not empty,   otherwise outputs  a  message, “Congratulations the game is over “.

Specify the class RingGame giving details of the constructor and functions void jump-in(int) and void jump-out(). Also define the main function to create an object and call methods accordingly to enable the task.                            

Question 12.

1. a) A linked list is formed from the objects of the class.            

class Node

{

int info;

}

Write an algorithm OR a method for deleting a node after ‘n’ nodes from a linked list. The method declaration is given:

void deletenode(Node start, int n).

(c) Answer the following from the diagram of a binary  tree • Write the postorder tree traversal.
• Name the root of the right subtree
• Level of the tree.