Last Updated :
10 Apr, 2024
Given two numbers A and B, XOR is the result after performing xor between those two numbers. Pick the correct operation from below which gives same result as : XOR – A.
(A) XOR | A
(B) XOR ^ A
(C) XOR & B
(D) None of the mentioned
Answer: (D)
Explanation:
Let us take some examples: A = 4 and B = 9, XOR = 4 ^ 9 = 13. Now XOR ^ A = 13 ^ 4 = 9 which is same as XOR – A = 13 – 4 = 9. It holds true for vice versa as well: XOR – B = 13 – 9 = 4. XOR ^ B = 13 ^ 9 = 4. But the above fails in case of A = 3 and B = 2, XOR = 3 ^ 2 = 1 as XOR – A doesn\’t holds same as that of XOR ^ A. So it cannot be generalized hence the correct option will be D.
Share your thoughts in the comments
Please Login to comment...