Read the questions as text
Answer all questions in Part I (compulsory) and six questions from Part-II, choosing two questions from
Section-A, two from Section-B and t wo 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
Question 1.
[1X5=5]
(a) State the Principle of Duality.
(b) Verify if (a + b)^(a + c) = a →(b^c)
(c) Write the contra positive statement for the following statement : If I see lightning then it is raining.
(d) Convert the given Canonical SOP Canonical POS form ∑(1,2,6,7)
(e) Draw the logic circuit of a AND gate using NOR gates only.
Question 2.
[2 x 5=10]
a) What is an exception?
b) Differentiate between Selection and Insertion sort
c) Convert the following infix notation to its postfix form
(A+B)* C-D/E+F
d) An array X[10][7] is stored in memory with each element requiring 2 bytes of storage space. If the address of
X[m][1] is 1012 and the address at X[7][3] is 1060, determine the value of m, when the array is stored
Column - Major order.
e) State the difference between Function Overloading and Function Overriding.
Question3.
[5]
Read the following program segment and answer the question given below. Show the dry
run/working.
int fun(int a[],int n)
{
int x;
if(n==1)
return a[0];
else
x= fun(a, n-1);
if(x > a[n-1])
return x;
else
return a[n-1];
}
a) What will be the output when function fun() is called with the value of
a[]= {55,87,48,24,9} and n = a.length.
b) What will be the output when function fun() is called with the value of
a[]= {-1,-2,8,7,0,-1} and n=a.length.
c) In one line state what the function fun() is doing?
Part II
Answer six questions in this part, choosing two questions from Section A, two from B and two from Section C.
Section A
Answer any two questions
Answer any two questions.
Question 4
[2X5=10]
(a) Given FIA,B,C,D) = ∑(0,2,3, 6, 8, 10, 11, 14, 15)
(1) Reduce the above expression by using 4-variable Karnaugh map, showing the various groups (ie, octal, quads and pairs). (2) Draw the logic gate diagram for the reduced expression. (b) Given F(P,Q,R,S) =(5,7,8, 10, 12, 14, 15) (1) Reduce the above expression by using 4-variable Karnaugh map, showing the various groups (i.e. octal, quads and pairs). (2) Draw the logic gate diagram for the reduced expression.
Question 5
(a) Draw the logic diagram and truth table for Decimal to Binary encoder and briefly explain its working. [5]
(b) Convert the following expression F(X,Y,Z)=XY+Y’Z into minterms.
[2]
(c) Draw the truth table and a logic gate diagram for a 2 to 4 Decoder and briefly explain its working.
[3]
Question 6
(a) Draw a truth table with a 3 input combination which outputs 1 if there are odd number of O's. Also derive an
SOP expression for the output. Reduce the expression using Karnaugh Map. zx
[5]
(b) Define Proposition. How does tautology differ from contradiction?
[2]
(c) Draw the logic diagram of the multiplexer for the given function f(a,b,c)= (1,3,4,5,7).
[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]
A disarium number is a number in which the sum of the digits to the power of their respective position is equal to the
number itself. Example: 135 = 11 + 32 + 53
Hence, 135 is a disarium number.
Design a class Disarium to check if a given number is a disarium number or not. Some of the members
of the class are given below:
Class name
Disarium
Data members/instance variables:
int num int size Member functions/methods:
stores the number stores the size of the number
Disarium(int nn)
parameterized constructor to initialize the data members n = nn and size =0
void countDigit( )
counts the total number of digits and assigns it to size
int sumofDigits(int n, int p) returns the sum of the digits of the number(n) to the power· of their
respective positions(p) using recursive technique
void countDigit( )
Checks whether the number is a disarium number and displays the result
with an appropriate message
Specify the class Disarium giving the details of the constructor( ), void countDigit( ), int sumofDigits (int,
int) and void check( ). Define the main( ) function to create an object and call the functions accordingly to
enable the task.
Question8.
[10]
The Feint Distance between two strings is calculated by counting the number of corresponding
characters that are unequal. For example : the Feint Distance between sunday" and "fridays" is 1+1+1+0+0+0+1-4 (i.e, when the character matches, it is 0, otherwise it is 1). Some of the members of the class are given below: Class Name: Feint Data Members/Instance Variables:
S1, S2: To store two strings D: To store the distance integer Member Functions/Methods Feint(): Default Constructor to initialize the data members void read(): To accept the values for S1 and 52 from user void dist(): To calculate the distance between S1 andS2 and store in D. void display(): To display the data members with appropriate message: Specify the class Feint giving details of the constructor and other member functions. The main() function need not be written.
Question 9.
[10]
A class Shift contains a two dimensional integer array of order (m x n) where the maximum values of both in and m is 5. Design the class Shift to shuffle the matrix (i.e. the fast row becomes the last, the second row becomes the first
and so on). The details of the members of the class are given below:
Class name : - Shift Data members/ instance variable :
mat [][]: stores the array element
m: integer to store the number of rows n: integer to store the number of columns
Member functions/methods: Shift (int mm. int nn): parameterized constructor to Initialize the data members m= mm and n = nn
void input():To take input values of the array.
void cyclic (Shift P): enables the matrix of the object(P) to shift each row upwards in a cyclic manner and
store the resultant matrix in the current object
void displays (): displays the matrix elements
Specify the class Shift giving details of the constructor(), void input(), void cyclic(Shift) and void display().
Define the main() function to create an object and call the methods accordingly to enable the task of shifting the
array elements
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 Worker has been defined to store the basic pay of a worker. Define Chess Wages to compute
the monthly wages for the worker, it implements the interface Worker. The details of both the classes are
given below:
Class name :Worker
Data members: basic: to store a basic pay of rupees
Member functions void display(): display worker details
class name: Wages Data members:
name: to store the name of the worker hrs: stores the hours worked rate: stores rate per hour wage: stores the overall wage of the worker Member functions Wages(...) : parameterized constructor to assign values to the instance variables
double overtime(): calculates and returns the overtime amount as (hours * rate)
void display(); calculates the wage using the formula wage=overtime amount +basic pay and
displays it along with other details
Using the concept of inheritance, specify the class Wages giving details of the constructor, double overtime and void display. The main function need not be written.
Question 11.
[5]
Details of class stack are given below
Data members:
SEO : array to hold the names Size : the maximum capacity of the string array
Top : index of the topmost element of the array Ctr : to count no of elements of the
Member functions:
Stack:default constructor
Stack(int cap): constructor to initialize size-cap and top =-1.
void pushnamestring (): to push the name into stack and display 'overflow’ if full
String popname() : removes the name from the top of the stack. If it is empty displays the message
"underflow"
void display(): displays the elements of the stack
Specify the class stack giving details of the constructor(), void pushname(), String popname(), and void display().
Main function need not to be written.
Question 12.
[5]
1.Size of the tree 2. In order traversal of the tree
3. Preorder traversal of the tree
4. Post order traversal of the tree
5. Leaf nodes