Page 662 - Computer science 868 Class 12
P. 662
(iv) The following is a part of some class. What will the function mymethod( ) return when the value of the counter is equal to 5?
Show the dry run/working. [3]
int mymethod (int counter)
{
if (counter == 1)
return 1;
else
{ return( (counter%10)%2= =0 ? counter%10* mymethod(counter – 1) :
mymethod(counter – 1) );
}
}
Ans.
mymethod(counter) mymethod(5) mymethod(4) mymethod(3) mymethod(2) mymethod(1)
counter==0 false false false false return 1*2*4 =8
(counter%10)%2=0 5%10=5 4%10=4 3%10=3 2%10=2\
5%2=0 false 4%2=0 true 3%2=0 false 2%2=0 true
return mymethod(4) 4* mymethod(3) mymethod(2) 2* mymethod(1)
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 3.
(a) Given the Boolean function F(A, B, C, D) = Σ(0, 2, 3, 4, 5, 8, 10, 11, 12, 13).
(i) Reduce the above expression by using 4-variable Karnaugh map, showing the various groups (i.e. octal, quads and pairs). [4]
Ans.
C'.D' C'.D C.D C.D'
A'.B' 1 0 0 1 1 3 1 2
A'.B 1 4 1 5 0 7 0 6
A.B 1 12 1 13 0 15 0 14
A.B' 1 8 0 9 1 11 1 10
Quad 1: m +m +m +m = C'.D'
4
0
12
8
Quad 2: m +m +m +m = B.C'
12
5
4
13
Quad 3: m +m +m +m = B'.C
11
3
10
2
Quad 4: m +m +m +m = B'.D' (redundant)
10
8
0
2
Reduced SOP expression is:
C'.D' + B.C' + B'.C
(ii) Draw the Logic gate diagram of the reduced using AND/OR gates. Assume that the variables and it’s complements are
available as inputs [1]
Ans. The logic circuit diagram is
C'
D'
B'
C
B
C'
660660 Touchpad Computer Science-XII

