1.

Which of the following bitwise operations will you use to toggle a particular bit?(a) OR(b) AND(c) XOR(d) NOTThe question is from Bit Array in section Arrays Types of Data Structures & Algorithms II had been asked this question in an online interview.

Answer» CORRECT OPTION is (c) XOR

To explain: 1 XOR 1 = 0, 0 XOR 1 = 1, NOTE that NOT inverts all the bits, while XOR TOGGLES only a specified bit.


Discussion

No Comment Found

Related InterviewSolutions