निम्नलिखित छद्मकोड का आउटपुट क्या होगा, जहां ʌ XOR ऑपरेशन का प्रतिनिधित्व करता है?
What will be the output of the following pseudocode, where ʌ represent XOR operation ?
Integer a, b, c
Set b = 4, a = 3
c = a ^ b
Print c
A)
B)
C)
D)
Explanation:
Sure!
a = 3
(binary0011
) andb = 4
(binary0100
).- XOR (
^
) gives1
when bits are different,0
when the same.
So, 3 ^ 4 = 7
(binary 0111
).
Answer: (D) 7.