Set 4
Set 4
Paper-l
(THEORY)
Question 1
(a) State the two Absorption laws. Verify anyone of them using truth table.[2]
F(A.B.C) = ∑ ¿¿ )
(c) Name the logic gate for the following circuit diagram and write its truth
table.
(d) Using truth table, verify whether the following is true or false:
→ →
(p ⇒ q) = ( q ⇒ p )
(i) Maxterm
(ii) Minterm
Question 2
(a) The following is a part of some class. What will be the output of the
function mymethod( ) when the value of counter is equal to 3? Show the dry
run / working.
1
{
if ( counter = = 0 )
System.out.println(" ");
else
mymethod( --counter) ;
System.out.println(" "+counter);
(b) The following function is a part of some class which computes and returns
the greatest common divisor of any two numbers. There are some places in
the code marked by ?1?, n?, ?3?, ?4? and ?5? which must be replaced by
statement/expression so that the"function works correctly.
int r;
while(?1?)
r=?2?;
b=?3?
a=?4?
if(a==0)
2
return ?5?;
else
return -1;
Question 3
(a) State the principle of Duality. Give the dual of the following:
(A'.B)+(C.l )=(A'+C).(B+C)
(ii) A.{B+C(A.B+A.C)'}
Question 4
(a) Show with the help of a logic diagram how a NAND gate is equivalent to an
OR gate. [3]
3
(a => b) /\ (a => c) = a => (b /\ c) [3]
(c) What is a Decoder? Draw the truth table and logic circuit diagram for a 2 to
4 Decoder. [4]
Question 5
Input a sentence from the user and count the number of times, the words "an"
and "and" are present in the sentence. Design a class Frequency using the
description given below:
Member functions/methods:
instance variables
be in lower case.
4
void display( ) to display the number of "and"
messages.
Question 6
A class DeciOct has been defined to convert a decimal number into its
equivalent octal number. Some of the members of the class are given below:
number
Member functions:
5
(a) Specify the class DeciOct, giving details of the constructor( ), void
getnum(int), void deci_oct() and void show(). Also define a maine ) function to
create an object and call the functigns accordingly to enable the task.
Question 6
You are given a sequence of N integers, which are called as pseudo arithmetic
sequences (sequences that are in arithmetic progression).
For sequence containing an odd number of elements the rule is to double the
middle element, for example 2, 5, 7, 9, 12
= 2 + 12 = 5 + 9 = 7 + 7 = 14.
14 x 3 = 42 [middle element = 7]
numbers
6
r store the sum of the two numbers
Member functions:
pseudo-arithmetic sequence
Specify the class Pseudoarithmetic, giving the details of the constructor( ), void
accept(int) and boolean check(). Also define a main( ) function to create an
object and call the member functions accordingly to enable the task.