# Number Systems & Base Conversions

- **Track:** Cambridge IGCSE™ Computer Science (0478 / 0984) (CAMBRIDGE IGCSE 0478)
- **Module:** Section 1: Data Representation
- **Estimated Duration:** 15 minutes
- **Access:** Open Theory + Free Practice

---

## Theory & Conceptual Background

In Cambridge IGCSE Computer Science, all data inside a digital computer is processed and stored in binary format (base 2) using discrete electrical voltage states: $0$ (low voltage / off) and $1$ (high voltage / on).

Learning Objectives
Understand why computers use binary representation for instructions and data.Convert positive integers between Denary (base 10), Binary (base 2), and Hexadecimal (base 16) up to 16-bit values.Explain the practical benefits and applications of hexadecimal representation in computer science.

Core Syllabus Theory
1. The Three Number Bases

  
    SystemBaseAllowed Digits / SymbolsExample Value
    BinaryBase 2$0, 1$$10110010_2$Denary (Decimal)Base 10$0, 1, 2, 3, 4, 5, 6, 7, 8, 9$$178_{10}$HexadecimalBase 16$0\text{--}9, \text{A}(10), \text{B}(11), \text{C}(12), \text{D}(13), \text{E}(14), \text{F}(15)$$\text{B}2_{16}$
  

2. Conversion Methods
A. Binary to Denary
Construct an 8-bit binary positional place value table:
$$\begin{array}{|c|c|c|c|c|c|c|c|}
\hline
128 & 64 & 32 & 16 & 8 & 4 & 2 & 1 \\
\hline
1 & 0 & 1 & 1 & 0 & 0 & 1 & 0 \\
\hline
\end{array}$$
$$\text{Result} = 128 + 32 + 16 + 2 = 178_{10}$$
B. Denary to Binary (Successive Subtraction or Division by 2)
To convert $109_{10}$ to 8-bit binary:
$109 \ge 64 \rightarrow \text{place 1 at 64, remainder } 45$$45 \ge 32 \rightarrow \text{place 1 at 32, remainder } 13$$13 \ge 8 \rightarrow \text{place 1 at 8, remainder } 5$$5 \ge 4 \rightarrow \text{place 1 at 4, remainder } 1$$1 \ge 1 \rightarrow \text{place 1 at 1, remainder } 0$
$$\text{Binary: } 01101101_2$$
C. Binary to Hexadecimal (4-bit Nibble Grouping)
Group the binary string into 4-bit nibbles from right to left:
$$11010110_2 \longrightarrow \underbrace{1101}_{\text{D}(13)} \quad \underbrace{0110}_{6} \longrightarrow \text{D}6_{16}$$
3. Why Hexadecimal is Used
Human Readability: Hexadecimal strings are significantly shorter than binary (e.g. 8 binary bits condense into 2 hex digits), making them much easier for humans to read, write, and remember.Error Reduction: Shorter strings drastically reduce transcription errors when programmers copy memory addresses or byte values.Direct Nibble Mapping: Each hexadecimal digit corresponds exactly to one 4-bit binary nibble ($2^4 = 16$), making conversion between binary and hex instantaneous without complex calculations.
4. Common Hexadecimal Applications
HTML/CSS Colour Codes: #FF0000 (Red), #00FF00 (Green), #0000FF (Blue) — 24-bit true colour represented as 6 hex digits.MAC Addresses: Physical hardware identifiers formatted as 12 hex digits (e.g. 00:1A:2B:3C:4D:5E).Memory Dumps & Debugging: Displaying contents of RAM when troubleshooting system crashes or buffer overflows.IPv6 Addresses: 128-bit network addresses formatted in 8 groups of 4 hexadecimal digits.

Exam Tips & Common Pitfalls

  Note: Pad to 8 Bits: In exam questions, always write binary answers as full 8-bit bytes (e.g. write 00101101 rather than 101101) unless instructed otherwise.

Key Terminology Glossary
Bit: A binary digit, the smallest unit of digital data ($0$ or $1$).Nibble: A group of 4 binary bits (equivalent to 1 hexadecimal digit).Byte: A group of 8 binary bits (capable of representing $2^8 = 256$ distinct values).
Written practice and self-review
Identify two distinct reasons why computer scientists use hexadecimal notation instead of binary when displaying MAC addresses or memory addresses. Explain why this representation does NOT reduce the amount of physical storage required by the computer.
Write an explanation before checking the theory. Check that each claim answers the question, uses the correct concept and explains why it applies. Discuss uncertain points with a teacher. The structured exercise below checks specific facts; it does not automatically mark this explanation.

---

## Interactive Exercises & Autotest Specifications

### Exercise 1: Exam-Style Check: Hexadecimal Applications (Multiple choice, 25 XP)

**Instructions:**
State why computer programmers frequently use hexadecimal rather than binary notation when inspecting memory dumps:

**Options:**
- **A**: Hexadecimal is easier for humans to read and remember, and significantly reduces transcription errors.
- **B**: Hexadecimal numbers occupy less memory in RAM than binary numbers.
- **C**: Computer microprocessors execute hexadecimal instructions faster than binary.
- **D**: Hexadecimal allows computers to store floating-point numbers without precision loss.



### Exercise 2: Exam-Style Question: Base Conversions (Fill in blank, 35 XP)

**Instructions:**
Convert the following values across denary, binary, and hexadecimal representations:


**Starter Code:**
```text
{"prompt":"Convert the values across denary, binary, and hexadecimal bases:\n1. Convert denary 179 into an 8-bit binary number.\n2. Convert 8-bit binary 11010110 into hexadecimal.\n3. Convert hexadecimal 2F into denary.","template":"1. Denary 179 in 8-bit binary: [Blank 1]\n2. Binary 11010110 in hexadecimal: [Blank 2]\n3. Hexadecimal 2F in denary: [Blank 3]","word_bank":["10110011","D6","47","11010110","B3","45","10110101"],"blanks":[{"id":"blank_1"},{"id":"blank_2"},{"id":"blank_3"}]}
```


### Exercise 3: Application: Check the reasoning (Fill in blank, 30 XP)

**Instructions:**
Work out each answer before submitting. Hexadecimal 3A in denary: Denary 241 in hexadecimal: Hexadecimal 9C as eight binary digits:


**Starter Code:**
```text
{"prompt":"Application: Check the reasoning","template":"1. Hexadecimal 3A in denary: [blank_1]\n2. Denary 241 in hexadecimal: [blank_2]\n3. Hexadecimal 9C as eight binary digits: [blank_3]","blanks":[{"id":"blank_1"},{"id":"blank_2"},{"id":"blank_3"}],"word_bank":["58","F1","10011100","50","42","1F","E1","10011011"]}
```


### Exercise 4: Independent Practice: Sixteen-bit conversions (Fill in blank, 30 XP)

**Instructions:**
Work out each answer before submitting. Denary value of hexadecimal FFFF: Hexadecimal value of binary 1010101111001101: Write hexadecimal BEEF as exactly 16 binary digits:


**Starter Code:**
```text
{"prompt":"Independent Practice: Sixteen-bit conversions","template":"1. Denary value of hexadecimal FFFF: [blank_1]\n2. Hexadecimal value of binary 1010101111001101: [blank_2]\n3. Write hexadecimal BEEF as exactly 16 binary digits: [blank_3]","blanks":[{"id":"blank_1"},{"id":"blank_2"},{"id":"blank_3"}],"word_bank":["65535","ABCD","1011111011101111","65536","32767","ABCE","DCBA","1011111011101110"]}
```


