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
Question 1.                                                              [1X5=5]

a) Find the dual of: Y·X+X’+1=1
b) Write the maxterm and minterm, when the inputs are A=O, B=J, C=J and D=O.
c) State the difference between an interface and a class.
d) What is an abstract class?
e) Define inheritance. How is it useful in programming?

Question 2.                                                                [2 x 5=10]

a) Define a Queue. How is dequeue is different from queue
b) State the difference between Function Overloading and Function Overriding.
c) Convert the following expression F(X, Y, Z)=XY+Y’Z into minterms.
d) Convert the following infix expression to postfix form: A+B/C*(D/E*F)
e) A matrix A[m][n] is stored with each element requiring 4 bytes of storage. If the base address at A[1][1] is 1500 and the address at A[4][5] is 1608, determine the number of rows of the matrix when the matrix is stored in Column Major Wise.

Question3.
The following function magicfun( ) is a part of some class. What will the function magicfun() return when the value of n=7 and n=10 respectively? Show the dry run/working:
int magicfun( int n)
{

if ( n= = 0) .
return 0;
else
return magicfun(n/2)* 10 + (n % 2);
}

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

Question 4.

a) Given X(A,B,C,D)=Σ (1,2,5,8,9,10)
1. Reduce the above expression by using 4- variable-map(SOP), showing the various groups (octal, quads, pairs) [4]
2. Draw the logic gate diagram of the reduced expression. Assume that the variable and their complements are available as input. [1]

b) Given X(A,B,C,D)=π (0,8,10,12,13,14,15)
1. Reduce the above expression by using 4- variable-map(POS), showing the various groups (octal, quads, pairs) [4]
2. Draw the logic gate diagram of the reduced expression. Assume that the variable and their complements are available as input. [1]
Question 5
(a)Prove that complement of A.(A+B).B.(B+C’) is a universal gate. [3]
(b) Prove the Boolean expression using Boolean Jaws. Also, mention the law used at each step.
F = (x’ + z) + [ (y’ + z) • (x’ + y) ]’ = 1 [3]
(c) What is a decoder? Draw the logic diagram for a binary to octal (3 to 8) decoder. [4]

Question 6
(a) A passenger is allotted a window seat in an aircraft, if he/she satisfies the criteria given below
• The passenger is below 10 years and is accompanied by an adult
OR
• The passenger is a lady and is not accompanied by an adult
OR
• The passenger is not below 10 years, but is travelling the first time

The inputs are
A: The passenger is below 10 years
C: The passenger is accompanied by an adult.
L: The passenger is a lady.
F: the passenger is travelling for the first time.
(in all cases 1 indicates yes and 0 indicates no)
Output: W- Denotes the passenger is allotted a window seat (1 indicates yes and 0 indicates no)
Draw the truth table for the inputs and outputs given above and with SOP expression for W (A, C, L, F) [5]

(b) Define SOP form of an expression and POS form of an expression. Give an example for each. [3]
(c) Given F(x,y,z) =∑ (1,3,7)
Verify : F(x,y,z)= π (0,2,4,5,6) if both are equal. [2]

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 stores the number
int size stores the size of the number

Member functions/methods;
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]
A class SwapSort has been defined to perform string related operations on a word input. Some of the members of the class are as follows:
Class name SwapSort·

Data members/instance variables:

Wrd                        to store a word

len                         integer to store length of the word

swapwrd                 to store the swapped word

sortedword ·            to store the sorted word

Member functions/methods
SwapSort( )                  default constructor to initialize data members with legal initial                                           values
void readword( )           to accept a word in UPPER CASE

Void sortword()            sorts the characters of the original word. ‘in alphabetical order and·                                    stores it in ‘sortwrd’

void swapchar( )           to interchange/swap the first and last characters of the word in                                          ‘wrd’ and stores the new word in ‘swapwrd’

void display( )               displays the original word, swapped word and the sorted word.

Specify the class SwapSort, giving the details of the constructor( ), void readword( ), void swapchar( ), void sortword( ) and void display( ). Define the main( ) function to create an object and call the functions accordingly to enable the task.

Question 9.                                      [10]

A class Matrix contains a two dimensional integer array of order [ m x n ]. The maximum value possible for both m and n is 25. Design a class Matrix to find the difference of the two matrices. The details of the members of the class are given below:
Class name : Matrix
Data members
arr [ ][ ] :                            stores the matrix element
m :                                     integer to store the number of rows
n :                                      integer to store the number of columns
Member functions:
Matrix(int mm, int nn) :                     to initialize the size of the matrix m=mm and n=nn
void fillarray() :                                to enter the elements of the matrix
Matrix SubMat(Matrix A) :                 subtract the current object from the matrix of                                                                  parameterized object and return the resulting object.
void display() :                                display the matrix elements.

Specify the class Matrix giving details of the constructor(int, int), void fillarray(),Matrix SubMat(Matrix) and void display(). Define the main() function to create an object and call the functions accordingly to enable the task.

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 and create 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(int), void pushfront(int) and int poprear(). Assume that other functions have been defined. The main function need not be written.

Question 12.
A magic number is a number in which the eventual sum of digits of the number is equal to 1. For example, 172 = 1 + 7 + 2 = 10
10 = 1 + 0 = 1
Then 172 is a magic number.
Design a class Magic to check if a given number is a magic number. Some of the members of the class are given below:
Class name : Magic

Data members
n :                                 stores the number
Member functions
Magic() :                                   constructor to assign 0 to n
void getnum(intnn) :                  to assign the parameter value to the number, n=nn
int sum_of_digits(int) :               return the sum of the digits of number void ismagic()                                                       checks if the given number is a magic number by calling                                                   the function sum_of_digits(int) and displays appropriate                                                   message.                     [5]

LEAVE A REPLY

Please enter your comment!
Please enter your name here