Number of colours from the colour depth

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

This Number of colours from the colour depth worksheet is part of the IGCSE Computer Science 0478 — 1.2 Text, Sound and Images journey. Print it as a booklet?

Number of colours from the colour depth

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. A colour depth of 2 bits allows how many different colours?
A 4 colours
B 2 colours
2. A colour depth of 8 bits allows how many different colours?
A 64 colours
B 256 colours
3. Which formula gives the number of colours for a colour depth of n bits?
A 2^n
B n^2
4. An image has its colour depth increased from 3 bits to 4 bits. What happens to the number of colours?
A It doubles from 8 to 16
B It goes up by 1 from 8 to 9
5. A colour depth of 1 bit allows 2 colours, for example black and white. True or false: 1 bit can store 1 colour only.
A True: 1 bit gives 1 colour
B False: 1 bit gives 2 colours

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1colours = 2^n AAn 8-bit colour depth allows 256 different colours
22^8 = 256 B2^4 = 2 * 2^3
3A 2-bit colour depth gives 4 different colours C2^2 = 4
4Adding one extra bit doubles the number of colours (3 bits to 4 bits: 8 to 16 colours) DThe wrong power was used. The power is the number of bits, so 2 bits give 2^2 = 4 colours.
5colours = 2 * n (n = 8 gives 16 colours) EThe colours are found by multiplying n by 2, but the correct rule is 2 to the power n. 8 bits give 2^8 = 256 colours, not 16.
62 bits = 2^3 = 8 colours FA colour depth of n bits gives 2 to the power n different colours

Definitions

colours = 2^n

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
colours = 2 _ bits
2.
2 bits give 2 ^ 2 = _ colours
3.
8 bits give 2 ^ 8 = ___ colours
4.
bits = bits + 1 colours = colours * _
5.
bits = 4 colours = _ ^ bits print(colours)

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A depth ← 3
B colours ← 2 ^ depth
C OUTPUT "Colours:"
D OUTPUT depth
Question 2
A colours ← 1
B FOR i ← 1 TO 2
C colours ← colours + 2
D NEXT i
E OUTPUT colours
Question 3
A depth ← 8
B colours ← depth ^ 2
C OUTPUT colours
Question 4
A INPUT colours
B colours ← 2 ^ bits
C OUTPUT colours
Question 5
A old ← 2 ^ 2
B new ← 2 ^ 3
C ratio ← new - old
D OUTPUT ratio

Answer Key

Number of colours from the colour depth
Section A: Quick Questions
Q1
A — 4 colours
Q2
B — 256 colours
Q3
A — 2^n
Q4
A — It doubles from 8 to 16
Q5
B — False: 1 bit gives 2 colours
Section B: Match the Pairs
Q1
colours = 2^n → A colour depth of n bits gives 2 to the power n different colours
Q2
2^8 = 256 → An 8-bit colour depth allows 256 different colours
Q3
A 2-bit colour depth gives 4 different colours → 2^2 = 4
Q4
Adding one extra bit doubles the number of colours (3 bits to 4 bits: 8 to 16 colours) → 2^4 = 2 * 2^3
Q5
colours = 2 * n (n = 8 gives 16 colours) → The colours are found by multiplying n by 2, but the correct rule is 2 to the power n. 8 bits give 2^8 = 256 colours, not 16.
Q6
2 bits = 2^3 = 8 colours → The wrong power was used. The power is the number of bits, so 2 bits give 2^2 = 4 colours.
Section C: Definitions
Q1
colours = 2^n — 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.
Section D: Fill in the Blanks
Q1
colours = 2 ^ bits
Q2
2 bits give 2 ^ 2 = 4 colours
Q3
8 bits give 2 ^ 8 = 256 colours
Q4
bits = bits + 1 colours = colours * 2
Q5
bits = 4 colours = 2 ^ bits print(colours)
Section E: Spot the Error
Q1
D — 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.
Q2
C — 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.
Q3
B — The formula is 2 to the power of the colour depth, so the base is 2 and the power is the depth. It should be colours ← 2 ^ depth, giving 256, not depth ^ 2, which gives 64.
Q4
A — The user should enter the colour depth (bits), which is then used in the calculation. Inputting colours leaves bits with no value. It should be INPUT bits.
Q5
C — To show that one extra bit doubles the colours, divide the new number of colours by the old number (8 / 4 = 2). It should be ratio ← new / old, not subtraction.