# Binary, without the headache
FindTutor • Original introductory study guide • O Level / IGCSE Computer Science

## Why binary?
A bit can have one of two values: 0 or 1. A byte contains 8 bits. In an unsigned binary integer, each position represents a power of two.

| Position | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|---|---|---|---|
| Place value | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
| Example | 0 | 0 | 1 | 0 | 1 | 1 | 0 | 1 |

00101101 = 32 + 8 + 4 + 1 = 45 in denary.

## Denary to binary
To convert 83, take the largest place value that fits, then repeat with the remainder:
83 − 64 = 19; 19 − 16 = 3; 3 − 2 = 1; 1 − 1 = 0.
Use 64, 16, 2 and 1: **01010011**.

## Hexadecimal
Hex uses sixteen symbols: 0–9, A–F. A = 10 and F = 15. Each hex digit corresponds to four binary bits.
2D = (2 × 16) + 13 = 45. In binary: 0010 1101.

## Binary addition
0 + 0 = 0; 0 + 1 = 1; 1 + 1 = 10 (write 0, carry 1).
For example, 00001111 + 00000001 = 00010000.
An 8-bit unsigned integer ranges from 0 to 255. A result above 255 cannot fit in 8 bits: this is overflow.

## Practice
1. Convert 00110110 to denary.
2. Write 109 as an 8-bit unsigned binary number.
3. Convert hexadecimal 7B to denary and binary.
4. Calculate 00101111 + 00000001.
5. How many distinct values can 6 bits represent? What is the largest unsigned value?
6. Why does 11111111 + 00000001 overflow an 8-bit register?

## Answers
1. 32 + 16 + 4 + 2 = **54**.
2. 64 + 32 + 8 + 4 + 1 = **01101101**.
3. 7 × 16 + 11 = **123**; **01111011**.
4. **00110000**, which is 48.
5. 2⁶ = **64 values**, from 0 to **63**.
6. The mathematical result is 256 = 100000000, which needs 9 bits. The carry cannot be stored in the 8-bit result.

These examples use unsigned integers. Signed representations have different ranges. Check your current syllabus for required representations and terminology. Not an official exam-board publication.
