Question 7 on digital from GATE (Graduate Aptitude Test in Engineering) 2012 Electronics and Communication Engineering paper.
Q7. The output Y of a 2-bit comparator is logic 1 whenever the 2 bit input A is greater than 2 bit input B. The number of combinations for which output is logic 1 is
(A) 4
(B) 6
(C) 8
(D) 10
Solution
Let’s write all the 16 possible combinations of A and B and count the number of times A is greater than B. Can easily see that the count is 16.
A | B | Out |
0 | 0 | 0 |
0 | 1 | 0 |
0 | 2 | 0 |
0 | 3 | 0 |
1 | 0 | 1 |
1 | 1 | 0 |
1 | 2 | 0 |
1 | 3 | 0 |
2 | 0 | 1 |
2 | 1 | 1 |
2 | 2 | 0 |
2 | 3 | 0 |
3 | 0 | 1 |
3 | 1 | 1 |
3 | 2 | 1 |
3 | 3 | 0 |
TOTAL | 6 |
Alternately, pick each value of A and count the number of instances when A is greater than B. The count is 0 + 1 + 2 + 3 for A = 0,1,2,3 respectively.
Based on the above, the right choice is (B) 6
References
[1] GATE Examination Question Papers [Previous Years] from Indian Institute of Technology, Madras http://gate.iitm.ac.in/gateqps/2012/ec.pdf