Given two numbers A = 0111 1111 and B = 0111 1111. Add them and find the correct option.
a) There is unsigned overflow but no signed overflow.
b) There is signed overflow but not unsigned overflow.
c) There is signed as well as unsigned overflow.
d) There is no overflow.
with explanation.
Ans
b) There is signed overflow but not unsigned overflow
.
.
In signed numbers first bit is sign bit. Here add results in 11111110 the magnitude gets into sign bit and sets the sign bit . Overflow flag get set. Signed overflow occur when result goes out of 7 bits
.
.
If unsigned numbers are used all bits represent magnitude. so addition does not lead any overflow. The result is a valid unsigned number. No carry flag is set which indicate unsigned overflow. It occurs if result goes out of 8 bits.
.
.
.
If any doubt ask in the comments.
Please appreciate the work by giving a thumbs up.
Get Answers For Free
Most questions answered within 1 hours.