MCQ Single Best Answer Easy

QWhat is the value of p >> 2 after the expression is executed in Java, where p is 24?

ID: #20167 Bitwise Operators 86 views
Question Info
#20167Q ID
EasyDifficulty
Bitwise OperatorsTopic

Choose the Best Option

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

  • A 4
  • B 6
  • C 8
  • D 12
Correct Answer: Option C

Explanation

The right shift operator (>>) in Java shifts the bits of the left operand to the right by the number of positions specified by the right operand. In this case, p >> 2 is equivalent to 00011000 >> 2, resulting in 00000011, which is 6 in decimal.

Share This Question

Challenge a friend or share with your study group.