Difficulty: Easy
Correct Answer: Correct — two’s complement = one’s complement + 1
Explanation:
Introduction / Context:Two’s complement is the dominant representation for signed integers in digital systems. It simplifies hardware for addition and subtraction, supports a unique zero, and makes sign extension straightforward. This question confirms the canonical construction rule for two’s complement.
Given Data / Assumptions:
Concept / Approach:To obtain the two’s complement of an n-bit binary number X, first invert every bit to get the one’s complement (~X), then add 1: (two’s complement of X) = (~X) + 1, computed modulo 2^n. This operation is central for negation: the negative of a number A is its two’s complement with respect to the chosen width.
Step-by-Step Solution:
Start with X = b_{n−1}…b_1 b_0.Compute one’s complement: ~X flips each bit (0 ↔ 1).Add 1: (~X) + 1 modulo 2^n to form two’s complement.Verify by addition: X + (two’s complement of X) = 0 modulo 2^n.Verification / Alternative check:Example (8-bit): X = 00010110 (22). One’s complement = 11101001. Add 1 → 11101010, which represents −22 in two’s complement. Adding X and this result yields 00000000 with a carry out discarded, validating the rule.
Why Other Options Are Wrong:
“One’s complement − 1”: That procedure gives a different value and breaks the negation identity.BCD/floating-point claims: Two’s complement applies to binary integers, not BCD or floating-point mantissas.Common Pitfalls:Forgetting fixed width during inversion, mishandling carry out, or mixing sign-magnitude with two’s complement rules.
Final Answer:Correct — two’s complement = one’s complement + 1
Discussion & Comments