← GCSE Computer Science · Eduqas · GCSE Computer Science revision
⭐ 0
Eduqas GCSE Computer Science · 4 Data representation and storage
Mini-Lesson

Data representation and storage

7 missions. Guess, learn, then check. Your place is saved.

  1. Mission 1Web colours look like #FF8C00. Why letters and numbers?
  2. Mission 2How can a computer multiply by 8 without doing any multiplying?
  3. Mission 3A one-byte thermometer must show −20 °C. Where does the minus sign go?
  4. Mission 4How does a computer store the letter A if it can only store numbers?
  5. Mission 5Double a photo's width and height: how much bigger is the file?
  6. Mission 6How can a list of numbers turn into a song?
  7. Mission 7How can a file shrink but still open exactly as before?
Mission 1

Web colours look like #FF8C00. Why letters and numbers?

Make a guess: Web colours look like #FF8C00. Why letters and numbers?

Data representation · number bases

Everything is binary

One pattern, many meaningsoff0on1off0off0off0off0off0on165Aa pixel colour
  • A computer is built from billions of tiny switches, each off or on. So it stores and processes everything in binary: 0s and 1s.
  • Numbers, text, images, sound and program instructions are all binary patterns.
  • One pattern can mean a number, a letter or a colour.
  • A bit is a single 0 or 1.
Data representation · number bases

Binary place values

Binary place values128643216842101101001MSBLSB64 + 32 + 8 + 1 = 105
  • Denary (base 10) columns go 1, 10, 100. Binary (base 2) columns double: 1, 2, 4, 8…
  • Add columns holding 1: 0110 1001 = 64 + 32 + 8 + 1 = 105.
  • Leftmost bit: most significant bit (MSB). Rightmost: least significant bit (LSB).
  • Each extra bit doubles the patterns: 8 bits give 256 (0 to 255).
  • Leading zeros change nothing: 11010 = 0001 1010.
1286432168421
01101001
Calculate
?Convert the binary number 1011 0110 to denary.
Your answer
?Convert the denary number 200 to 8-bit binary.
Data representation · number bases

Hexadecimal

Binary to hexadecimal842184211101011113 → D7 → 71101 0111 = D7 in hex101112131415ABCDEFHex is shorter1010 0101 1111 000016 charactersA5F04 characters
  • Hexadecimal (base 16) has sixteen digits: 0–9, then A–F for 10–15.
  • One hex digit is exactly 4 bits (a nibble), as 4 bits give 16 patterns.
  • Binary to hex: split into nibbles from the right: 1101 0111 → D7.
  • Hex to binary: each digit becomes 4 bits: 3F → 0011 1111.
  • Hex to denary: 8C = 8 × 16 + 12 = 140.
  • Denary to hex: 200 ÷ 16 = 12 r 8, so C8.
Your answer
?Convert the binary number 1011 1110 to hexadecimal.
Calculate
?Convert the hexadecimal number A7 to denary.
Data representation · number bases

Why use hex?

Binary to hexadecimal842184211101011113 → D7 → 71101 0111 = D7 in hex101112131415ABCDEFHex is shorter1010 0101 1111 000016 charactersA5F04 characters
  • Computers never store hex. It is a shorthand for binary for humans.
  • Hex is much shorter: 8 bits become 2 hex digits.
  • It is easier to read, remember and copy without mistakes than long strings of 0s and 1s.
  • Converting hex to binary is quicker than converting denary to binary, because each digit maps to 4 bits.
  • Uses: colour codes in web pages, MAC addresses, memory addresses and error codes.
Mission check

?Why is a web colour such as #FF8C00 written with letters and numbers?
Mission 2

How can a computer multiply by 8 without doing any multiplying?

Make a guess: How can a computer multiply by 8 without doing any multiplying?

Data representation · binary arithmetic

Adding in binary

Binary addition1286432168421111carry0100101175+001001103801110001113
  • Add column by column from the right, carrying like denary addition.
  • 0 + 0 = 0 · 0 + 1 = 1 · 1 + 1 = 10 (write 0, carry 1) · 1 + 1 + 1 = 11 (write 1, carry 1).
  • Example: 0100 1011 + 0010 0110 = 0111 0001 (75 + 38 = 113).
  • Check by converting each number to denary.
Your answer
?Add these two 8-bit binary numbers: 0101 1011 + 0011 0110. Give the 8-bit answer.
Data representation · binary arithmetic

Overflow

Overflow128643216842111111110000+00100000100010000= 16272lostThe 9th bit does not fit in the 8-bit register: overflow.
  • A register has a fixed number of bits: 8 bits hold at most 255.
  • A result that needs more bits than are available causes an overflow error.
  • 1111 0000 + 0010 0000 = 1 0001 0000 (272). The 9th bit is lost, leaving 0001 0000 = 16.
  • Underflow: a result too small to represent. Shifting 0000 0001 right one place should give 0.5, which cannot be stored.
Calculate
?A program adds 1100 1000 and 0110 0100 in an 8-bit register. The 9th bit is lost. What denary value is left in the register?
Data representation · binary arithmetic

Binary shifts

Binary shiftsLeft shift 1 placeBefore0000110113After00011010260lostRight shift 1 placeBefore0000110113After0000011061lost
  • Binary columns double in value from right to left.
  • A binary shift slides every bit left or right. Bits pushed off the end are lost; gaps fill with 0.
  • Left 1 place: × 2. Right 1 place: ÷ 2, remainder lost. Use: fast × or ÷ by 2, 4, 8.
  • 0000 1101 (13) shifted left 1 → 26; right 1 → 6.
  • This is an arithmetic shift on a positive number.
  • If a 1 is pushed off the left end, Eduqas mark schemes call this overflow: the result is too big for the register.
Your answer
?Shift 0001 0110 three places to the left. Give the 8-bit result.
Calculate
?Shift 0110 1101 (109) two places to the right. What is the result in denary?
Quick check
?1110 0000 (224) is shifted 2 places left in an 8-bit register. What is the result?
Mission check

?How can a computer multiply a number by 8 without doing any multiplying?
Mission 3

A one-byte thermometer must show −20 °C. Where does the minus sign go?

Make a guess: A one-byte thermometer must show −20 °C. Where does the minus sign go?

Data representation · negative numbers

A bit for the sign

Sign bitsign bit: 0 = +, 1 = −
  • 8 bits counting up from 0 hold 0 to 255: unsigned integers, with no minus sign.
  • A signed integer gives the most significant bit (MSB) a new job: the sign. 0 = positive, 1 = negative.
  • Sign and magnitude: sign bit, then 7 bits of size. +53 = 0011 0101, −53 = 1011 0101.
  • Range −127 to +127, with two zeros: 0000 0000 and 1000 0000.
  • Computers mostly use two's complement.
Data representation · negative numbers

Two's complement

Two’s complement−128643216842111111011= −5−128 + 64 + 32 + 16 + 8 + 2 + 1 = −5Making −5+500000101flip11111010+111111011= −58-bit range: −128 to +127−1281000 0000−11111 111100000 0000+1270111 1111
  • In two's complement the MSB is worth −128. Other columns keep their values.
  • 1111 1011 = −128 + 64 + 32 + 16 + 8 + 2 + 1 = −5.
  • Positive numbers look the same as unsigned: +5 = 0000 0101.
  • To make a negative: write the positive, flip every bit, add 1: 0000 0101 → 1111 1010 → 1111 1011.
  • 8-bit range: −128 to +127.
−1286432168421
11111011
Your answer
?Write −20 as an 8-bit two's complement binary number.
Your answer
?Write −20 as an 8-bit sign and magnitude binary number.
Data representation · negative numbers

Arithmetic shifts

Arithmetic shift rightBefore11101100−20After11110110−10copy of sign bitLogical01110110+1180lost
  • An arithmetic shift keeps the sign of a two's complement number.
  • Right shift: bits move right and copies of the MSB fill the gaps. Each place ÷ 2.
  • 1110 1100 (−20) right 1 → 1111 0110 (−10).
  • Left shift: bits move left and 0s fill the right. Each place × 2: 1110 1100 → 1101 1000 (−40).
Your answer
?Apply an arithmetic shift right of 3 places to the two's complement number 1001 1000. Give the 8-bit result.
Data representation · negative numbers

Binary subtraction

Subtraction by adding111110010110145+11101110−18100011011= 27discarded
  • To work out A − B, add the two's complement of B to A: A + (−B).
  • 45 − 18: −18 = 1110 1110 (flip 0001 0010, add 1).
  • 0010 1101 + 1110 1110 = 1 0001 1011.
  • The carry into a 9th bit is discarded, leaving 0001 1011 = 27.
Your answer
?Use two's complement to work out 0100 0110 − 0001 1001. Give the 8-bit result.
Mission check

?A one-byte thermometer must store −20 °C. Where does the minus sign go?
Mission 4

How does a computer store the letter A if it can only store numbers?

Make a guess: How does a computer store the letter A if it can only store numbers?

Data representation · characters

Characters as codes

Characters as codesAkey pressmemory0 1 0 0 0 0 0 1Ascreencharacter setboth devices use the same table
  • Each character (letter, digit, symbol, space) is stored as a binary number: its character code.
  • A character set is the agreed list of characters a computer can use, each with its own code.
  • Using a standard character set means text keeps its meaning when it moves between programs and devices.
  • Typing A sends A's code; the screen looks up the code to draw the A.
Data representation · characters

ASCII

ASCII codes run in orderDigitsCharacterDenaryBinary (7-bit)'0'480110000'1'490110001'2'500110010+1CapitalsCharacterDenaryBinary (7-bit)A651000001B661000010C671000011………Z901011010+1Lower caseCharacterDenaryBinary (7-bit)a971100001b981100010c991100011………z1221111010+1
  • ASCII (American Standard Code for Information Interchange) uses 7 bits per character.
  • 7 bits give 2⁷ = 128 codes (0 to 127): English letters, digits, punctuation, space and control codes such as Enter.
  • More bits per character means more possible characters.
Data representation · characters

Codes run in order

ASCII codes run in orderDigitsCharacterDenaryBinary (7-bit)'0'480110000'1'490110001'2'500110010+1CapitalsCharacterDenaryBinary (7-bit)A651000001B661000010C671000011………Z901011010+1Lower caseCharacterDenaryBinary (7-bit)a971100001b981100010c991100011………z1221111010+1
  • Codes are grouped and run in sequence: A = 65, B = 66, C = 67 … Z = 90.
  • Lower case runs on from a = 97; the digits from '0' = 48.
  • Know one code and you can work out its neighbours: 'C' = 65 + 2 = 67.
  • The character '7' has code 55. It is not the number 7.
Calculate
?In ASCII, 'A' has the code 65. What is the code for 'H'?
Your answer
?In ASCII, 'a' is 0110 0001. What is the binary code for 'd'?
Your answer
?In ASCII, 'A' is 65. Which word do the codes 66 69 68 spell? Type it in capitals.
Data representation · characters

Unicode

ASCII vs UnicodeNumber of charactersASCII128Unicodeabout 160,000 (159,801 in Unicode 17.0)axis brokenSome Unicode charactersبArabic字ChineseΩGreek😀emojiUnicode 0–127 = ASCII
  • ASCII's 128 codes cannot cover other alphabets. Unicode aims to code every writing system, plus symbols and emoji: about 160,000 characters so far.
  • Unicode uses more bits per character than ASCII, so text takes more storage.
  • Its first 128 codes are the same as ASCII: 'A' is 65 in both.
Quick check
?A messaging app must show Arabic, Chinese and emoji. Which character set should it use?
Mission check

?How does a computer store the letter A when it can only store numbers?
Mission 5

Double a photo's width and height: how much bigger is the file?

Make a guess: Double a photo's width and height: how much bigger is the file?

Data representation · images and file sizes

Pictures made of dots

PixelsThe picturezoom16 pixels16pixelspixelresolution 16 x 16
  • A pixel (picture element) is a single point in an image.
  • A bitmap is a grid of pixels. Each pixel's colour is stored as a binary code.
  • Resolution is the number of pixels, written width x height, e.g. 800 x 600.
  • More pixels: more detail, but more data to store.
  • Bitmaps are raster graphics. Vector graphics store shapes as maths, so they scale without losing quality.
Data representation · images and file sizes

Colour depth

Colour depth10010110011010011 = black0 = whiteColour depthColoursSample1 bit22 bits48 bits25624 bits16,777,216millions of shades
  • Colour depth is the number of bits used to store each pixel's colour.
  • n bits give 2ⁿ colours: 1 bit gives 2, 8 bits 256, 24 bits about 16.7 million.
  • In a 1-bit image, 1 could mean black and 0 white: each row is a bit pattern, and a bit pattern can be drawn back as pixels.
  • Higher colour depth: more colours and better quality, but a bigger file.
Your answer
?This row comes from a 1-bit image where black = 1 and white = 0. Reading left to right, write the bit pattern for the row.
A row of pixels12345678pixelblack = 1white = 0
Data representation · images and file sizes

Working out file size

  • File size in bits = width x height x colour depth. Divide by 8 for bytes.
  • Example: 800 x 600 pixels at 24 bits is 800 x 600 x 24 = 11,520,000 bits = 1,440,000 bytes.
  • No calculator? Write the whole expression, then cancel before multiplying.
Calculate
?An image is 200 x 100 pixels with a colour depth of 8 bits. What is its file size?

bytes

Data representation · images and file sizes

Units of data

Units of databitnibble× 4byte× 2kibibyte (KiB)× 1,024mebibyte (MiB)× 1,024gibibyte (GiB)× 1,024tebibyte (TiB)× 1,024
  • A bit is a single 0 or 1. A nibble is 4 bits. A byte is 8 bits.
UnitSize
1 kilobyte (KB)1,024 bytes
1 megabyte (MB)1,024 KB
1 gigabyte (GB)1,024 MB
1 terabyte (TB)1,024 GB
  • Each step up is x 1,024 (2¹⁰), so divide by 1,024 to go up one unit.
  • 1 petabyte (PB) = 1,024 TB.
Calculate
?A photo file is 2,048,000 bytes. What is its size in kilobytes?

KB

Calculate
?A camera saves every photo as exactly 4 MB. How many photos fit on an empty 1 GB memory card?

photos

Mission check

?Double a photo's width and height: how much bigger is the file?
Mission 6

How can a list of numbers turn into a song?

Make a guess: How can a list of numbers turn into a song?

Data representation · sound

Sound is analogue

Sampling a sound wave01234567sample: 110timeamplitude
  • Sound is a wave that changes smoothly and continuously: it is analogue.
  • A computer can only store binary, so the sound must be converted to digital form.
  • To do this, the wave's height (amplitude) is measured at regular moments. Each measurement is a sample: the amplitude at a point in time.
  • Each sample is stored as a binary number.
Data representation · sound

Sample rate and bits per sample

Sample rate and bits per sampleLow sample rateHigh sample rateBits per sample: levels2 bits = 4 levels3 bits = 8 levels
  • Sample rate: samples taken per second, in hertz (Hz). Music is often sampled 44,100 times a second.
  • Sample resolution (or bit depth): bits used to store each sample.
  • Raise either one: the sound is closer to the original, but the file is bigger.
Quick check
?A recording app changes its sample rate from 22,050 Hz to 44,100 Hz. Nothing else changes. What happens?
Doubling the sample rate22,050 Hz44,100 HzSchematic, not to scale: twice as many samples in thesame time.
Data representation · sound

Working out sound file size

  • File size in bits = sample rate x sample resolution x length in seconds.
  • Divide by 8 to get bytes.
  • Example: 1 second at 44,100 Hz and 16 bits is 44,100 x 16 = 705,600 bits.
  • Without a calculator, write the whole expression first, then cancel before you multiply.
  • These questions assume one channel (mono) unless they say otherwise.
Calculate
?A voice memo is sampled at 8,000 Hz with a sample resolution of 8 bits. It lasts 10 seconds. What is its file size?

bytes

Calculate
?A sound file is 96,000 bytes. It was sampled at 8,000 Hz with 8 bits per sample. How long is the recording?

seconds

Calculate
?A clip is sampled at 32,000 Hz with a sample resolution of 16 bits. It lasts 64 seconds. What is its file size in kilobytes?

KB

Quick check
?To save space, an app stores samples with 8 bits instead of 16. What is the effect?
Bits per sample16 bits: 65,536 levels8 bits: 256 levelsschematic: real steps are smaller
Mission check

?How can a list of numbers turn into a song?
Mission 7

How can a file shrink but still open exactly as before?

Make a guess: How can a file shrink but still open exactly as before?

Data representation · compression

Why compress?

  • Compression makes a file smaller, so it uses fewer bits.
  • Smaller files need less storage space.
  • They take less time to send or download and use less bandwidth.
  • Common cases: streaming video and music, web pages, email attachments, photos on a phone.
Data representation · compression

Squeezing out repetition

Runs of repeated pixels6 W3 B4 Wrebuilt exactly13 pixels
  • Data often repeats: a row of 6 white pixels, then 3 black, then 4 white.
  • Instead of storing all 13 pixels, store each run as a count and a value: 6 W, 3 B, 4 W.
  • The original can be rebuilt exactly, bit for bit. Compression that loses nothing is lossless.
  • The more repetition there is, the more the file shrinks.
Quick check
?Two images are the same size. One is a logo with large areas of flat colour. The other is TV static, where neighbouring pixels are random colours. Which shrinks more using repetition, and why?
Data representation · compression

Lossy and lossless

Lossless and lossyOriginaloriginal fileLosslessrebuilt exactlyLossydata removed for good
  • Lossy compression permanently removes data, usually detail people are unlikely to notice.
  • Example: a photo stored with fewer colours or a song with sounds we barely hear removed.
  • Lossy: much smaller files, but lower quality and the original cannot be got back.
  • Lossless: the original is rebuilt exactly, but the file is not as small. Use it for text, program files and data.
Quick check
?Which file must be compressed using lossless compression?
Data representation · compression

Compression ratios

  • A compression ratio compares the size before with the size after: original : compressed.
  • Example: 10 MB compressed to 2 MB has a ratio of 10 : 2 = 5 : 1.
  • Size after compression = original size ÷ ratio, e.g. 24 MB at 3 : 1 is 8 MB.
  • Ratio needed to fit a space = original size ÷ space available.
Your answer
?A 600 MB folder must be compressed to fit into 150 MB of free space. What compression ratio is needed? Give it in the form n:1.
Mission check

?How can a file shrink but still open exactly as before?
Recap

Big ideas

  • Computers store all data and instructions as binary. Binary place values double: 1, 2, 4 … 128, so 8 bits hold 0 to 255.
  • One hex digit = 4 bits (a nibble). Hex digits A–F mean 10–15.
  • Convert hex to denary with ×16: 8C = 8 × 16 + 12 = 140.
  • Hex is a shorthand for humans: shorter, easier to read and fewer copying mistakes.
  • Binary addition: 1 + 1 = 10 and 1 + 1 + 1 = 11, so write the right digit and carry the left.
  • A result too big for the bits available causes an overflow error.
  • A result too small to represent causes underflow.
  • Shift left n places: × 2ⁿ. Shift right n places: ÷ 2ⁿ, rounded down. Bits pushed off the end are lost.
  • A signed integer uses the MSB for the sign: 0 positive, 1 negative.
  • Two's complement: the MSB is worth −128; to negate, flip every bit and add 1. 8-bit range −128 to +127.
  • Sign and magnitude: sign bit plus 7-bit size; range −127 to +127 with two zeros.
  • An arithmetic shift right copies the sign bit into the gaps, so negatives stay negative.
  • A character set is an agreed list of characters with a binary code for each. Codes run in order, so B is one more than A.
  • ASCII uses 7 bits: 128 characters, enough for English.
  • Unicode uses more bits per character to cover far more characters, including other alphabets and emoji; its first 128 codes match ASCII.
  • A bitmap is a grid of pixels; colour depth is the bits per pixel, and n bits give 2ⁿ colours.
  • File size (bits) = width x height x colour depth; divide by 8 for bytes.
  • Each unit up is x 1,024.
  • A sample is the amplitude of the wave at one point in time, stored in binary.
  • Sample rate = samples per second (Hz); sample resolution = bits per sample. Both raise quality and file size.
  • File size (bits) = sample rate x bits per sample x seconds.
  • Compression makes files smaller: less storage, faster transfer, less bandwidth.
  • Lossless compression rebuilds the original exactly by storing repetition efficiently.
  • Lossy compression permanently removes data for much smaller files.
🏆

Mini-lesson complete!

⭐⭐⭐

You've worked through Data representation and storage for Eduqas GCSE Computer Science. 🎉

  1. Mission 1Web colours look like #FF8C00. Why letters and numbers?
  2. Mission 2How can a computer multiply by 8 without doing any multiplying?
  3. Mission 3A one-byte thermometer must show −20 °C. Where does the minus sign go?
  4. Mission 4How does a computer store the letter A if it can only store numbers?
  5. Mission 5Double a photo's width and height: how much bigger is the file?
  6. Mission 6How can a list of numbers turn into a song?
  7. Mission 7How can a file shrink but still open exactly as before?

Your stars: 0 / 0

Next: more GCSE Computer Science · Eduqas lessons and games on the GCSE Computer Science · Eduqas page.

📣 Smashed it? Share your score

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

→ Back to GCSE Computer Science · Eduqas

Specification points and sources for this lesson are listed at the bottom of the page.

Sources (10)

The specification points and sources behind this lesson.

  1. 1 WJEC Eduqas GCSE Computer Science spec (2020) section 4 and Guidance for Teaching p.19
  2. 2 WJEC Eduqas GCSE Computer Science spec (2020) section 4; Guidance for Teaching pp.19–20
  3. 3 WJEC Eduqas GCSE Computer Science spec (2020) section 4; Guidance for Teaching p.19–20
  4. 4 WJEC Eduqas GCSE Computer Science spec (2020) section 4; Guidance for Teaching p.20
  5. 5 Eduqas GCSE CS spec (2020), Representation of graphics, Storage requirements; teaching guidance pp. 21–22
  6. 6 Eduqas GCSE CS spec (2020), Representation of sound; teaching guidance p. 22
  7. 7 Eduqas GCSE CS spec (2020), Compression; teaching guidance p. 23
  8. 8 W3C, CSS Color Module Level 4, section "The RGB hexadecimal notations" (first pair of digits = red, next = green, last = blue; 00 minimum, ff = 255 maximum), https://www.w3.org/TR/css-color-4/#hex-notation (wording checked in the W3C snapshot https://www.w3.org/TR/2019/WD-css-color-4-20190305/); also MDN, "hex-color", https://developer.mozilla.org/en-US/docs/Web/CSS/hex-color
  9. 9 Unicode Consortium, "Unicode 17.0 Release Announcement", 9 September 2025, https://blog.unicode.org/2025/09/unicode-170-release-announcement.html
  10. 10 Library of Congress, Sustainability of Digital Formats, "Linear Pulse Code Modulated Audio (LPCM)" (fdd000011): "Audio CDs use 44.1 kHz sampling rate with 16-bit samples", https://www.loc.gov/preservation/digital/formats/fdd/fdd000011.shtml