What you'll learn
Data representation is the study of how computers store every kind of data — numbers, text, images and sound — as binary. This overview brings together the whole data representation unit of CIE IGCSE Computer Science (0478): number systems and conversions, binary arithmetic and overflow, logical binary shifts, two's complement for negative numbers, character sets, how images and sound are stored and how big their files are, units of storage, and compression. Each section gives the method you need for the exam and a worked example; the more detailed guides on individual sub-topics go further into each area.
Data representation questions appear on Paper 1 and are among the most dependable marks in the course, because each skill follows a fixed method. Practise the methods by hand until they are automatic, and always show your working.
Key terms and definitions
Binary — Base 2, using the digits 0 and 1.
Denary — Base 10, the everyday number system.
Hexadecimal — Base 16, using digits 0–9 and A–F.
Overflow — Occurs when the result of a calculation is too large for the number of bits available.
Logical shift — Moving all bits left or right, filling empty positions with 0.
Two's complement — A method of representing positive and negative integers in binary, where the most significant bit has a negative place value.
Character set — A list of characters with a unique binary code for each, such as ASCII or Unicode.
Pixel — The smallest element of a bitmap image.
Colour depth — The number of bits used per pixel.
Resolution — The number of pixels in an image.
Sample rate — The number of sound samples per second.
Sample resolution — The number of bits per sound sample.
Lossy / lossless compression — Compression that permanently removes data / that allows the original to be restored.
Core concepts
Why computers use binary
A computer is made from billions of transistors acting as switches, each either on or off. Binary's two digits map directly to those two states, so all data and instructions inside a computer are binary. Data must be converted into binary before a computer can process it.
Number systems and conversions
Binary place values for 8 bits are 128, 64, 32, 16, 8, 4, 2, 1. To convert binary to denary, add the place values with a 1. 10010110 = 128 + 16 + 4 + 2 = 150. To convert denary to binary, subtract the largest place value that fits and repeat: 77 = 64 + 8 + 4 + 1 → 01001101.
Hexadecimal uses 0–9 and A (10) to F (15). Each hex digit represents four bits (a nibble). To convert binary to hex, split into groups of four from the right: 1011 0110 → B6. To convert hex to denary, multiply the first digit by 16 and add the second: 2F = 2 × 16 + 15 = 47.
Hexadecimal is used because it is easier for humans to read and remember than long binary strings and less prone to error when copying, while converting easily to and from binary. Common uses include error codes, MAC addresses, IPv6 addresses, HTML colour codes and memory dumps.
Binary addition and overflow
Add from right to left, using 1 + 1 = 0 carry 1 and 1 + 1 + 1 = 1 carry 1. In an 8-bit register, the largest positive value is 255. If adding two 8-bit numbers produces a ninth bit, an overflow error occurs: the extra bit cannot be stored, so the result is incorrect.
Logical binary shifts
A logical left shift of one place multiplies a positive integer by 2; a logical right shift of one place divides it by 2. The positions left empty are filled with 0, and bits shifted off the end are lost. Losing bits can make the result inaccurate: shifting 00000111 (7) right by one gives 00000011 (3), losing the remainder. Shifting left too far causes the most significant bits to be lost.
Two's complement
Two's complement allows negative integers to be stored. In 8-bit two's complement, the most significant bit has the value −128, and the others keep their usual positive values. The range is −128 to +127.
To find the two's complement of a negative number, write its positive value in binary, invert every bit, then add 1:
+20 = 00010100 → invert → 11101011 → add 1 → 11101100 = −20.
Check: −128 + 64 + 32 + 8 + 4 = −20. ✓
Text: character sets
Each character is assigned a binary code. ASCII uses 7 bits (128 characters), and an extended version uses 8 bits (256). It covers English letters, digits, punctuation and control characters. Unicode uses more bits per character (up to 32), so it can represent characters from many more languages and symbols such as emoji. Unicode text therefore takes more storage than ASCII text. Codes are sequential, so 'B' is one more than 'A'.
Images
A bitmap image is a grid of pixels, each stored as a binary number. With colour depth n, there are 2ⁿ colours. Increasing resolution shows more detail and increasing colour depth gives more colours; both improve quality and both increase file size.
Image file size (bits) = width × height × colour depth.
Sound
Sound waves are analogue. They are sampled at regular intervals and each sample's amplitude is stored in binary. A higher sample rate and higher sample resolution (bit depth) produce a more accurate recording but a larger file.
Sound file size (bits) = sample rate × sample resolution × length in seconds.
Data storage units
CIE uses binary prefixes based on 1,024:
| Unit | Size |
|---|---|
| Nibble | 4 bits |
| Byte | 8 bits |
| KiB (kibibyte) | 1,024 bytes |
| MiB (mebibyte) | 1,024 KiB |
| GiB (gibibyte) | 1,024 MiB |
| TiB (tebibyte) | 1,024 GiB |
| PiB, EiB | 1,024 TiB, 1,024 PiB |
Always read whether a question uses 1,024 (KiB, MiB) or asks for bytes, and show each conversion step.
Compression
Compression reduces file size so that files take less storage, transfer more quickly, use less bandwidth and stream more smoothly.
Lossy compression permanently removes data, such as detail people are unlikely to notice. Methods include reducing resolution or colour depth for images, reducing sample rate or resolution for sound, and perceptual music shaping, which removes sounds the human ear cannot distinguish. JPEG and MP3 are lossy formats. The original cannot be restored.
Lossless compression reduces file size without losing data, so the file can be restored exactly. Run-length encoding (RLE) replaces runs of identical values with a count and the value — for example, the pixel sequence of 6 white then 3 black can be stored as 6 white, 3 black. Lossless compression is essential for text and program files.
Quick-reference conversions
| Denary | Binary (8-bit) | Hex |
|---|---|---|
| 10 | 00001010 | 0A |
| 15 | 00001111 | 0F |
| 16 | 00010000 | 10 |
| 100 | 01100100 | 64 |
| 127 | 01111111 | 7F |
| 200 | 11001000 | C8 |
| 255 | 11111111 | FF |
Notice the patterns: 16 in denary is 10 in hex, and every value with all four low bits set ends in F. Recognising these patterns helps you check answers quickly.
Why file size matters
File size affects how much storage is needed, how long files take to download or upload, how much bandwidth they use and whether audio and video stream smoothly. A photographer, a music streaming service and a website designer all make trade-offs between quality and size: higher resolution, colour depth, sample rate and sample resolution improve quality, but every increase multiplies the number of bits stored. Compression is the tool that resolves this trade-off — lossy where small size matters most and some loss is acceptable, lossless where every bit must be kept.
Worked examples
Example 1: Hex to binary and denary
Convert the hexadecimal number 7C into binary and into denary.
7 = 0111 and C (12) = 1100, so 7C = 01111100. Denary: 7 × 16 + 12 = 124.
Example 2: Two's complement
Convert −45 into 8-bit two's complement.
+45 = 00101101. Invert: 11010010. Add 1: 11010011. Check: −128 + 64 + 16 + 2 + 1 = −45. ✓
Example 3: Image file size
Calculate the file size in KiB of an image 512 × 256 pixels with a colour depth of 8 bits.
512 × 256 × 8 = 1,048,576 bits. ÷ 8 = 131,072 bytes. ÷ 1,024 = 128 KiB.
Example 4: Sound file size
A 30-second recording uses a sample rate of 8,000 Hz and a sample resolution of 16 bits. Calculate its size in bytes.
8,000 × 16 × 30 = 3,840,000 bits. ÷ 8 = 480,000 bytes.
Example 5: Logical shift
Perform a logical left shift of two places on 00011010 and state the effect.
00011010 (26) → 01101000 (104). The value has been multiplied by 4.
Common mistakes and how to avoid them
- Forgetting to add 1 after inverting the bits in two's complement.
- Misreading the sign bit. In two's complement, a leading 1 means the number is negative.
- Dividing by 1,000 when the question uses KiB. KiB is 1,024 bytes.
- Forgetting to divide bits by 8 to get bytes.
- Saying lossy compression keeps all data. It removes data permanently.
- Omitting working. Method marks are lost.
Exam technique for "Data Representation"
- Write the place value headings above every binary number before converting.
- For two's complement, always check your answer by adding the place values, remembering −128.
- For file size questions, write the formula, substitute, then convert units one step at a time.
- For "why is hexadecimal used" questions, give a reason and a use.
- For compression questions, name a method and say whether it is lossy or lossless.
Quick revision summary
- Binary place values 128 → 1; hex digits 0–F; one hex digit = 4 bits.
- Hex is easier to read and less error-prone; used for error codes, MAC addresses, IPv6, colour codes.
- Binary addition can cause overflow; logical shifts multiply or divide by powers of 2 and can lose bits.
- Two's complement: MSB = −128; invert and add 1 to negate.
- ASCII (7-bit) vs Unicode (more bits, more languages).
- Image size = width × height × colour depth; sound size = sample rate × resolution × seconds.
- Units use 1,024 (KiB, MiB, GiB, TiB).
- Lossy (JPEG, MP3, perceptual shaping) vs lossless (RLE).