WJEC GCSE Computer Science Data representation: a complete overview of binary, hexadecimal, negative numbers, characters, images, sound and compression
A deep-dive WJEC GCSE Computer Science guide to the Data representation content in Unit 1. Covers binary and denary, hexadecimal, binary arithmetic and overflow, arithmetic shifts, signed numbers in sign and magnitude and two's complement, character sets, bitmap images, sampled sound, file-size calculations and compression, with the conversions and exam patterns WJEC repeats.
Reviewed by: AI editorial process; not yet individually human-reviewed
Jump to a section
What the Data representation content demands
Data representation is where WJEC checks that you understand how a machine built from two-state switches can store numbers, text, pictures and sound. Every other part of the course, from hardware to networks to programming, sits on top of the idea that everything is ultimately a pattern of bits. This area is also the most calculation-heavy part of Unit 1, so fluent, accurate conversions and file-size sums earn marks reliably under exam pressure.
This guide walks through the Data representation content and ties together the matching dot-point pages, each of which has its own worked examples and practice questions.
Binary and the denary system
Computers use binary because their electronic components have two stable states, on and off, that map onto and . A bit is one binary digit, a byte is bits, and capacity rises through kilobytes, megabytes, gigabytes and terabytes. Binary columns are powers of two ( for a byte). To convert binary to denary, add the place values where a appears; to convert denary to binary, subtract the largest power of two that fits at each step.
Hexadecimal
Hexadecimal is base , using to then to for to . It is a shorthand for binary because each hex digit is exactly four bits, so a byte is two hex digits. Convert hex to binary one digit at a time, binary to hex by grouping bits into fours from the right, and hex to denary using the column values and . Hexadecimal appears in colour codes, memory addresses and error messages.
Binary arithmetic and overflow
Add binary from the right using (carry one) and (carry one). Overflow happens when a result is too large for the available bits, so the final carry is lost and the answer is wrong. An arithmetic shift moves all the bits: a left shift multiplies by two and a right shift divides by two, with a shift of places multiplying or dividing by . Shifts are fast, so compilers use them for multiplying and dividing by powers of two.
Representing negative numbers
Plain binary stores only positive numbers, so signed methods are needed. In sign and magnitude the leftmost bit is the sign and the rest is the size, but it has two zeros. In two's complement you write the positive value, flip every bit and add one; subtraction then becomes a single addition, there is one zero, and an -bit range runs from to . Two's complement is what real processors use.
Characters, ASCII and Unicode
Text is stored using a character set that gives each character a unique binary code. ASCII uses bits ( characters, or in extended ASCII) and orders the letters in sequence, with upper and lower case apart. Unicode uses more bits to cover every language plus symbols and emoji, so the same text takes more storage than in ASCII. A string's size is the number of characters times the bits per character.
Representing images
A bitmap is a grid of pixels, each storing a colour as a binary number. Resolution is the number of pixels; colour depth is the bits per pixel, and the number of colours is . The file size in bits is width times height times colour depth, divided by eight for bytes. Metadata such as the dimensions and colour depth is stored with the image so it can be displayed correctly. More pixels or more colours mean a larger file.
Representing sound
Sound is an analogue wave, digitised by sampling: the amplitude is measured at regular intervals and stored as binary. The sample rate is samples per second and the sample resolution (bit depth) is bits per sample; both raise quality and file size. The file size in bits is sample rate times duration times bit depth, divided by eight for bytes. Sound is often compressed (for example to MP3) to make files small enough to stream.
Compression
Compression makes files smaller so they take less storage and less bandwidth. Lossy compression permanently removes data and cannot be reversed exactly; it suits photos, music and video. Lossless compression keeps every bit so the original is recovered exactly; it suits text, spreadsheets and code. Run-length encoding is lossless and stores each run of repeated values as the value and a count, which helps on data with long runs but can enlarge varied data.
Check your knowledge
A mix of conversion, arithmetic, file-size and compression questions covering the Data representation content. Attempt them under timed conditions, then check against the solutions.
- Convert the binary number to denary. (2 marks)
- Convert the denary number to -bit binary. (2 marks)
- Convert the hexadecimal number to denary. (2 marks)
- Add the binary numbers and . (2 marks)
- Write in -bit two's complement. (2 marks)
- An image is by pixels with a colour depth of bits. Calculate its size in bytes. (3 marks)
- A -second sound is sampled at with a bit depth of bits. Calculate its size in bytes. (3 marks)
- Compress WWWWWWWWBBWWWW using run-length encoding. (2 marks)