LearnFrenzy
Sign in Take a free test

Bitwise Operators · Bitwise Operators MCQ · Question 2

What is x ^ x in C? Answer, explanation & discussion

  • MCQ
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
Question 2 Back to Exercise

For any integer x, what is x ^ x?

  • A x
  • B 0 Correct
  • C 1
  • D 2 * x
Correct Answer: Option B

XOR gives 1 only where the bits differ, and a number never differs from itself. This "cancelling" property is behind the find-the-single-number trick and simple checksums.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Popular