8-bit binary form of a small decimal Convert the decimal number 35 to an 8-bit binary value (show leading zeros).
-
A00100000
-
B00100010
-
C00100011
-
D00100100
Answer
Correct Answer: 00100011
Explanation
Introduction / Context:Expressing small decimal integers in a fixed 8-bit binary format is routine when initializing registers, masks, and configuration values. Leading zeros are preserved to keep the full 8-bit width, which is important for clarity and alignment in low-level work.
Given Data / Assumptions:
- Decimal input: 35.
- Target width: 8 bits.
- Standard base-2 place values are used.
Concept / Approach:Decompose 35 into powers of two. 35 = 32 + 2 + 1 = 2^5 + 2^1 + 2^0. Set bits at those positions and clear the rest. Finally, pad with leading zeros to form 8 bits.
Step-by-Step Solution:
1) Largest power of 2 ≤ 35 is 32 → set bit 5.2) Remainder 3 → set bit 1 (value 2).3) Remaining 1 → set bit 0 (value 1).4) Bits from 7 down to 0: 0 0 1 0 0 0 1 1 → 00100011.Verification / Alternative check:Convert back: 00100011₂ = 32 + 2 + 1 = 35 decimal, confirming correctness.
Why Other Options Are Wrong:
- 00100000: equals 32.
- 00100010: equals 34.
- 00100100: equals 36.
Common Pitfalls:Dropping leading zeros or misplacing the 2^1 and 2^0 bits when forming the lower three bits.
Final Answer:00100011