Representing Text, Sound, Images and Storage: Computer Science 0478 (Cambridge O Level / IGCSE)

Syllabus 1.2, 1.3 · Strand 1 Data representation

Questions
10
Total marks
53
Tier mix
10 Core

0 of 10 questions completed

Quick-fire this topic Practice set

Syllabus coverage

  • 1.2 6 questions
  • 1.3 7 questions

Text, sound and images all reach the same destination as binary, but each is converted differently before storage (syllabus 1.2). A character set such as ASCII or Unicode assigns every letter, digit and symbol a unique binary code, with Unicode using more bits per character so it can also cover emojis and non-Latin scripts. Sound is captured by sampling a wave thousands of times a second; the sample rate is how often it is measured and the sample resolution is how many bits describe each sample, so both push up accuracy and file size together. An image is a grid of pixels, where resolution counts the pixels and colour depth counts the bits used to describe each one’s colour.

Because higher quality always means a larger file (syllabus 1.3), candidates need to calculate file size from given resolution, sample rate or colour depth, and to compare compression methods: lossless compression, such as run length encoding, shrinks a file without discarding any data, while lossy compression permanently removes some detail for a much smaller result.

The exam-style questions below are original, written to match this syllabus objective, and each is followed by a full worked solution so you can check your method step by step.

Question 1

Multiple choice 1 mark

A website developer is choosing a character set to store customer reviews that may include text in several different languages and emoji symbols.

Which statement about the ASCII and Unicode character sets is correct?

Question 2

Structured 7 marks

A weather-monitoring drone has a camera that captures still images of cloud cover. Each image is stored with a resolution of 480 pixels by 320 pixels and a colour depth of 24 bits.

(a) State what is meant by the resolution of an image. [1]

(b) State what is meant by the colour depth of an image. [1]

(c) Calculate the file size of one image, in bytes. Show all your working. [3]

(d) Give the file size of one image in kibibytes (KiB). [2]

Question 3

Structured 9 marks

A voice-messaging app records short audio clips sent between users. One voice message is 3 seconds long and is recorded with a sample rate of 8000 Hz and a sample resolution of 16 bits.

(a) State what is meant by sample rate and by sample resolution. [2]

(b) Calculate the file size of the voice message, in bytes. Show all your working. [3]

(c) The app developer decides to increase the sample resolution used for new recordings to 32 bits, keeping the sample rate and the length of the message the same. Calculate the new file size, in bytes. [2]

(d) Give one advantage and one disadvantage, for the user, of the app recording future voice messages using this higher sample resolution. [2]

Question 4

Structured 8 marks

A satellite research station stores one day's sensor readings as a single uncompressed sound recording for later analysis. The uncompressed recording has a file size of 5 gibibytes (GiB).

(a) State how many mebibytes (MiB) are equal to 5 gibibytes (GiB). [1]

(b) Before transmitting the recording to a base station, the satellite compresses it using lossless compression, reducing the file size to 3840 mebibytes (MiB). Calculate the percentage reduction in file size caused by the compression. Show all your working. [3]

(c) Explain why lossless compression, rather than lossy compression, is the more suitable choice for compressing this sensor data. [2]

(d) One method of lossless compression is run-length encoding (RLE). Describe how RLE could reduce the file size of a sensor reading that contains many repeated identical values in sequence. [2]

Question 5

Multiple choice 1 mark

A scanned copy of a black-and-white document contains large blocks of a single colour, such as wide plain margins. The document needs to be compressed before it is emailed, without permanently losing any of the original scanned data.

Which compression method would achieve this?

Question 6

Structured 8 marks

A retro text-adventure game stores its dialogue as plain text, using a custom character set that contains exactly 256 different symbols (letters, digits, punctuation and a few special game symbols).

(a) State the minimum number of bits needed to represent each of the 256 symbols in this character set, showing how you arrived at your answer. [2]

(b) One screen of dialogue contains 300 characters. Calculate the file size of this screen, in bytes. [2]

(c) The game contains 400 screens of dialogue, each exactly 300 characters long. Calculate the total file size of all the dialogue, in kilobytes (kB), using 1 kB = 1000 bytes. [3]

(d) State one advantage of using this 256-symbol character set, rather than Unicode (which can use up to 32 bits per character), for storing this game's dialogue. [1]

Question 7

Multiple choice 1 mark

A digital art app lets the user choose from a palette of exactly 16 different colours for each pixel of an image.

What is the minimum colour depth, in bits, needed to represent 16 different colours per pixel?

Question 8

Structured 9 marks

A fax machine scans a single row of a black-and-white document as 60 individual pixels, each of which is either black or white. Before any compression, each pixel is stored using 1 bit (0 for white, 1 for black).

The scanned row consists of four runs of pixels, in this order:

  • 15 white pixels
  • 20 black pixels
  • 10 white pixels
  • 15 black pixels

The fax machine then applies run-length encoding (RLE) to compress the row. Each run is stored as one code made up of: 1 bit for the colour, followed by 8 bits for the count of pixels in that run (an 8-bit count can record run lengths from 0 up to 255).

(a) Calculate the uncompressed file size of the pixel row, in bits. [1]

(b) Calculate the file size of the RLE-encoded row, in bits, showing your working for one run code. [3]

(c) Calculate the percentage reduction in file size achieved by the RLE encoding. Show all your working. [3]

(d) State how many pixels are described in total by the four RLE run codes, and explain how this confirms that no image data has been lost by the compression. [2]

Question 9

Multiple choice 1 mark

A software company distributes a program to customers as an executable installer file. When the company compresses this installer file for download, it always uses lossless compression, and never lossy compression.

Which statement best explains why lossless compression, rather than lossy compression, must be used for the installer file?

Question 10

Structured 8 marks

A podcast studio records an interview in stereo, meaning two separate audio channels (left and right) are sampled at the same time, rather than the single channel used for a mono recording. Both channels use a sample rate of 44,100 Hz and a sample resolution of 16 bits. The recording lasts exactly 2 minutes.

(a) State how many channels are recorded in this stereo recording, and explain why recording in stereo affects the file size compared with a mono recording made with the same sample rate, sample resolution and duration. [2]

(b) Calculate the file size of the 2-minute stereo recording, in bytes. Show all your working. [4]

(c) Give the file size of the recording in mebibytes (MiB), to 2 decimal places. [2]