Difficulty: Easy
Correct Answer: 0000 0111 1111 1101 1111 0100
Explanation:
Introduction / Context:
Two's-complement is the standard signed integer format for 8-bit microcontrollers and processors. This problem reinforces encoding both positive and negative decimal integers into fixed-width binary.
Given Data / Assumptions:
Concept / Approach:
For a positive number, simply write its 8-bit binary with leading zeros. For a negative number –N: write N in binary, invert all bits, then add 1. Keep the width at 8 bits throughout.
Step-by-Step Solution:
+7: binary 7 = 0000 0111 (8 bits).–3: magnitude 3 = 0000 0011 → invert 1111 1100 → add 1 ⇒ 1111 1101.–12: magnitude 12 = 0000 1100 → invert 1111 0011 → add 1 ⇒ 1111 0100.Thus the triplet is 0000 0111, 1111 1101, 1111 0100.
Verification / Alternative check:
Add the two's-complement negatives to their magnitudes: 1111 1101 + 0000 0011 = 1 0000 0000 (discard carry) → 0000 0000, confirming additive inverse. Similarly, 1111 0100 + 0000 1100 also wraps to 0000 0000 with a carry out.
Why Other Options Are Wrong:
Options with 1000 xxxx for small positives misuse the sign bit.Options showing raw magnitude for negatives lack inversion and +1.Mixed patterns do not pass the additive-inverse check.
Common Pitfalls:
Dropping leading zeros, forgetting the +1 step, or accidentally expanding beyond 8 bits.
Final Answer:
0000 0111 1111 1101 1111 0100
Discussion & Comments