[Solved] Which of the following bitwise operations will you use to toggle a particular bit?

Which of the following bitwise operations will you use to toggle a particular bit?

a) OR
b) AND
c) XOR
d) NOT

Answer: c
Explanation: 1 XOR 1 = 0, 0 XOR 1 = 1, note that NOT inverts all the bits, while XOR toggles only a specified bit.

Comments