Discussion
Which two statements are equivalent?
1.16*4
2.16>>2
3.16/2^2
4.16>>>2
Answer: B
Correct answer: 2 and 4
\( 16 \gg 2 \) and \( 16 \ggg 2 \) both give 4: for a positive value the arithmetic and logical right shifts are identical, since the sign bit being shifted in is zero either way. \( 16 \times 4 \) is 64, and \( 16/2^{\wedge}2 \) is not 4 either - division binds tighter than the bitwise exclusive-or, so it evaluates as \( (16/2) \wedge 2 = 8 \wedge 2 = 10 \). The caret is XOR in Java, not exponentiation.
No comment is present. Be the first to comment.
Loading…
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development