Question
Which statement is true about the following method?
int selfXor(int i) {
return i ^ i;
}
- A. It always returns 0.
- B. It always returns 1.
- C. It always an int where every bit is 1.
- D. The returned value varies depending on the argument.
A.
Note
Any value XOR itself is always 0.
PreviousNextRelated