What you'll learn
Data representation covers how computers store and process all types of information using binary. You'll learn to convert between number systems, understand how text and images are encoded, and calculate file sizes. This topic forms the foundation for understanding how computers work and appears in both Paper 1 and Paper 2 of the Edexcel GCSE Computer Science exam.
Key terms and definitions
Binary — A base-2 number system using only digits 0 and 1, which computers use to represent all data electronically.
Hexadecimal — A base-16 number system using digits 0-9 and letters A-F, commonly used as a shorthand for binary values.
Bit — The smallest unit of data in computing, representing a single binary digit (0 or 1).
Byte — A group of 8 bits, used as the standard unit for measuring data storage and memory.
ASCII — American Standard Code for Information Interchange; a 7-bit character encoding standard representing 128 characters.
Unicode — An extended character encoding standard supporting multiple languages and symbols, using 8, 16 or 32 bits per character.
Pixel — Picture element; the smallest addressable unit in a digital image, typically represented by colour values.
Overflow error — An error that occurs when a calculation produces a result too large to be stored in the allocated number of bits.
Core concepts
Number systems and conversions
Computers use binary because electronic circuits have two stable states: on (1) and off (0). Understanding how to convert between binary, denary (decimal) and hexadecimal is essential.
Binary to denary conversion
Each bit position represents a power of 2, starting from 2⁰ on the right:
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|---|---|---|---|---|---|---|---|
| 2⁷ | 2⁶ | 2⁵ | 2⁴ | 2³ | 2² | 2¹ | 2⁰ |
To convert binary to denary, add up the column values where there's a 1.
Denary to binary conversion
Use repeated division by 2, recording remainders from bottom to top, or subtract the largest possible power of 2 repeatedly.
Hexadecimal system
Hexadecimal uses 16 digits: 0-9 and A-F (where A=10, B=11, C=12, D=13, E=14, F=15). One hexadecimal digit represents exactly 4 bits (a nibble), making it a convenient shorthand for binary.
| Denary | Binary | Hexadecimal |
|---|---|---|
| 0 | 0000 | 0 |
| 10 | 1010 | A |
| 15 | 1111 | F |
| 255 | 11111111 | FF |
Binary to hexadecimal conversion
Split the binary number into groups of 4 bits (starting from the right), then convert each group to its hexadecimal equivalent.
Hexadecimal to binary conversion
Convert each hexadecimal digit to its 4-bit binary equivalent.
Binary addition and shift operations
Binary addition
Binary addition follows similar rules to decimal addition, but only uses 0 and 1:
- 0 + 0 = 0
- 0 + 1 = 1
- 1 + 0 = 1
- 1 + 1 = 10 (write 0, carry 1)
- 1 + 1 + 1 = 11 (write 1, carry 1)
When the result exceeds the available bits, an overflow error occurs, and the calculation is incorrect.
Logical binary shifts
A logical shift moves all bits left or right by a specified number of positions:
- Left shift: Each bit moves one position left; zeros fill empty positions on the right. This multiplies the value by 2 for each shift.
- Right shift: Each bit moves one position right; zeros fill empty positions on the left. This divides the value by 2 for each shift (rounding down).
Bits shifted beyond the register size are lost.
Character encoding
Computers represent text characters using numeric codes. Two main standards exist:
ASCII encoding
ASCII uses 7 bits to represent 128 different characters, including:
- Uppercase letters (A-Z): codes 65-90
- Lowercase letters (a-z): codes 97-122
- Digits (0-9): codes 48-57
- Punctuation and control characters
Extended ASCII uses 8 bits (1 byte) to represent 256 characters, adding accented letters and symbols.
Unicode encoding
Unicode was developed to represent characters from all world languages, including:
- Latin alphabets
- Chinese, Japanese, Arabic scripts
- Emoji and mathematical symbols
- Over 1 million possible characters
Unicode uses variable bit lengths (UTF-8, UTF-16, UTF-32), with common characters using 8-16 bits and less common ones using more. This allows global communication but requires more storage than ASCII.
Image representation
Digital images are composed of pixels arranged in a grid. Each pixel stores colour information as binary values.
Bitmap images
A bitmap (or raster image) stores colour values for each individual pixel. Key properties include:
- Resolution: Number of pixels in the image (width × height), measured in pixels or megapixels
- Colour depth: Number of bits used to represent each pixel's colour
- Image dimensions: Physical width and height in pixels
Colour depth
Common colour depths include:
| Colour depth | Number of colours | Description |
|---|---|---|
| 1 bit | 2 | Black and white |
| 8 bit | 256 | Greyscale or indexed colour |
| 24 bit | 16,777,216 | True colour (8 bits each for Red, Green, Blue) |
Higher colour depth produces better quality images but requires more storage.
Calculating image file size
File size (in bits) = width (pixels) × height (pixels) × colour depth (bits)
To convert to bytes, divide by 8. To convert to kilobytes, divide by 1024.
Metadata
Image files contain metadata — data about the data — including:
- Image dimensions
- Colour depth
- Creation date and time
- Camera settings (for photographs)
- GPS location
This information helps software display and manage images correctly but adds to file size.
Units of data storage
Understanding data storage units is crucial for file size calculations:
| Unit | Symbol | Size |
|---|---|---|
| Bit | b | 1 binary digit |
| Nibble | — | 4 bits |
| Byte | B | 8 bits |
| Kilobyte | KB | 1024 bytes |
| Megabyte | MB | 1024 KB = 1,048,576 bytes |
| Gigabyte | GB | 1024 MB |
| Terabyte | TB | 1024 GB |
Note: In computing, 1 KB = 1024 bytes (not 1000), because it's based on powers of 2 (2¹⁰ = 1024).
Sound representation
Digital sound is created by sampling analogue sound waves at regular intervals.
Sampling fundamentals
- Sample rate: Number of samples taken per second, measured in Hertz (Hz). CD quality uses 44,100 Hz (44.1 kHz).
- Sample resolution (bit depth): Number of bits used to store each sample. Higher values capture more detail.
Calculating sound file size
File size (bits) = sample rate (Hz) × sample resolution (bits) × duration (seconds) × number of channels
For stereo sound, multiply by 2 channels.
Higher sample rates and resolutions produce better quality sound but create larger files.
Worked examples
Example 1: Binary and hexadecimal conversion (3 marks)
Convert the binary number 10110101 to hexadecimal.
Solution: Split into nibbles: 1011 0101
Convert each nibble:
- 1011 = (8 + 0 + 2 + 1) = 11 = B
- 0101 = (0 + 4 + 0 + 1) = 5 = 5
Answer: B5
Mark scheme: 1 mark for correctly splitting into nibbles, 1 mark for each correct hexadecimal digit
Example 2: Image file size calculation (4 marks)
A bitmap image has dimensions 1920 × 1080 pixels and uses 24-bit colour depth. Calculate the file size in megabytes.
Solution: Number of pixels = 1920 × 1080 = 2,073,600 pixels ✓
File size in bits = 2,073,600 × 24 = 49,766,400 bits ✓
File size in bytes = 49,766,400 ÷ 8 = 6,220,800 bytes ✓
File size in MB = 6,220,800 ÷ 1024 ÷ 1024 = 5.93 MB ✓
Mark scheme: 1 mark for calculating pixels, 1 mark for multiplying by colour depth, 1 mark for converting to bytes, 1 mark for converting to MB
Example 3: Binary addition with overflow (4 marks)
Add the 8-bit binary numbers 11010110 and 01101101. State whether an overflow error occurs.
Solution:
11010110
+ 01101101
-----------
101000011
Carry: 1 1 1 1 1 1
The result requires 9 bits (101000011) but only 8 bits are available ✓
The leftmost bit is lost, giving 01000011 ✓
An overflow error occurs ✓
The result is incorrect (should be 323, but stored value is 67) ✓
Mark scheme: 1 mark for correct addition, 1 mark for identifying 9-bit result, 1 mark for stating overflow occurs, 1 mark for explaining consequence
Common mistakes and how to avoid them
Confusing binary place values: Remember each column is double the previous one (1, 2, 4, 8, 16...), reading right to left. Write out the column headings when converting to avoid errors.
Incorrect unit conversions: Always divide by 1024 when converting between KB, MB, GB (not 1000). Show all conversion steps in calculations for maximum marks.
Forgetting to convert bits to bytes: File size questions often require the answer in bytes or kilobytes. Always check the question carefully and divide by 8 to convert bits to bytes.
Mixing up ASCII and Unicode: ASCII uses 7-8 bits and represents 128-256 characters (English alphabet primarily). Unicode uses variable bits and represents over 1 million characters (all world languages).
Hexadecimal letter confusion: Remember A=10, B=11, C=12, D=13, E=14, F=15. When converting, write this out if needed to avoid errors.
Incomplete metadata examples: When asked about metadata, give specific examples (date created, image dimensions, GPS coordinates) rather than vague descriptions like "information about the file."
Exam technique for "Data Representation"
Show all working: Even if you get the final answer wrong, you can gain method marks by showing clear steps in conversions and calculations. Write out column headings for binary/hexadecimal conversions.
Command word awareness: "State" requires a brief answer (1-2 words), "Describe" needs a fuller explanation with context, "Calculate" requires numerical working and units, "Explain" demands reasons or causes with linked points.
Include units in calculations: Always state units (bits, bytes, KB, MB) in file size calculations. Missing units can lose marks even with correct numerical answers.
Check question context: Data representation questions often link to real scenarios (digital cameras, music streaming, web pages). Tailor your answer to the context given for maximum relevance.
Quick revision summary
Data representation covers how computers store information in binary. Master conversions between binary, denary and hexadecimal, understanding that hex provides a convenient shorthand (4 bits per digit). Know that ASCII uses 7-8 bits for English characters while Unicode supports all languages with variable bit lengths. Calculate image file sizes using: width × height × colour depth, remembering to convert bits to bytes. Binary shifts multiply (left) or divide (right) by 2. Sound quality depends on sample rate and resolution. Always show working and include units in exam answers.