Data Representation (GCSE & IGCSE Computer Science): Revision Notes and Worksheets
GCSE and IGCSE Computer Science data representation: binary, hex, addition, shifts, two's complement, text, images, sound and compression, with worksheets.

Every photo, song and message on a computer is stored as a long row of 0s and 1s. This guide covers GCSE and IGCSE data representation for OCR J277 and Cambridge IGCSE 0478: why computers use binary, converting between denary, binary and hexadecimal, binary addition and overflow, binary shifts, two's complement, character sets, images, sound and compression. Each part has a worked example and a worksheet for your exam board.
What does data representation cover for OCR and Cambridge?
Data representation is about how numbers, text, images and sound are turned into binary so a computer can store and process them, and how files are made smaller. Both boards ask you to convert between denary, binary and hex, add binary numbers, shift them, and explain how text, images and sound are stored and compressed. They differ in the details: how big the numbers get (OCR stops at 8 bits and 2 hex digits, Cambridge goes up to 16 bits and 4 hex digits), two's complement and run length encoding (Cambridge only) and metadata (OCR only). The table below is based on the OCR J277 specification (version 3.1) and the Cambridge IGCSE 0478 syllabus for 2026-2028, as checked in November 2026.
Part | Topic | OCR J277 | Cambridge 0478 |
|---|---|---|---|
C1 | Why computers use binary | 1.2.3 | 1.1.1 |
C2 | Denary and binary (up to 16 bits IGCSE only) | 1.2.4 | 1.1.2 |
C3 | Hexadecimal (why hex is used IGCSE only) | 1.2.4 | 1.1.2, 1.1.3 |
C4 | Binary and hexadecimal | 1.2.4 | 1.1.2 |
C5 | Binary addition and overflow | 1.2.4 | 1.1.4 |
C6 | Binary shifts | 1.2.4 | 1.1.5 |
C7 | Two's complement (IGCSE only) | not on spec | 1.1.6 |
C8 | Character sets: ASCII and Unicode | 1.2.4 | 1.2.1 |
C9 | Representing images (metadata GCSE only) | 1.2.4 | 1.2.3 |
C10 | Representing sound | 1.2.4 | 1.2.2 |
C11 | Compression (RLE IGCSE only) | 1.2.5 | 1.3.3, 1.3.4 |
C1: Why do computers use binary?
A computer is built from billions of tiny switches (transistors) that are either on or off. Two states are easy to make and to tell apart, so each one stores a binary digit: 1 for on, 0 for off. Data is processed using logic gates and held in registers, which both work with these two states. So any form of data, whether numbers, text, images or sound, must be converted to binary before a computer can store or process it.
With more bits you can make more patterns: n bits give 2ⁿ different values. 1 bit gives 2, 4 bits give 16, and 8 bits give 256 (0 to 255). This part is the same for both boards.
Worked example: how many bits for 20 values?
Step 1: list the powers of 2: 2, 4, 8, 16, 32.
Step 2: 4 bits give only 16 patterns, which is not enough for 20.
Step 3: 5 bits give 32 patterns, so you need 5 bits (round up to the next power of 2).
Practise C1: OCR questions · OCR mark scheme · Cambridge questions · Cambridge mark scheme
C2: How do you convert between denary and binary?
Denary is base 10, the number system you use every day. Binary is base 2: each column is worth double the one to its right. In an 8-bit number the place values are 128, 64, 32, 16, 8, 4, 2, 1. The left-hand bit is the most significant bit (MSB) and the right-hand bit is the least significant bit (LSB).
To turn binary into denary, add up the place values that have a 1. To turn denary into binary, work from the left: put a 1 under each place value that fits into what is left, and a 0 where it does not.
GCSE only: OCR J277 uses positive whole numbers up to 8 bits (0 to 255, 00000000 to 11111111) and accepts answers with 1 to 8 bits, so 11010 is the same as 00011010.
IGCSE only: Cambridge 0478 can use positive binary numbers up to 16 bits, so the place values carry on: 256, 512, 1,024 and so on up to 32,768.

Worked example: 156 to binary, and 01101011 to denary
Step 1: does 128 fit into 156? Yes: 1, leaving 28. 64? No: 0. 32? No: 0.
Step 2: 16 fits into 28: 1, leaving 12. 8 fits: 1, leaving 4. 4 fits: 1, leaving 0. 2 and 1: 0, 0.
Step 3: read the bits in order: 10011100. Check: 128 + 16 + 8 + 4 = 156.
Step 4: 01101011 to denary: 64 + 32 + 8 + 2 + 1 = 107.
Practise C2: OCR questions · OCR mark scheme · Cambridge questions · Cambridge mark scheme
C3: What is hexadecimal and how do you convert it?
Hexadecimal (hex) is base 16. It uses the digits 0 to 9 and then the letters A to F for 10 to 15. In a 2-digit hex number the left digit is worth 16s and the right digit is worth 1s.
To turn hex into denary, multiply the left digit by 16 and add the right digit. To turn denary into hex, divide by 16: the whole number is the left digit and the remainder is the right digit. Always convert each hex digit on its own: 2F is not "twenty-something".
GCSE only: OCR J277 uses 2-digit hex only, from 00 to FF (0 to 255).
IGCSE only: Cambridge 0478 uses hex up to 4 digits (place values 4,096, 256, 16, 1), and asks why hex is used: it is a shorter representation of binary, so it is easier for humans to read, write and remember, with fewer mistakes. Hex is used for things such as MAC addresses, colour codes in web pages, error codes and memory addresses.
Worked example: 156 to hex, and 2F to denary
Step 1: 156 ÷ 16 = 9 remainder 12. 9 is the left digit; 12 is C. So 156 = 9C.
Step 2: 2F to denary: 2 x 16 = 32, and F = 15. 32 + 15 = 47.
Step 3 (IGCSE only): 1A3F to denary: 1 x 4,096 + 10 x 256 + 3 x 16 + 15 = 4,096 + 2,560 + 48 + 15 = 6,719.
Practise C3: OCR questions · OCR mark scheme · Cambridge questions · Cambridge mark scheme
C4: How do you convert between binary and hexadecimal?
One hex digit stands for exactly 4 bits, a nibble, because 4 bits give 16 patterns. So you never need denary in between. Binary to hex: split the binary into nibbles from the right, and turn each nibble (place values 8, 4, 2, 1) into one hex digit. Hex to binary: turn each hex digit into a 4-bit nibble and write them side by side.
Both boards ask for conversions both ways. OCR stays at 8 bits (2 hex digits); Cambridge can use up to 16 bits (4 hex digits).
Worked example: 10110110 to hex, and 3E to binary
Step 1: split into nibbles: 1011 and 0110.
Step 2: 1011 = 8 + 2 + 1 = 11 = B. 0110 = 4 + 2 = 6. So the answer is B6.
Step 3: 3E to binary: 3 = 0011 and E = 14 = 1110, so 3E = 00111110. Keep the zeros inside the number, or the nibbles slide out of place.
Practise C4: OCR questions · OCR mark scheme · Cambridge questions · Cambridge mark scheme
C5: How do you add binary numbers, and what is overflow?
Add binary column by column from the right, just like denary addition, using four rules: 0 + 0 = 0; 0 + 1 = 1; 1 + 1 = 0 carry 1; 1 + 1 + 1 = 1 carry 1. Write each carry above the next column so the examiner can see your method.
An overflow error happens when the result is too big to fit in the number of bits available. In an 8-bit register, any result greater than 255 needs a ninth bit, and that bit cannot be stored. Overflow is on both boards. Cambridge adds that every computer or device has a predefined limit it can store (for example 16 bits), and overflow happens when a value outside that limit should be returned.
Worked example: 10110110 + 01100111
9th bit | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | |
|---|---|---|---|---|---|---|---|---|---|
Carries | 1 | 1 | 1 | 0 | 0 | 1 | 1 | 0 | |
1 | 0 | 1 | 1 | 0 | 1 | 1 | 0 | ||
+ | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 1 | |
= | 1 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 1 |
Step 1: add from the right, writing each carry above the next column. The final carry out of the left-hand column makes the full answer 9 bits: 100011101.
Step 2: check in denary: 182 + 103 = 285, which is more than 255.
Step 3: the 8-bit register can only keep 00011101 (29), so this is an overflow error: the ninth bit is lost and the stored answer is wrong.
Practise C5: OCR questions · OCR mark scheme · Cambridge questions · Cambridge mark scheme
C6: What does a binary shift do?
A binary shift moves every bit left or right by a number of places. Bits that move off the end are lost, and 0s fill the gaps at the other end. Each place left multiplies the number by 2; each place right divides it by 2. So a left shift of 3 places multiplies by 8, and a right shift of 2 places divides by 4. Bits lost off the right end make a right-shift answer lose its remainder; bits lost off the left end make a left-shift answer wrong.
Both boards ask you to carry out shifts of one or more places and describe their effect. Cambridge calls them logical shifts on positive 8-bit integers.
Worked example: shifting 00010110 (22)
Step 1: left shift of 2 places: 00010110 becomes 01011000. Check: 22 x 4 = 88.
Step 2: right shift of 3 places on 01011000: it becomes 00001011. Check: 88 ÷ 8 = 11.
Step 3: to multiply by 8, the answer needs the direction and the number of places: a left shift of 3 places.
Practise C6: OCR questions · OCR mark scheme · Cambridge questions · Cambridge mark scheme
C7: What is two's complement?
IGCSE only: two's complement is in Cambridge 0478 (1.1.6) but not in OCR J277, which uses positive binary only.
Two's complement lets 8 bits store negative as well as positive whole numbers. The MSB is worth -128 instead of +128, and the other place values stay the same (64 to 1). If the MSB is 0 the number is positive; if it is 1 the number is negative. The range is -128 to +127.
To store a negative number: write the positive number in 8-bit binary, flip every bit, then add 1. To read a two's complement number, add up the place values, using -128 for the MSB.
Worked example: -45 in two's complement, and 10110100 to denary
Step 1: +45 in 8-bit binary is 00101101.
Step 2: flip every bit: 11010010. Add 1: 11010011.
Step 3: check: -128 + 64 + 16 + 2 + 1 = -45.
Step 4: 10110100 to denary: -128 + 32 + 16 + 4 = -76.
Practise C7 (IGCSE only): Cambridge questions · Cambridge mark scheme
C8: How is text stored with ASCII and Unicode?
Each character (a letter, digit, space or symbol) is given a unique binary code. A character set is the list of all the characters a computer can represent and their codes. The number of bits per character limits how many characters there can be: n bits give 2ⁿ characters.
ASCII uses 7 bits, giving 128 characters: English letters, digits, punctuation and control codes. (An extended 8-bit version gives 256.) Unicode uses more bits per character (up to 32), so it can represent far more characters, including other languages' alphabets and emojis. The trade-off: Unicode text takes up more storage than ASCII.
GCSE only: OCR J277 shows ASCII as 8 bits in the exam, and expects you to know that codes are logically ordered: the code for B is one more than the code for A. You do not need to memorise any codes; a table is given.
Worked example: writing "CAB" in ASCII
You are told that A is 65 (01000001).
Step 1: the codes are in order, so B = 66 and C = 67.
Step 2: 67 in 8 bits = 01000011; 65 = 01000001; 66 = 01000010.
Step 3: "CAB" is 3 characters, so it needs 3 x 8 = 24 bits. Lowercase letters have different codes, so do not use them for capitals.
Practise C8: OCR questions · OCR mark scheme · Cambridge questions · Cambridge mark scheme
C9: How is an image stored in binary?
A bitmap image is a grid of pixels (picture elements). Each pixel has a colour, stored as a binary code. The colour depth is the number of bits used for each pixel: 1 bit gives 2 colours, 2 bits give 4, 8 bits give 256. The resolution is the number of pixels in the image (width x height).
Increase the colour depth and there are more colours, so the image is better quality but the file is bigger. Increase the resolution and there are more pixels, so there is more detail, but again the file is bigger. This is the same for both boards.
GCSE only: OCR J277 also asks about metadata: extra data stored with the image so it can be displayed properly, such as its width, height and colour depth. Cambridge 0478 does not ask about metadata.

Worked example: a 4 x 4 image with 4 colours
Step 1: 4 colours need 2 bits per pixel, because 2² = 4. So the colour depth is 2.
Step 2: the image has 4 x 4 = 16 pixels, so it needs 16 x 2 = 32 bits of image data.
Step 3: with 8 colours it would need 3 bits per pixel, so 16 x 3 = 48 bits: more colours, bigger file.
Practise C9: OCR questions · OCR mark scheme · Cambridge questions · Cambridge mark scheme
C10: How is sound stored in binary?
Sound is an analogue wave, so it must be sampled to be stored in binary. At regular intervals, the amplitude (height) of the wave is measured and stored as a binary number. The sample rate is the number of samples taken each second, measured in hertz (Hz). The number of bits used for each sample sets how many different amplitude values can be stored.
A higher sample rate or more bits per sample makes the stored sound closer to the original (better quality), but the file is bigger. A longer recording also makes a bigger file.
Both boards need this, but the words differ. OCR J277 calls the bits per sample the bit depth and talks about playback quality and duration. Cambridge 0478 calls it the sample resolution and talks about the accuracy of the recording.

Worked example: making a recording better
Step 1: a recording sounds rough. Raising the sample rate takes more samples each second, so the wave's shape is followed more closely.
Step 2: raising the bit depth (sample resolution) from 8 to 16 bits gives 65,536 possible amplitude values instead of 256, so each sample is more accurate.
Step 3: both changes make the file bigger. Doubling the sample rate doubles the number of samples, so it doubles the file size.
Practise C10: OCR questions · OCR mark scheme · Cambridge questions · Cambridge mark scheme
C11: What are lossy and lossless compression?
Compression makes a file smaller. Smaller files need less storage space, use less bandwidth and take less time to send or download. Both boards ask why compression is needed and how the two types compare.
Lossy compression permanently removes data, usually detail people are unlikely to notice. Files get much smaller, but the original cannot be rebuilt and quality may drop. It suits photos, music and video. Lossless compression makes the file smaller without losing any data: the original file can be rebuilt exactly. Files do not shrink as much. It is needed for text, program files and anything where every bit matters, because one changed character would be an error.
GCSE only: OCR J277 does not ask you to carry out a compression algorithm.
IGCSE only: Cambridge 0478 names the methods. Lossy: reducing the resolution or colour depth of an image, or reducing the sample rate or sample resolution of a sound. Lossless: run length encoding (RLE), which stores a run of repeated values once, with a count of how many times it repeats.
Worked example: RLE on a row of pixels (IGCSE only)
A row of 12 pixels is WWWWBBBWWWWW (W = white, B = black).
Step 1: find the runs: 4 white, then 3 black, then 5 white.
Step 2: write each run as a count and a value: 4W 3B 5W.
Step 3: that is 6 items instead of 12, and the original row can be rebuilt exactly, so RLE is lossless. RLE only helps when data has long runs: ABCD would get bigger.
Practise C11: OCR questions · OCR mark scheme · Cambridge questions · Cambridge mark scheme
Common exam mistakes in data representation
Saying "computers only understand binary" with no reason: say computers use switches (transistors) and logic gates with two states, on and off.
Writing binary place values in the wrong order, or skipping working when the question says "show your working".
Hex: converting a pair of digits as one number (treating 14 as fourteen), or dropping a 0 nibble so B0 becomes B.
Binary addition: converting to denary and back instead of adding in binary, which earns no method marks, or leaving out the final carry. Overflow needs "the result is greater than 255 and cannot be stored in 8 bits".
Shifts: giving the direction but not the number of places. To multiply by 8, write "left shift of 3 places".
(IGCSE) Two's complement: writing the positive pattern with a 1 in front instead of flipping the bits and adding 1.
Thinking Unicode uses fewer bits than ASCII, or confusing the sample rate with how loud or high the sound is.
Compression: defining all compression as removing data (that is only lossy), choosing lossy for text, or not linking the answer to the file in the question.
Quick recap
C1: computers use switches with two states, so all data is binary; n bits give 2ⁿ values.
C2: place values 128 to 1; MSB on the left, LSB on the right; OCR up to 8 bits, Cambridge up to 16 bits.
C3: hex is base 16 (A to F = 10 to 15); OCR 00 to FF; Cambridge up to 4 digits and why hex is used (IGCSE only).
C4: one hex digit = one nibble (4 bits).
C5: add with carries; a result over 255 in 8 bits is an overflow error.
C6: left shift multiplies by 2 per place, right shift divides; bits off the end are lost.
C7: (IGCSE only) two's complement: MSB = -128; flip the bits and add 1 for a negative number.
C8: a character set gives each character a binary code; ASCII 7 bits (8 bits in OCR exams), Unicode more bits for more characters.
C9: pixels, colour depth and resolution: more of either means better quality and a bigger file; metadata GCSE only.
C10: sampling the amplitude; higher sample rate and bit depth (sample resolution) mean better quality and a bigger file.
C11: lossy removes data for good, lossless keeps it all; RLE and named lossy methods IGCSE only.
Download the whole module
Frequently asked questions
Why do computers use binary instead of denary?
Computers are made of switches (transistors) and logic gates that have only two states, on and off. Two states are easy to make and tell apart, so each one stores a binary digit, 1 or 0, and all data must be converted to binary to be processed.
How do you convert binary to hexadecimal?
Split the binary number into groups of 4 bits (nibbles) from the right. Turn each nibble into one hex digit using the place values 8, 4, 2 and 1, so 1011 0110 becomes B6.
What is an overflow error in binary addition?
An overflow error happens when the result of an addition is too big to fit in the bits available. In an 8-bit register, any result greater than 255 needs a ninth bit, which cannot be stored, so the stored answer is wrong.
Do I need to know two's complement for GCSE Computer Science?
Only for Cambridge IGCSE 0478, which asks you to convert positive and negative 8-bit integers to and from two's complement. OCR J277 uses positive binary numbers only, so two's complement is not on the OCR GCSE.
Is bit depth the same as sample resolution?
Yes. Both mean the number of bits used to store each sound sample. OCR J277 calls it bit depth and Cambridge IGCSE 0478 calls it sample resolution.
What is the difference between lossy and lossless compression?
Lossy compression permanently removes some data, so files get much smaller but the original cannot be rebuilt exactly. Lossless compression makes the file smaller without losing any data, so the original can be rebuilt exactly, which is needed for text and program files.
Previous module: Memory and storage revision notes. Next module: Data transmission revision notes.
More help: browse the GCSE Computer Science revision hub.