Question 1
A bitmap image is represented as a grid of pixels.
State what is meant by the term pixel.
[1 mark]
Answer
State the maximum number of different colours that can be used if a bitmap image has a colour depth of six bits.
[1 mark]
Answer
What is the minimum file size for an 800 pixel by 1000 pixel bitmap image that uses 20 different colours? You should give your answer in kilobytes.
You should show your working.
[3 marks]
Answer
The algorithm shown in Figure 1 converts binary data entered as a string by the user into a representation of a black and white image.
The algorithm uses the + operator to concatenate two strings. Characters in the string are indexed starting at zero. For example bdata[2] would access the third character of the string stored in the variable bdata The MOD operator calculates the remainder after integer division, for example 17 MOD 5 = 2
Figure 1
Complete the trace table for the algorithm shown in Figure 1 when the variable bdata is given the following value from the user: 110101
You may not need to use every row in the table. The algorithm output is not required.
[3 marks]
Answer