ITPEC FE Morning April 2020 Question 1

Source exam: ITPEC FE Morning April 2020Topic: Basic Theory & Math

ITPEC FE Morning April 2020 — Question 1 of 80

Two's Complement Overflow — detect when adding two 8-bit signed integers causes overflow.

Overflow occurs only when both operands have the same sign and the result has the opposite sign.

8-bit signed range: -128 to +127.

  • (a) 0111 1111 (+127) + 1111 1110 (−2) = +125 → different signs → no overflow
  • (b) 0111 1111 (+127) + 0111 1110 (+126) = 253 > 127 → both positive, result wraps negative → overflow
  • (c) 1000 0000 (−128) + 0111 0000 (+112) = −16 → different signs → no overflow
  • (d) 1111 1111 (−1) + 1111 1111 (−1) = −2 → fits in range → no overflow

Key rule: Addition overflow is impossible when operands have different signs. Check only same-sign pairs: does the sum exceed +127 or go below -128?

AI-generated — may contain errors

The original exam layout is preserved in the image so diagrams, formulas, tables, and code remain accurate.

This question comes from an official ITPEC past paper. ITPEC Practice is an independent study tool and is not affiliated with ITPEC. See the official FE past-paper collection or Report an issue.