Consider a system that uses 5 bits for representing signed integers in 2’s…

2024

Consider a system that uses 5 bits for representing signed integers in 2’s complement format. In this system, two integers 𝐴 and 𝐵 are represented as 𝐴=01010 and 𝐵=11010. Which one of the following operations will result in either an arithmetic overflow or an arithmetic underflow?

  1. A.

    A + B

  2. B.

    A - B

  3. C.

    B - A

  4. D.

    2 * B

Attempted by 461 students.

Show answer & explanation

Correct answer: B

Key insight: determine the decimal values, check each arithmetic result against the 5-bit two's complement range (−16 to +15).

  • Convert the operands: A = 01010 = +10, B = 11010 = −6.

  • Check A − B: 10 − (−6) = 16. This exceeds the maximum representable +15, so it causes an arithmetic overflow. A 5-bit wrap gives 10000, which corresponds to −16, demonstrating the overflow.

  • Other operations do not overflow: A + B = 4 (00100), B − A = −16 (10000) which is representable, and 2 * B = −12 (10100).

Therefore, the operation that results in arithmetic overflow is A − B.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Gate Guidance By Sanchit Sir