GATE Computer ScienceModerateGATE CS (PYQ pattern)

A two's complement accumulator starts at 0 and adds 100 signed 8-bit values (−128 to 127) and 100 unsigned 8-bit values (0 to 255), in any order. What is the minimum accumulator width that can never overflow, whatever the values and order?

  1. A. 16
  2. B. 18
  3. C. 17
  4. D. 15

Correct answer: C. 17

Every partial sum lies between the extreme totals, which are -12800 (all signed values −128, unsigned 0) and 100·127 + 100·255 = 38200. 16 bits reach only 32767, so 17 bits (−65536..65535) are needed. Treating all 200 values as signed bytes would suggest 16 bits; 100 signed values alone need 15.

More Digital Logic questions

Exams that ask this topic