Binary and Hexadecimal Representations
Binary (base‑2) and hexadecimal (base‑16) are the two most common numeral systems used in computer science and programming. Mastering these systems is essential for tasks such as memory…

Convert the hexadecimal value BD07C to binary. Which binary string is correct?
When adding two 4‑bit two's‑complement numbers, both positive, which condition indicates overflow?
A sound sample is digitized using 8‑bit quantization. How many distinct amplitude levels can be represented?
Which hexadecimal notation correctly represents the binary pattern 0011 0101 0111 0011?
In two's‑complement, what binary pattern represents -5 using a 4‑bit word?
A programmer writes a hexadecimal constant as 3573h. Which of the following statements about this notation is true?
When extending a 4‑bit signed integer to 8 bits, which rule must be applied to preserve its value?
A computer stores a character using ASCII. Which limitation does this encoding have compared to Unicode?
Understanding Binary and Hexadecimal Representations
Binary (base‑2) and hexadecimal (base‑16) are the two most common numeral systems used in computer science and programming. Mastering these systems is essential for tasks such as memory addressing, low‑level debugging, and digital signal processing. In this module we will explore the fundamentals of binary numbers, how to convert between binary and hexadecimal, and the special rules that apply to signed numbers in two’s‑complement form.
Why 4‑bit Addresses Matter
A 4‑bit unsigned binary number can represent values from 0 to 2⁴‑1 = 15. This range is often used for simple memory addressing in micro‑controllers or educational examples. Because the highest representable decimal value is 15, any decimal number larger than 15, such as 16, cannot be encoded with only four bits.
- 4‑bit range: 0000₂ (0) to 1111₂ (15)
- Decimal 16 requires a fifth bit (1 0000₂)
Understanding this limitation helps prevent address‑overflow bugs in embedded systems.
Converting Hexadecimal to Binary
Hexadecimal is a compact way to write binary data. Each hex digit corresponds to exactly four binary bits (a nibble). To convert the hex value BD07C to binary, replace each digit with its 4‑bit equivalent:
- B → 1011
- D → 1101
- 0 → 0000
- 7 → 0111
- C → 1100
Putting the nibbles together yields 1011 1101 0000 0111 1100. Notice the spaces are optional; they are added only for readability.
Detecting Overflow in Two’s‑Complement Addition
Two’s‑complement is the standard method for representing signed integers. When adding two positive 4‑bit numbers, overflow occurs if the result’s most significant bit (MSB) becomes 1 while both operands have an MSB of 0. This indicates the arithmetic result exceeds the maximum positive value (+7) that can be stored in 4 bits.
Key point: the carry out of the MSB is not a reliable overflow indicator for two’s‑complement addition. Instead, compare the sign bits of the operands and the result.
Quantization Levels and Bit Depth
When a sound sample is digitized using 8‑bit quantization, the number of distinct amplitude levels equals 2⁸ = 256. Each possible 8‑bit pattern maps to a unique voltage level, just as each key on a 256‑key piano produces a distinct pitch.
- 8‑bit → 256 levels
- 7‑bit → 128 levels
- 6‑bit → 64 levels
Understanding bit depth is crucial for audio engineers who balance fidelity against file size.
Hexadecimal Notation for a Given Binary Pattern
To express the binary pattern 0011 0101 0111 0011 in hexadecimal, group the bits into nibbles from left to right:
- 0011 → 3
- 0101 → 5
- 0111 → 7
- 0011 → 3
The resulting hex constant is 0x3573. This notation is widely used in assembly language and low‑level C programming.
Representing Negative Numbers in Two’s‑Complement
To encode -5 in a 4‑bit two’s‑complement word, follow these steps:
- Write the magnitude 5 in binary: 0101₂.
- Invert the bits: 1010₂.
- Add 1: 1011₂.
Thus, the 4‑bit pattern for -5 is 1101₂. Notice that the sign bit (the leftmost bit) is 1, indicating a negative value.
Hexadecimal Constants in Assembly Language
When a programmer writes 3573h, the trailing h suffix tells the assembler that the number is in base‑16. Therefore, 3573h is equivalent to 0x3573. It does not represent a decimal or binary value; the suffix merely clarifies the radix.
Sign Extension for Wider Word Sizes
Extending a signed integer from 4 bits to 8 bits requires sign extension. This means copying the original sign bit into the newly added high‑order bits. For example, the 4‑bit pattern 1101 (which is -3 in two’s‑complement) becomes 11111101 when extended to 8 bits. This preserves the numeric value while increasing the word size.
Incorrect methods—such as inserting zeros or reversing bit order—alter the value and lead to subtle bugs.
Key Takeaways
- Four‑bit unsigned addresses can represent 0‑15; the decimal 16 is out of range.
- Each hexadecimal digit maps to four binary bits; conversion is a simple lookup.
- Overflow in two’s‑complement addition is detected by mismatched sign bits, not by the carry out.
- Bit depth determines the number of quantization levels: 2ⁿ levels for n‑bit data.
- Hex constants ending with
hare base‑16 numbers. - Sign extension replicates the sign bit to maintain the original value when increasing word size.
Further Reading and SEO Keywords
For deeper exploration, search for "binary to hexadecimal conversion table", "two's complement overflow detection", and "audio quantization bit depth". These terms are frequently queried by students and professionals seeking practical guidance on low‑level programming and digital signal processing.
