File-Size Calculations

For GCSE Computer Science you need to calculate the size of various types of file - text, image and sound. Before answering the questions you might also like to watch some demonstrations of file-size calculations.

File Contents

Before you think about calculating the size of the file, it's helpful to think about the contents of the file represent:

Note that metadata in image and sound files will add to the size, but possibly not as much as you've been told.

Calculations

What will affect the size of the file?

The short answer is that you just multiply all the numbers together together - but it's better to understand why that works. Just be careful to check which units are expected.

Colour-Depth/Bit-Depth

Image files use a number of bits to represent each pixel - this is known as the colour-depth. The wording used to describe sound recordings varies according to the exam board. The OCR and Edexcel specifications uses the term bit depth, but AQA refers to bit depth as sample resolution (a term also used by download sites such as Qobuz). The only measurement mentioned in the Eduqas specification is sampling rate. Elsewhere I've also seen the term sample size used to describe the bit rate or resolution.

The number of colours or distinct sample sizes that can be represented with n bits is 2n. The Range of Binary Values page helps you to investigate this and visualise the impact of changing the number of bits used. If the question requires you to calculate how many bits are required to represent a given number of colours, you need to reverse the process - increase the number of bits, and calculate how many colours that would represent, until you get a number that's at least as big as the number of colours required. For example, if you're asked to calculate the colour-depth needed for 30 colours, then 1 bit allows two colours, 2 allows four, 3 allows eight, 4 allows sixteen and 5 allows thirty-two - i.e. you need 5 bits.

Questions

Type your answers into the boxes and click the Check button to see whether they are correct. These questions use a more realistic range of numbers than you will encounter on the paper, so you can use a calculator if you want to - but you won't be able to use one in the exam.