← Back to subjects
0
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.

binary · denary · hex · shifts units · text images · sound compression everything is stored as 0s and 1s

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:

128643216 8421 0 1 0 1 0 0 1 0 64 + 16 + 2 = 82
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.

1010 1101 nibble → A nibble → D 10101101 = AD in hex
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.)
Hint: 2 × 16 + F = 32 + 15.
Numbers · binary arithmetic

Binary addition

Binary addition uses four rules: 0+0=0, 0+1=1, 1+1=10 (0 carry 1), 1+1+1=11 (1 carry 1).

Worked example

  0011 (3)
+ 0110 (6)
= 1001 (9)

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.
Hint: 0101 = 5 and 0011 = 3; 5 + 3 = 8 (binary 1000).
Numbers · binary shifts

Binary shifts

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).
00000110 = 6 0 0 0 0 0 1 1 0 → shift left 1 → 0 0 0 0 1 1 0 0 00001100 = 12
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:

  • 1 nibble = 4 bits · 1 byte = 8 bits
  • 1 kibibyte (KiB) = 1024 bytes
  • 1 mebibyte (MiB) = 1024 KiB · 1 gibibyte (GiB) = 1024 MiB · 1 tebibyte (TiB) = 1024 GiB

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?
Recap

The big ideas to know

Bases: binary (2) · denary (10) · hex (16, uses A–F)

Convert: binary↔denary via place values · 1 hex digit = 4 bits

Arithmetic: binary addition · overflow when too big · left shift ×2ⁿ, right shift ÷2ⁿ

Units: bit → byte (8 bits) → KiB → MiB → GiB (×1024 each)

Text/media: ASCII (128 chars) · images = pixels × colour depth · sound = sample rate + bit depth

Compression: lossless (restorable, text/code) · lossy (data removed, photos/music/video)

You've covered the whole of Edexcel Data representation. Press Finish to see your score.

🏆

Mini-lesson complete!

⭐⭐⭐

You've worked through Data representation for Edexcel GCSE Computer Science. 🎉

Your stars: 0 / 0

Next: test yourself in the Evaluate stage Confidence Quiz, then lock it in with Verify.

📣 Smashed it? Share your score

Challenge a mate to beat your stars, or show a parent how you got on.

→ Back to all subjects