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 questions are given in brackets [ ].

**———————————————————————————————————————–**

**PART I**

*Answer all questions *

**Question1**

- Draw the truth table to prove the proportional logic expression. [1]

a<=>b = (a => b) . (b => a)

- Determine if following wff is valid, satisfiable or unsatisfiable: [1]

(p -> q) => [~q -> (~p ^ ~q)]

- Differentiate between a tautology and a contradiction. [1]
- Convert the following expression F(X,Y,Z) = XY+Y’Z into [1]
- Minimize F = AB + (AC)’ +AB’C using Boolean laws. [1]

** ****Question 2**

- Each element of an array A [-15….. 20, 20….. 45] requires 4 bytes for storage. [2]

Find the address of A [30][20] if the base address is 1000, in RowMajorWise

- State the different applications of stac
- Convert the following infix notation to its postfix form: [2]

(A + ( B * C )) / ( C – ( D * B ))

- Prove that (x.y)’=x’+y’ using truth table [2]
- State the two idempotent laws of Boolean algebra. Verify any one. [2]

**Question 3**** **[5]

Give output of the following function where x and y are arguments greater than 0.

Show the dry run/working.

void confusing ( int x, int y )

{

if ( x > 1 ) // base case

{

if ( x % y = = 0 )

{

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

confusing ( x / y, y);

} // end of inner if

else

confusing ( x , y+1);

} //end of outer if

}

(i) What will the function confusing (24 , 2) return ?

(ii) What will the function confusing (84 , 2) return ?

**PART II**

*Attempt any two** questions from Section-A, two from Section-B and two from Section-C*

**Section A**

**Question 4 **(a) Given the Boolean function: **[5]**

F ( P, Q, R, S ) = π ( 0, 1,2, 3, 5, 7, 8,9, 10, 11 )

Use Karnaugh’s map to reduce the function F, using the SOP form. Draw a logic gate diagram for the reduced SOP form. You may use gates with more than two inputs. Assume that the variable and their complements are available as inputs.

(b) Given G(A,B,C,D)= ABC’D’+A’BC’D’+A’BC’D+ABC’D+A’BCD+ABCD

- 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.**

- What is a multiplexer? Draw the circuit and the truth table of 8 to 1 multiplexer.
**[5]** - Draw the truth table and logic circuit diagram for an Octal to Binary encoder.
**[5]**

**Question 6.**

- How is a half adder different from full adder? Draw the truth table and derive the sum and carry expression for a full adder. Also, draw the logic diagram for a full adder.
**[4]** - State whether the following expression is a Tautology, contradiction or a contingency, with the help of a truth table(XàZ) ˅ ~[(XàY) ^ (YàZ)].
**[3]** - Draw the truth table and logic circuit diagram for a 3×8 decoder.
**[3]**

**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. [10]**

Design a class Alpha which enables a word to be arranged in ascending order according to its alphabets.

The details of the members of the class are given below :

Class name | : | Alpha | ||

Data members /instance variables: | ||||

Str | : | to store a word | ||

Member functions : | ||||

Alpha( ) | : | default constructor | ||

void readword( | ) | : | to | accept the inputted word |

void arrange ( ) | : | to arrange the letter in alphabetical order using any | ||

Standard sorting technique. | ||||

void disp() | : | Displays the word. |

Specify the class Alpha giving details of the constructor and the member functions void readword( ), void arrange( ), void disp ( ) and defining the main ( ) function to create an object and call the function in order to execute the class by displaying the original word and the changed word with proper message.

**Question 8. [10]**

Design a class Palindrome which enables a word to be arranged in ascending order according to its alphabets and also finds the frequency of each alphabets present in the word. The details of the members of the class are given below:

Class name : Palindrome

Data members/instance variables :

str : to store a word

revword : to store the reverse of the word

Member functions/methods :

Palindrome( ) : constructor to initialize data members with initial values

void readWord( ) : to accept the inputted word

String rev( String, int ): to reverse the word using Recursive Technique

void disp( ) : to display the original word, and the reversed word

void isPalin( ) : to check whether the inputted word is a Palindrome or not by calling the rev( ) function.

Specify the class Palindrome giving details of the constructor and member functions void readWord( ), String rev(String,int), void disp( ) and void isPalin( ). Define the main( ) function to create an object and call the member function according to enable the task .

**Question 9. **

Rack is a kind of data structure which can store at the most 20 books. The rack restriction is that a book can be kept in to the rack or removed only at one end i.e. on the top.

The class Rack has the following details :

**Class name : Rack **

**Data members/ instance variables : **

book[ ] : array of string of maximum 50 locations to store books.

name : string variable to store name of book.

Limit : integers as maximum capacity of the array

Top: integer to indicate topmost book into the Rack.

**Member functions/methods : **

Rack( ) : a constructor to store blank in the array book[ ].

Rack( int nx ) : a constructor to assign ** nx ** to

**limit**and -1 to top.

void dispList( ) : to display list of books in the rack.

boolean ifEmpty( ) : returns true, if rack is empty, otherwise returns false.

void putTheBook( ) : input name of the book into variable name and adds it on the top into the array book[ ] if rack is empty otherwise prints a message “Rack overflow”.

void removeBook( ) : removes a book form the top of the rack, if rack is not Empty and print the book name, otherwise outputs a Message “Rack underflow”.

Specify the class **Rack** giving details of **constructors** and the functions **ifEmpty()**, **void putTheBook( )**, **void removeBook( )** only. Assume that other functions are already written for you. You **do not need** to write the main function.

**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]**

Sum=1+x/1!+x3/2!+x5/3!+……..+x2n-1/n!

A class seriessum has been defined to calculate the sum of the above series. Some of the members of the class are given below:

Class name : seriessum

Data members x

n : int

sum : double

Memberfunctions

sumseries() : constructor

int factorial(intn) : calculates and returns the factorial of n( n!) where n!=1x2x

3x4x….x n.

Double term(intp,intq): Calculates and returns the value of p/q! by making use of factorial(int).

Void accept() : Inputs the value of member data x,n

Void displaysum() : displays the value of member data sum.

Double calsum() : calculates the sum of the given series using the appropriate data and other member functions.

Specify the class sumseries giving details of the constructor, int factorial(int), double term(int,int),void displaysum().You may assume that other member functions are written for you. You do not need to write the main function.

**Question11. [5]**

An emirp number is a number which is prime backwards and forwards.

Example:13 and 31 are both prime numbers. Thus 13 is an emirp number.

Designa class Emirp to check if a given number is Emirp number or not. Some of the members of the class are given below:

**C****l****a****s****sName : Emirp**

**Data Members**

n : stores the number

rev : stores the reverse of the number

f : stores the divisor

**M****emberfunctions**

Emirp(intnn) : to assign n=nn,rev=0,andf=2

Int isprime(intx) : check if the number is prime using the

and return1 if prime otherwise return0.

Void isEmirp() : reverse the given number and check if both the

original number and the reverse number are prime,by invoking the function isprime(int) and display the result with an appropriate message.

Specify the class Emirp giving details of the constructor(int),int isprime(int)and void isEmirp(). Define the main function to create an object and call the methods to check for Emirp number.

** ****Question12. [5]**

Verify if X’YZ+XY’Z+XYZ’+XYZ= XY+YZ+XZ

** **