Edexcel GCSE Computer Science (1CP2) · Data representation
Mini-Lesson
Data representation
Computers store everything as binary. This mini-lesson covers binary, denary & hexadecimal and how to convert between them, binary addition & shifts, units of storage, characters/ASCII, how images and sound are stored, and lossy vs lossless compression.
Work through each screen, answer the questions (lots of conversions here — double-check your working!) and collect ⭐ stars. Press Start when you're ready.
Numbers · binary & denary
Binary and denary
Denary (base 10) uses digits 0–9. Binary (base 2) uses only 0 and 1. Each binary digit is a bit. In an 8-bit number the place values double from right to left:
01010010 = 64 + 16 + 2 = 82. Add up the place values wherever there is a 1.
Method: to convert binary → denary, add the place values under each 1. To convert denary → binary, subtract the biggest place value you can, put a 1 there, repeat.
Calculate
Your turn — binary to denary
1Convert the 8-bit binary number 00101101 to denary.
Hint: place values with a 1 are 32, 8, 4, 1 → 32 + 8 + 4 + 1.
Quick check
Denary to binary
?What is the denary number 19 as an 8-bit binary number?
Numbers · hexadecimal
Hexadecimal
Hexadecimal (base 16) uses digits 0–9 then A–F for 10–15. One hex digit = exactly 4 bits (a nibble), so hex is a short, human-friendly way to write binary.
Split a byte into two 4-bit nibbles: 1010 = A (10) and 1101 = D (13), so 10101101 = AD.
Fast method: convert each 4-bit nibble to one hex digit. 1010 = 10 = A, 1101 = 13 = D. To go the other way, expand each hex digit back into 4 bits.
Calculate
Your turn — hex to denary
2Convert the hexadecimal number 2F to denary. (Remember F = 15, and the left digit is worth ×16.)
Overflow: if a result needs more bits than are available (e.g. a 9th bit for an 8-bit number), an overflow error occurs — the extra carried bit is lost, so the answer is wrong.
Calculate
Your turn — binary addition
3Add the binary numbers 0101 and 0011. Give your answer as a denary number.
Shifting the bits sideways multiplies or divides by powers of 2:
Left shift by n places = multiply by 2ⁿ (zeros fill in on the right).
Right shift by n places = integer divide by 2ⁿ (bits fall off the right).
A left shift of 1 turns 6 into 12 (× 2). A left shift of 2 would give × 4.
Careful with right shifts: because bits drop off the end, dividing an odd number rounds down (integer division) — e.g. 7 right-shifted by 1 gives 3, not 3.5.
Calculate
Your turn — a left shift
4The denary number 5 is shifted left by 2 places. What denary value does this give?
Hint: left shift by 2 means × 2² = × 4, so 5 × 4.
Storage · units
Units of storage
The smallest unit is the bit (a single 0 or 1). Bigger units build up:
Note: each step up multiplies by 1024 (2¹⁰). In everyday use people often say "kilobyte = 1000 bytes", but the exact binary units go up in 1024s.
Match it
Match each amount to its unit
Tap an amount on the left, then its matching unit on the right.
Amount
Unit
Text · characters
Characters & ASCII
Text is stored as numbers using a character set. In ASCII, each character has a 7-bit code (stored in a byte), so it can represent 128 different characters.
The codes are in order, so 'A' = 65, 'B' = 66, … and 'a' = 97.
Unicode uses more bits, so it can represent far more characters — including other alphabets and emoji.
Handy fact: because codes run in sequence, if 'A' is 65 then 'C' is 65 + 2 = 67. Digit characters like '0'–'9' also have their own codes (they are not the same as the numbers 0–9).
Calculate
Your turn — ASCII codes
5The ASCII code for 'A' is 65. The letters run in order. What is the ASCII code for 'E'?
Hint: E is 4 letters after A, so 65 + 4.
Media · images
Storing images
A bitmap image is a grid of pixels. Each pixel's colour is stored as a binary number. The number of bits per pixel is the colour depth.
1 bit per pixel → 2 colours (black/white). 8 bits → 256 colours. 24 bits → about 16.7 million colours.
Resolution = the number of pixels (width × height). More pixels and higher colour depth = better quality but bigger file.
File size (bits) ≈ width × height × colour depth. Doubling the colour depth roughly doubles the file size.
Quick check
Colour depth
?An image uses a colour depth of 1 bit per pixel. How many different colours can each pixel be?
Media · sound
Storing sound
Sound is analogue, so it is sampled: the height of the wave is measured many times a second and each measurement stored as a binary number.
Sample rate — how many samples per second (measured in hertz). Higher rate = more accurate sound, bigger file.
Bit depth (sample resolution) — how many bits store each sample. More bits = finer detail.
Trade-off: higher sample rate and bit depth give better sound quality but larger files. This is why streaming services offer different quality settings.
Compression · lossy vs lossless
Compression
Compression makes files smaller so they use less storage and transfer faster. Two types:
Lossless — no data is lost; the original can be perfectly restored. Used for text and program files. (e.g. run-length / ZIP-style methods.)
Lossy — some data is permanently removed to shrink the file more; quality drops slightly and it can't be fully restored. Used for photos, music and video (e.g. JPEG, MP3).
Choosing: use lossless when every bit matters (a spreadsheet or program). Use lossy when a small quality loss is acceptable in exchange for a much smaller file (a holiday photo).
Sort it
Lossy or lossless?
Tap a statement, then tap where it belongs. (Some are true of both.)
💾 Lossless
🗜️ Lossy
🔁 Both
Quick check
Which compression?
?You are compressing a program's source code, where losing even one character would break it. Which type of compression must you use?
Quick check
Bits per hex digit
?How many bits does one hexadecimal digit represent?
Quick check
What is overflow?
?Adding two 8-bit binary numbers produces a result that needs a 9th bit. What has happened?