Java Programming - Operators and Assignments - Discussion
Discussion Forum : Operators and Assignments - Pointing out the correct statements (Q.No. 4)
4.
Which two statements are equivalent?
- 3/2
- 3<2
- 3*4
- 3<<2
Answer: Option
Explanation:
(1) is wrong. 3/2 = 1 (integer arithmetic).
(2) is wrong. 3 < 2 = false.
(3) is correct. 3 * 4 = 12.
(4) is correct. 3 <<2= 12. In binary 3 is 11, now shift the bits two places to the left and we get 1100 which is 12 in binary (3*2*2).
Discussion:
11 comments Page 2 of 2.
Firoz said:
1 decade ago
I Can't Understand it. Explain clearly...
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers