Data Representation Homework #01 - Answers: A) 1100 B) 111010 C) 1010010 D) 10011 E) 101101

Download as pdf or txt
Download as pdf or txt
You are on page 1of 67

IGCSE CS 0984

Chapter 01 – Data Representation


Homework #01 - Answers
Question 1

Convert the following decimal numbers to binary:


a) 12
b) 58
c) 82
d) 19
e) 45

a) 1100
b) 111010
c) 1010010
d) 10011
e) 101101
Question 2

The IP address of a computer is stored as a set of four 8-bit binary numbers.


The network administrator converts each binary number into hexadecimal. Complete the table to
show the hexadecimal equivalent of the binary IP address. The first number has already been
converted.
Binary IP address

11000100 00010000 11111110 00001001

Hexadecimal

C4 10 FE 09

Explain why the network administrator uses hexadecimal.


▪ Easier / simpler to remember / write down
▪ // quicker to transcribe
▪ Less likely to make error
▪ Less digits to use
Question 3

What is the largest decimal number that can be represented in binary with eight bits?
28-1=255
Question 4

Determine the weight of the 1 in the binary number 10000.


16

1
IGCSE CS 0984

Question 5 (a)

The photographer takes up to 2000 photographs per week. Each photograph requires 5 MB of
storage on the camera’s memory card. Select the camera memory card with the smallest capacity
that can store 2000 photographs. Indicate your answer by putting a cross in the box.

Capacity (GB)
A 4
B 8
C 16
D 32
Question 5 (b)

At the end of each week, the photographer transfers the photographs from the camera’s memory
card to his computer’s hard drive. Explain how to calculate the time it will take to transfer 2000
photographs.

Number of bits = 5 x 2000 x 1024 x 1024x8


Time = Number of bits/transfer rate

Question 6

An alarm system sensor embedded in a baby’s clothing is used to measure its heart rate.
(a) A digital display shows the baby’s heart rate in beats per minute (bpm). Each digit in the
display is represented as a 4-bit binary code. For example:

1 0

0 0 0 1 0 0 0 0
1 0

(b) Complete the table to show how a heart rate of 95 bpm is represented.

1 0 0 1 0 1 0 1
9 5
(c) Complete the table to show what heart rate is being displayed.

0 1 1 1 0 0 1 0
7 2

2
IGCSE CS 0984

Question 7

Dima has agreed to send Michaela a 20 megabyte file. They both have a broadband connection.
Dima has to upload his file to a server and then Michaela needs to download it from the same
server. The broadband data transfer rates (speeds) are:

1 megabits per second to upload a file


8 megabits per second to download a file

(a) How long does it take to upload Dima’s file?

1 megabits/second = 0.125 Mbyte/second


20 Mbyte file takes 20/0.125 seconds
160 seconds
(b) How long does it take to download Dima’s file?
8 megabits/second = 1 Mbyte/second
20 Mbyte file takes 20/1 seconds
20 seconds

3
IGCSE CS 0984

Question 8

A digital light meter has a 3-digit LCD. The value of each digit on the instrument display is stored
as a 4-bit binary number in a register. For example:

(a) What value is shown on the display if the 4-bit binary registers contain:

(b) What would be stored in the 4-bit binary registers if the display shows:

4
IGCSE CS 0984

(c) If any of the 4-bit binary registers X, Y or Z contain the value 1 1 1 1 this indicates an error.
How could this error be shown on the instrument display?
▪ E, E, E
▪ Flashing display or digits
(d) What cause the error to occur?
▪ a fault in the system
▪ reading exceeded the value 999

5
IGCSE CS 0984

Question 9

Letters from the Greek alphabet are to be transferred to a computer system. Each letter can be
represented on an 8 by 8 grid. Each column has a value from 1 to 128. The value of each row is
stored in a table. The values in the column headings are used to work out the value for each row
(e.g. in our example, row 8 has the value 64 + 32 + 4 + 2 = 102). Thus, in the example below, the
letter (π) is stored as:

(a) What values would be stored in the table for the Greek character (Σ)?

row value
1 255
2 192
3 96
4 48
5 96
6 192
7 255
8 0

6
IGCSE CS 0984

(b) Draw the character formed from the following value table:

Question 10

(a) Represent binary 101111100001 in hex.


(b) Represent binary 10000111111101 in hex.

(a) BE1
(b) 21FD

Question 11

(a) Convert hex 40AA to binary


(b) Convert hex DA47 to binary

(a) 100000010101010
(b) 1101101001000111

Question 12

(a) Convert hex AD89 to denary


(b) Convert hex 12AE to denary

(a) 44425
(b) 4782

7
IGCSE CS 0984

Question 13

Convert the following binary numbers into denary:

a) 00110011
b) 01111111
c) 10011001
d) 01110100
e) 11111111
f) 00001111
g) 10001111
h) 11110000
i) 01110000
j) 11101110

a) 51
b) 127
c) 153
d) 116
e) 255
f) 15
g) 143
h) 240
i) 112
j) 238

8
IGCSE CS 0984

Question 14

A binary pattern can be used to represent a variety of different data used in a computer system. The
pattern could represent an ASCII character code. The table shows part of the ASCII code table.

Consider the binary pattern: 01001110. What character is represented by this binary pattern?

0 1 0 0 1 1 1 0
27 26 25 24 23 22 21 20

2 + 4 + 8 + 64 =78 → N
What is the hexadecimal for this binary pattern?

0 1 0 0 1 1 1 0
4 E
Question 15

Explain what is meant by an ASCII?


▪ Set of codes the computer understands
▪ Represented in a single byte/7 or 8 bits used per character
Question 16

Give two advantages for software developers for using hexadecimal rather than binary [2]
▪ Faster to key in values in hexadecimal
▪ Hexadecimal has less error prone to write code compared to binary
▪ Help software developers to locate errors in the code
Question 17

Explain what is meant by MAC address?


Unique ID for a network interface card

9
IGCSE CS 0984

Question 18

Computer memories are measured in terms of the number of bytes.


What is meant by the term byte?
▪ unit of data/memory
▪ 8 bits
▪ used to represent a character
The number of bytes in a Gigabyte can be written as 2x What is the value of x?
30
Question 19

When a key is pressed on the keyboard, the computer stores the ASCII representation of the
character typed into main memory. The ASCII representation for A is 65 (denary), for B is 66
(denary), etc. There are two letters stored in the following memory locations:

Show the contents of Location 1 and Location 2 as binary using 8 bits.

Location 1 0 1 0 0 0 0 0 1

65 / 2 = 32 R1
32 / 2 = 16 R0
16 / 2 = 8 R0
8/2=4 R0
4/2=2 R0
2/2=1 R0
1/2=0 R1

Location 2 0 1 0 0 0 0 1 1

67 / 2 = 33 R1
33 / 2 = 16 R1
16 / 2 = 8 R0
8/2=4 R0
4/2=2 R0
2/2=1 R0
1/2=0 R1

10
IGCSE CS 0984

Show the contents of Location 1 and Location 2 as hexadecimal.


Location 1
0100 0001
4 1
Therefore, location 1 contains 41 in hexadecimal

Location 2
0100 0011
4 3
Therefore, location 1 contains 43 in hexadecimal

The following machine code instruction is stored in a location of main memory:

1 1 1 1 1 0 1 0 1 0 0 1 0 1 1 1

Convert this binary pattern into hexadecimal.


1111 1010 1001 0111
F A 9 7
Therefore, the binary pattern is equal to FA97 hex
Explain why a programmer would prefer to see the contents of the locations displayed as
hexadecimal rather than binary, when debugging his program that reads the key presses.
▪ Easier to identify values in hexadecimal than binary.
▪ Easier to spot errors in hexadecimal than binary.
Question 20

Give four examples where hexadecimal numbers are used in computer science.
▪ Used in notations for colour in HTML // Used in HyperText Markup Language
(HTML)
▪ Used in MAC Media Access Control address
▪ Used in assembly language/machine code
▪ Used in debugging (displays bytes in hex when using memory dumps)
Question 21

State two benefits of using hexadecimal numbers in computer science.


▪ Can represent 16 bit words as only 4 hexadecimal digits
▪ It is easy to convert hex digits back to binary if necessary

11
IGCSE CS 0984

Question 22

A company advertises its backup memory device as having 500 GB of storage. A customer wishes
to know how many 8 MB files could be stored on the device. The company claimed that up to 62
500 files (assuming each file is 8 MB) could be stored. The customer calculated that 64 000 files
could be stored. Explain the difference between these two storage values. Show any calculations
you use in your explanation.
▪ company calculation is based on 1 GByte = 1000 MByte
▪ so (500 × 1000)/8 = 62 500 files
▪ customer calculation based on 1 GByte = 1024 MByte
▪ so (500 × 1024)/8 = 64 000 files
▪ giving the difference of 1500 files
Question 23

Characters can be represented in a computer by a numerical code.


The following list shows 16 characters with their numerical codes in denary:
a = 97 e = 101 k = 107 t = 116
b = 98 g = 103 m = 109 u = 117
c = 99 h = 104 o = 111 w = 119
d = 100 i = 105 r = 114
. = 46 (code for the full stop)
Web addresses can be written using hexadecimal rather than denary. Hexadecimal codes are
preceded by a % sign. For example, the word “c a g e” is written as:
either 99 97 103 101 (in denary)
or %63 %61 %67 %65 (in hexadecimal)
Complete the conversion of the following web address into hexadecimal:

Complete the web address from the given hexadecimal codes:

12
IGCSE CS 0984

Question 24

The following code shows HTML ‘tag’ pairs on either side of the text stating the colour that each
creates.
<font color “#FF0000“> RED </font>
<font color “#00FF00“> GREEN </font>
<font color “#0000FF“> BLUE </font>
<font color “#X“> YELLOW </font>
<font color “#Y“> MAGENTA </font>
<font color “#Z“> CYAN </font>

Yellow is a combination of red and green, magenta a combination of red and blue and cyan a
combination of green and blue. State what 6-digit hexadecimal values should replace X, Y and Z in
the above code.
X FF FF 00
Y FF 00 FF
Z 00 FF FF

Describe how other colours, such as a darker shade of blue, are created.
▪ Hex values between 0 to F are combined together to create a hex code
▪ Different combinations in hex codes will create different shades/tones/colours
Question 25

1A – 16 – C5 – 22 – FF – FF is an example of a MAC address. Identify what the first six and last
six hexadecimal digits represent.
First six digits: Manufacturer code/manufacturer ID
Last six digits: Serial number/serial ID of device/product
Question 26

State why MAC addresses are used.


Allows all devices to be uniquely identified
Question 27

Hexadecimal codes are used in MAC addresses. State what is meant by the term MAC.
Media access control
Explain what the hexadecimal code in a MAC address represents.
▪ Hardware/physical address
▪ Unique address/number associated (with network card in) a device/computer
▪ Usually 48/64 bits (12/16 hex digits)
▪ First 6/8 digits = manufacturer code/ID of device (NIC)
▪ Last 6/8 digits = serial number of device (NIC)

13
IGCSE CS 0984

Question 28

Each seat on a flight is uniquely identified on an LCD above the seat. For example, seat 035C is
shown as:

The first three characters are digits that represent the row. The fourth character is the seat position
in that row. This is a single letter, A to F, that is stored as a hexadecimal value.
Each of the four display characters can be stored in a 4-bit register. For example, 0 and C would be
represented as:

Show how the 4-bit registers would store the remaining two characters, 3 and 5.

3 0 0 1 1

5 0 1 0 1

Identify which seat is stored in the following 4-bit registers.

0 0 0 1 1
1 0 0 1 9
0 1 0 0 4
1 1 1 0 E

14
IGCSE CS 0984

Question 29

Convert the following hexadecimal number into 12-bit binary:


4AF

0 1 0 0 1 0 1 0 1 1 1 1

The 2016 Olympic Games will be held in Rio de Janeiro. A timer that counts down to the opening
of the Games is shown on a microprocessor-controlled display. The number of hours, minutes and
seconds until the Games open are held in three 8-bit registers. The present register values are:

The timer will count down in seconds.


Show the values in each 8-bit register 30 seconds after the time shown above:

0 1 1 0 1 0 0 1 hours

0 0 0 1 1 1 1 1 minutes

0 0 1 1 0 0 1 0 seconds

105 hours
31 minutes
50 seconds

15
IGCSE CS 0984

Question 30

Identify three uses for hexadecimal and for each one give an example of hexadecimal that matches
the use.
▪ Notations for colour in HTML // HTML colours
➢ e.g. blue #0000FF
▪ Display machine code/programs/memory dump
➢ e.g. 5F 3A 09 F1
▪ Display (MAC) addresses
➢ e.g. 01-23-45-67-89-AB
▪ Display ASCII/Unicode values in web address
➢ e.g %20 space is displayed in URL/ URL cannot contain spaces
▪ Display error codes
➢ e.g. error #404 page not found
Question 31

A manufacturer of aeroplane engines assigns a denary identification number (ID) to each engine.
One engine has the ID: 0431. Convert this denary number to a 12-bit binary format.
000110101111
Show how this number would be represented in hexadecimal.
1AF
The current status of the engine is sent to a computer in the aeroplane. Each piece of data collected
is 8 bytes in size. Data collection occurs every 30 seconds. Calculate the number of kilobytes that
would be needed to store the data collected during a 10-hour flight. Show your working.
Working
▪ 1200 × 8 = 9600 (bytes)
▪ 9600/1024 or 9600/1000
Answer
▪ 9.4 or 9.6 kilobytes
At the end of the flight, all of the data are sent to the aeroplane engine manufacturer using the
Internet. The computer in the aeroplane has a MAC address and an IP address.
State what is meant by MAC address
▪ Media Access Control (address)
▪ unique number that identifies a device (connected to the Internet)
▪ address is made up of manufacturer id + serial number of device
▪ address is allocated by the manufacturer

16
IGCSE CS 0984

Question 32

A computer uses an 8-bit register.


The 8-bit register contains binary integers. Write the denary (base 10) value represented by:

112
All the bits in the register are shifted one place to the right as shown below.

Write the denary number that is represented after this shift.


56
State the effect the shift to the right had on the original denary number
Divided by 2
// value 112 was halved // multiplied by 0.5
The original number is shifted three places to the right.
Show the new binary number:
00001110
Write the equivalent denary number.
14
Describe the problems that could be caused if the original binary number is shifted five places to the
right.
▪ run out of places to the right of register / at the end of register
▪ right-most 1 would be lost
▪ number would become 3 instead of 3.5
▪ loss of precision

17
IGCSE CS 0984

Question 33

The memory of a computer contains data and instructions in binary. The following instruction is
stored in a location of the memory.

Convert the instruction into hexadecimal


29FC

Explain why a programmer might prefer to read the instruction in hexadecimal rather than in binary.
▪ Easier/quicker to understand/read
▪ Easier to debug/identify errors
▪ Fewer digits are used / shorter
▪ // takes up less space on screen
▪ // more can be shown on screen / page
Give two other uses of hexadecimal.
▪ Notations for colour in HTML
▪ // HTML colour (codes)
▪ Error messages
▪ MAC address
▪ // IP address
▪ Locations in memory
▪ Memory dump
Question 34

The denary number 57 is to be stored in two different computer registers.


Convert 57 from denary to binary and show your working
32 + 16 + 8 + 1 (00)111001

Show the binary number from previous question as it would be stored in the following registers.

18
IGCSE CS 0984

A binary number stored in a register can have many different uses, for example an address in main
memory. Give two other uses for a binary number stored in a register.
▪ data
▪ ASCII value / Unicode value / character
▪ number
▪ part of image / small image
▪ a sound / sound sample / small sound track
▪ instruction
A register in a computer contains binary digits.

The contents of the register represent a binary integer. Convert the binary integer to hexadecimal.
3A

Question 35

A 32-second sound clip will be recorded. The sound will be sampled 16000 times a second.
Each sample will be stored using 8 bits.
Calculate the file size in kilobytes. You must show all of your working.
16000 × 8
128000 × 32
4096000 / 8
512000 / 1024
Correct answer:
500 kB
Question 36

A washing machine has a small display screen built into it. One use of the display screen is to show
an error code when a problem has occurred with a washing cycle. The display screen shows a
hexadecimal error code: E04
This error code means that the water will not empty out of the washing machine.
Convert this error code to binary.

19
IGCSE CS 0984

State why hexadecimal is used to display the error code


▪ Hexadecimal codes can fit in a smaller display rather than a full text based message
▪ Smaller amount of memory needed to store the hex error messages than text based
Question 37

A robot arm in a factory is programmed to move products. The binary instructions to operate the
robot arm are

The instructions are entered as hexadecimal values. An operator enters the values
9 1 C 3 F
Convert the values and write down the operation (e.g. RIGHT) carried out by the robot arm
9 – LEFT
1 – DOWN
C – OPEN
3 – CLOSE
F – UP

20
IGCSE CS 0984

Question 38

Explain the differences between the binary number system and the denary number system
▪ A binary number system is a base-2 system
▪ A denary number system is a base-10 system
▪ A binary number system uses 0 and 1 values
▪ A denary number system uses 0 to 9 values
▪ A binary number system has units/ placeholders/column headings that increase by the
power of 2
▪ A denary number system has units/ placeholders/column headings that increase by the
power of 10
▪ Binary has more digit for the same value
Question 39

Explain the process of converting the binary number 1010 into a denary number
▪ Write column headings (Powers of 2 ) (23, 22, 21,20)
▪ Place a 1 or a 0 for each column in correct position
▪ Identify the columns to be added
▪ Add together the denary values identified this will give a total which is the denary
number/answer
▪ Answer is 10

Question 40

A computer has 2048MB of RAM.


How many GB of RAM does the computer have?
Show your working.
▪ 2048/1024 (or 1024 ×2)
▪ 2 GB
Question 41

A stopwatch uses six digits to display hours, minutes and seconds. The stopwatch is stopped at

An 8-bit register is used to store each pair of digits.


Write the 8-bit binary numbers that are currently stored for the Hours, Minutes and Seconds.

21
IGCSE CS 0984

The stopwatch is started again and then stopped. When the watch is stopped, the 8-bit binary
registers show:

Write the denary values that will now be shown on the stopwatch.

Question 42

Jafar is using the Internet when he gets the message: “D03, page is not available”
Jafar remembers that hexadecimal is often used to represent binary values in error codes.
Convert the hexadecimal number in the error message into 12-bit binary.

Question 43

Represent the denary number 300 as it would be stored in a 12-bit binary register.
0001 0010 1100

Convert the denary number 179 to hexadecimal.


B3

22
IGCSE CS 0984

Question 44

Some decorative lights are made up from a cluster of red, blue, green, yellow and white LEDs. Each
colour is represented by a binary code:

A 6-bit register, R1, stores the 1-values to represent a sequence of colours. Thus, if R1 contains:

this means the blue, yellow and black colour sequence is stored and displayed in that order.
The length of time each light is on is set by a binary value in another register, R2: Thus

means each colour is on for 2 seconds.


The two registers contain the following values. What is the sequence of coloured lights and the
timing for each colour?

sequence of colours
blue green white
timing
7 seconds
What will the two registers contain if the coloured light sequence is red, green and black and the
timing is 5 seconds?

23
IGCSE CS 0984

What is the problem with trying to display green, blue, red in that order?
▪ Sequence always starts from left to right
▪ So sequence would still be red, blue then green
Question 45

A denary number can be represented as an 8-bit binary number. For example: 27 would be
represented as:

All the bits in the binary number have now been shifted (moved) one place to the left.
What denary number does this now represent?
54

What effect did the shift have on the original denary number?
Multiplied by 2

If the above binary number was shifted another one place to the left, what denary number would it
be equivalent to?
108

Represent the denary number 46 as an 8-bit binary number.

Shift this 8-bit binary number 2 places to the left. What is the denary equivalent?
184

What problem would arise if you tried to shift this 8-bit binary number 3 places to the left?
▪ No more places left in register/binary number
▪ The left most 1 bit would disappear
▪ Number would become 112 (0111 0000) instead of 368
▪ Number would be greater than 255
▪ Overflow
If any 8-bit binary number was shifted one place to the right, what would this be equivalent to?
divided by 2

24
IGCSE CS 0984

Question 46

Explain why data is stored as binary in computers.


▪ Computers use switches / logic gates
▪ Only uses 2 states / On or Off / 1 or 0
Question 47

An electronic guessing game compares denary integer values input by a user with pre-stored values.
The pre-stored values are held in 10-bit binary format.
Convert the binary values in the table to denary.

Binary Denary
0001001110 78
0110110111 439
1000000001 513

When planning the game, the designer decided to use hexadecimal notation to represent the binary
values. Explain why the designer used hexadecimal notation.
▪ Uses fewer characters // shorter
▪ Easier to read / write / understand
▪ Less likely to make mistakes // less error prone
▪ Easier to debug
State the hexadecimal equivalent of the binary value 1010110101
2B5
Question 48

Programmers can use denary and hexadecimal values. These values are stored in a computer
system using binary. Explain why binary is used to store data in a computer system.
▪ Computer consist of transistors / logic circuits
▪ … that can only store/process data in two states / as high-low / on-off / 1 and 0

25
IGCSE CS 0984

Question 49

All smartphones have a MAC address.


State what is meant by the term MAC address.
▪ Media access control
▪ Unique address given to each device
Describe the structure of a MAC address
▪ Uses hexadecimal values
▪ Normally 48/64 bits in length (accept any other reasonable value)
▪ First half is manufacturer number/code/ID
▪ Second half is serial number
Question 50

Give the smallest number of bits that can be used to store the denary value 2000.
11
Question 51

Give one way that hexadecimal is used in website development.


▪ To represent HTML colour codes
▪ In error messages
Give one way that hexadecimal is used in low-level programming.
▪ Assembly code/language
▪ Memory address locations
▪ In error messages
▪ Memory dump

26
IGCSE CS 0984

Question 52

What is the difference between analogue and digital data?

Analogue data is continuous, allowing for an infinite number of possible values. Digital data is
discrete, allowing for a finite set of values

Question 53

Name the device used by computers to convert sound files into sound coming out of the speaker

Digital to Analogue converter

Question 54

Name a peripheral that could be used to feed sound into a ADC

A microphone

Question 55

This is a diagram of a system set up for recording, storing and saving sound. Fill in the numbers
from the following options

▪ ADC
▪ DAC
▪ Headphones
▪ Main Memory
▪ Microphone
▪ Secondary Storage

1. Microphone
2. ADC
3. DAC
4. Main Memory
5. Headphones
6. Secondary Storage

27
IGCSE CS 0984

Question 56

Why might you choose to have a lower sampling rate than a higher one for storing a song on your
computer?

The higher the sampling rate the more data is needed to be stored, meaning the larger the file
size.

Question 57

What is the sampling resolution?

The number of bits assigned to each sample, effecting the range of volumes that can be stored
in a sample

Question 58

For the following sound sample work out its size:

Sample Rate = 16,000Hz


Sample Resolution = 8 bit
Length of Sound = 10 seconds

16,000 * 8 * 10 = 1 280 000 Bits

28
IGCSE CS 0984

Question 59

Using the grid below, plot the following sample points for a sample resolution of 3 bits per sample:
000001100101100011100110111101

Question 60

Sound can be represented in a computer in a digital format.

Give the definition of the term sampling.

▪ Amplitude of sound wave taken at different points in time


▪ Measurement of value of analogue signal at regular time intervals/a point in time
Give one reason why 16-bit sampling is used in an audio compact disc (CD).

▪ Bit depth/sampling resolution sufficient for good quality sound


▪ Higher bit depth/sampling resolution would mean bigger files hence less (music)
content on each CD
▪ Can represent dynamic range of about 90 dB
▪ 90 dB is basically the maximum dynamic range of human hearing
▪ Compromise between quality and reasonable file size
Explain what is meant by the term sampling resolution.

▪ Resolution is the number of distinct values available to encode/represent each


▪ sample
▪ Specified by the number of bits used to store/record each sample
▪ Sometimes referred to as bit depth
▪ The higher the sampling resolution, the smaller the quantization error
▪ A higher sampling resolution results in less distortion of the sound
▪ Usually 8 bit, 16 bit, 24 bit or 32 bit

29
IGCSE CS 0984

Give one benefit and one drawback of using a higher sampling resolution.

Benefit

▪ Allows for larger dynamic ranges as dynamic range is approximately six times the bit
depth
▪ More accurate representation/crisper sound quality
Drawback

▪ Bigger files/occupies more memory/storage


▪ Longer to transmit data/download music
▪ Greater processing power needed
Question 61

Here are the contents of three memory locations with addresses shown in denary.

Address Memory contents

150 0100 0111

151 1100 1101

152 1001 1100

What is the binary value for address 150?

1001 0110

What is the hexadecimal value for the contents of address 152?

9C
The numbers in location 151 and 152 are the height and width (in pixels) of a bitmap graphic
currently in main memory. What are the dimensions of the bitmap in denary?

Height: 205 pixels


Width: 156 pixels
A bitmap graphic can be saved in a number of different image resolutions. How many bits are
required to store each pixel for a black and white bitmap?

1 bit

For a 256-colour bitmap, each pixel requires a byte of memory. Explain this statement.

Each colour is represented by a number.


1 byte makes possible 256 different numbers/colours.

30
IGCSE CS 0984

In addition to the pixel data values and its dimensions, what other information is stored in the
bitmap file?

The header
The resolution
Question 62

Bitmaps may use compression techniques to reduce the file size.


Explain the difference between ‘lossless’ and ‘lossy’ techniques for achieving this compression.

▪ A bitmap may contain the same sequence of pixels (i.e. a pattern) repeated many times
/ may contain the same pixel in a long sequence.
▪ A lossless technique is designed to lose none of the original detail. / Lossless allows the
original file to be re-created exactly. / Lossy may result in a loss of detail.
▪ One lossless technique is ‘run-length encoding/store the colour and the number of
consecutive pixels of that colour’. JPEG and GIF file formats use RLE (i.e. a lossless
technique).
▪ Lossless techniques are founded on some form of replacement.
▪ Lossy techniques make a decision about what parts of the image are important and
then discard certain information.
Question 63

Convert the following binary number into hexadecimal.

10111000

B8

Using two’s complement, show how the following denary numbers could be stored in an 8-bit
register:

114 0 1 1 1 0 0 1 0

-93 1 0 1 0 0 0 1 1

Question 64

Using two’s complement, show how the following denary numbers could be stored in an
8-bit register:

124 0 1 1 1 1 1 0 0

-77 1 0 1 1 0 0 1 1

Convert the two numbers 124 and -77 into hexadecimal.


124 = 7 C
-77 = B 3

31
IGCSE CS 0984

Question 65

A group of students broadcast a school radio station on a website. They record their sound clips
(programmes) in advance and email them to the producer. Describe how sampling is used to record
the sound clips.

▪ The height/amplitude of the sound wave is determined.


▪ At set time intervals
▪ To get an approximation of the sound wave
▪ And encoded as a sequence of binary numbers and converted to a digital signal.
▪ Increasing the sampling rate will improve the accuracy of the recording.
Question 66

The students use software to compress the sound clips before emailing them. Circle your chosen
method of compression and justify your choice. Lossy Lossless
Lossy
▪ The human ear will not notice that the decompressed stream will not be identical to the
original (file) / that parts of the original data have been discarded / removed / deleted.
▪ File size reduction is greater than using lossless.
▪ Email has limits on file sizes (on attachments) / a smaller file will take less time to
transmit.
▪ The file may not need to be of high precision / accuracy.
▪ The producer has requested an mp3 file.

Lossless
▪ The file needs to be high precision / accuracy
▪ None of the original data is lost / the decompressed file will be identical to the original
▪ The producer has requested a flac file
Students also email images to the radio station for use on its website.
These are compressed before sending using run-length encoding (RLE). Explain what is meant by
run-length encoding.

▪ Lossless method of compression.


▪ Reduces the physical size of a string of adjacent, identical characters/pixels / bytes etc..
▪ The repeating string (a run) is encoded into two values.
▪ One value represents the number of identical characters in the run (the run count).
▪ The other value is the code of the character / colour code of pixel etc. in the run (the
run value).
▪ The run value and run count combination may be preceded by a control character.

32
IGCSE CS 0984

The following diagrams show:


▪ the denary colour code that represents each colour
▪ the first three rows of a bitmap image

Show how RLE will compress the first three rows of this image.
Row 1:
153 10 255 3 153 3
Row 2:
153 9 255 6 153 1
Row 3:
153 7 255 9
Alternative correct answer:
Row 1:
153 9 255 2 153 2
Row 2:
153 8 255 5 153 0
Row 3:
153 6 255 8

33
IGCSE CS 0984

Question 67

Convert the denary number 46 to an 8-bit binary integer.


00101110
Convert the denary integer – 46 to an 8-bit two’s complement form.
11010010
Convert the denary number 46 into hexadecimal.
2E
Question 68

The program used the ASCII coding system for character codes. An alternative coding system is
Unicode. Give two disadvantages of using ASCII code.

▪ Only 128 / 256 characters can be represented


▪ Uses values 0 to 127 (or 255 if extended form) / one byte
▪ Many characters used in other languages cannot be represented
▪ In extended ASCII the characters from 128 to 255 may be coded differently in
different systems
Describe how Unicode is designed to overcome the disadvantages of ASCII.
▪ Uses 16, 24 or 32 bits / two, three or four bytes
▪ Unicode is designed to be a superset of ASCII
▪ Designed so that most characters (in other languages) can be represented
Question 69

A computer has a microphone and captures a voice recording using sound recording software.
Before making a recording, the user can select the sampling rate. Define the term sampling rate.
Explain how the sampling rate will influence the accuracy of the digitised sound.
Sampling rate
▪ The number of samples taken per unit time
▪ // The number of times the amplitude is measured per unit time
▪ Increasing the sampling rate will increase the accuracy / precision of the digitised
sound
▪ // Increasing the sampling rate will result in smaller quantisation errors.

34
IGCSE CS 0984

The computer also has bitmap software. Define the terms pixel and screen resolution.
Pixel
Smallest picture element which can be drawn

Screen resolution

The number of pixels which can be viewed horizontally and vertically on the screen
// by example - A typical screen resolution is 1680 pixels × 1080 pixels
A picture has been drawn and is saved as a monochrome bitmap image. State how many pixels are
stored in one byte
8
A second picture has width 2048 pixels and height 512 pixels. It is saved as a 256-colour image.
Calculate the file size in KiB. Show your working.

▪ Number of pixels is 2048 × 512


▪ One pixel will be stored as one byte
▪ Number of kilobytes = (2048 × 512) / 1024
▪ Number of kilobytes = 1024 KiB
The actual bitmap file size will be larger than your calculated value. State another data item that the
bitmap file stores in addition to the pixel data.

▪ Confirmation that the file is a BMP


▪ File size
▪ Location/offset of image data within the file
▪ Dimensions of the image in pixels
▪ Colour depth (bits per pixel)
▪ Type of compression used, if any

35
IGCSE CS 0984

Question 70

A computer has a microphone and captures a voice recording using sound editing software.
The user can select the sampling resolution before making a recording. Define the term sampling
resolution. Explain how the sampling resolution will affect the accuracy of the digitised sound.

The number of distinct values available to encode/represent each sample


Specified by the number of bits used to encode the data for one sample
Sometimes referred to as bit depth
Explanation
▪ A larger sampling resolution will mean there are more values available to store each
sample
▪ A larger sampling resolution will improve the accuracy of the digitised sound
▪ Increased sampling resolution means a smaller quantization error
The computer also has bitmap software.
Define the term image resolution

▪ The number of pixels per unit measurement


▪ The number of pixels in an image
▪ The number of pixels wide by the number of pixels high
▪ Number of pixels per row by the number of rows
Picture is drawn and is saved as a 16-colour bitmap image. State how many bits are used to encode
the data for one pixel.

4
A second picture has width 8192 pixels and height 256 pixels. It is saved as a 256-colour bitmap.
Calculate the file size in kilobytes. Show your working.
▪ Number of pixels is 8192 × 256 1
▪ One pixel will be stored as one byte 1
▪ Number of kilobytes = (8192 × 256) / 1024 1
▪ Number of kilobytes = 2048 KB
Question 71

State in denary, the range of integer values that it is possible to represent in two’s complement
integers using a single byte.

Lowest value: −128


Highest value: +127

36
IGCSE CS 0984

Question 72

A black and white bitmap image is shown. Explain how a computer can store this bitmap image

▪ Each pixel requires only one bit (as there are only two colours)
▪ Black represented by 1 and white by 0 (or vice versa)
▪ Bits are stored for each pixel in sequence
▪ 11111 01010 01010 01010 01010
The image is compressed before it is attached to an email.
Explain how run-length encoding (RLE) will compress the image.

▪ Stores the colour and the number of times it occurs


▪ An example from the bitmap given e.g. B5, W1, B1 and so on
The finished logo is 500 pixels by 1000 pixels and uses 35 different colours. Estimate the file size
for the logo. Give your answer in kilobytes. Show your working.

▪ Number of pixels 500*1000 (= 500 000)


▪ 35 colours require 6 bits per pixel
▪ Number of bytes (500 000 * 6) / 8 = 3 000 000 / 8 (= 375 000)
▪ = 375 Kb
Question 73

The binary integer represents a character from the computer’s character set. Define the term
character set.

The symbols that the computer recognises/uses


A list of characters recognised by the computer hardware and software
Explain the differences between the ASCII and Unicode character sets.

▪ UNICODE has greater range of characters than ASCII


▪ UNICODE represents most written languages in the world while ASCII
▪ does not ASCII used for English only
▪ ASCII uses 7 or 8 bits or one byte whereas UNICODE uses up to 4
▪ bytes per character
▪ UNICODE is standardised while ASCII is not

37
IGCSE CS 0984

Question 74

A student has recorded a sound track for a short film. Explain how an analogue sound wave is
sampled to convert it into digital format.

▪ Amplitude (of the sound wave) measured


▪ At set / regular time intervals / per time unit / time period
▪ Value of the sample is recorded as a binary number
Explain the effects of increasing the sampling resolution on the sound file.

▪ (Increasing the sampling resolution means) more bits per sample


▪ Larger file size
▪ More accurate representation of sound
The original sound was sampled at 44.1 kHz. The sample rate is changed to 22.05 kHz. Explain the
effects of this change on the sound file.

▪ Fewer samples (per unit time)


▪ File size will decrease
▪ Larger gaps / spaces between samples // Greater quantization errors
▪ Sound accuracy will reduce // not as close to original sound
Question 75

Each of the following bytes represents an integer in two’s complement form.


State the denary value.
0111 0111 Denary 119
1000 1000 Denary –120
Express the following integer in two’s complement form using 8bits.
-17
11101111

38
IGCSE CS 0984

Question 76

A recording of a concert is stored as a file. The file is compressed using lossy compression
before it is streamed to users.
State why this file needs to be compressed.
▪ The data files are very large
▪ It would take a long time to send the uncompressed file // Compressed
files will download faster
▪ A higher bandwidth would be needed to transmit the uncompressed file
Define the term lossy compression.
▪ Data is lost
▪ The decompressed file is not the same as the original
The file could be compressed using lossless compression.
Explain why lossy compression is a more appropriate compression technique than lossless for this
file.
▪ Lossy creates a smaller file than lossless // lossy compresses further than lossless
▪ The recording of the concert is a large file size and needs significant reduction in size
▪ Lossy removes detail which can be lost without people noticing•
▪ By example e.g. reduction in sound quality will not be noticed
Question 77

A sound track is recorded for the video.


Describe how a computer encodes the sound track.
▪ The amplitude of the wave is measured /sound wave is sampled
▪ At set/regular time intervals
▪ Each sample is stored as a binary number
▪ Samples are stored in order in a file
Question 78

Explain how the sampling rate and sampling resolution affect the file size of the sound track.
Sample rate:
▪ Increasing the sample rate means more samples per second hence more bits per second
and larger file size
▪ Decreasing the sample rate means fewer samples per second hence fewer bits per
second and smaller file size
Sample resolution:
▪ A higher sampling resolution means more bits per sample and a larger file size
▪ A lower sampling resolution means fewer bits per sample. a smaller file size

39
IGCSE CS 0984

Question 79

The sound track has a sampling rate of 88.2 kHz and a sampling resolution of 32 bits. State what is
meant by a sampling rate of 88.2 kHz and a sampling resolution of 32 bits. Sampling rate of 88.2
kHz
88.2 kHz The sound wave is sampled 88200 times per second
32 bits Each sample is stored as a 32-bit binary number
Question 80

One example of a character set used by computers is ASCII. Describe how one character is
represented in a character set.
▪ Each character is represented by a unique
▪ …. denary / hexadecimal / binary number
Question 81

Data can be compressed using either lossy or lossless compression. Tick (✓) one box in each
scenario to identify whether lossy or lossless compression should be used. Justify your choice.
A program written in a high-level language.

Lossy Lossless

▪ All the data is needed // the original file is fully restored


▪ If any data is lost, the program will not run
▪ Probably does not require significant reduction in file size // a program written in a
high-level language is just text, so does not need much reduction in size
A photograph that needs to be emailed to a friend.

Lossy Lossless

Lossy:
▪ All the data is not required
▪ The number of colours / resolution can be reduced without the user noticing Email
requires a significantly smaller file size // takes less time to transmit
Lossless:
▪ A high quality image may be needed
▪ All of the data is needed // cannot afford to lose any data // the original file is fully
restored

40
IGCSE CS 0984

You need to upload a video that you have created to a website.

Lossy Lossless

Lossy:
▪ Some loss of quality will not be noticed // high quality video not needed on the website
▪ A more significant reduction may be needed
▪ Takes a shorter time to upload / download // requires less bandwidth
Lossless:
▪ A high quality video may be needed
▪ Might only be a short video clip
▪ All of the data is needed // cannot afford to lose any data // the original file is fully
restored
Question 82

A digital camera takes a bitmap image. The image is 2000 pixels wide by 1000 pixels high with a
colour depth of 24-bits. Calculate an estimate of the file size for the image. Give your answer in
megabytes. Show your working.
▪ 2000 * 1000 * 24 = 48 000 000 bits
▪ 48 000 000 / 8 / 1024 / 1024
▪ = 6 MB or 5.7 MB
A second image is taken, this time in black and white. It has the same number of pixels, but
the file size is smaller.
Explain why the file size is smaller.
▪ Only 1 bit needed to store the colour of each pixel ...
▪ ... so number of pixels * bit depth is 2000 * 1000 * 1 (rather than 2000 * 1000 * 24)
▪ ... so the calculation results in smaller figure for file size
Question 83

A logo is 160 pixels wide and 160 pixels high. The image has a colour depth of
3 bytes per pixel. Calculate an estimate of the file size for the logo. Give your answer in kilobytes.
Show your working.
▪ 160 * 160 (= 25600 pixels)
▪ 25600 * 3 (= 76800 bytes)
▪ 75 KB (divide by 1024) or 76.8 KB (divide by 1000)

41
IGCSE CS 0984

Question 84

Anne is downloading a sound file from a web server. She had the choice of a sampling rate of
44.1kHz or 98kHz before she downloaded the sound file.
Explain the differences between the two sound files stored on the server.
▪ 98 kHz has a larger file size…because it is recording more samples per second
▪ …meaning more binary values being stored per second
▪ ...will take more time to download
▪ 98 kHz – Sound will be closer to the original
▪ …because the samples will be closer together
▪ …because of smaller quantization errors
Question 85

One method of compressing a file is run-length encoding (RLE). Describe, using an example, how a
text file is compressed using RLE.
▪ Instead of storing each repeated sequence of characters individually
▪ … the character is stored and the number of consecutive occurrences
▪ e.g. instead of storing aaaa , store a4
Explain why run-length encoding will sometimes increase the size of a text file
▪ Repeated sequences of characters rarely occur in text files // Most
characters are used only once in any sequence
▪ The character code and the fact that it is stored once will both be stored,
which will use as much if not more space
Question 86

Wilbur scans a hand drawn image. The scanned image uses 8 bits to store the colour for
each pixel. The image is 2048 pixels wide by 1024 pixels high.
Calculate an estimate of the file size of the scanned image. Give your answer rounded to the nearest
MB.

▪ 1024  2048 = 2 097 152 pixels


▪ = 2 097 152 bytes (8 bits per pixel)
▪ = 2 097 152 / 1024 = 2048 KB
▪ = 2048 / 1024 MB

42
IGCSE CS 0984

Wilbur wants to compress the scanned image before emailing it to his colleague.
Describe one lossy compression technique that Wilbur can use to compress this image.
▪ Reduce the colour depth
▪ … reduce the number of bits per colour
▪ … each pixel has fewer bits
▪ Reducing the resolution
▪ … fewer pixels per unit measurement
▪ … fewer pixels / binary numbers are stored
Question 87

Anya scans an image into her computer for a school project.


The scanned image is a bitmapped image.
Describe the following two terms about graphics.
Pixel
▪ A single square of one colour
▪ The smallest addressable element in an image
File header
Data about the bitmap image (e.g. number of colours)

The image is scanned with an image resolution of 1024 × 512 pixels, and a colour depth of 8 bits
per pixel.
Calculate an estimate for the file size, giving your answer in mebibytes. Show your working

▪ 1024  512 = 524 288 pixels/bytes


▪ 524288 / 1024 / 1024
▪ 0.50 mebibytes
The image is compressed using lossless compression.
Identify one method of lossless compression that can be used to compress the image and describe
how the method will reduce the file size.
Lossless compression method Run-length encoding
Description
▪ Replace sequences of the same colour pixel
▪ … with colour code and number of identical pixels

43
IGCSE CS 0984

One of the colours used in the image has the hexadecimal colour code:
#FC238A
FC is the amount of red, 23 is the amount of green and 8A is the amount of blue in the colour.
Convert the hexadecimal code FC into denary.
252
The amount of green in binary is 00100011. This has the denary number 15 added to it to create a
second colour. Add the denary number 15 to the binary number 00100011 and give your answer in
binary. Perform the addition in binary. Show your working.
Converting 15 to binary 0000 1111

Question 88

A computer uses the ASCII character set.


State the number of characters that can be represented by the ASCII character set and the extended
ASCII character set.
ASCII ASCII = 128 // 27
Extended ASCII = 256 // 28
Explain how a word such as ‘HOUSE’ is represented by the ASCII character set.
▪ Each character has its own unique code
▪ Each character in the word is replaced by its code
▪ The codes are stored in the order in the word
Unicode is a different character set.
The Unicode value for the character ‘1’ is denary value 49.
Write the hexadecimal value for the Unicode character ‘1’.
31
Write the denary value for the Unicode character ‘5’.
53

44
IGCSE CS 0984

Question 89

Perform the following binary addition. Show your working.

State how an overflow can occur when adding two binary integers.
The result is a larger number than can be stored in the given number of bits.
// The result is greater than 255
Convert the hexadecimal value F0 into denary.
240
Question 90

Bobby is recording a sound file for his school project.


He repeats the recording of the sound several times, with a different sample rate each time.
Describe the reasons why the sound is closer to the original when a higher sample rate is used.
▪ Smaller time gaps between the samples
▪ Makes the digital sound wave more accurate
▪ Smaller quantisation errors
Describe the reasons why the sound file size increases when a higher sample rate is used.
▪ More samples/data are taken/recorded
▪ … so more bits are stored altogether
Bobby wants to email the sound file to his school email address. He compresses the file before
sending the email.
Explain the reasons why Bobby compresses the sound file.
▪ Reduces the file size
▪ Faster to transmit/download
▪ Original file is too large for email storage/attachment

45
IGCSE CS 0984

Bobby uses lossless compression.


Describe how lossless compression can compress the sound file.
▪ Reduce amplitude to only the range used
▪ … limited amplitudes mean fewer bits per sample
▪ Run-length-encoding
▪ … Where consecutive sounds are the same record the binary value of the sound and
number of times it repeats
▪ Record the changes instead of the actual sounds
Question 91

A register stores the following binary number:

The binary value in the register represents an unsigned binary integer.


Convert the unsigned binary integer into denary.
205
The binary value in the register represents a two’s complement binary integer.
Convert the two’s complement binary integer into denary
– 51
The binary value in the register represents a hexadecimal number.
Convert the binary number into hexadecimal.
CD

46
IGCSE CS 0984

Question 92

The binary contents of two registers are:

Add the contents of Register 1 and Register 2. Show your working.

Question 93

The following 2 pictures are images of the letter ‘R’ stored as bitmap files:

Why is picture X fuzzy?


▪ Poor/low resolution
▪ Low bit map image
▪ Insufficient pixel density/picture has less pixels
Even the sharp image in picture Y would become fuzzy if enlarged. Why would this happen?
▪ as picture is enlarged covers larger area
▪ so pixel density gets smaller and sharpness of image is lost
▪ pixels become too big
Name an output device that makes use of this imaging method.
▪ Printer (e.g. dot matrix)
▪ Television/monitor/screen
▪ Projector

47
IGCSE CS 0984

State a drawback of storing sharp quality bitmap image files.


▪ Uses up large amount of memory/storage space
▪ Download/upload takes longer
Question 94

On what does the quality of the pictures taken by the digital camera mainly depend? [1]
Number of pixels
Question 95

The following statistics refer to a music track being recorded on a CD:

▪ music is sampled at 44100 times per second


▪ each sample is 16 bits
▪ each track requires separate sampling for left and right speakers of a stereo recording

How many bytes are required to represent one second of sampled music?
44100 × 16 × 2 = 1411200 bits/second
1411200/8 = 176400 (bytes)
If a typical music track is 3 minutes long, how much memory is used on the CD to store one track?
(Give your answer in megabytes.)
3 minutes = 180 seconds
176 400 × 180 = 31 752 000 bytes = 30.281 (megabytes)
When using MP3 format, the size of the above music track will be reduced by a factor of 10 (i.e. the
size is reduced by 90%).
How is the music quality retained?
▪ similar to how Jpeg files work
▪ file is compressed
▪ only keeps the sounds that the human ear hears better than others
▪ if 2 sounds played together, human ear can only hear louder one and not the softer one
which is consequently discarded

48
IGCSE CS 0984

Question 96

Explain the difference between lossy and lossless compression.


▪ Lossless designed to lose none of the original detail/lossless allows original file to be
recreated exactly
▪ Lossless technique based on some form of replacement
▪ For example RLE (Run Length Encoding)
▪ Example: 000–1111–222222–333 = 3–0, 4–1, 6–2, 3–3
▪ Maximum compression about 50%
▪ Lossy may result in loss of detail compared to original file/lossy does not allow original
file to be re-created exactly
▪ Lossy techniques make decision about what parts of sound/sound file are important
and discards other information
▪ Only keeps sounds human ear can process/discards sounds most people cannot hear
then applies lossless technique, for further reduction
▪ Lossy compression can reduce to about 10%
▪ For example jpeg, mp3

49
IGCSE CS 0984

Question 97

Give an example of a file that could be compressed and justify whether lossy or lossless
compression would be best suited to this file
Example where lossy compression would be appropriate:
Image file, an image with a lot of blue sky, lossy compression would be appropriate to reduce
2000 blue shades to 10. There is no requirement to capture all shades of blue as the naked eye
would not be able to differentiate between them all, and would not notice any significant
difference following compression
Question 98

The compression of files can be expressed in a number of ways. One way is a ratio that can be
written as:
Size of file before compression : Size of file after compression
For instance, a data compression ratio of 5 : 2 means that a file of 5000 KB in size before
compression would be 2000 KB in size after compression. The table below shows the compression
ratios for three files and their size before compression.

FILE SIZE BEFORE COMPRESSION COMPRESSION RATIO


File A 2000 KB 15 : 2
File B 8000 KB 16 : 5
File C 3000 KB 16 : 1

Calculate the size of files A, B and C following compression. Identify which of these files could be
attached to an email with an attachment limit of a maximum size of 200KB. Show your workings.
File A: (2000/15) x 2 = 266.67KB
File B: (8000/16) x 5 = 2500KB
File C: (3000/16) x 1 = 187.5KB
Therefore only file C could be attached to the email

50
IGCSE CS 0984

Question 99

The picture shown is stored as a black and white bitmap file.

Calculate the size of the file in bytes assuming each pixel in the bitmap requires one bit of storage.
Show your workings.
File is 80 bits in size (8 x 10 = 80)
Convert to bytes (80/8)
Write file size with units as 10 bytes
Question 100

Different types of compression are used for different purposes. A travel company has designed
some brochures that contain images and text in desktop publishing format. The travel company
sends the documents electronically to a printing company for them to be printed. Explain why the
travel company uses lossless compression to send the documents.
▪ Lossless compression ensures that no data is lost
▪ So that the desktop published file can be restored so that it is exactly the same as the
original
Question 101

State what is meant by a pixel


A pixel is the smallest identifiable unit in a graphic image.

51
IGCSE CS 0984

Question 102

A simple bitmap image has the following characteristics:


▪ 4-bit colour depth (bit depth)
▪ 100 pixels by 300 pixels.
▪ Calculate the size of this image in bytes.

4 x100 x300
= 15000bytes
8
Question 103

Nicolae needs to send 30 photos to a friend and he chooses to send all 30 together as a single email
attachment. Each photo is 1.8 MB in size, but the maximum possible attachment size is only 20
MB. State how Nicolae can solve this problem.
▪ Send as JPEG files
▪ Carry out a file compression first
Question 104

JPEG

File compression format designed to make photo files smaller in size for storage and for
transmission
MP3 format

File compression system for music which does not noticeably affect the quality of the sound
Lossless compression

The file is reduced in size for transmission and storage; it is then put back together again later
producing a file identical to the original
Lossy compression
Reduction of file size by permanently removing certain, redundant information from the file
Question 105

MP3 file compression reduces the size of a music file by 90%. A music track is 80 MB in size.
Calculate the file size after compression.
8 MB
How many MP3 files of the size calculated above could be stored on an 800 MB CD?
100
Explain how MP3 files retain most of the original music quality.
▪ Removes sounds human ear can’t hear very well
▪ If two sounds played at same time, softer sound removed
▪ Uses perceptual music shaping

52
IGCSE CS 0984

State the type of file compression used in MP3 files.


Lossy
Name another file compression format.
▪ jpeg
▪ MP4
▪ zip
▪ gif
Question 106

Nigel wants to send a large text file electronically to Mashuda. Describe how the size of the text file
can be reduced.
▪ The file can be compressed
▪ The compression that is used is lossless (not lossy)
▪ Use of a compression algorithm
▪ Repeated words can be indexed
▪ Repeated word sections (e.g. “OU”) can be replaced by a numerical value
▪ Save file as a pdf/convert to pdf
▪ The file is send as zip file
Question 107

A high definition video and a large text file are to be sent as email attachments. Both files are
compressed before sending. Each file is compressed using a different type of data compression
algorithm. Explain, with reasons, which type of data compression algorithm should be chosen for
each file.
High definition video – lossy (algorithm)
images may contain less detail without noticeable degradation in quality
Text – lossless (algorithm)
so that the original and the decompressed text will be exactly the same
Question 108

Gurdeep wants to send a large file to Jennifer over the Internet. State two benefits of compressing
the file to send it.
▪ Smaller file to transmit
▪ The file is transmitted quicker
▪ Uses / requires less bandwidth

53
IGCSE CS 0984

Two types of compression are lossy and lossless. Choose the most suitable type of compression for
the following and explain your choice.
Downloading the code for a computer program:
▪ Lossless (compression)
▪ It is important the code must be (exactly) the same as the original file
▪ If it does not match the original file it will not work
Streaming a video file:
▪ Lossy (compression)
▪ It would make the file smaller than lossless compression / the file would stream faster
than lossless compression
▪ The quality of the video can be reduced but it can still be viewed
Question 109

Data files are stored in different file formats. Complete the table by providing a suitable file format
for each file type. The first one has been done for you.

File type File format


Pictures .JPEG
Text .doc, .txt, .rtf, .docx, .odt .pdf
Sound mp3, .wav, .aif, .flac, .mid
Video .mp4, .flv, .wmv

Kamil wants to store a 16-bit colour image file. The image size is 1000 pixels. Calculate the size of
the file. Give your answer in bytes. Show your working.
– 1000 × 16 – 16000/8 – Answer is 2000 bytes
Question 110

Miriam needs to use a large high-resolution photo as a thumbnail image on a website.


She will use lossy compression to reduce the file size of the photo to create the thumbnail image.
State why a smaller file size is appropriate for this situation.
Smaller file size reduces download / display time // reduces upload time

Explain how lossy compression reduces the file size.


▪ A compression algorithm is used
▪ Permanently deleting some data // file cannot be restored to original
▪ Colour depth / palette can be reduced
▪ Resolution can be reduced
▪ Less bits will be required for each pixel / colour

54
IGCSE CS 0984

Question 111

Michele wants to email a file to Elsa. The file is too large so it must be compressed.
Name two types of compression that Michele could use.
▪ Lossy (compression)
▪ Lossless (compression)
The file Michele is sending contains the source code for a large computer program.
Identify which type of compression would be most suitable for Michele to use. Explain your answer
▪ Lossless (compression)
▪ The file can be restored/decompressed to the exact same state it was before
compression/ to original
▪ (It is a computer program so) no data can be lost // Lossy would remove data
▪ Will not run correctly (with any other compression)
▪ (Lossless) will give repeating words/sections of word a value
▪ // RLE is used // Other valid examples of methods of lossless compression
▪ Value is recorded in an index
Question 112

Nancy wants to email the photos to Nadia. Many of the photos are very large files, so Nancy needs
to reduce their file size as much as possible. Identify which type of compression would be most
suitable for Nancy to use. Explain your choice.
▪ Lossy
▪ Lossy would reduce the file size more (than lossless)
▪ The redundant data can be removed from the files
▪ Images can still be a similar quality
▪ There is no requirement for the files to be exactly the same as original file
▪ Photos can be sent quicker // faster to upload // faster to download

55
IGCSE CS 0984

Question 113

Jamelia wants to store an image file. The image has an 8-bit resolution and is 150 pixels by 100
pixels in size. Calculate the file size of the image. Give your answer in kilobytes (kB). Show all of
your working.
▪ 150*100 = 15 000
▪ 15 000/1024
▪ 14.65kB
Large files can be compressed to reduce their file size. Two types of compression that can be used
are lossy and lossless. Explain how a file is compressed using lossless compression.
▪ A compression algorithm is used
▪ No data is lost in the process
▪ Repeated words/patterns can be indexed // repeated sections of words/patterns can be
indexed //
▪ The indexed words/patterns can be replaced with numerical values

56
IGCSE CS 0984

Question 114

Darius is sending several programs that he has created to his friend Selma.
He wants to compress the files to send them as he needs to attach them to an email.
Darius tells Selma he is going to use lossy compression. Selma tells him that he should use lossless
instead. Explain why Selma tells Darius to use lossless compression instead of lossy.
▪ Lossy would remove data
▪ Lossless does not remove data // No data can be lost
▪ Can be restored to original state otherwise will not run / work correctly
Question 115

David needs to send a large section of the programming code as an email attachment.
He uses lossless compression to reduce the file size.
Explain how the file size is reduced.
▪ Uses compression algorithm / by example e.g. RLE
▪ Repeating words / phrases / patterns identified replaced with value
▪ File / dictionary / index of phrases created
▪ Index will store word/phrase with value
Question 116

The following text is stored as a text file:


She sells sea shells on the seashore. The shells that she sells are sea shells I am sure.
Explain how lossless compression would compress this file.
▪ No data is removed in the process // original file can be restored
▪ Repeated words (are identified) // Patterns in the data (are identified)
▪ and are indexed/put into a table // by example
▪ and are replaced with their index // by example
▪ and their positions are stored (in the table) // by example
▪ and the number of times the word/pattern appears is stored (in the table)

57
IGCSE CS 0984

Question 117

Marley also needs to store ten 8-bit colour images in a file for his project.
Each image is 500 pixels wide and 300 pixels high.
Calculate the total file size in megabytes (MB) for all Marley’s images.
Show all your working.
▪ 500 * 300 * 10 // 150 000 *10
▪ 8 then ÷ 8 (anywhere in the process)
▪ 1 500 000 ÷ 1024 ÷ 1024 // 1 500 000 ÷ 1 048 576
▪ = 1.43 MB
Question 118

Ishan is a member of a software community that develops computer games. He has programmed a
new feature for one of the community’s existing games.
The program files for the games are compressed before they are published on the Internet. Describe
one benefit of compressing the program files.
▪ File size is reduced…
▪ …so it uses less storage space
▪ …so faster transmission
▪ …so quicker to download
State whether lossy or lossless compression should be used.
Lossless
Question 119

Audrey wants to send a sound file to Nico using email.


The file is too large to attach to an email so Audrey decides to compress the file.
She uses lossy compression to reduce the size of the sound file.
Describe how lossy compression reduces the size of the sound file.
▪ A compression algorithm is used
▪ Discards any unnecessary sounds …
▪ …using perceptual musical shaping
▪ …such as removing background noise / sounds humans can’t hear // or other suitable
example
▪ Reduces sample size / resolution // by example
▪ Reduces sample rate // by example
▪ Sound is clipped
▪ The data is permanently removed

58
IGCSE CS 0984

Nico asks Audrey why she used lossy compression rather than lossless.
State one advantage Audrey could give of using lossy rather than lossless to compress the sound
file.
▪ The file size will be smaller than lossless
▪ Requires less storage space
▪ Requires less time to transmit
State one disadvantage Nico could give of using lossy rather than lossless to compress the sound
file.
▪ The quality of the sound will be reduced
Question 120

A library has a system that allows customers to check out the books that they want to borrow.
Each book has a barcode that can be used to identify the book.
Videos on the library website show customers which books the library will soon have in stock.
The library wants the file size of a video to be as small as possible.
Identify and describe a method the library could use to reduce the file size of a video as much as
possible.
▪ Compression
▪ Best compression would be lossy
▪ Use compression algorithm
▪ This would remove all the unnecessary data from the file // removes detail/sound that
the human eye/ear may not see/hear
▪ Reduce colour palette …
▪ …so each pixel requires fewer bits
▪ Reduce resolution
▪ Only store what changes between frames // temporal redundancy

59
IGCSE CS 0984

Question 121

Priya shares her sound files with other students. Before sharing the sound files, she compresses the
files using lossless compression. Describe how lossless compression reduces the size of a sound
file.
▪ Uses a compression algorithm
▪ Does not permanently remove any data
▪ Repeated patterns of notes are identified …
▪ … and are grouped, with an index
Give two features of an MP3 file.
▪ Contains actual sound
▪ Contains samples of the sound wave
▪ Contains metadata // by example
▪ Uses lossy compression
▪ Recorded using microphone // Is recorded/played on an MP3 recorder/player
Question 122

Carla’s computer has a USB port.


Carla uses the USB port to connect her mobile device to her computer, to transfer her photos.
Carla wants to reduce the file size of the photos she has transferred to her computer.
She does not want the quality of the photos to be reduced, so she uses lossless compression.
Describe how lossless compression reduces the file size of the photos.
▪ A compression algorithm is used
▪ No data is removed in the compression process
▪ An index/dictionary of pixels is created
▪ The number of times a pixel is repeated in a row is stored

60
IGCSE CS 0984

Question 123

Gurdeep takes high definition photographs using a digital camera. She has set up a website where
users can view thumbnails of her photographs. A thumbnail is a small version of the high definition
photograph. Gurdeep compresses the high definition photographs to create the thumbnails. She uses
lossy compression. Describe how lossy compression creates the thumbnails.
▪ A compression algorithm is used
▪ Data will be lost/deleted permanently // original file cannot be recreated
▪ Reduce the range of colours used / colour depth / bits per pixel
▪ Reduce the number of pixels / image resolution Removes data that will not be noticed
by the user // removes unnecessary data
Question 124

Tina is creating a website for charity events. She uses HTML to create the website.
She wants to compress the recording to make sure that the file is as small as possible for the
website. Identify which type of compression she should use and describe how this would compress
the file for the website.
▪ Lossy (compression)
▪ A (compression) algorithm is used
▪ Removes redundant/unnecessary data from the file
▪ Removes sounds that cannot be heard by the human ear/background noise
▪ Reduces sample rate
▪ Reduces sample resolution
▪ Data is permanently removed // original file cannot be re-instated
▪ Perceptual music shaping is used
NOTE: If lossless given, marks can be awarded for a correct description of lossless as follow
through.
▪ A (compression) algorithm is used
▪ Repeating patterns are identified
▪ … are replaced with a value
▪ … and indexed
▪ No data is permanently removed // original file can be re-instated
▪ Suitable example of a lossless algorithm
Give two benefits of compressing the file for the website.
▪ Quicker for her to upload
▪ Quicker for users to download
▪ Won’t slow website down as much when loading
▪ Takes up less storage space

61
IGCSE CS 0984

Question 125

A music company has a website that allows users to stream music. The music is stored in sound
files. The sound files are compressed using lossless compression.
Describe how the sound files are compressed using lossless compression.
▪ (Compression) algorithm is used
▪ No data will be removed // original file can be restored
▪ Example of type of algorithm that would be used e.g. RLE
▪ Repeated patterns in the music are identified
▪ … and indexed
✓ NOTE: If another lossless method is described, marks can be awarded.
State one reason why the music company would compress the sound files using lossless, rather than
lossy, compression.
▪ To provide the highest quality of music file (that compression will allow)
▪ The user is able to listen to the original sound file
▪ No loss of quality for the sound file provided
Give one benefit, to the user, of the music company compressing the sound files.
▪ Allow for quicker streaming speed
▪ Would not require as much bandwidth (to stream)
▪ Does not need as much RAM
▪ Smoother listening experience // less lag
▪ Will not use as much of data allowance
Give one drawback of the music company using lossless, rather than lossy, compression for the
sound files.
▪ Streaming speed may be slower
▪ … and may affect listening experience // buffering may occur
▪ User may need more bandwidth to stream
▪ … that could be more expensive
▪ It would be a larger file size
▪ … so may take longer to upload
▪ … so will take up more storage space …
▪ … on webserver

62
IGCSE CS 0984

Question 126

Jolene displays videos on her website. She uses lossy compression to reduce the file size of the
videos. Describe how lossy compression reduces the file size of the videos.
▪ A compression algorithm is used
▪ Redundant data is removed
▪ Reduce colour depth
▪ Reduce image resolution
▪ Reduce sample rate
▪ Reduce sample resolution
▪ Reduce frame rate
▪ Use perceptual music shaping
▪ Data is permanently removed
State two reasons why Jolene would use lossy rather than lossless compression for the videos.
▪ Lossy decreases the file size more
▪ Take up less storage space on webserver/users' computer
▪ Quicker to upload/download
▪ May not need to be high quality
▪ Website will load faster for users
▪ Less lag/buffering when watching
▪ Takes up less bandwidth to download/upload
▪ Uses less data allowance

63
IGCSE CS 0984

Question 127

Nadia creates a digital image for a school project.


Give one example of an image format.
e.g. JPEG
Describe how a digital image file is stored by a computer.
▪ Image is made of pixels
▪ Each pixel stores one colour
▪ Image has a set number of pixels wide by pixels high
▪ Each colour has a unique binary value // Each colour has a unique colour code
▪ The colour/binary value of each pixel is stored in sequence
▪ File contains metadata to identify how the file should be displayed
▪ … metadata can be the colour depth / resolution
Nadia compresses the digital image file before emailing it to a friend.
State what is meant by data compression.
Reducing the file size
Explain why Nadia compresses the digital image file before emailing it.
▪ reduces the storage/memory space taken on email server // reduces the storage space
taken on her friend's computer when downloaded
▪ sending/receiving email accounts may have restricted file size for attachments
▪ reduces the time taken to transmit/upload/download to destination
▪ reduces amount of bandwidth needed to transmit/download
▪ file will mean less data usage is taken (for mobile clients)

64
IGCSE CS 0984

Question 128

Georgia is a wedding photographer. She wants to store 10 photographs on a USB flash memory
drive for a customer. Each photograph is 100 pixels wide and 50 pixels high. The photographs are
8-bit colour photographs. Calculate the total file size, in kilobytes (kB), of all the photographs. For
this calculation, you may use the unit of measurement of 1024 or 1000. Show all your working
Working:
100 × 50 = 5000 bits
5000 × 8 = 40,000 bits
40,000 / 8 = 5,000 bytes
5,000 × 10 = 50,000 bytes
50,000 / 1024
Answer:
48.83 kB // 49 kB
Georgia compresses photographs to store them on the USB flash memory drive. It is important that
the compression does not affect the quality of the photographs in any way. State which type of
compression is the most suitable. Justify your choice.
▪ Lossless
▪ Lossy would remove data permanently // lossless would not remove any
▪ data permanently // File could be restored to original …
▪ … that could affect the quality (lossy) // … to maintain the quality (lossless)
Question 129

Sammi creates videos for the finance company website that give customers advice about their
finances. He uses lossy compression to reduce the file size of the videos for the website.
Give three ways that lossy compression can reduce the file size of the videos.
▪ A compression algorithm is used
▪ The resolution could be reduced
▪ Colour depth could be reduced // bits per pixel reduced
▪ Sounds not heard by human ear could be removed // Perceptual music shaping can be
used
▪ Repeating frames could be removed
Give one drawback of using lossy compression to reduce the file size of the videos.
▪ Quality may be reduced
▪ Data is lost // original file cannot be reconstructed

65
IGCSE CS 0984

Sammi could have used lossless compression to compress the videos for the website.
Give one reason why he would use lossless compression, rather than lossy compression, for the
videos.
▪ Maintains quality // quality better than lossy
▪ Original file is retained // Data is not permanently lost
▪ A significant reduction in file size is not required
Give two disadvantages of Sammi using lossless compression, rather than lossy compression, for
the videos.
▪ Takes more time to transmit file // Takes more time to upload to web server // Takes
more time to download to customer // Web page will load slower
▪ Takes up more storage space
▪ Data usage would be increased
▪ Uses more bandwidth
Question 130

The paragraph describes an MP3 file, MP4 file and a MIDI file.
Complete the paragraph using the list of terms. Not all terms in the list need to be used.
▪ can
▪ cannot
▪ compressed
▪ image
▪ microphone
▪ MIDI
▪ MP3
▪ MP4
▪ notes
▪ pixels
▪ speaker
▪ should
▪ uncompressed
MP4 files are a multimedia format that stores video and audio.
MP3 files are only used as a digital recording of sound; they
are created using a Microphone and recording software. The data in
the file is Compressed.

66
IGCSE CS 0984

Question 131

Julius also creates videos to explain how to use the application that he has created. He reduces the
file size of the videos using lossless compression. Describe how lossless compression reduces the
file size of the video.
▪ Compression algorithm used
▪ …, e.g. RLE
▪ Repeating frames/pixels are identified
▪ … and are collated/indexed
▪ No data is permanently removed
▪ It just records the changes between frames/pixels
State why Julius uses lossless compression, rather than lossy compression.
▪ Maintains quality // quality better than lossy
▪ Original file is retained // Data is not permanently lost
▪ A significant reduction in file size is not required

67

You might also like