What is the result of the expression 3 << 2 in Java?
A. 6
B. 9
C. 8
D. 12
Answer: Option C
Solution(By Examveda Team)
The correct answer is Option C: 8.In Java, the expression
3 << 2
represents a left shift operation. In this case, the binary representation of 3 is shifted two positions to the left, resulting in 8 in decimal notation.The binary representation of 3 is
0000 0011
, and after a left shift of 2 positions, it becomes 0000 1100
, which is 8 in decimal.Therefore, the correct answer is Option C: 8.
Join The Discussion
Comments ( 2 )
Related Questions on Operators
12 is correct answer
12