1.2.4 Data storage · Paper 1
Binary: how numbers, text, images and sound are stored
Each section has pictures and things to try, then its key points and key words. Exam practice is at the end of the page.
You need to know
- Convert between denary (0 to 255), binary (8 bits) and 2-digit hex (00 to FF)
- Add two 8-bit binary numbers, and explain overflow
- Carry out binary shifts left and right, and say what they do
- Most and least significant bit
- How characters are stored, character sets, ASCII and Unicode
- How images are stored as pixels, metadata, colour depth and resolution
- How sound is sampled, sample rate, duration and bit depth
You don't need to know
- Character codes off by heart
- Numbers bigger than 8 bits or 255
Numbers: binary
Each binary column is worth double the one to its right. Add up the columns with a 1.
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
| 0 | 0 | 1 | 0 | 1 | 1 | 0 | 1 |
Denary to binary: work from the left. If the column value fits, write 1 and take it away. If not, write 0.
Key points
Binary to denary
Before this: 1.2.3Why computers use binary
1 Learn
- Binary uses only 0 and 1. Denary is the normal number system, using 0 to 9.
- Each binary column has a value. From the right they go 1, 2, 4, 8, 16, 32, 64, 128. Each one doubles.
- To convert, add up the column values that have a 1 under them.
- The left-most bit is the most significant bit (biggest value). The right-most is the least significant bit.
Example: 00001101 has 1s under 8, 4 and 1. So 8 + 4 + 1 = 13.
2 Try
Tap the boxes to switch bits on and off.
3 Check
What is 00001010 in denary?
What is the biggest number 8 bits can hold?
Which bit is the most significant bit?
Denary to binary
Before this: Binary to denary
- Write out the column values: 128, 64, 32, 16, 8, 4, 2, 1.
- Start at the left. If the column value fits into what's left of your number, write 1 and subtract it. If not, write 0.
- Keep going until you reach the 1s column.
- Always give 8 bits in the exam, adding 0s at the front if needed.
- Example: 100 = 64 + 32 + 4 = 01100100.
Key words
Say what each one means, then tap to check.
Numbers: adding and overflow
Rules: 0+0=0, 0+1=1, 1+1=0 carry 1, 1+1+1=1 carry 1.
0 1 0 1 1 0 1 0 (90) + 0 0 1 1 1 0 0 1 (57) --------------- 1 0 0 1 0 0 1 1 (147)
Overflow happens when the answer needs more than 8 bits (bigger than 255). The extra bit is lost, so the answer is wrong.
Try it
Add one column at a time, from the right. Watch the carries. Then try the overflow sum.
Key points
Adding binary numbers
Before this: Denary to binary
- Add from right to left, like column addition.
- 0 + 0 = 0, 0 + 1 = 1, 1 + 1 = 0 carry 1, 1 + 1 + 1 = 1 carry 1.
- Write any carries above the next column.
- Check your answer by converting to denary.
0 0 1 1 0 1 0 1 (53) + 0 0 0 1 1 0 1 1 (27) --------------- 0 1 0 1 0 0 0 0 (80)
Overflow errors
Before this: Adding binary numbers
- 8 bits can hold numbers up to 255.
- If an addition gives an answer bigger than 255, it needs a 9th bit.
- There is no room for it, so the extra bit is lost. This is an overflow error.
- The stored answer is wrong. Programs can detect overflow and warn the user.
Key words
Say what each one means, then tap to check.
Numbers: binary shifts
00000101 (5) 00001010 (10)
00001010 (10) 00000101 (5)
Try it
Make a number, then shift it left and right.
Key points
Binary shifts
Before this: Binary to denary
- A left shift moves every bit left. Each place multiplies the number by 2.
- A right shift moves every bit right. Each place divides the number by 2.
- Empty spaces are filled with 0s.
- Bits that fall off the end are lost. A left shift can cause overflow; a right shift can lose accuracy (e.g. 7 ÷ 2 gives 3).
Key words
Say what each one means, then tap to check.
Numbers: hexadecimal
Hex is base 16. It's used because it is shorter and easier for people to read than binary, and easy to convert. One hex digit = one nibble (4 bits).
| Denary | 0–9 | 10 | 11 | 12 | 13 | 14 | 15 |
|---|---|---|---|---|---|---|---|
| Hex | 0–9 | A | B | C | D | E | F |
- Binary to hex: split into two nibbles. 1011 0110 B 6 B6
- Hex to denary: first digit × 16, plus the second. B6 = 11 × 16 + 6 = 182
Try it
Make a number and see it in hex.
Key points
Why we use hexadecimal
Before this: Binary to denary
- Hexadecimal (hex) is base 16. It uses 0–9 then A–F for 10–15.
- One hex digit represents exactly 4 bits (a nibble), so 2 hex digits = 1 byte.
- Hex is used because it's shorter and easier for people to read and remember than binary, with fewer mistakes.
- It's easy to convert to and from binary.
- Used for things like colour codes (#FF0000) and MAC addresses.
- Computers still store everything in binary. Hex is just for humans.
Hex and denary
Before this: Why we use hexadecimal
- Hex to denary: first digit × 16, then add the second digit. e.g. 2B = 2 × 16 + 11 = 43.
- Denary to hex: divide by 16. The whole number answer is the first digit; the remainder is the second. e.g. 200 ÷ 16 = 12 remainder 8 C8.
- Remember A=10, B=11, C=12, D=13, E=14, F=15.
- You can also convert through binary if you find that easier.
Hex and binary
Before this: Why we use hexadecimal
- Binary to hex: split the 8 bits into two nibbles. Convert each nibble to one hex digit.
- e.g. 1010 0111 A and 7 A7.
- Hex to binary: turn each hex digit into 4 bits, then join them.
- e.g. 3C 0011 and 1100 00111100.
Key words
Say what each one means, then tap to check.
Characters
Each character is given a binary code. The full list of characters a computer can use is its character set. Codes are in order, so if 'A' is 65, 'B' is 66.
| ASCII | Unicode | |
|---|---|---|
| Bits per character | 7 bits (8 in the exam) | Up to 32 bits |
| Number of characters | 128 (256 with 8 bits) | Over a million possible |
| Covers | English letters, digits, symbols | Every language, plus emoji |
| Downside | Can't show other languages | Files take more space |
More bits per character means more characters can be represented.
Try it
Type a word and see the code for each character. Then switch to Unicode, or try an emoji.
Key points
Characters in binary
Before this: Binary to denary
- Each character (letter, digit, symbol) is given a unique binary code.
- The complete list of characters and codes a computer uses is its character set.
- Codes are in a logical order: if 'A' is 65, then 'B' is 66 and 'C' is 67.
- The more bits used per character, the more characters can be represented. n bits give 2ⁿ characters.
ASCII and Unicode
Before this: Characters in binary
- ASCII uses 7 bits, giving 128 characters (8 bits are used in the exam, giving 256). Covers English letters, digits and symbols.
- Unicode uses more bits per character (up to 32), so it can represent over a million characters.
- Unicode covers almost every language in the world, plus emoji.
- Unicode's first 128 codes are the same as ASCII.
- Downside of Unicode: each character may take more space, so files can be bigger.
Key words
Say what each one means, then tap to check.
Images
An image is a grid of pixels. Each pixel's colour is stored as a binary code.
- Colour depth: bits per pixel. 1 bit = 2 colours, 8 bits = 256 colours.
- Resolution: how many pixels, e.g. 1920 × 1080.
- Increase either one: better quality, bigger file.
- Metadata: extra information stored with the image, such as width, height and colour depth.
Try it
Paint a picture. Change the colour depth and watch the size.
Key points
Images as pixels
Before this: Binary to denary
- A bitmap image is a grid of tiny squares called pixels.
- Each pixel's colour is stored as a binary code.
- With 1 bit per pixel, there are 2 colours (e.g. black and white). With 2 bits, 4 colours.
- The number of colours = 2ⁿ, where n is the number of bits per pixel.
Colour depth and resolution
Before this: Images as pixels
- Colour depth is the number of bits used per pixel. More bits = more colours = more realistic image.
- Resolution is the number of pixels in the image, e.g. 1920 × 1080. More pixels = more detail.
- Increasing either makes the image better quality but the file bigger.
- Decreasing them gives a smaller file but lower quality.
Image metadata
Before this: Images as pixels
- Metadata is data about data: extra information stored with a file.
- For an image it includes width, height and colour depth, so the computer can display it correctly.
- It can also include the date taken, camera type and location.
- Metadata adds a little to the file size.
Key words
Say what each one means, then tap to check.
Sound
- Sample rate: samples per second, in hertz (Hz). e.g. 44,100 Hz.
- Bit depth: bits used for each sample. e.g. 16-bit.
- Duration: how many seconds long the sound is.
- Higher sample rate or bit depth: closer to the real sound, bigger file.
Try it
Change the sample rate and bit depth. How close can you get?
Key points
Sampling sound
Before this: 1.2.3Why computers use binary
- Sound is an analogue wave. Computers can only store digital (binary) data.
- To store sound, the wave's height (amplitude) is measured at regular intervals. Each measurement is a sample.
- Each sample is stored as a binary number.
- The digital version is close to the original, but not identical, because the gaps between samples are lost.
Sample rate and bit depth
Before this: Sampling sound
- Sample rate: how many samples are taken each second, in hertz (Hz). CD quality is 44,100 Hz.
- Bit depth: how many bits are used to store each sample, e.g. 16-bit.
- Higher sample rate: more samples, so closer to the original sound.
- Higher bit depth: each sample is more precise.
- Increasing either gives better quality but a bigger file.
Key words
Say what each one means, then tap to check.
Exam practice
42 questions in the style of the OCR exam, 67 marks in total. Try each one, then check the mark scheme.
Numbers: binary
Hint
Write 128, 64, 32, 16, 8, 4, 2, 1 above the bits. Add up the columns with a 1.
Convert means change it into the other form. Show your working.
1 mark: for the correct answer.
Show mark scheme
- 99
Hint
Write 128, 64, 32, 16, 8, 4, 2, 1 above the bits. Add up the columns with a 1.
Convert means change it into the other form. Show your working.
1 mark: for the correct answer.
Show mark scheme
- 240
Hint
The most significant bit is the one on the far left.
State means give a short, clear answer. You don't need to explain it.
1 mark: one answer is enough.
Show mark scheme
- 128
Hint
Start at 128. Does it fit into 45? If not, write 0 and move right. When one fits, write 1 and take it away.
Convert means change it into the other form. Show your working.
1 mark: for the correct answer.
Show mark scheme
- 00101101
Don't accept: 101101 (it must be 8 bits, with leading 0s).
Hint
Start at 128. If it fits, write 1 and take it away from 200. Carry on with what is left.
Convert means change it into the other form. Show your working.
1 mark: for the correct answer.
Show mark scheme
- 11001000
Hint
What do you get if every one of the 8 bits is a 1?
State means give a short, clear answer. You don't need to explain it.
1 mark: one answer is enough.
Show mark scheme
- 255
Numbers: adding and overflow
Hint
Add from the right. Remember 1 + 1 = 0 carry 1, and 1 + 1 + 1 = 1 carry 1. Check by converting to denary.
Add means work out the binary sum, column by column from the right. Write your carries above.
2 marks: your working can earn marks as well as the answer.
Show mark scheme
- 01010000
- (53 + 27 = 80) 1 mark for correct working with one error.
2 marks for the correct answer. 1 mark for correct working with one error.
Hint
Add from the right, writing each carry above the next column. Check: 73 + 38 = ?
Add means work out the binary sum, column by column from the right. Write your carries above.
2 marks: your working can earn marks as well as the answer.
Show mark scheme
- 01101111
- (73 + 38 = 111)
2 marks for the correct answer. 1 mark for correct working with one error.
Hint
Add as normal. What happens to a carry out of the left-most column when there are only 8 bits?
Add means work out the binary sum, column by column from the right. Write your carries above.
3 marks: your working can earn marks as well as the answer.
Show mark scheme
- 8-bit result 01000000.
- Overflow has occurred.
- 192 + 128 = 320, which is more than 255 / needs 9 bits.
Also accept: Showing the 9-bit answer 101000000, with the left-most bit marked as lost.
Don't accept: "The answer is wrong" with no reason.
1 mark for each point.
Hint
What is the biggest number 8 bits can hold? What happens if an answer is bigger?
State means give a short, clear answer. You don't need to explain it.
1 mark: one answer is enough.
Show mark scheme
- When the result of a calculation is too big to be stored in the available bits.
Numbers: binary shifts
Hint
Move every bit 3 places left and fill the gaps with 0s. Each place left multiplies by 2.
Carry out means do each step and show your working.
2 marks: your working can earn marks as well as the answer.
Show mark scheme
- 00101000
- Multiplied by 8 (5 40).
1 mark for the binary, 1 mark for the effect.
Hint
Move every bit 1 place right. What happens to the 1 on the far right?
Carry out means do each step and show your working.
2 marks: your working can earn marks as well as the answer.
Show mark scheme
- 00000110 (6).
- The right-most 1 is lost, so 13 ÷ 2 gives 6, not 6.5.
1 mark for the binary, 1 mark for the explanation.
Numbers: hexadecimal
Hint
Compare writing 11111111 with writing FF. Which is easier for a person?
Give means give a short, clear answer. You don't need to explain it.
2 marks: make 2 separate points.
Show mark scheme
- Shorter / easier to read.
- Easier to remember.
- Fewer mistakes when writing / copying.
- Easy to convert to binary.
Don't accept: "Computers use hex" or "it takes less memory". Computers still store everything in binary.
1 mark each, max 2
Hint
A is 10. Count on from there.
State means give a short, clear answer. You don't need to explain it.
1 mark: one answer is enough.
Show mark scheme
- 12
Hint
First digit × 16, then add the second digit. A is 10.
Convert means change it into the other form. Show your working.
1 mark: for the correct answer.
Show mark scheme
- 164
Hint
How many 16s go into 95? That is the first digit. The remainder is the second digit.
Convert means change it into the other form. Show your working.
1 mark: for the correct answer.
Show mark scheme
- 5F
Hint
F is 15. So 15 × 16, plus 15.
Convert means change it into the other form. Show your working.
1 mark: for the correct answer.
Show mark scheme
- 255
Hint
Split it into two groups of 4 bits. Turn each group into one hex digit.
Convert means change it into the other form. Show your working.
2 marks: your working can earn marks as well as the answer.
Show mark scheme
- 5
- E, giving 5E.
1 mark per digit
Hint
Turn each hex digit into 4 bits, using 8, 4, 2, 1. B is 11.
Convert means change it into the other form. Show your working.
2 marks: your working can earn marks as well as the answer.
Show mark scheme
- 1011
- 1001, giving 10111001.
1 mark per nibble
Characters
Hint
The codes are in order: a, b, c, d.
State means give a short, clear answer. You don't need to explain it.
1 mark: one answer is enough.
Show mark scheme
- 100
Hint
Think about the full list of characters a computer can use, and what each one is given.
Explain means say what happens and why. Words like “because” and “so” help.
2 marks: aim for 2 things said, such as a point and then the reason for it.
Show mark scheme
- A defined list of characters a computer can represent…
- …each with a unique binary code.
1 mark for each point.
Hint
Each extra bit doubles the number of codes. Work out 2 to the power of 7.
State means give a short, clear answer. You don't need to explain it.
1 mark: one answer is enough.
Show mark scheme
- 128
Hint
How many characters can ASCII store? Is that enough for every language in the world?
Explain means say what happens and why. Words like “because” and “so” help.
2 marks: aim for 2 things said, such as a point and then the reason for it.
Show mark scheme
- ASCII couldn't represent enough characters…
- …for other languages / symbols / emoji.
Don't accept: "Unicode uses more bits" on its own. Say why more bits were needed.
1 mark for each point.
Hint
Unicode uses more bits for each character. What does that do to a file?
Give means give a short, clear answer. You don't need to explain it.
1 mark: one answer is enough.
Show mark scheme
- Uses more bits per character, so files are larger.
Images
Hint
Zoom right into a photo. What are the tiny squares called?
State means give a short, clear answer. You don't need to explain it.
1 mark: one answer is enough.
Show mark scheme
- The smallest single point / element of an image.
Hint
Number of colours = 2 to the power of the number of bits.
State means give a short, clear answer. You don't need to explain it.
2 marks: make 2 separate points.
Show mark scheme
- 2³
- = 8 colours.
1 mark for the working, 1 mark for the answer.
Hint
Resolution is how many pixels. More pixels means what for the picture, and for the file?
Explain means say what happens and why. Words like “because” and “so” help.
2 marks: aim for 2 things said, such as a point and then the reason for it.
Show mark scheme
- More pixels, so more detail / better quality.
- Larger file size.
Don't accept: "The image is bigger on the screen". Resolution is the number of pixels, not the size it is shown at.
1 mark for each point.
Hint
Number of colours = 2 to the power of the number of bits.
State means give a short, clear answer. You don't need to explain it.
1 mark: one answer is enough.
Show mark scheme
- 256
Hint
What would a computer need to know before it could draw the image? What else does a camera save?
Give means give a short, clear answer. You don't need to explain it.
2 marks: make 2 separate points.
Show mark scheme
- Width.
- Height.
- Colour depth.
- Date / time taken.
- Location / camera model.
1 mark each, max 2
Hint
Without it, how would the computer know where each row of pixels ends?
Explain means say what happens and why. Words like “because” and “so” help.
1 mark: one point, with the reason.
Show mark scheme
- So the computer knows how to display it, e.g. its width / height / colour depth.
Sound
Hint
Three steps: what is measured, how often, and how each measurement is stored.
Describe means say what it is like or what happens. Make each point a separate fact.
3 marks: make 3 separate points.
Show mark scheme
- The sound wave is sampled / amplitude measured…
- …at regular intervals.
- Each sample is stored as a binary number.
Also accept: Mentions the sample rate (how often samples are taken) or the bit depth (bits per sample).
Don't accept: "The sound is recorded" with no detail.
1 mark for each point.
Hint
More samples each second means what for the quality, and what for the file?
Explain means say what happens and why. Words like “because” and “so” help.
2 marks: aim for 2 things said, such as a point and then the reason for it.
Show mark scheme
- More samples per second, so closer to the original / better quality.
- Larger file size.
Don't accept: "The sound is louder". The sample rate changes the quality, not the volume.
1 mark for each point.
Hint
It counts samples per second, like clock speed counts cycles per second.
State means give a short, clear answer. You don't need to explain it.
1 mark: one answer is enough.
Show mark scheme
- Hertz (Hz).
Mixed questions on the whole page
Hint
Write 128, 64, 32, 16, 8, 4, 2, 1 above the bits. Add up the columns with a 1.
Convert means change it into the other form. Show your working.
1 mark: for the correct answer.
Show mark scheme
- 150
Hint
Start at 128 and work right. If the column fits, write 1 and take it away.
Convert means change it into the other form. Show your working.
1 mark: for the correct answer.
Show mark scheme
- 01001101
Don't accept: 1001101 (it must be 8 bits).
Hint
First digit × 16, then add the second digit. F is 15.
Convert means change it into the other form. Show your working.
1 mark: for the correct answer.
Show mark scheme
- 63
Hint
Split it into two nibbles: 1101 and 1010. Turn each one into a hex digit.
Convert means change it into the other form. Show your working.
2 marks: your working can earn marks as well as the answer.
Show mark scheme
- D (for 1101)
- A (for 1010), giving DA.
1 mark per correct digit
Hint
Add from the right. Is there a carry out of the left-most column? What happens to it?
Add means work out the binary sum, column by column from the right. Write your carries above.
3 marks: your working can earn marks as well as the answer.
Show mark scheme
- 8-bit result 00100010.
- An overflow error has occurred.
- The answer (290) is bigger than 255 / needs 9 bits, so the extra bit is lost.
Also accept: Showing the answer as 1 00100010, with the 9th bit marked as the overflow.
Don't accept: "The answer is wrong" with no reason. Say that it needs more than 8 bits.
1 mark for each point.
Hint
Move every bit 2 places left and fill the gaps with 0s. Each place left multiplies by 2.
Carry out means do each step and show your working.
2 marks: your working can earn marks as well as the answer.
Show mark scheme
- 01010100
- The number is multiplied by 4 (21 becomes 84).
1 mark for the binary, 1 mark for the effect.
Hint
How many characters can ASCII represent? Will that be enough for people all around the world?
Explain means say what happens and why. Words like “because” and “so” help.
2 marks: aim for 2 things said, such as a point and then the reason for it.
Show mark scheme
- Unicode uses more bits per character.
- So it can represent many more characters.
- Including characters from other languages / alphabets / emoji.
- ASCII can only represent English characters.
1 mark each, max 2
Hint
More bits per pixel gives more what? And what happens to the file?
Explain means say what happens and why. Words like “because” and “so” help.
2 marks: aim for 2 things said, such as a point and then the reason for it.
Show mark scheme
- More colours can be represented / better image quality.
- More bits per pixel, so a bigger file size.
Don't accept: "The image has more pixels". That is resolution, not colour depth.
1 mark for each point.
Hint
What does the sample rate count? What does more of those do to the stored wave, and to the file?
Explain means say what happens and why. Words like “because” and “so” help.
3 marks: aim for 3 things said, such as a point and then the reason for it.
Show mark scheme
- More samples are taken each second…
- …so the gaps between samples are smaller / the stored wave is closer to the real sound.
- Drawback: the file is bigger / needs more storage / takes longer to download.
Don't accept: "It is louder" or "it is clearer" with no reason. Say that more samples are taken each second.
Don't accept: "The bit depth is higher". Only the sample rate has changed.
1 mark for each point.