Computer Science I / Arithmetic at Machine Level
Practice question · Select all that apply

Each option is an addition performed in an 8-bit UNSIGNED register. Select every one that overflows.

Hints
  1. Compute each true sum, then compare it with the largest value eight unsigned bits can hold.
  2. The boundary is 255: a sum of exactly 255 is fine, a sum of 256 is not.
Show the answer
  • A. 200 + 100
  • B. 255 + 1
  • D. 240 + 16
Why

200 + 100 = 300, 255 + 1 = 256 and 240 + 16 = 256 all exceed 255 and wrap. 128 + 127 = 255 fits exactly, and 100 + 100 = 200 fits easily. The tempting error is 128 + 127, which looks like it should overflow because both numbers are large, but the boundary is about the sum, not the operands.

Read the lesson: Arithmetic at Machine Level →

Practise Arithmetic at Machine Level

The app has 7 more questions on this lesson, and keeps your place in the course. Computer Science I is free to start.

More questions on Arithmetic at Machine Level