Logic circuits
What happens to the value of a binary number when it is shifted left by one bit (assuming no overflow)?
- AIt doubles
- BIt halves
- CIt increases by 1
Show answer and explanation
Answer: A. It doubles
Each binary place has twice the weight of the one below, so shifting left one bit (filling with 0) doubles the value and shifting right halves it (truncating); n bits multiply or divide by 2ⁿ. Because shifters are far smaller and faster than multipliers or dividers, optimizing compilers replace integer x × 8 with x << 3. For signed numbers, right shifts use arithmetic shifts that replicate the sign bit. For negative odd numbers the result rounds toward negative infinity, so −7 becomes −4, which differs from the −3 given by division truncated toward zero.