Single Choice Easy

QIf b is 9 and c is 2, what is the value of b ^= c after the expression is executed in Java?

ID: #20170 Bitwise Operators 117 views
Question Info
#20170Q ID
EasyDifficulty
Bitwise OperatorsTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A 2
  • B 7
  • C 9
  • D 11
Correct Answer

Explanation

The bitwise XOR assignment operator (^=) in Java performs a bitwise XOR operation between the variable on the left-hand side and the value on the right-hand side and assigns the result to the variable. In this case, b ^= c is equivalent to 00001001 ^ 00000010, resulting in 00001011, which is 11 in decimal.

Share This Question

Challenge a friend or share with your study group.