On left shifting, the bits from the left are rotated and brought to the right and accommodated where there is empty space on the right?
Answer: B
Correct answer: False
C's shift operators do not rotate. On a left shift the bits leaving the top are simply discarded, and zeros are brought in at the bottom - nothing wraps around.
Rotation exists in most processors as a machine instruction but has no operator in C, and must be written out: (x << k) | (x >> (n-k)) on an unsigned type of \( n \) bits, which reintroduces at the bottom the bits the left shift discarded. Discarding rather than rotating is what makes a left shift a multiplication by two.
Please log in or register to report this question.