Computer Arithmetic

When two unsigned 8-bit numbers are multiplied, how many bits are needed to represent the result without overflow?

  1. A8 bits
  2. B9 bits
  3. C16 bits
Show answer and explanation

Answer: C. 16 bits

The largest unsigned 8-bit value is 255, so the largest product is 255 × 255 = 65025. That is less than 2¹⁶ = 65536 but greater than 2¹⁵ = 32768, so 16 bits always suffice while 15 do not. In general, the product of n-bit and m-bit numbers fits in n + m bits, which is why multiplier outputs are normally twice the input width. Nine bits is the width needed for a sum (n + 1 bits).

  • A. Eight bits reach only 255, so the product overflows.
  • B. Nine bits is the width needed for a sum.
  • C. Correct. The largest product, 65025, fits in 16 bits.
Practice this topic Back to topic

More Computer Arithmetic questions

  1. Which expression multiplies an integer x by 10 using shifts and additions instead of a multiply instruction?
  2. Why do typical integer dividers (restoring or non-restoring, producing one quotient bit at a time) tend to be slower than multipliers?
  3. What is the result of arithmetic right-shifting the 8-bit signed integer −8 (1111 1000) by one bit?
  4. In C, what are the results of −7 / 2 and −7 >> 1 (with an arithmetic shift) for int?
  5. In C, what is the result of subtracting 1 from 0 in a 32-bit unsigned integer (unsigned int)?