Data Representation: Images, Sound and Compression - Worksheets, Questions and Revision

20 original exam-style questions - 11 pages of questions with a full mark scheme - free printable PDF.

Download PDFJump to mark scheme (page 12)Read the revision guide
« Previous: Data Representation: Number SystemsNext: Programming Practice: Writing and Refining Programs »
Revision Library
revisionlibrary.co.uk
GCSE · Data Representation

P2.6 Data Representation: Images, Sound and Compression

OCR J277 · Calculators not allowed · about 115 minutes
Total Marks
Name: _______________________________    Date: ____ / ____ / ______
Answer ALL questions. Show all your working.
1
Digital images are made up of a grid of picture elements.
(a)Define the term 'pixel'.(1)
(b)A photograph has a resolution of 1200 x 800. State what the two numbers in this resolution represent.(1)
(c)Calculate the total number of pixels in the photograph described in part (b).(2)
(Total for Question 1 is 4 marks)
2
Colour depth affects how many different colours a bitmap image can display.
(a)Define the term 'colour depth'.(1)
(b)An image uses a colour depth of 4 bits per pixel. Calculate the maximum number of different colours that can be represented.(2)
(c)Circle the letter next to the colour depth that would allow an image to store the greatest number of different colours.(1)
  • A) 1 bit
  • B) 2 bits
  • C) 4 bits
  • D) 8 bits
(Total for Question 2 is 4 marks)
3
An image editing program uses a palette of 32 different shades of grey. Each shade is given an index number, which is stored using binary.
(a)Calculate the minimum number of bits needed to store a palette index for one of the 32 shades. Show your working.(2)
(b)Convert the denary palette index 19 into binary, using the number of bits found in part (a).(2)
(c)One pixel stores the binary value 11010 as its palette index. Convert this binary value to hexadecimal.(2)
(Total for Question 3 is 6 marks)
4
A bitmap image is 320 pixels wide and 240 pixels high. Each pixel is stored using a colour depth of 8 bits.
(a)State the number of different colours that a colour depth of 8 bits can represent.(1)
(b)Show that the uncompressed image requires 614400 bits of storage.(2)
(c)Calculate the size of the uncompressed image in kilobytes (KB). Use 1 byte = 8 bits and 1 KB = 1000 bytes.(2)
(Total for Question 4 is 5 marks)
5
Digital photographs usually store extra information alongside the pixel data, called metadata.
(a)State what is meant by the term 'metadata'.(1)
(b)Give two examples of metadata that might be stored with a digital photograph.(2)
(c)State one reason why storing metadata increases the overall file size of a photograph.(1)
(Total for Question 5 is 4 marks)
6
Sound is recorded by sampling an analogue sound wave at regular intervals.
(a)Define the term 'sample rate'.(1)
(b)Define the term 'bit depth' in the context of sound recording.(1)
(c)State the effect on the recorded sound of increasing the sample rate used.(1)
(d)State one drawback of increasing the sample rate.(1)
(Total for Question 6 is 4 marks)
7
A mono sound clip is recorded with a sample rate of 8000 Hz and a bit depth of 8 bits. The clip lasts 3 seconds.
(a)Calculate the total number of samples taken during the recording.(2)
(b)Calculate the file size of the recording in bits.(2)
(c)Calculate the file size of the recording in kilobytes (KB). Use 1 byte = 8 bits and 1 KB = 1000 bytes.(2)
(Total for Question 7 is 6 marks)
8
A sound engineer is deciding on recording settings for a podcast that will be streamed to mobile phones.
(a)Explain the effect of recording in stereo instead of mono on the file size of the podcast.(2)
(b)Explain why the sound engineer might choose a lower bit depth for the podcast than a professional music studio would use for a music recording.(2)
(Total for Question 8 is 4 marks)
9
Files can be compressed using lossy or lossless compression.
(a)Define 'lossy compression'.(1)
(b)Define 'lossless compression'.(1)
(c)Give one example of a file format that commonly uses lossy compression.(1)
(d)State one situation where lossless compression would be more suitable than lossy compression, and justify your answer.(2)
(Total for Question 9 is 5 marks)
10
A single row of a black and white bitmap image is 12 pixels wide, shown below (W = white pixel, B = black pixel):
W W W W W B B B W W W W
(a)State what run-length encoding (RLE) is used for.(1)
(b)Use run-length encoding to encode the row of pixels above. Give your answer in the form (run length)(colour).(2)
(c)State one type of image for which RLE would achieve a high compression ratio, and one type for which it would not.(2)
(Total for Question 10 is 5 marks)
11
A row of pixels has been run-length encoded as: 6W 2B 6W
The original (uncompressed) row used 1 byte to store the colour of each pixel. The encoded version above uses 2 bytes for each run (1 byte for the run length number and 1 byte for the colour letter).
(a)Decode this run-length encoded data to show the original row of pixels.(2)
(b)Calculate the compression ratio of the encoded row compared to the original uncompressed row, giving your answer in the form n:1 (original size : encoded size).(3)
(Total for Question 11 is 5 marks)
12
A text file contains the following phrase, which is to be compressed using Huffman coding: AAAABBBCCD
(a)Explain what is meant by 'dictionary coding' as a method of lossless compression.(2)
(b)Complete a frequency table showing how many times each character (A, B, C, D) appears in the phrase AAAABBBCCD.(2)
(c)Explain why characters that occur more frequently, such as 'A', are given shorter binary codes in Huffman coding.(2)
(Total for Question 12 is 6 marks)
13
A programmer is writing a program, in the OCR Exam Reference Language, that helps photographers estimate storage needs. The program should input the width, height and colour depth (in bits) of a photo, calculate the file size in bytes, and output the result to the user.
Write pseudocode for this program.
(Total for Question 13 is 6 marks)
14
Table 1 shows the file size of the same photograph saved in three different ways.
Table 1 Version File size (KB) Original (uncompressed) 4800 Lossless compressed 3200 Lossy compressed 800
(a)Calculate the compression ratio of the lossless compressed version compared to the original, giving your answer in the form n:1.(2)
(b)Calculate the percentage reduction in file size achieved by the lossy compressed version compared to the original.(3)
(Total for Question 14 is 5 marks)
15
A small business owner is building a website to sell handmade jewellery. She needs to include high-quality product photographs and a short looping background music clip. Storage space and page loading speed are both important to her.
Discuss the compression choices the business owner should make for the images and the sound file on her website, and the impact of these choices on the customer's experience.
(Total for Question 15 is 6 marks)
16
A programmer has written the following algorithm, using the OCR Exam Reference Language, to decode run-length encoded data. Arrays are indexed from 0 and LEN(array) returns the number of items in the array.
runLengths = [4, 2, 3]
symbols = ["W", "B", "W"]
output = ""
FOR i = 0 TO LEN(runLengths) - 1
    count = 0
    WHILE count < runLengths[i]
        output = output + symbols[i]
        count = count + 1
    ENDWHILE
NEXT i

OUTPUT output
i runLengths[i] symbols[i] output (after inner loop) 0 1 2
(a)Complete the trace table below to show the value of output after the inner WHILE loop finishes, for each pass of the outer FOR loop.(4)
(b)State the final value output by the program once the whole algorithm has finished running.(1)
(Total for Question 16 is 5 marks)
17
A file contains only the following characters, with these frequencies:
E: 8 T: 5 A: 3 O: 2
A Huffman tree is to be built to assign binary codes to each character, with the most frequent characters given the shortest codes.
(a)Describe the general method used to build a Huffman tree from a frequency table.(3)
(b)Using the frequencies given, calculate the total number of bits needed to store the whole file if a fixed-length binary code were used for every character instead of Huffman coding.(3)
(Total for Question 17 is 6 marks)
18
Using the same frequencies as the previous question (E: 8, T: 5, A: 3, O: 2), Huffman coding was used to generate the following variable-length codes:
E = 0 T = 10 A = 110 O = 111
(a)Calculate the total number of bits needed to store the whole file using these Huffman codes.(3)
(b)Calculate the number of bits saved by using Huffman coding compared to the fixed-length code from the previous question, and hence calculate the percentage saving in file size.(3)
(Total for Question 18 is 6 marks)
19
A hospital stores digital X-ray images for diagnosis, and also stores short video clips of ultrasound scans for training purposes.
Evaluate whether lossy or lossless compression would be more appropriate for each of these two types of file, justifying your answer with reference to the consequences of data loss and the practical constraints of storage and transmission.
(Total for Question 19 is 6 marks)
20
A video call application sends both image frames and sound at the same time.
Each video frame is 640 x 480 pixels with a colour depth of 16 bits per pixel. The application sends 2 frames every second.
The sound is sampled at 8000 Hz with a bit depth of 16 bits, recorded in stereo (2 channels).
(a)Calculate the number of bits needed to store one uncompressed video frame.(2)
(b)Calculate the total number of bits of video data sent in one second, given that 2 frames are sent per second.(1)
(c)Calculate the number of bits of sound data generated in one second.(2)
(d)Calculate the total combined number of bits per second (video and sound together) that the application must transmit, and hence explain why real-time video calls almost always use compression.(3)
(Total for Question 20 is 8 marks)
Mark scheme · P2.6 Data Representation: Images, Sound and Compression

Question 1

Question 2

Question 3

Question 4

Question 5

Question 6

Question 7

Question 8

Question 9

Question 10

Question 11

Question 12

Question 13

Question 14

Question 15

Question 16

Question 17

Question 18

Question 19

Question 20