Data Representation Homework #01 - Answers: A) 1100 B) 111010 C) 1010010 D) 10011 E) 101101
Data Representation Homework #01 - Answers: A) 1100 B) 111010 C) 1010010 D) 10011 E) 101101
Data Representation Homework #01 - Answers: A) 1100 B) 111010 C) 1010010 D) 10011 E) 101101
a) 1100
b) 111010
c) 1010010
d) 10011
e) 101101
Question 2
Hexadecimal
C4 10 FE 09
What is the largest decimal number that can be represented in binary with eight bits?
28-1=255
Question 4
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.
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:
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) BE1
(b) 21FD
Question 11
(a) 100000010101010
(b) 1101101001000111
Question 12
(a) 44425
(b) 4782
7
IGCSE CS 0984
Question 13
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
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
9
IGCSE CS 0984
Question 18
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:
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
Location 2
0100 0011
4 3
Therefore, location 1 contains 43 in hexadecimal
1 1 1 1 1 0 1 0 1 0 0 1 0 1 1 1
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
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
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
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
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
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:
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
112
All the bits in the register are shifted one place to the right as shown below.
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.
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
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
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 stopwatch uses six digits to display hours, minutes and seconds. The stopwatch is stopped at
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
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
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
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
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
Give the smallest number of bits that can be used to store the denary value 2000.
11
Question 51
26
IGCSE CS 0984
Question 52
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
Question 54
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
The number of bits assigned to each sample, effecting the range of volumes that can be stored
in a sample
Question 58
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
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
Here are the contents of three memory locations with addresses shown in denary.
1001 0110
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?
1 bit
For a 256-colour bitmap, each pixel requires a byte of memory. Explain this statement.
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
▪ 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
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
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 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.
32
IGCSE CS 0984
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
The program used the ASCII coding system for character codes. An alternative coding system is
Unicode. Give two disadvantages of using ASCII code.
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.
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.
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.
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.
The binary integer represents a character from the computer’s character set. Define the term
character set.
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.
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
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
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
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.
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
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
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
44
IGCSE CS 0984
Question 89
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
45
IGCSE CS 0984
46
IGCSE CS 0984
Question 92
Question 93
The following 2 pictures are images of the letter ‘R’ stored as bitmap files:
47
IGCSE CS 0984
On what does the quality of the pictures taken by the digital camera mainly depend? [1]
Number of pixels
Question 95
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
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.
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
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
51
IGCSE CS 0984
Question 102
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
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.
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
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
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
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
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
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