MCQ Single Best Answer Easy

QWhat is the value of the expression m &= 7 after it is executed in Java, where m is initially 15?

ID: #20171 Bitwise Operators 95 views
Question Info
#20171Q ID
EasyDifficulty
Bitwise OperatorsTopic

Choose the Best Option

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

  • A 0
  • B 7
  • C 8
  • D 15
Correct Answer: Option A

Explanation

The bitwise AND assignment operator (&=) in Java performs a bitwise AND 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, m &= 7 is equivalent to 00001111 & 00000111, resulting in 00000111, which is 7 in decimal.

Share This Question

Challenge a friend or share with your study group.