Question 1
- Draw the truth table and logic diagram for the 2 inputs XOR gate. [1]
- Using the truth table, verify the following expression. X+(Y+Z) = (X+Y)+Z [1]
- If F(A,B,C)=A.B’+A’+A’.B+B’, then find F’. [1]
- Verify using truth table ( A ^ ~B ) V (~A ^ B) V A = AVB [1]
- Simply the given expression using Boolean laws: F1=(a+c’).(a’+b’+c’) [1]
Question 2
- An array DR[-2…2,-3…3] stores elements in Col major wise, with address DR[0][0] as 2500. If each element requires 2 bytes of storage, find the base address. [2]
- Write a java statement for the following:
i) write data to a file “emp.dat” in binary form.
ii) Read data from a file “story.txt” in text form. [2]
- Convert the following infix to postfix form:
((M/N-P) * (Q+R)) /(C+D) [2]
- State one case when the error “Queue Overflow” occur. [2]
- Convert from infix to prefix form P*Q/R*(S+T/(U-V)) [2]
Question 3 [5]
The following function witty() is a part of some class. What will be the output of the function witty() when the value of n is “SCIENCE” the value of p is 5. Show the dry run/working.
void witty(String n, int p) {
if (p<0)
System.out.println(“”);
else{
System.out.println(n.charAt(p) +”.”};
witty(n, p-1);
System.out.println(n.charAt(p));
}
}
PART II (50 Marks)
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
- Given the Boolean function : F(A,B,C,D) =Ʃ(0,,2,5,7,8,10,11,13,14,15)
i) Reduce the above expression by using 4 variable Karnaugh map, showing [4]
the various groups (i.e., octal, quads, pairs).
ii) Draw the logic gate diagram for the reduced expression using NAND gates only. [1]
Assume that the variables and their complements are available as inputs.
- Given the Boolean function : F(P, Q,R,S) =Π (2,3,6,7,9,11,12,13,14,15)
- Reduce the above expression by using 4 variable Karnaugh map, showing [4]
the various groups (i.e., octal, quads, pairs).
- Draw the logic gate diagram for the reduced expression using NOR gates only. [1]
Assume that the variables and their complements are available as inputs.
Question 5
- The person is not an Indian citizen but has taken active part in activities for the upliftment of the nation. The inputs are:
Inputs
A The person is/was an Indian citizen
B Has a continuous service of more than 20 years.
C lost his/her life in a war.
D Taken part in activities for upliftment of the nation.
Output: X denotes eligible for medal [1 indicate yes, 0 indicates no for all cases]
Draw the truth table for the inputs and outputs given above and write POS expression for X(A,B,C,D) [5]
- Write the cardinal form of P(A,B,C) = ABC’ +A’BC +A’BC’+ABC [2]
Question 6
- Using a truth table, verify the following proposition is valid or invalid [3]
(aàb) ^(bàc) =(aàc)
- Draw the truth table representing a 2 input XNOR gate and derive its SOP expression and draw its logic gate diagram. [2]
- What is a multiplexer? Draw the truth table and logic diagram of 8*1 multiplexer. [5]
SECTION – B
Answer any 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
A class Admission contains the admission numbers of 100 students. Some of the data members/ functions are given below:
Class name : Admission
Data members:
Adno[] : integer array to store admission numbers
Member functions:
Admission() : constructor to initialize the array elements
void fillArray(): to accept the elements of the array in ascending order
int binSearch(int l, int u, int v): to search for a particular admission number(v) using binary search and recursive technique and returns 1 if found otherwise returns -1.
Specify the class Admission, giving details of the constructor , void fillArray(), and
int binSeacrh(int, int, int). Define the main() to create an object and call the function accordingly to enable the task.
Question 8
The transpose of a matrix is found by interchanging the elements of rows and columns.
Design a class matrix that contains a 2D array of order [n * n ]. The maximum value possible for n is 20. The details of some of the members of the class are given below
Class name : matrix
Data members:
int t[][] : to store the matrix
int n : integer to store the number of rows and columns
Member functions:
matrix(…..) : Parameterized constructor to initialize n and to allocate memory to member array
void fnGet() : to fill the member array
void fnDisplay() : to show the member matrix
matrixfnTrans(matrix A) : to store the transpose of the argument matrix in the current object and return that.
Specify the class matrix giving the details of the above member data and methods only
Question 9 [10]
Design a class Chord that accepts a string and prints the number of vowels present in each word of the string. Also note that a string is considered valid if it does not contain any repeated spaces. For example : String : “SUMMER IN AUSTRALIA IS IN DECEMBER.
Output: SUMMER : 2
IN : 1
AUSTRALIA : 5
IS : 1
IN : 1
DECEMBER : 3
Some of the members of the class Chord are given below:
Class Name : Chord
Data members
cd : the string
Member functions:
Chord() : to initialize the member string to null
void fnIn() : to input the member string
void fnOp() : to print “invalid Sting “ if the string is not valid, otherwise print the words of the member string along with the number of vowels present in them.
SECTION – C
Answer any 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 10 [5]
A super class Circle has a sub class Circumference. The details of both the classes are given below.
The details of the base class:
Class name : Circle
Data member/ instance variable :
int rad : an integer to store the radius
Member functions/methods
Circle (….) : parameterized constructor to initialize the data members.
void show() : to display the member data.
The details of the derived class:
Class name : Circumference
Data member :
double cir : to store the Circumference
Member functions
Circumference (…) : parameterized constructor to initialize the data members of the base and current class
void calCirum : calculates the circumference by using the formula (2*pi*r) (pi=3.14)
void show() : to display the details of both the classes with proper messages(apply method overriding).
Specify the class Circumference giving the details of its mentioned methods. Assume that class Circle is already present. Write the main ().
Specify the base class, derived class and write the main() and call above member methods.
Question 11 [5]
A class Flow allows that a user to add and delete names in a list from the same end(top). The following details of the class Flow are given below:
Class name :Flow
Data members :
names[] : a string array to hold a maximum of 10 names
top : stores the position of the topmost element.
Member methods:
Flow(….) : initialize the data member top=-1 and to create the string array
void pushName(String n): to push a name into the stack at position top, if possible, else display the message “Overflow”.
String popName() : to remove and return element from the top. If the list is empty then return “Underflow”.