Question
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 and . Which one of the following operations will result in either an arithmetic overflow or an arithmetic underflow?
Official answer and solution
- Official answer
- B
- From
- Official GATE 2024 answer key
Solution
Convert the 5-bit 2's complement numbers to decimal and check which result falls outside the representable range .
In a 5-bit 2's complement system, the representable signed integer range is .
Evaluating each operation:
- (A) (no overflow)
- (B) , which exceeds the maximum positive value and causes an arithmetic overflow.
- (C) (representable as , no underflow)
- (D) (no underflow)
Option (B)
Assuming overflows in 5-bit 2's complement and choosing , forgetting that the asymmetric range includes .
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2024 Computer Science and Information Technology - Set 1 (CS1)
- Question
- 13 of 65
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.