Number of colours from the colour depth
A colour depth of n bits gives 2^n different colours, so each extra bit doubles the number. For example, 2 bits give 4 colours and 8 bits give 256 colours.
Understanding Number of colours from the colour depth in IGCSE Computer Science Paper 1
What it does: 2 bits make the combinations 00, 01, 10 and 11, which is 2^2 = 4 colours. Each extra bit multiplies the colours by 2, so 2^4 is double 2^3 (16 is double 8). 2^8 = 256. Each pixel uses 8 bits, so there are 256 different bit patterns. The number of colours is 2 to the power n. For example, 3 bits give 2^3 = 8 colours, but 3^2 would wrongly give 9. 1 bit can be 0 or 1, so 2^1 = 2 colours. This is the same as how many values n bits can store. Adding one bit always doubles the colours: 2^2 = 4 and 2^3 = 8, so 4 more colours are added.
Common mistakes: The program should output the number of colours, which is stored in colours. Outputting depth would only show the number of bits (3), not the 8 colours. It should be OUTPUT colours. Each extra bit doubles the number of colours, so the loop must multiply by 2, not add 2. It should be colours ← colours * 2, which gives 4 colours for 2 bits.
Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.
This module's key terms are also in a printable crossword (Modules 43–58) and word search (Modules 28–58).
Take this worksheet further — free with Cloodit
Each concept is reinforced from every angle — learned, then applied, then tested.
Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.
Over 100 of them, across seven natural biomes.
Turns their work into revision material ready for Flash Cards and Exam study.
Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.
Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.
Quick Questions
Match the Pairs
Key Term
colours = 2^nFill in the Blanks
Spot the Error
Student with a class code? Join your class →