Hex-to-binary conversion practice: Convert the hexadecimal value 12 (base 16) into an 8-bit binary representation with leading zeros.
-
A00010111
-
B00010100
-
C00010010
-
D00100001
Answer
Correct Answer: 00010010
Explanation
Introduction / Context: Converting between hexadecimal and binary is fundamental in digital design, debugging, and low-level programming. Hexadecimal compresses binary by grouping bits in units of four, making the conversion a straightforward nibble-by-nibble mapping.
Given Data / Assumptions:
- Hex value is 12 (base 16).
- We seek an 8-bit binary form with leading zeros.
- Mapping: each hex digit corresponds to 4 binary bits.
Concept / Approach: Split the hex number into digits: '1' and '2'. Convert each digit to a 4-bit binary nibble and concatenate left to right. Hex 1 maps to 0001; hex 2 maps to 0010. Concatenating yields 0001 0010, which as a continuous 8-bit string is 00010010.
Step-by-Step Solution:
Take hex 12 → digits: 1 and 2.Map 1 → 0001; map 2 → 0010.Concatenate: 0001 0010.Remove space: 00010010 (8 bits).Verification / Alternative check: Convert 00010010 back to hex by grouping into nibbles: 0001 = 1, 0010 = 2 → 0x12, confirming correctness.
Why Other Options Are Wrong: 00010111 equals 0x17; 00010100 equals 0x14; 00100001 equals 0x21. None match 0x12.
Common Pitfalls: Reversing nibble order; forgetting leading zeros; confusing decimal 12 with hex 12 (which equals decimal 18).
Final Answer: 00010010