Author Topic:   Please check this qstn from Khalid Mock Exam. maha annabartender posted April 04, 2000 07:21 PM              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 result2) The result of -1 >> 1 is 03) The result of -1 >>> 1 is -14) The value returned by >>> will not be -ve as long as the right operand is equal to or greater than 15) 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. regdsmaha anna[This message has been edited by maha anna (edited April 04, 2000).] Jim Yingstsheriff posted April 04, 2000 08:13 PM              You're right - but see Mughal & Rasmussen's errata. vjcool75greenhorn posted April 05, 2000 01:40 AM              >>> 32 will result in shifting the bit by 0 positions. maha annabartender posted April 05, 2000 09:13 AM              Thanks. This qstn is put in the ErrataPage with the corrected version of the answer 4)regdsmaha anna
 |