Skip to main content
WalesComputer Science

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.

Generated by Claude Opus 4.814 min read3500 Unit 1 Data representation and data types

Reviewed by: AI editorial process; not yet individually human-reviewed

Jump to a section
  1. What the Data representation content demands
  2. Binary and the denary system
  3. Hexadecimal
  4. Binary arithmetic and overflow
  5. Representing negative numbers
  6. Characters, ASCII and Unicode
  7. Representing images
  8. Representing sound
  9. Compression
  10. Check your knowledge

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 11 and 00. A bit is one binary digit, a byte is 88 bits, and capacity rises through kilobytes, megabytes, gigabytes and terabytes. Binary columns are powers of two (128,64,32,16,8,4,2,1128, 64, 32, 16, 8, 4, 2, 1 for a byte). To convert binary to denary, add the place values where a 11 appears; to convert denary to binary, subtract the largest power of two that fits at each step.

Hexadecimal

Hexadecimal is base 1616, using 00 to 99 then A\text{A} to F\text{F} for 1010 to 1515. 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 1616 and 11. Hexadecimal appears in colour codes, memory addresses and error messages.

Binary arithmetic and overflow

Add binary from the right using 1+1=101 + 1 = 10 (carry one) and 1+1+1=111 + 1 + 1 = 11 (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 nn places multiplying or dividing by 2n2^n. 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 88-bit range runs from 128-128 to +127+127. 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 77 bits (128128 characters, or 256256 in extended ASCII) and orders the letters in sequence, with upper and lower case 3232 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 2colour depth2^{\text{colour depth}}. 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.

  1. Convert the binary number 1010110010101100 to denary. (2 marks)
  2. Convert the denary number 5353 to 88-bit binary. (2 marks)
  3. Convert the hexadecimal number 3D\text{3D} to denary. (2 marks)
  4. Add the binary numbers 0010110100101101 and 0001011000010110. (2 marks)
  5. Write 9-9 in 88-bit two's complement. (2 marks)
  6. An image is 4040 by 3030 pixels with a colour depth of 88 bits. Calculate its size in bytes. (3 marks)
  7. A 44-second sound is sampled at 2000Hz2000\,\text{Hz} with a bit depth of 88 bits. Calculate its size in bytes. (3 marks)
  8. Compress WWWWWWWWBBWWWW using run-length encoding. (2 marks)

Sources & how we know this

  • computer-science
  • wjec-gcse
  • wjec-computer-science
  • data-representation
  • binary
  • hexadecimal
  • gcse