Difficulty: Easy
Correct Answer: overflow, both numbers, sign, incorrect sign bit
Explanation:
Introduction / Context:Overflow in signed 2’s-complement arithmetic occurs when the mathematical result lies outside the representable range. Recognizing the operand sign pattern that produces overflow is key for reliable ALU and software behavior.
Given Data / Assumptions:
Concept / Approach:If two positives yield a negative, or two negatives yield a positive, overflow has occurred. Equivalently, overflow = (carry into MSB) XOR (carry out of MSB). This differs from unsigned arithmetic, where carry-out indicates out-of-range without sign semantics.
Step-by-Step Solution:
Check operand signs: both positive or both negative.Add and inspect result sign.If the result sign differs from the operands’ sign, set overflow flag.Report using status flags or exceptions as required.Verification / Alternative check:Truth tables over MSB combinations and the carry-in/carry-out relation confirm the same-sign rule and the XOR overflow test.
Why Other Options Are Wrong:
Common Pitfalls:Confusing overflow with carry-out; assuming different-sign addition can overflow (it cannot in 2’s complement).
Final Answer:overflow, both numbers, sign, incorrect sign bit
Discussion & Comments