Difficulty: Medium
Correct Answer: -1, 2, -3
Explanation:
Introduction / Context:
The task examines signed bit-field behavior, especially how values outside the representable range wrap and are interpreted as negative numbers for very small signed widths.
Given Data / Assumptions:
Concept / Approach:
A 1-bit signed field has range -1 to 0. Storing 1 yields the pattern that represents -1. A 4-bit signed field has range -8 to 7. Storing 13 causes wrapping modulo 16, producing 13 - 16 = -3. The middle field stores 2, which is within range and remains 2.
Step-by-Step Solution:
Verification / Alternative check:
Consider two’s complement encoding: for 1-bit signed, the single bit 1 is the sign bit set, which is -1. For 4-bit signed, 1101 is -3, confirming the wrap logic.
Why Other Options Are Wrong:
Common Pitfalls:
Forgetting that small signed bit-fields have very tight ranges and that overflow wraps into negative representations. Also confusing signed and unsigned bit-fields leads to wrong conclusions.
Final Answer:
-1, 2, -3
Discussion & Comments