Operators in java Bitwise Operators Question #20169
Single Choice Easy

QWhat is the result of the expression a |= 3 after it is executed in Java, where a is initially 5?

ID: #20169 Bitwise Operators 98 views
Question Info
#20169Q ID
EasyDifficulty
Bitwise OperatorsTopic

Choose the Best Option

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

  • A 3
  • B 5
  • C 6
  • D 7
Correct Answer

Explanation

The bitwise OR assignment operator (|=) in Java performs a bitwise OR 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, a |= 3 is equivalent to 00000101 | 00000011, resulting in 00000111, which is 7 in decimal.

Share This Question

Challenge a friend or share with your study group.