Difficulty: Medium
Correct Answer: 110001
Explanation:
Introduction / Context:Binary subtraction is commonly performed by adding the two’s-complement of the subtrahend. This problem tests whether you can form the correct two’s-complement for a given decimal number using a fixed bit width and apply it to a subtraction example.
Given Data / Assumptions:
Concept / Approach:
To subtract B from A, compute A + (two’s-complement of B). The two’s-complement of B is formed by inverting all bits of B (with respect to the chosen width) and adding 1. Ensure the correct width to avoid sign or overflow mistakes.
Step-by-Step Solution:
Represent 15 in 6 bits: 001111.One’s-complement: 110000.Two’s-complement: 110000 + 1 = 110001.Add to 43 (101011) to verify: 101011 + 110001 = 1 011100; discard carry → 011100 (28 decimal), which equals 43 − 15.Verification / Alternative check:
Decimal check: 43 − 15 = 28. Binary result 011100 is 28, confirming that 110001 was the correct two’s-complement to add.
Why Other Options Are Wrong:
Common Pitfalls:
Final Answer:
110001
Discussion & Comments