Computer Science – Data representation | e-Consult
Data representation (1 questions)
The binary shift operation used to multiply by 2 is a left shift. A left shift moves all the bits in the binary number one position to the left. This effectively adds a 0 to the rightmost position.
Consider an 8-bit binary number representing the decimal value 5 (which is 00000101 in binary). When this number is left-shifted by one position, it becomes 00001010. This binary representation corresponds to the decimal value 10, which is 5 multiplied by 2.
The left shift operation is equivalent to multiplying the binary number by 2 because each position represents a power of 2. Shifting left effectively multiplies the number by 2 raised to the power of the shift amount.