Consider the -bit signed integers and represented using the sign-magnitude form. The binary representations of and are as follows:
Which of the following operations to compute result(s) in an arithmetic overflow?
View worked solution
Answer: B;C
In an -bit signed sign-magnitude representation:
- The most significant bit (MSB) represents the sign ( for positive, for negative).
- The remaining bits represent the magnitude.
- The range of representable integers is from to , which is .
Let us determine the decimal values of and :
- For :
- Sign bit is (negative).
- Magnitude bits: .
- Thus, .
- For :
- Sign bit is (positive).
- Magnitude bits: .
- Thus, .
Now, we evaluate each operation to check if the result falls outside the representable range :
-
:
Since , there is no overflow. -
:
Since , this results in an arithmetic overflow. -
:
Since , this results in an arithmetic overflow. -
:
Since , there is no overflow.
Thus, operations B and C result in an arithmetic overflow.
Free practice · Your answers on this page are not saved.
