Number systems are a regular source of marks in the Computer Operator exam (Paper I job knowledge and Paper II). This note explains binary, octal, decimal and hexadecimal numbers, how to convert between them, binary arithmetic and how computers store data.
1. The four number systems
| System | Base | Digits used | Example |
|---|---|---|---|
| Binary | 2 | 0, 1 | 1011₂ |
| Octal | 8 | 0–7 | 17₈ |
| Decimal | 10 | 0–9 | 25₁₀ |
| Hexadecimal | 16 | 0–9 and A–F (A=10 … F=15) | 1F₁₆ |
2. Decimal to binary
Divide the number by 2 again and again and write the remainders from bottom to top. Example: 13 ÷ 2 = 6 r1, 6 ÷ 2 = 3 r0, 3 ÷ 2 = 1 r1, 1 ÷ 2 = 0 r1 → 1101₂.
3. Binary to decimal
Multiply each bit by its place value (1, 2, 4, 8, 16 …) from the right and add. Example: 1011₂ = 8 + 0 + 2 + 1 = 11.
4. Binary ↔ octal and hexadecimal
- Group binary digits in 3s from the right for octal: 101 110₂ = 56₈.
- Group binary digits in 4s from the right for hexadecimal: 1010 1111₂ = AF₁₆.
- Each hex digit equals 4 bits; each octal digit equals 3 bits.
5. Binary arithmetic rules
| Addition | Result |
|---|---|
| 0 + 0 | 0 |
| 0 + 1 | 1 |
| 1 + 1 | 10 (0 carry 1) |
| 1 + 1 + 1 | 11 (1 carry 1) |
6. Data units and codes
- 1 bit = 0 or 1; 4 bits = 1 nibble; 8 bits = 1 byte.
- 1 KB = 1024 bytes; 1 MB = 1024 KB; 1 GB = 1024 MB; 1 TB = 1024 GB.
- ASCII uses 7 bits (128 characters); extended ASCII uses 8 bits.
- Unicode supports characters of all languages, including Devanagari.
- 1’s complement: flip all bits; 2’s complement: 1’s complement + 1 (used for negative numbers).
7. Quick reference: 0 to 15
Learn this table by heart. It makes every binary ↔ octal ↔ hexadecimal conversion fast, because each octal digit is a group of 3 bits and each hex digit is a group of 4 bits.
| Decimal | Binary (4 bits) | Octal | Hex |
|---|---|---|---|
| 0 | 0000 | 0 | 0 |
| 1 | 0001 | 1 | 1 |
| 2 | 0010 | 2 | 2 |
| 3 | 0011 | 3 | 3 |
| 4 | 0100 | 4 | 4 |
| 5 | 0101 | 5 | 5 |
| 6 | 0110 | 6 | 6 |
| 7 | 0111 | 7 | 7 |
| 8 | 1000 | 10 | 8 |
| 9 | 1001 | 11 | 9 |
| 10 | 1010 | 12 | A |
| 11 | 1011 | 13 | B |
| 12 | 1100 | 14 | C |
| 13 | 1101 | 15 | D |
| 14 | 1110 | 16 | E |
| 15 | 1111 | 17 | F |
8. Octal and hexadecimal to decimal
Multiply each digit by its place value and add. Place values are powers of the base: for octal 1, 8, 64, 512 …; for hexadecimal 1, 16, 256, 4096 … (counted from the right).
- 157₈ = 1×64 + 5×8 + 7×1 = 64 + 40 + 7 = 111₁₀
- 2B₁₆ = 2×16 + 11×1 = 32 + 11 = 43₁₀ (B = 11)
- 1A3₁₆ = 1×256 + 10×16 + 3×1 = 256 + 160 + 3 = 419₁₀ (A = 10)
9. Decimal to octal and hexadecimal
Use the same repeated-division method as for binary, but divide by 8 (octal) or 16 (hexadecimal). Read the remainders from bottom to top.
- 100 → octal: 100 ÷ 8 = 12 r4, 12 ÷ 8 = 1 r4, 1 ÷ 8 = 0 r1 → 144₈ (check: 64 + 32 + 4 = 100)
- 250 → hex: 250 ÷ 16 = 15 r10, 15 ÷ 16 = 0 r15 → remainders 15 and 10 = F and A → FA₁₆ (check: 15×16 + 10 = 250)
- Octal → hex: go through binary. 75₈ = 111 101 = 111101₂ = 0011 1101 = 3D₁₆ (both equal 61₁₀)
10. Fractions in binary
Binary fraction to decimal: place values after the point are ½, ¼, ⅛ … Example: 101.11₂ = 4 + 0 + 1 + 0.5 + 0.25 = 5.75₁₀.
Decimal fraction to binary: multiply the fraction by 2 again and again and write the whole-number parts from top to bottom. Example: 0.625 × 2 = 1.25 → 1; 0.25 × 2 = 0.5 → 0; 0.5 × 2 = 1.0 → 1 → 0.101₂. Some fractions never end: 0.1₁₀ = 0.000110011…₂ (the pattern 0011 repeats).
11. Binary subtraction, multiplication and 2’s complement
| Subtraction | Result |
|---|---|
| 0 − 0 | 0 |
| 1 − 0 | 1 |
| 1 − 1 | 0 |
| 0 − 1 | 1 (borrow 1) |
- Addition example: 1011₂ + 0110₂ = 10001₂ (11 + 6 = 17)
- Subtraction example: 1101₂ − 0110₂ = 0111₂ (13 − 6 = 7)
- Multiplication rules: 0×0 = 0, 0×1 = 0, 1×1 = 1. Example: 101₂ × 11₂ = 1111₂ (5 × 3 = 15)
- Subtraction by 2’s complement (4 bits), 7 − 5: 5 = 0101 → 1’s complement 1010 → 2’s complement 1011. Now 0111 + 1011 = 1 0010; drop the extra carry → 0010₂ = 2
- −5 in 8-bit 2’s complement: 00000101 → 11111010 → 11111011
12. Ranges and BCD
- With n bits (unsigned) you can store 0 to 2n − 1. 8 bits → 0 to 255.
- In 2’s complement (signed), n bits store −2n−1 to 2n−1 − 1. 8 bits → −128 to +127.
- BCD (Binary Coded Decimal) writes each decimal digit as its own 4-bit group: 59₁₀ = 0101 1001 (BCD), which is different from 59 in pure binary (111011₂).
13. Practice questions (answers below)
- Convert 45₁₀ to binary.
- Convert 110110₂ to decimal.
- Convert 11010111₂ to hexadecimal.
- Convert 63₈ to decimal.
- Convert C5₁₆ to decimal.
- Convert 200₁₀ to octal.
- Add 1110₂ + 1011₂.
- Find the 2’s complement of 01101100.
- How many bits are there in 2 KB?
- What is the largest unsigned number that fits in 6 bits?
Show answers
- 101101₂ (32 + 8 + 4 + 1)
- 54 (32 + 16 + 4 + 2)
- D7₁₆ (1101 = D, 0111 = 7)
- 51 (6×8 + 3)
- 197 (12×16 + 5)
- 310₈ (200 ÷ 8 = 25 r0, 25 ÷ 8 = 3 r1, 3 ÷ 8 = 0 r3)
- 11001₂ (14 + 11 = 25)
- 10010100 (flip → 10010011, then + 1)
- 16,384 bits (2 × 1024 × 8)
- 63 (26 − 1)
📌 Key points to remember
- Binary base 2, octal base 8, decimal base 10, hexadecimal base 16.
- Hex uses A–F for 10–15.
- Decimal → binary: divide by 2, read remainders upward.
- Binary → octal: groups of 3; binary → hex: groups of 4.
- 1 + 1 = 10 in binary.
- 8 bits = 1 byte; 1 KB = 1024 bytes.
Test yourself: Number Systems for Computer Operator
Practise The four number systems, Quick reference: 0 to 15 and Practice questions (answers below) with 50 questions. Each attempt picks 25 at random.