Consider two binary numbers P = 10110001 and Q = 1001110. If X = P OR Q and Y = P AND Q, then what will be the values of X and Y respectively?
A01001110, 10110001
B10110001, 00000000
C10110001, 11111111
D11111111, 00000000 ✓ Correct
Correct answer: (D) 11111111, 00000000
Explanation
A bitwise OR of P = 10110001 and Q = 01001110 gives X = 11111111.
A bitwise AND of the same two numbers gives Y = 00000000.
OR sets each bit to 1 when either input bit is 1, filling every position here.
AND sets a bit to 1 only when both input bits are 1, which never happens here.
Answers keeping X as 10110001, setting Y to all ones, or swapping the two values do not follow these rules.
P and Q are bitwise complements, so their OR is all ones and their AND is all zeros.
Want more like this? Create a free account to practise a full test, track your progress, and get spaced-repetition review.
Practise on Mcqkart →🎓 Book an expert →