PART – I (20 Marks)
Answer all questions.
While answering questions in this Part, indicate briefly your working and
reasoning, wherever required.
Question 1
- State the involution law. Prove anyone using truth table. [1]
- Simplify expression using Boolean laws
F1=a.b’ + a’ + a’.b +b’ [1]
- Find the complement of :
F 2 =(a’ +c’ +d)(b +c+d’)(a+b’+c) [1]
- Verify using truth table ( ~p ^ q) V (p^q) = q. [1]
- Write the dual of F3 = p’.0 + q.1 +r’ [1]
Question 2
- An array D [-2…10][3…8] contains double type elements. If the base address is
4110, find the address of D[5][5], when the array is stored in Column Major Wise. [2]
- I) What do you understand by the keyword : Integer [2]
- Write the syntax of a string input.
- From the premises p àq and q àp, conclude q’ +pq [2]
- What are wrapper classes? Give two examples. [2]
- State De Morgan’s laws. Verify anyone using truth table [2]
Question 3
- Given the following method [5]
void fnM(int p)
{
int RM[]={3,6,9,12,15};
for( int j=1; j<=RM.length-1; j++)
{
RM[j-1] = RM[j-1] +RM[j];
RM[j] = RM[j-1] *3;
}
System.out.print(“OUTCOME=” +RM[p]);
}
i)What will be the output if p=2?
ii)What will be the output if p=4?
iii)Which token finds the size of the array?
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,4,5,8,9,10,12,13)
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. Assume that the [1]
variables and their complements are available as inputs.
- Given the Boolean function : F(P, Q,R,S) =Π (0, 1, 3, 5,7, 8, 9,10,11,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. Assume that the [1]
variables and their complements are available as inputs.
Question 5
- Given the Boolean function: F(A,B,C,D)= Ʃ(5,6,7,8,9,10,14)
a. Reduce the above expression by using 4-variable K map, showing the various groups (i.e., octet, quads and pairs) [4]
- b. Draw the logic gate diagram for the reduced expression. Assume that the [1]
variables and their complements are available as inputs.
- Given the Boolean function: F (A, B, C, D) =(A+B+C+D)(A+B+C+D’)(A+B+C’+D’)(A+B+C’+D)(A+B’+C+D’)(A+B’+C’+D)(A’+B+C+D)(A’+B+C’+D)
Reduce the above expression by using 4 variable K map showing the various groups (i.e., octet, quads and pairs).
- Draw the logic gate diagram for the reduced expression. Assume that the
variables and their complements are available as inputs
Question 6
A person is allowed to travel in a reserved coach of the train, if he/she satisfies any one of the criteria given below:
The person has a valid reservation ticket and a valid ID, proof.
The person does not have a valid reservation ticket, but holds a valid pass issued by the Railway department with a valid ID proof.
The person is a senior citizen 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.
S The person is a senior citizen
(in all the above cases 1 indicates yes and 0 indicates no for all cases)
Output: T – Denotes allowed to travel [1 indicates yes and 0 indicates no.]
Draw the truth table for the inputs and outputs given above and write the SOP expression for T(R, P, D and S).
What is redundant group? [2]
Convert the following Boolean expression into its Canonical SOP form: [3]
XY’ + X’Y + X’Z’
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 SeriesSum is desgined to calculate the sum of the following series: [10]
Sum = x2/1! + x4/3! + x6/5! + xn/(n-1)!
Some of the members of the class are given below:
class name : SeriesSum
Data members/ instance variables :
x : to store an integer number
n : to store number of terms
sum : double variable to store the sum of the series
Member functions:
SeriesSum(int xx, int nm) : constructor to assign x=xx and n=nn
double findfact(int m) : to return the factorial of m using recursive technique
double findpower(int x, int y) : to return x raised to the power of y using recursive technique
void calculate() : to calculate the sum of the series by invoking the recursive functions respectively.
void display() : to display the sum of the series.
Specify the class SeriesSum, giving the details of the above member data and methods only. Define the main() function to create an object and call the member function accordingly to enable the task.
Question 8
- Write a program in Java to perform Bubble Sort in a given array of integers in ascending order.
- Write a program to obtain maximum and minimum element in an array using
maximum( int[] t) and minimum( int[] t). Also define a main() and call the
methods to enable the task.
Question 9 [10]
A class Binary defines a recursive function to convert a binary number into its equivalent decimal form.
Example: Let Binary number 1101, its equivalent decimal 1*23 + 1*22 +0*21 + 1*20= 8+4+0+1=13.
The details of the class are given below:
class name : Binary
Data members/ instance variables :
bin : long integer data to store binary number
de : long integer data to store decimal number
Member functions/methods:
Binary() : default constructor
void readBin() : to read a binary number in bin.
long convertDec(long): to convert the binary number stored in bin into its equivalent decimal using Recursive technique. Store the decimal number into dec and return.
void Show() : to display the binary number and its equivalent decimal number stored in dec by invoking the recursive function.
Specify the class Binary, giving the details of the above member data and methods only. Define the main() function to create an object and call the member function 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. 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]
Show the output of the following code;
( In all output questions you must give dry run/ working and after that final output should be written.)
void fnCheck(int n)
{
int s=0,t=1;
do
{
n=n/t++;
System.out.println(“n =”+ n+ “t =” +t);
} while(n>0);
}
- What will be the output if n=25?
Question 11 [5]
The following is a public member function of some class which finds whether an integer number ‘n’ is a perfect number or not. There are five places in the code marked as ?1?, ?2?, ?3?, ?4?, ?5? which must be replaced by the expressions or statements so that the program works correctly. Answer the questions given after function.
void Check_Number(int a)
{
int s = ?1? ;
for (int q=1; q <n; q++)
{
if(a% ?2? ==0)
s=s+ ?3?;
}
if( ?4? === ?5?)
System.out.println(n+ “is a perfect number”);
else
System.out.println(n+ “is not a perfect number”);
}
- What is the expression or statement at ?1?
- What is the expression or statement at ?2?
- What is the expression or statement at ?3?
- What is the expression or statement at ?4?
- What is the expression or statement at ?5?
Question 12 [5]
The following is a function of some class which sorts an array arr[] in descending order using the bubble sort technique. There are five places in the code marked by ?1?, ?2? , ?3? , ?4? , ?5? which must be replaced by an expression or statement so the function works correctly.
void bubblesort(int arr[]) {
int i, j, k, temp;
for(i=0;i < ?1? ; i++)
{
for( j=0; j< ?2? ; j++)
{
if(?4? < ?3?){
temp=arr[j];
arr[j]=arr[j+1];
arr[j+1]= ?5? ;
}
}
- What is the expression or statement at ?1?
- What is the expression or statement at ?2?
- What is the expression or statement at ?3?
- What is the expression or statement at ?4?
- What is the expression or statement at ?5?