Number representations: binary, denary and hexadecimal
OCR J277 is one of the few GCSE subjects with guaranteed calculation questions. Binary/hex conversions and binary arithmetic appear on virtually every Paper 1. Mastering these is important — they are easy marks if practised.
Denary (base 10)
The number system we use every day. Uses digits 0–9. Each position is a power of 10.
Binary (base 2)
Uses only digits 0 and 1 (bits). Each position is a power of 2:
| Bit position | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|---|---|---|---|---|---|---|---|---|
| (2^n) | 2⁷ | 2⁶ | 2⁵ | 2⁴ | 2³ | 2² | 2¹ | 2⁰ |
Binary to denary
Add up the values of all positions where the bit is 1. Example: 10110101 = 128+32+16+4+1 = 181.
Denary to binary
Repeatedly divide by 2, record the remainder, read remainders bottom-up. Example: 181 ÷ 2 = 90 r1; 90÷2=45 r0; 45÷2=22 r1; 22÷2=11 r0; 11÷2=5 r1; 5÷2=2 r1; 2÷2=1 r0; 1÷2=0 r1. Read up: 10110101 ✓
Binary addition
Rules: 0+0=0; 0+1=1; 1+1=10 (write 0, carry 1); 1+1+1=11 (write 1, carry 1).
Example: 01101010
- 00110111 = 10100001
Overflow occurs if the result is too large to fit in the number of bits. E.g. adding two 8-bit numbers that produce a 9-bit result — the 9th bit is lost, giving a wrong answer.
Binary shifts
Logical left shift (multiply)
Shift all bits left by n positions; fill vacated right positions with 0; bits shifted off the left are lost.
- Left shift by 1 = multiply by 2¹ = 2.
- Left shift by 2 = multiply by 2² = 4. Example: 00000110 (6) left shift 1 → 00001100 (12).
Logical right shift (divide)
Shift all bits right by n positions; fill vacated left positions with 0; bits shifted off the right are lost.
- Right shift by 1 = divide by 2 (any remainder is discarded). Example: 00001100 (12) right shift 1 → 00000110 (6).
⚠ Right shift discards the remainder — 00001101 (13) right shift 1 → 00000110 (6), not 6.5.
Hexadecimal (base 16)
Uses digits 0–9 and A–F (A=10, B=11, C=12, D=13, E=14, F=15). Each hex digit represents exactly 4 bits (a nibble).
Why use hexadecimal?
- More compact than binary (4 bits → 1 hex digit).
- Used in: MAC addresses, IP addresses, colour codes (HTML), memory addresses, error codes.
- Human-readable shorthand for binary.
Binary to hex
Split binary into groups of 4 (from the right); convert each nibble to its hex digit. Example: 10110101 → 1011 | 0101 → B | 5 → B5.
Hex to binary
Replace each hex digit with its 4-bit binary equivalent. Example: 3F → 3=0011, F=1111 → 00111111.
Hex to denary
Multiply each digit by its positional value (powers of 16). Example: B5 = (11 × 16) + (5 × 1) = 176 + 5 = 181.
Common OCR exam mistakes
- Forgetting to pad binary to 8 bits when converting to hex (must group into nibbles of exactly 4 bits).
- Writing A=10 but then treating hex incorrectly in arithmetic — always convert to denary for arithmetic, then back.
- Overflow: forgetting that the carry bit is lost — the question often asks what the result is AND whether overflow occurred.
- Right shift: forgetting that any remainder/fractional result is discarded (it's integer division).
AI-generated · claude-opus-4-7 · v3-ocr-computer-science