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 [5X1=5]

a) Draw the truth table of implication.

b) Explain bit and byte.

c) What is the use of ASCII code?

d) What is BCD?

e) What is a proposition?

Question 2 [5X2=10]

a) Write the dual of the following. A.(A’+0)=1

Write the complement of the following: (A+BC).(A’B+C’)

b) State the Associative law and prove it with the truth table.

c) Explain Disjunction with example.

d) Explain contradiction with example.

e) Write the inverse and converse of the following proposition.

Proposition: “If four is an even number, then it is divisible by 2”

Question 3 [5]

The following function wit() is a part of a class. What will be the output of the following function wit() when the value of n is ‘JAVA ‘ and the value of R is 3? Show the dry run/working.

void wit(String n, int p)

{

if(p<0)

System.out.print(“ “ );

else

{

System.out.print (n.charAt(p) +” .”);

wit(n, p-1);

System.out.print (n.charAt(p) +” – ”);

}

}

PART II

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

Section A

Question 4 Perform the following conversions. [5X2=10]

a) (1010.1010)2=(**_)16**)8

b) (AB5)16=()2

c) 1010-101(using 2s complement method)

d) (582)10=()2=(__

e) 11111 X 101

Question 5.

A person is allowed to travel in a reserved coach of the train, if he / she satisfies the criteria given below:-

• The person has a valid reservation ticket and a valid ID proof.

OR

• The person does not have a valid reservation ticket, but holds a valid pass issued by the Railway department with a valid ID proof.

OR

• The person is a disabled person and holds a valid pass issued by the Railway department along with a valid ID proof.

The inputs are:

INPUTS

R The person has a valid reservation ticket

P The person holds a valid pass issued by the

Railway department

D The person has a valid ID proof

H The person is a disabled person

(In all the above cases 1 indicates yes and 0 indicates no).

Output :- T Denotes allowed to travel ( 1 indicates yes and 0 indicates no in all the cases)

Draw the truth table for the inputs and outputs given above and write the terms with conjunction operator for the terms that are true(1’s) in the result column. [5]

a) Simplify the following expression.

PQ’R’+PR’+Q’R’+P [3]

b) Draw the truth table and circuit of EX-OR gate [2]

Question 6.

a) Draw the combinational logic circuit and truth table of full adder. [5]

b) Verify if

(P’Q)^P=(P^Q’)v(P^ Q) with the help of truth table. [3]

c) Draw the logic circuit diagram with NAND gate [2]

(A’.B)+(C.D’)

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 Change to perform string related operations. The details of the class are given below:

Class name : Change

Data members

str : stores the word

newstr : stores the changed word

len : stores the length of the word

Member functions

Change() : default constructor

void inputword() : to accept a word

char caseconvert(char ch) : converts the case of the character and returns it

void recchange(int) : extracts characters and changes its case using caseconvert() and

forms a new word

void display() : displays both the words

Specify the class Change, giving details of the constructor(), member functions void inputword(), char caseconvert(char ch), void recchange(int) and void display(). Define the main function to create an object and call the functions accordingly to enable the above change in the given word.

Question 8.

A class RevArray contains a two dimensional integer array of order [ m x n]. The maximum value possible for both ‘m’ and ‘n’ is 12. Design a class RevArray to reverse all the elements of the f a given matrix. The details of the members of the class are given below :

Class name : RevArray

Data members

arr[][] : stores the matrix elements

rev[][] : stores the reverse of the matrix elements

m : integer to store the number of rows

n : integer to store the number of columns

Member functions :

RevArray () : default constructor

RevArray (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 reverse( ) : to reverse all the elements of a given matrix and

store in rev[][].

void disparray() : displays both the arrays in a matrix form

Specify the class RevArray giving the details of the constructor and other member functions.

Write the main function and call the functions.

[10]

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 : Special

Data members

n : integer to store the number

Member functions

Special() : default constructor

void read() : to accept the number

int factorial(int x) : return the factorial of a number using recursion technique

booleanisSpecial() : checks for the special number by invoking the function factorial() and returns true if Special, otherwise returns false.

void display() : to show the result with an appropriate message

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

Question 10.

a) Write a recursive method to calculate and return the sum of the digits of a number. The function signature is as follows.

int sumofdigits(int num) [4]

b) Differentiate constructor and method. [1]

Question 11.

a) Draw all four realization of NAND and NOR gate. [4]

b) What is the function overloading? [1]

Question 12. [5]

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

Date member

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

stringop() : constructor

void readstring() : to accept the string

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

void circular decode() : 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().