This is from Mr.Khalid's Mock Exam. I checked the answer of this qstn by cheating, just answering 1 qstn at a time and finishing the
test and saw the result.
Which statements are true concerning the effect of the >> and >>> operators? 1) For non-negative values of left operand >> and >>> will have same result
2) The result of -1 >> 1 is 0
3) The result of -1 >>> 1 is -1
4) The value returned by >>> will not be -ve as long as the right operand
is equal to or greater than 1
5) When using >> operator the left most bit of the result will always be same as of the left operand
Ans given was 1) 4) 5) I think ans shd be 1) 5) because -100>>>32 will be -100 right?
We see the last 5/6 bits of the right operand depending on the left is int/long
So we can not generalize the statement like this in ans 4)
Any input welcome.
regds
maha anna
[This message has been edited by maha anna (edited April 04, 2000).]