Chapter 1 - Data Representation
Chapter 1 - Data Representation
(Chapter 1)
Syllabus Content:
1
Syllabus Content:
2
Syllabus Content:
3
Syllabus Content:
4
1 Data Representation
5
Example:
The following is an 8-bit register which means it contains 8 digits. The registers are always filled
from right to left.
27 26 25 24 23 22 21 20
128 64 32 16 8 4 2 1
Example:
Understanding Bits:
For a better understanding, binary numbers can be broken down into their smallest representation
called bits (the term bit is short for binary digit). The easiest way to understand bits is to think of
them as digits. Digit is simply a single place that can hold numerical values between 0 and 9.
For example, 6357 has four digits. It is understood that in this number:
6
So you could express things this way if you wanted to be clear:
Another way to represent it would be in denary (decimal) number system by using powers of 10
like we saw in the table above. The power increases from right-hand side to the left-hand side.
It can be seen from this that each digit is a placeholder for the next higher power of 10, starting
from the first digit with 10 raised to the power of zero and so on.
The binary number system works exactly the same way as the denary system, except that it
contains only two digits, 0 and 1.
For example, to figure out the value of binary number 1101, you use the similar method described
above but with a base of 2 instead of 10 (which means that increasing powers of 2 from right-hand
side to the left-hand side instead of powers of 10).
To further simplify this, we can use the table method as well, by drawing a 4 bit register as 1101
contains only 4 digits.
23 22 21 20
8 4 2 1
? ? ? ?
Now fill 1101 in the table and remember that 1 means YES/ON and 0 means NO/OFF. So
accordingly, the powers of 2 above 1’s would be counted whereas the powers above 0 would be
ignored.
23 22 21 20
8 4 2 1
1 1 0 1
We get 8 (23), 4 (22) and 1 (20) from the table and 2 (21) is ignored as the binary value 0 means OFF
or more simply, 2 x 0 = 0.
7
Conversions:
(i) binary to denary:
1. First, draw a table like the ones above.
2. On top of the table, simply write the powers of 2 starting from right to left in an increasing
order.
3. The binary number given to you is written underneath the powers.
4. The powers of 2 above binary number “1” are taken into consideration and those above “0”
are simply ignored.
5. The powers of 2 above “1” are all written and added together to obtain the denary number.
Examples:
The maximum binary number length for conversion to be used in this syllabus is 16-bit.
The process of binary to denary conversion is best shown by four examples below which use the 6-
bit, 8-bit, 12-bit & 16-bit binary numbers:
Since the total digits are 8, we’ll use an 8-bit register as given below.
You can either write it as powers of 2 from right to left or straight away the results of the powers.
For example, you can either use 23 or its result 8.
27 26 25 24 23 22 21 20
128 64 32 16 8 4 2 1
1 1 1 0 1 1 1 0
Numbers “16” and “1” are ignored since the binary value underneath them is 0. We simply take
128, 64, 32, 8, 4, 2 and add them all together.
8
2) Convert (111001)2 to denary [6-bit]:
Since the total digits are 6, we’ll still use an 8-bit register but in a slightly different way.
We will write this binary number in the table starting from right-hand side to the left hand-side.
Only 6 places will be filled and leftmost 2 will be left empty.
In a register, all the places have to be filled so we will write 0 in the empty spaces instead of
leaving them blank to fulfil the pattern of 8-bit register.
27 26 25 24 23 22 21 20
128 64 32 16 8 4 2 1
0 (blank) 0 (blank) 1 1 1 0 0 1
Numbers “128”, “64”, “4” and “2” are ignored since the binary value underneath them is 0. We
simply take 32, 16, 8, 1 and add them all together.
32 + 16+ 8 + 1 = (57)10
Since the total digits are 12, we’ll use an 12-bit register as given below.
You can either write it as powers of 2 from right to left or straight away the results of the powers.
For example, you can either use 23 or its result 8.
211 210 29 28 27 26 25 24 23 22 21 20
0 1 1 1 1 0 0 0 1 0 1 1
Numbers “2048”, “64”, “32”, “16” and “4” are ignored since the binary value underneath them is 0.
We simply take 1024, 512, 256, 128, 8, 2, 1 and add them all together.
9
4) Convert (0011000111100110)2 to denary [16-bit]:
Since the total digits are 16, we’ll use a 16-bit register as given below.
You can either write it as powers of 2 from right to left or straight away the results of the powers.
For example, you can either use 23 or its result 8.
0 0 1 1 0 0 0 1 1 1 1 0 0 1 1 0
Numbers “32768”, “16384”, “2048”, “1024”, “512”, “16”, “8” and “1” are ignored since the binary
value underneath them is 0. We simply take 8192, 4096, 256, 128, 64, 32, 4, 2 and add them all
together.
This same method can be used for a binary number of any size.
Examples:
The process of denary to binary conversion is best shown by three examples below:
1. Does the number go into 128? Yes, so it becomes a ‘1’ and (142 – 128 = 14).
2. Does the remaining 14 go into 64? No, so it becomes a ‘0’.
3. Does the remaining 14 go into 32? No, so it also becomes a ‘0’.
4. Does the remaining 14 go into 16? No, so it also becomes a ‘0’.
5. Does the remaining 14 go into 8? Yes, so it becomes a ‘1’ and (14 – 8 = 6).
6. Does the remaining 6 go into 4? Yes, so it also becomes a ‘1’ and (6 – 4 = 2).
7. Does the remaining 2 go into 2? Yes, so it also becomes a ‘1’ and (2 – 2 = 0).
8. Since there is nothing left to compare with 1, it becomes a ‘0’ by default.
128 64 32 16 8 4 2 1
1 0 0 0 1 1 1 0
10
Hence the answer becomes: (10001110)2
You can now double check your answer by the same method used in binary to denary
conversion:
Numbers “64”, “32”, “16” and “1” are ignored since the binary value underneath them is 0. We
simply take 128, 8, 4, 2 and add them all together.
128 + 8 + 4 + 2 = (142)10
Hence this confirms that the answer of conversion from denary to binary (10001110)2 is
correct.
128 64 32 16 8 4 2 1
0 0 1 1 1 0 1 1
You can now double check your answer by the same method used in binary to denary
conversion:
Numbers “128”, “64” and “4” are ignored since the binary value underneath them is 0. We simply
take 32, 16, 8, 2, 1 and add them all together.
32 + 16 + 8 + 2 + 1 = (59)10
Hence this confirms that the answer of conversion from denary to binary (00111011)2 is
correct.
11
The third example shows how this method can be used for any size of binary number, which
in this case is a 16-bit binary number.
1. Does the number go into 32768? Yes, so it becomes a ‘1’ and (35000 – 32768 = 2232).
2. Does the remaining 2232 go into 16384? No, so it becomes a ‘0’.
3. Does the remaining 2232 go into 8192? No, so it also becomes a ‘0’.
4. Does the remaining 2232 go into 4096? No, so it also becomes a ‘0’.
5. Does the remaining 2232 go into 2048? Yes, so it becomes a ‘1’ and (2232 – 2048 = 184)
6. Does the remaining 184 go into 1024? No, so it becomes a ‘0’.
7. Does the remaining 184 go into 512? No, so it also becomes a ‘0’.
8. Does the remaining 184 go into 256? No, so it also becomes a ‘0’.
9. Does the remaining 184 go into 128? Yes, so it becomes a ‘1’ and (184 – 128 = 56).
10. Does the remaining 56 go into 64? No, so it also becomes a ‘0’.
11. Does the remaining 56 go into 32? Yes, so it becomes a ‘1’ and (56 – 32 = 24).
12. Does the remaining 24 go into 16? Yes, so it also becomes a ‘1’ and (24 – 16 = 8).
13. Does the remaining 8 go into 8? Yes, so it also becomes a ‘1’ and (8 – 8 = 0).
14. Since there is nothing left to compare with 4, 2 & 1, they all become ‘0’ by default.
1 0 0 0 1 0 0 0 1 0 1 1 1 0 0 0
You can now double check your answer by the same method used in binary to denary
conversion:
Numbers “16384”, “8192”, “4096”, “1024”, “512”, “256”, “64”, “4”, “2” and “1” are ignored since the
binary value underneath them is 0. We simply take 32768, 2048, 128, 32, 16, 8 and add them all
together.
Hence this confirms that the answer of conversion from denary to binary
(1000100010111000)2 is correct.
12
Why is data always stored as binary in computers?
For example, the following is a robot vacuum cleaner with the shown structure and register:
i) 10101010:
motor B is ON and motor C is ON and both motors are turning to produce forward motion.
ii) 10011000:
motor B is ON and motor C is OFF and motor B is turning to produce forward motion.
iii) 10100110:
(b) What would the register contain if only motor C was ON and the motors were turning in
a backwards direction?
01100101
13
c) What would the register contain if motor B and motor C were both ON but B was turning
in a backward direction and C was turning in a forward direction?
10100110
14
Exam Style Questions:
Question 1:
Explain the difference between binary number system and denary number system. (4)
Exam Tip:
One statement about either binary or denary earns you 1 mark while a statement
involving both binary and denary with an appropriate comparison using words such as
“whereas or while” earns you 2 marks for each proper comparison.
To obtain 4/4 marks in such questions, you need to write two proper comparisons which
means a total of 4 statements (2 about binary + 2 about denary).
Possible answers:
A binary number system is a base-2 system whereas a denary number system is a base-10
system.
A binary number system uses 0 and 1 values whereas a denary number system uses 0 to 9
values.
Binary has units that increase by power of 2 whereas denary has units that increase by
power of 10.
15
Question 2:
Answer:
16
3) The Hexadecimal System:
The hexadecimal number system is a base 16 number system.
It uses 16 different values to represent each digit and the values used are 0-9 and A-F.
It can be written in sequence as 0,1,2,3,4,5,6,7,8,9 and 10,11,12,13,14,15 which becomes
letters such as:
Digit Letter
10 = A
11 = B
12 = C
13 = D
14 = E
15 = F
This means that it counts in multiples of 16 giving us the headings such as 160, 161, 162, 163
and so on.
Since 16 = 24 this means that four binary digits are equivalent to each hexadecimal digit.
The table on the next page summarizes the link between binary, hexadecimal and denary. It is
mostly used for direct conversions from binary to hexadecimal, and hexadecimal to binary.
17
Conversions (continued):
1 0 0 0 8 8
(ii) hexadecimal to binary:
1 0 0 1 9 9
Examples:
1 0 1 0 A 10
1) Convert (21FD)16 to binary:
1 0 1 1 B 11
Use the table on the left and for each digit find
1 1 0 0 C 12 equivalent binary digits.
1 1 0 1 D 13 2 = 0010, 1 = 0001, F = 1111, D = 1101
1 1 1 0 E 14 Hence the binary number is:
1 1 1 1 F 15 (0010000111111101)2
Note: In case of a binary number with 14 digits, it will be split into 4 groups (from right to left
always) and each must contain four bits. 4 bits x 4 groups = 16 digits total. Hence, we must add 0’s
to fill the empty space of 2 digits.
To complete the space of 2 digits on left, we will add 2 zeroes and it will become:
Following the same method, we will use the table above and find the equivalent hexadecimal
digits for all four parts.
18
(iii) hexadecimal to denary:
Examples:
First multiply each digit by its value (power of 16 written above it) and then add the results
together:
4 5 A = 10
First multiply each digit by its value (power of 16 written above it) and then add the results
together:
C = 12 8 F = 15
Place hexadecimal digits in appropriate positions (under appropriate powers of 16) so that the
total equates to 2004:
256 16 1
7 13 = D 4
19
2) Convert (3743)10 to hexadecimal:
Place hexadecimal digits in appropriate positions (under appropriate powers of 16) so that the
total equates to 3743:
256 16 1
14 = E 9 15 = F
Another method involves successive division by 16. The remainders are then read from
bottom to top to give hexadecimal value. Using 3743, we get:
16 3743
16 233 15
16 14 9
0 14
14 = E
9
15 = F
20
There are four main uses of the hexadecimal system in our syllabus:
1. Error codes
2. Media Access Control (addresses) / MAC addresses
3. Internet Protocol addresses / IPv6 addresses
4. HTML color codes
1) Error Codes:
The error codes are often shown as hexadecimal values.
These numbers refer to the memory location of the error and are usually automatically
generated by the computer.
The programmer needs to know how to interpret the hexadecimal error codes.
NN–NN–NN–DD–DD–DD OR NN:NN:NN:DD:DD:DD
NOTE: Any of the following points written according to number of marks will earn you full
marks in exam question such as:
For a 3 mark question, write any 3 points.
For a 4 mark question, write 4 points
Therefore, write answers accordingly based on number of marks
21
Explain what the hexadecimal code in a MAC address represents.
NOTE: The hexadecimal code in a MAC address is the NN’s and DD’s.
IPv4 address:
IPv6 address:
Note: IPv6 uses a colon (:) rather than a decimal point (.) as used in IPv4.
HTML is used in specifying the color of the text using tags which bracket a piece of code.
It is used to represent different colors of text on computer screens and all colors can be
made up of different combinations of three primary colors: red, green & blue.
The different intensity of each primary color is determined by its hexadecimal value.
This shows different hexadecimal values represent different colors.
22
The color codes are always six hexadecimal digits representing the red, green & blue
components.
There are a possible 256 values for red, 256 values for green and 256 values for blue.
This proves 256 x 256 x 256 = 16 177 216 possible colors.
Example:
23
Exam Style Questions:
Question 1:
Answer:
24
Question 2:
25
Answer:
Question 3:
Answer:
26
Question 4:
27
Answer:
Question 5:
Answer:
28
Question 6:
29
Answer:
30
1.1.4 Binary Addition & Overflow:
NOTE: Binary Addition & Overflow are newly added topics in the Computer Science
(2210) syllabus for the session 2023–2025.
According to the new syllabus, we will look at the method of adding two positive 8-bit binary
integers.
The given key facts must be memorized at all costs because they will help in solving all types
of addition questions easily.
Remember the following rules when carrying out addition of two binary digits:
0+0 0 0
0+1 0 1
1+0 0 1
1+1 1 0
Remember the following extension of rules when carrying out addition of three binary
digits:
0+0+0 0 0
0+0+1 0 1
0+1+0 0 1
0+1+1 1 0
1+0+0 0 1
1+0+1 1 0
1+1+0 1 0
1+1+1 1 1
31
Examples:
The labeling below represents column numbers, such as c1 is column 1 & c5 is column 5.
Since binary addition is a newly added topic, the following addition example is solved step-by-step
so you can understand it better first and then practice a lot afterwards.
c8 c7 c6 c5 c4 c3 c2 c1
0 0 1 0 0 1 1 1
+ 0 1 0 0 1 0 1 0
carry values
sum values
1 + 0 = 1 (sum) & 0 (carry); therefore, carry column will be left blank for next column (c2).
c8 c7 c6 c5 c4 c3 c2 c1
0 0 1 0 0 1 1 1
+ 0 1 0 0 1 0 1 0
carry values
1 sum values
1 + 1 = 0 (sum) & 1 (carry); the carry value will be added to next column (c3).
c8 c7 c6 c5 c4 c3 c2 c1
0 0 1 0 0 1 1 1
+ 0 1 0 0 1 0 1 0
1 carry values
0 1 sum values
32
3) Solving c3 (according to rules of tables for three-digit addition):
1 + 0 + 1 (from carry) = 0 (sum) & 1 (carry); the carry value will be added to next column
(c4).
c8 c7 c6 c5 c4 c3 c2 c1
0 0 1 0 0 1 1 1
+ 0 1 0 0 1 0 1 0
1 1 carry values
0 0 1 sum values
0 + 1 + 1 = 0 (sum) & 1 (carry); the carry value will be added to the next column (c5).
c8 c7 c6 c5 c4 c3 c2 c1
0 0 1 0 0 1 1 1
+ 0 1 0 0 1 0 1 0
1 1 1 carry values
0 0 0 1 sum values
0 + 0 + 1 = 1 (sum) & 0 (carry); therefore, carry column will be left blank for next column
(c6).
c8 c7 c6 c5 c4 c3 c2 c1
0 0 1 0 0 1 1 1
+ 0 1 0 0 1 0 1 0
1 1 1 carry values
1 0 0 0 1 sum values
33
6) Solving c6 (according to rules of tables for two-digit addition):
1 + 0 = 1 (sum) & 0 (carry); therefore, carry column will be left blank for next column (c7).
c8 c7 c6 c5 c4 c3 c2 c1
0 0 1 0 0 1 1 1
+ 0 1 0 0 1 0 1 0
1 1 1 carry values
1 1 0 0 0 1 sum values
0 + 1 = 1 (sum) & 0 (carry); therefore, carry column will be left blank for last column (c8).
c8 c7 c6 c5 c4 c3 c2 c1
0 0 1 0 0 1 1 1
+ 0 1 0 0 1 0 1 0
1 1 1 carry values
1 1 1 0 0 0 1 sum values
0 + 0 = 0 (sum) & 0 (carry); therefore, no additional 9th bit would be generated and so
no overflow will occur (overflow discussed later).
c8 c7 c6 c5 c4 c3 c2 c1
0 0 1 0 0 1 1 1
+ 0 1 0 0 1 0 1 0
1 1 1 carry values
0 1 1 1 0 0 0 1 sum values
34
The second addition example is more advanced and solved step-by-step so you can understand it
better first and then practice a lot afterwards.
126 = 0 1 1 1 1 1 1 0
62 = 0 0 1 1 1 1 1 0
Add these two binary values obtained above and check that the result matches the addition
of these two denary numbers above:
c8 c7 c6 c5 c4 c3 c2 c1
0 1 1 1 1 1 1 0
+ 0 0 1 1 1 1 1 0
carry values
sum values
0 + 0 = 0 (sum) & 0 (carry); therefore, carry column will be left blank for next column (c2).
c8 c7 c6 c5 c4 c3 c2 c1
0 1 1 1 1 1 1 0
+ 0 0 1 1 1 1 1 0
carry values
0 sum values
35
2) Solving c2 (according to rules of tables for two-digit addition):
1 + 1 = 0 (sum) & 1 (carry); the carry value will be added to the next column (c3).
c8 c7 c6 c5 c4 c3 c2 c1
0 1 1 1 1 1 1 0
+ 0 0 1 1 1 1 1 0
1 carry values
0 0 sum values
1 + 1 + 1 = 1 (sum) & 1 (carry); the carry value will be added to the next column (c4).
c8 c7 c6 c5 c4 c3 c2 c1
0 1 1 1 1 1 1 0
+ 0 0 1 1 1 1 1 0
1 1 carry values
1 0 0 sum values
1 + 1 + 1 = 1 (sum) & 1 (carry); the carry value will be added to the next column (c5).
c8 c7 c6 c5 c4 c3 c2 c1
0 1 1 1 1 1 1 0
+ 0 0 1 1 1 1 1 0
1 1 1 carry values
1 1 0 0 sum values
36
5) Solving c5 (according to rules of tables for three-digit addition):
1 + 1 + 1 = 1 (sum) & 1 (carry); the carry value will be added to the next column (c6).
c8 c7 c6 c5 c4 c3 c2 c1
0 1 1 1 1 1 1 0
+ 0 0 1 1 1 1 1 0
1 1 1 1 carry values
1 1 1 0 0 sum values
1 + 1 + 1 = 1 (sum) & 1 (carry); the carry value will be added to the next column (c7).
c8 c7 c6 c5 c4 c3 c2 c1
0 1 1 1 1 1 1 0
+ 0 0 1 1 1 1 1 0
1 1 1 1 1 carry values
1 1 1 1 0 0 sum values
1 + 0 + 1 = 0 (sum) & 1 (carry); the carry value will be added to the next column (c8).
c8 c7 c6 c5 c4 c3 c2 c1
0 1 1 1 1 1 1 0
+ 0 0 1 1 1 1 1 0
1 1 1 1 1 1 carry values
0 1 1 1 1 0 0 sum values
37
8) Solving c8 (according to rules of tables for three-digit addition):
0 + 0 + 1 = 1 (sum) & 0 (carry); therefore, no additional 9th bit would be generated and
so no overflow will occur (overflow discussed later)
c8 c7 c6 c5 c4 c3 c2 c1
0 1 1 1 1 1 1 0
+ 0 0 1 1 1 1 1 0
1 1 1 1 1 1 carry values
1 0 1 1 1 1 0 0 sum values
128 + 32 + 16 + 8 + 4 = 188
126 + 62 = 188
Hence the result of two binary numbers matches the addition of their two denary numbers.
An overflow error will occur if the result of addition is greater than 255 in an 8-bit register.
An 8-bit register would allow a maximum denary value of 255 (which is 28 – 1) to be stored.
The generation of a 9th bit in addition shows sum has exceeded this value causing overflow
error.
This indicates that a number is too big to be stored in the computer using 8 bits hence it
requires more bits for storage.
However, the greater the number of bits which can be used to represent a number then the
larger the number that can be stored. The examples are given on the next page.
38
Overflow in 16-bit register:
An overflow error will occur if the result of addition is greater than 65 535 in a 16-bit
register.
A 16-bit register would allow a maximum denary value of 65 535 (which is 216 – 1) to be
stored.
The generation of a 9th bit in addition shows sum has exceeded this value causing overflow
error.
This indicates that a number is too big to be stored in the computer using 16 bits hence it
requires more bits for storage.
An overflow error will occur if the result of addition is greater than 4 294 967 295 in a 32-bit
register.
A 32-bit register would allow a maximum denary value of 4 294 967 295 (which is 232 – 1) to
be stored.
The generation of a 9th bit in addition shows sum has exceeded this value causing overflow
error.
This indicates that a number is too big to be stored in the computer using 32 bits hence it
requires more bits for storage.
This process of overflow goes on for 64-bit register, 128-bit register and so on in a similar way.
Example of Overflow:
The labeling below represents column numbers, such as c1 is column 1 & c5 is column 5.
Since overflow & binary addition are newly added topics, the following overflow in addition
example is solved step-by-step so you can understand it better first and then practice a lot
afterwards.
c8 c7 c6 c5 c4 c3 c2 c1
0 1 1 0 1 1 1 0
+ 1 1 0 1 1 1 1 0
carry values
sum values
Note: The denary number of 01101110 is 110 & denary number of 11011110 is 222.
39
1) Solving c1 & c2 first (according to rules of tables for two-digit addition):
c1 → 0 + 0 = 0 (sum) & 0 (carry); the carry column will be left blank for next column (c2).
c2 → 1 + 1 = 0 (sum) & 1 (carry); the carry value will be added to the next column (c3).
c8 c7 c6 c5 c4 c3 c2 c1
0 1 1 0 1 1 1 0
+ 1 1 0 1 1 1 1 0
1 carry values
0 0 sum values
c3 → 1 + 1 + 1 = 1 (sum) & 1 (carry); the carry value will be added to the next column (c4).
c4 → 1 + 1 + 1 = 1 (sum) & 1 (carry); the carry value will be added to the next column (c5).
c8 c7 c6 c5 c4 c3 c2 c1
0 1 1 0 1 1 1 0
+ 1 1 0 1 1 1 1 0
1 1 1 carry values
1 1 0 0 sum values
c5 → 0 + 1 + 1 = 0 (sum) & 1 (carry); the carry value will be added to the next column (c6).
c6 → 1 + 0 + 1 = 0 (sum) & 1 (carry); the carry value will be added to the next column (c7).
c8 c7 c6 c5 c4 c3 c2 c1
0 1 1 0 1 1 1 0
+ 1 1 0 1 1 1 1 0
1 1 1 1 1 carry values
0 0 1 1 0 0 sum values
40
4) Solving c7 (according to rules of tables for three-digit addition):
c7 → 1 + 1 + 1 = 1 (sum) & 1 (carry); the carry value will be added to the next column (c8).
c8 c7 c6 c5 c4 c3 c2 c1
0 1 1 0 1 1 1 0
+ 1 1 0 1 1 1 1 0
1 1 1 1 1 1 carry values
1 0 0 1 1 0 0 sum values
c8 c7 c6 c5 c4 c3 c2 c1
0 1 1 0 1 1 1 0
+ 1 1 0 1 1 1 1 0
1 1 1 1 1 1 1 carry values
1 0 1 0 0 1 1 0 0 sum values
41
Exam Tip:
The description of overflow given on previous page is for your conceptual understanding
only.
However, in the exam you will only write a specific, to the point and short answer such as
sample answers written for sample questions given below:
Sample Question 1: Describe an error that may occur during addition of binary numbers. (2)
Sample Answer:
Sample Question 2: State how an overflow can occur when adding two binary integers. (1)
Sample Answer:
The result is a larger number than can be stored in the given number of bits OR
The result is greater than 255.
42
Exam Style Questions:
Question 1:
Answer:
43
Question 2:
Answer:
Question 3:
Answer:
44
Question 4:
Answer:
45
Question 5:
Answer:
46
1.1.5 Logical Binary Shifts:
NOTE: Logical Binary Shifts is a newly added topic in the Computer Science (2210)
syllabus for the session 2023–2025.
According to the new syllabus, we will look at the method of performing a logical binary shift on a
positive 8-bit binary integer and understanding the effect this has on the positive binary integer.
Throughout this section, as per syllabus requirement, we will only use 8-bit registers.
Multiple right & left shifts can be performed on the same 8-bit binary integer.
However, there is clearly a limit to the number of shifts that can be carried out if the binary
number is stored in an 8-bit register.
Eventually after a number of shifts the register would only contain zeroes.
For Example:
This makes it seem as denary 112 x 32 (25) = 0! which is illogical because register contains 0
values and multiplication of 112 x 32 (25) cannot be equal to 0.
47
Most Significant & Least Significant Bit:
The bits shifted from the left end of the register are lost and zeros are shifted in at the
opposite right end of the register.
The positive binary integer is multiplied by 2 according to the left shift performed.
In this case, the most significant bit(s) are lost.
The bits shifted from the right end of the register are lost and zeros are shifted in at the
opposite left end of the register.
The positive binary integer is divided by 2 according to the right shift performed.
In this case, the least significant bit(s) are lost.
48
Examples of Logical Left Shift:
128 64 32 16 8 4 2 1
0 0 0 1 0 1 0 1
128 64 32 16 8 4 2 1
Left-most bit
is lost 0 0 1 0 1 0 1
This means that the left-most bit ‘0’ is lost & the remaining original 7 bits of binary number
0 0 1 0 1 0 1 are moved 1 place to the left:
128 64 32 16 8 4 2 1
0 0 1 0 1 0 1
49
Therefore, left-most bit is lost, and right-most bit position is now filled with a ‘0’ following
the logical left shift. This binary number is obtained:
128 64 32 16 8 4 2 1
0 0 1 0 1 0 1 0
Hence this confirms that the logical left shift is performed correctly.
128 64 32 16 8 4 2 1
0 0 0 1 0 1 0 1
128 64 32 16 8 4 2 1
Left-most bits
are lost 0 1 0 1 0 1
This means that the left-most bits ‘0’ & ‘0’ are lost & the remaining original 6 bits of binary
number 0 1 0 1 0 1 are moved 1 place to the left each:
128 64 32 16 8 4 2 1
0 1 0 1 0 1
50
This results in two empty right-most bits (least significant bits) position:
These empty right-most bits positions are filled with ‘0’’s both:
Therefore, two left-most bits are lost, and two right-most bits position is now filled with ‘0’s
following the double logical left shift. This binary number is obtained:
128 64 32 16 8 4 2 1
0 1 0 1 0 1 0 0
Hence this confirms that the double logical left shift is performed correctly.
51
(iii) Performing a triple logical left shift (3 times):
128 64 32 16 8 4 2 1
0 0 0 1 0 1 0 1
128 64 32 16 8 4 2 1
Left-most bits
are lost 1 0 1 0 1
This means that the left-most bits ‘0’, ‘0’ & ‘0’ are lost & the remaining original 5 bits of
binary number 1 0 1 0 1 are moved 1 place to the left each:
128 64 32 16 8 4 2 1
1 0 1 0 1
This results in three empty right-most bits (least significant bits) position:
52
Therefore, three left-most bits are lost, and three right-most bits position is now filled with
‘0’s following the triple logical left shift. This binary number is obtained:
128 64 32 16 8 4 2 1
1 0 1 0 1 0 0 0
Hence this confirms that the triple logical left shift is performed correctly.
128 64 32 16 8 4 2 1
0 0 0 1 0 1 0 1
128 64 32 16 8 4 2 1
Left-most bits
are lost 1 0 1 0 1
This means that the left-most bits ‘0’, ‘0’, ‘0’ & ’1’ are lost & the remaining original 4 bits of
binary number 0 1 0 1 are moved 1 place to the left each.
The loss of left-most 0-bits does not cause an error but as soon as a left-most 1-bit is lost, an
error occurs.
53
128 64 32 16 8 4 2 1
0 1 0 1
This results in four empty right-most bits (least significant bits) position:
Therefore, four left-most bits are lost, and four right-most bits position is now filled with ‘0’s
following the tetra logical left shift. This binary number is obtained:
128 64 32 16 8 4 2 1
0 1 0 1 0 0 0 0
Hence this confirms that the tetra logical left shift has caused an error.
This error is because we have exceeded the maximum number of left shifts possible using
this 8-bit register.
54
Error in Logical Left Shift:
The logical left shifts can be performed as many times as it does not cause loss of left-most
1-bit in the shift operation.
The loss of left-most 1-bit following a shift operation causes an error.
Therefore, shifting process can continue (error-free) as long as only left-most 0-bits are
being lost.
So, the loss of left-most 0-bits does not cause an error but as soon as a left-most 1-bit is
lost, an error occurs.
1) 0 0 0 0 0 0 0 1:
128 64 32 16 8 4 2 1
0 0 0 0 0 0 0 1
This binary number can be shifted left 7 times because there are 7 left-most 0-bits in this
number.
2) 0 0 0 0 0 0 1 1:
128 64 32 16 8 4 2 1
0 0 0 0 0 0 1 1
This binary number can be shifted left 6 times because there are 6 left-most 0-bits in this
number.
3) 0 0 0 0 0 1 1 1:
128 64 32 16 8 4 2 1
0 0 0 0 0 1 1 1
This binary number can be shifted left 5 times because there are 5 left-most 0-bits in this
number.
55
4) 0 0 0 0 1 1 1 1:
128 64 32 16 8 4 2 1
0 0 0 0 1 1 1 1
This binary number can be shifted left 4 times because there are 4 left-most 0-bits in this
number.
5) 0 0 0 1 1 1 1 1:
128 64 32 16 8 4 2 1
0 0 0 1 1 1 1 1
This binary number can be shifted left 3 times because there are 3 left-most 0-bits in this
number.
6) 0 0 1 1 1 1 1 1:
128 64 32 16 8 4 2 1
0 0 1 1 1 1 1 1
This binary number can be shifted left 2 times because there are 2 left-most 0-bits in this
number.
7) 0 1 1 1 1 1 1 1:
128 64 32 16 8 4 2 1
0 1 1 1 1 1 1 1
This binary number can be shifted left 1 time because there is 1 left-most 0-bit in this
number.
8) 1 1 1 1 1 1 1 1:
128 64 32 16 8 4 2 1
1 1 1 1 1 1 1 1
This binary number cannot be shifted left even once because there is 0 left-most 0-bit in
this number.
56
Examples of Logical Right Shift:
The denary number 200 is 1 1 0 0 1 0 0 0 in binary that is put into an 8-bit register:
128 64 32 16 8 4 2 1
1 1 0 0 1 0 0 0
128 64 32 16 8 4 2 1
Right-most
1 1 0 0 1 0 0 bit is lost
This means that the right-most bit ‘0’ is lost & the remaining original 7 bits of binary
number 1 1 0 0 1 0 0 are moved 1 place to the right:
128 64 32 16 8 4 2 1
1 1 0 0 1 0 0
57
Therefore, right-most bit is lost, and left-most bit position is now filled with a ‘0’ following
the logical right shift. This binary number is obtained:
128 64 32 16 8 4 2 1
0 1 1 0 0 1 0 0
The value of the binary bits is now denary number 200 ÷ 21 = 100
Therefore, the positive binary integer is divided by 2 as a result of the logical right shift
performed.
Hence this confirms that the logical right shift is performed correctly.
The denary number 200 is 1 1 0 0 1 0 0 0 in binary. Putting this into an 8-bit register:
128 64 32 16 8 4 2 1
1 1 0 0 1 0 0 0
128 64 32 16 8 4 2 1
Right-most
1 1 0 0 1 0 bits are lost
This means that the right-most bits ‘0’ & ‘0’ are lost & the remaining original 6 bits of binary
number 1 1 0 0 1 0 are moved 1 place to the right each:
128 64 32 16 8 4 2 1
1 1 0 0 1 0
58
This results in two empty left-most bits (most significant bits) position:
These empty left-most bits positions are filled with ‘0’’s both:
Therefore, two right-most bits are lost, and two left-most bits position is now filled with ‘0’s
following the double logical right shift. This binary number is obtained:
128 64 32 16 8 4 2 1
0 0 1 1 0 0 1 0
Hence this confirms that the double logical right shift is performed correctly.
59
(iii) Performing a triple logical right shift (3 times):
The denary number 200 is 1 1 0 0 1 0 0 0 in binary. Putting this into an 8-bit register:
128 64 32 16 8 4 2 1
1 1 0 0 1 0 0 0
128 64 32 16 8 4 2 1
Right-most
1 1 0 0 1 bits are lost
This means that the right-most bits ‘0’, ‘0’ & ‘0’ are lost & the remaining original 5 bits of
binary number 1 1 0 0 1 are moved 1 place to the right each:
128 64 32 16 8 4 2 1
1 1 0 0 1
This results in three empty left-most bits (most significant bits) position:
60
Therefore, three right-most bits are lost, and three left-most bits position is now filled with
‘0’s following the triple logical right shift. This binary number is obtained:
128 64 32 16 8 4 2 1
0 0 0 1 1 0 0 1
Hence this confirms that the triple logical right shift is performed correctly.
The denary number 200 is 1 1 0 0 1 0 0 0 in binary. Putting this into an 8-bit register:
128 64 32 16 8 4 2 1
1 1 0 0 1 0 0 0
128 64 32 16 8 4 2 1
Right-most
1 1 0 0 1 bits are lost
This means that the right-most bits ‘0’, ‘0’, ‘0’ & ‘1’ are lost & the remaining original 4 bits of
binary number 1 1 0 0 are moved 1 place to the right each.
The loss of right-most 0-bits does not cause an error but as soon as a right-most 1-bit is lost,
an error occurs.
61
128 64 32 16 8 4 2 1
1 1 0 0
This results in four empty left-most bits (most significant bits) position:
Therefore, four right-most bits are lost, and four left-most bits position is now filled with ‘0’s
following the tetra logical right shift. This binary number is obtained:
128 64 32 16 8 4 2 1
0 0 0 0 1 1 0 0
The value of the binary bits is now denary number 200 ÷ 24 = 12.5
Therefore, the positive binary integer is divided by 24 as a result of the tetra logical right
shift performed.
However, this is incorrect and an error has occurred.
Hence this confirms that the tetra logical right shift has caused an error.
This error is because we have exceeded the maximum number of right shifts possible using
this 8-bit register.
62
Error in Logical Right Shift:
The logical right shifts can be performed as many times as it does not cause loss of right-
most 1-bit in the shift operation.
The loss of right-most 1-bit following a shift operation causes an error.
Therefore, shifting process can continue (error-free) as long as only right-most 0-bits are
being lost.
So, the loss of right-most 0-bits does not cause an error but as soon as a right-most 1-bit is
lost, an error occurs.
1) 1 0 0 0 0 0 0 0:
128 64 32 16 8 4 2 1
1 0 0 0 0 0 0 0
This binary number can be shifted right 7 times because there are 7 right-most 0-bits in this
number.
2) 1 1 0 0 0 0 0 0:
128 64 32 16 8 4 2 1
1 1 0 0 0 0 0 0
This binary number can be shifted right 6 times because there are 6 right-most 0-bits in this
number.
3) 1 1 1 0 0 0 0 0:
128 64 32 16 8 4 2 1
1 1 1 0 0 0 0 0
This binary number can be shifted right 5 times because there are 5 right-most 0-bits in this
number.
63
4) 1 1 1 1 0 0 0 0:
128 64 32 16 8 4 2 1
1 1 1 1 0 0 0 0
This binary number can be shifted right 4 times because there are 4 right-most 0-bits in this
number.
5) 1 1 1 1 1 0 0 0:
128 64 32 16 8 4 2 1
1 1 1 1 1 0 0 0
This binary number can be shifted right 3 times because there are 3 right-most 0-bits in this
number.
6) 1 1 1 1 1 1 0 0:
128 64 32 16 8 4 2 1
1 1 1 1 1 1 0 0
This binary number can be shifted right 2 times because there are 2 right-most 0-bits in this
number.
7) 1 1 1 1 1 1 1 0:
128 64 32 16 8 4 2 1
1 1 1 1 1 1 1 0
This binary number can be shifted right 1 time because there is 1 right-most 0-bit in this
number.
8) 1 1 1 1 1 1 1 1:
128 64 32 16 8 4 2 1
1 1 1 1 1 1 1 1
This binary number cannot be shifted right even once because there is 0 right-most 0-bit in
this number.
64
Exam Style Questions:
Question 1:
Answer:
Question 2:
65
Answer:
Question 3:
66
Answer:
67
Question 4:
Answer:
68
Question 5:
Answer:
69
1.1.6 Two’s Complement (binary numbers):
NOTE: Two’s Complement is a newly added topic in the Computer Science (2210)
syllabus for the session 2023–2025.
According to the new syllabus, we will look at the method of using two’s complement to represent
positive and negative 8-bit binary integers.
Converting a positive binary or denary integer to a two’s complement 8-bit integer and vice
versa.
Converting a negative binary or denary integer to a two’s complement 8-bit integer and
vice versa.
Up until now, we have assumed all binary numbers are positive integers. To allow the possibility of
representing negative integers we make use of two’s complement method.
Throughout this section, as per syllabus requirement, we will only use 8-bit registers.
In the two’s complement, the left-most bit is changed to a negative value in the binary
headings.
In case of an 8-bit binary number, the left-most bit value 128 is changed to negative –128
whilst all the other binary headings remain same as shown below:
–128 64 32 16 8 4 2 1
The 27 in the 8-bit register which is +128 (positive) is changed to –128 (negative).
70
Signed 8-Bit Binary Integer/8-Bit Two’s Complement Integer:
The left-most bit always determines the sign of the binary number.
The 1-value in the left-most bit indicates a negative number.
The 0-value in the left-most bit indicates a positive number.
Example:
The binary number 0 0 1 1 0 0 1 1 contains 0-value in the left most-bit indicating a positive
number.
–128 64 32 16 8 4 2 1
0 0 1 1 0 0 1 1
32 + 16 + 2 + 1 = 51 denary (positive)
The binary number 1 1 0 0 1 1 1 1 contains 1-value in the left most-bit indicating a negative
number.
–128 64 32 16 8 4 2 1
1 1 0 0 1 1 1 1
71
Using Two’s Complement to represent/write positive 8-bit binary integers:
Steps:
1) Since the left-most bit determines the sign of the binary number; the 0-value in the left-
most bit indicates a positive number.
2) Write a ‘0’ in the left-most bit under the heading of –128.
3) Fill the rest of columns by writing ‘1’s in appropriate places according to the binary number
you want to represent.
Examples:
1) The binary number 0 0 0 1 0 0 1 1 contains 0-value in the left most-bit indicating a positive
number.
–128 64 32 16 8 4 2 1
0 0 0 1 0 0 1 1
This is a positive binary number because the left-most bit contains a ‘0’.
2) The binary number 0 1 1 1 0 0 0 1 contains 0-value in the left most-bit indicating a positive
number.
–128 64 32 16 8 4 2 1
0 1 1 1 0 0 0 1
This is also a positive binary number because the left-most bit contains a ‘0’.
3) The binary number 0 1 1 1 1 1 1 1 contains 0-value in the left most-bit indicating a positive
number.
–128 64 32 16 8 4 2 1
0 1 1 1 1 1 1 1
This is also a positive binary number because the left-most bit contains a ‘0’.
72
Converting a positive denary integer to a two’s complement 8-bit integer:
Steps:
1) Since the left-most bit determines the sign of the binary number; the 0-value in the left-
most bit indicates a positive number.
2) Write a ‘0’ in the left-most bit under the heading of –128.
3) Fill the rest of columns by writing ‘1’s in appropriate places so that when the values of
headings with ‘1’s are added, the total is equal to the denary number you want to represent.
Example:
Since the denary number 38 is positive, we will write a ‘0’ in the left-most bit under the heading of
–128. Then we will write ‘1’s in appropriate places so when they are added, the total is equal to 38.
–128 64 32 16 8 4 2 1
0 0 1 0 0 1 1 0
32 + 4 + 2 = 38 denary (positive)
Since the denary number 125 is positive, we will write a ‘0’ in the left-most bit under the heading
of –128. Then we will write ‘1’s in appropriate places so when they are added, total is equal to 125.
–128 64 32 16 8 4 2 1
0 1 1 1 1 1 0 1
73
Converting a positive two’s complement 8-bit integer to a positive denary integer:
Steps:
1) Since the left-most bit determines the sign of the binary number; the 0-value in the left-
most bit indicates a positive number.
2) Simply add all the heading values filled with ‘1’s to obtain the positive denary integer.
Example:
Since the left-most bit contains a ‘0’, this two’s complement binary number is positive. We will
simply add all the heading values which contains ‘1’s to obtain the positive denary integer.
–128 64 32 16 8 4 2 1
0 1 1 0 1 1 1 0
Since the left-most bit contains a ‘0’, this two’s complement binary number is positive. We will
simply add all the heading values which contains ‘1’s to obtain the positive denary integer.
–128 64 32 16 8 4 2 1
0 0 1 1 1 1 1 1
32 + 16 + 8 + 4 + 2 + 1 = 63 denary (positive)
74
Using Two’s Complement to represent/write negative 8-bit binary integers:
Steps:
1) Since the left-most bit determines the sign of the binary number; the 1-value in the left-
most bit indicates a positive number.
2) Write a ‘1’ in the left-most bit under the heading of –128.
3) Fill the rest of columns by writing ‘1’s in appropriate places according to the binary number
you want to represent.
NOTE: A two’s complement number with a 1-value in the –128 column must represent a
negative binary number.
Examples:
1) The binary number 1 0 0 1 0 0 1 1 contains 1-value in the left most-bit indicating a negative
number.
–128 64 32 16 8 4 2 1
1 0 0 1 0 0 1 1
This is a negative binary number because the left-most bit contains a ‘1’.
2) The binary number 1 1 1 1 0 0 0 1 contains 1-value in the left most-bit indicating a negative
number.
–128 64 32 16 8 4 2 1
1 1 1 1 0 0 0 1
This is also a negative binary number because the left-most bit contains a ‘1’.
3) The binary number 1 0 0 0 0 0 0 0 contains 1-value in the left most-bit indicating a negative
number.
–128 64 32 16 8 4 2 1
1 0 0 0 0 0 0 0
This is also a negative binary number because the left-most bit contains a ‘1’.
75
Converting a negative two’s complement 8-bit integer to a negative denary integer:
Steps:
1) Since the left-most bit determines the sign of the binary number; the 1-value in the left-
most bit indicates a negative number.
2) Simply add all the heading values filled with ‘1’s to obtain the negative denary integer.
Example:
Since the left-most bit contains a ‘1’, this two’s complement binary number is negative. We will
simply add all the heading values which contain ‘1’s to obtain the negative denary integer.
–128 64 32 16 8 4 2 1
1 0 0 1 0 0 1 1
Since the left-most bit contains a ‘1’, this two’s complement binary number is negative. We will
simply add all the heading values which contain ‘1’s to obtain the negative denary integer.
–128 64 32 16 8 4 2 1
1 1 1 0 0 1 0 0
Since the left-most bit contains a ‘1’, this two’s complement binary number is negative. We will
simply add all the heading values which contain ‘1’s to obtain the negative denary integer.
–128 64 32 16 8 4 2 1
1 1 1 1 0 1 0 1
76
Converting a negative denary integer to a two’s complement 8-bit integer:
Method 1:
1) Since the left-most bit determines the sign of the binary number; the 1-value in the left-
most bit indicates a negative number.
2) Write a ‘1’ in the left-most bit under the heading of –128.
3) Use the mathematical formulas:
4) Fill the rest of columns by writing ‘1’s in appropriate places so that when the values of
headings with ‘1’s are added (excluding ‘1’ in the left-most bit), the total is equal to the
value of X.
5) When you add all the values of headings with ‘1’s (including ‘1’ in the left-most bit), the
total is equal to the negative denary integer
Example:
1) Converting –67 to 8-bit binary number using two’s complement format (Method 1):
Since the denary number –67 is negative, we will write a ‘1’ in the left-most bit under the heading
of –128. Apply the formulas:
32 + 16 + 8 + 4 + 1 = 61
Therefore, we will write ‘1’s in appropriate places so when they are added, the total is equal to 61.
–128 64 32 16 8 4 2 1
0 1 1 1 1 0 1
32 + 16 + 8 + 4 + 1 = 61
77
Now for the final step, we will simply write a ‘1’ in the left-most bit:
–128 64 32 16 8 4 2 1
1 0 1 1 1 1 0 1
2) Converting –79 to 8-bit binary number using two’s complement format (Method 1):
Since the denary number –79 is negative, we will write a ‘1’ in the left-most bit under the heading
of –128. Apply the formulas:
32 + 16 + 1 = 49
Therefore, we will write ‘1’s in appropriate places so when they are added, the total is equal to 49.
–128 64 32 16 8 4 2 1
0 1 1 0 0 0 1
32 + 16 + 1 = 49
Now for the final step, we will simply write a ‘1’ in the left-most bit:
–128 64 32 16 8 4 2 1
1 0 1 1 0 0 0 1
78
Method 2:
1) First, we will convert the given denary number to a positive binary value.
2) We will then invert each binary value, which means swap the 1s with 0s & swap the 0s with
1s for each bit.
3) Then we will add 1 to that binary number we inverted (addition of binary numbers concept).
4) This will give us the negative binary (two’s complement) integer of the negative denary
integer.
5) When you add all the values of headings with ‘1’s, the total is equal to the negative denary
integer.
Example:
1) Converting –67 to 8-bit binary number using two’s complement format (Method 2):
We will convert –67 to a positive binary value which would be +67 by writing ‘1’s in appropriate
places so that when you add all the values of headings with ‘1’s, the total is equal to 67:
128 64 32 16 8 4 2 1
0 1 0 0 0 0 1 1
64 + 2 + 1 = 67
Inverting each binary value by swapping the 1s with 0s & swapping the 0s with 1s, we get:
128 64 32 16 8 4 2 1
1 0 1 1 1 1 0 0
c8 c7 c6 c5 c4 c3 c2 c1
1 0 1 1 1 1 0 0
+ 1
carry values
1 0 1 1 1 1 0 1 sum values
79
This gives us the final answer of the conversion of negative denary integer to a two’s
complement 8-bit integer:
–128 64 32 16 8 4 2 1
1 0 1 1 1 1 0 1
2) Converting –79 to 8-bit binary number using two’s complement format (Method 2):
We will convert –79 to a positive binary value which would be +79 by writing ‘1’s in appropriate
places so that when you add all the values of headings with ‘1’s, the total is equal to 79:
128 64 32 16 8 4 2 1
0 1 0 0 1 1 1 1
64 + 8 + 4 + 2 + 1 = 79
Inverting each binary value by swapping the 1s with 0s & swapping the 0s with 1s, we get:
128 64 32 16 8 4 2 1
1 0 1 1 0 0 0 0
c8 c7 c6 c5 c4 c3 c2 c1
1 0 1 1 0 0 0 0
+ 1
carry values
1 0 1 1 0 0 0 1 sum values
80
This gives us the final answer of the conversion of negative denary integer to a two’s
complement 8-bit integer:
–128 64 32 16 8 4 2 1
1 0 1 1 0 0 0 1
81
Exam Style Questions:
Question 1:
Answer:
Question 2:
Answer:
82
Question 3:
Answer:
Question 4:
Answer:
83
Question 5:
Answer:
Question 6:
Answer:
84
Question 7:
Answer:
Question 8:
85
Answer:
Question 9:
Answer:
Question 10:
Answer:
86
1 Data Representation
NOTE: Text, Sound & Images are newly added topics in the Computer Science (2210)
syllabus for the session 2023–2025.
Character Set:
These are all the characters and symbols that can be represented/used by a computer
system.
Each character and symbol have a unique number/binary number/hexadecimal number.
1. ASCII
2. Extended ASCII
3. Unicode
87
How one character is represented in a character set such as ASCII:
Number of characters that can be represented by the extended ASCII character set:
88
Number of characters that can be represented by the Unicode character set:
Unicode can represent more characters than ASCII & Extended ASCII both.
It has 16 bits, 24 bits or 32 bits.
It allows for a greater range of characters and symbols than ASCII, including different
languages and emojis.
Unicode represents most written language in the world while ASCII is used for English only.
One disadvantage of using the Unicode character set, instead of the ASCII character set, is
that the text stored takes up more storage space.
89
Calculation Based Questions:
Q1. The Unicode character code for ‘G’ is 0047 in hexadecimal. State, in hexadecimal, the
Unicode character code for ‘D’.
Answer: 0044
Working:
We will write the alphabets in reverse order from ‘G’ to ‘D’ and keep subtracting 1 from the
value 0047 every time we move 1 letter towards ‘D’ as we’re going backwards in alphabets.
D → E → F → G, so reversing it we get:
G→F→E→D
G 0047
F 0046
E 0045
D 0044
Q2. The table shows the ASCII denary values for five characters.
a 97
b 98
c 99
d 100
e 101
Complete the table by writing ASCII denary value for character ‘t’ and its hexadecimal equivalent.
Character t
Hexadecimal value
90
Answer:
Character t
Hexadecimal value 74
Working:
We will write the alphabets in increasing order from ‘e’ to ‘t’ and keep adding 1 in the value
101 every time we move 1 letter towards ‘t’ as we’re going forward in alphabets.
e→f→g→h→i→j→k→l→m→n→o→p→q→r→s→t
e 101
f 102
g 103
h 104
i 105
j 106
k 107
l 108
m 109
n 110
o 111
p 112
q 113
r 114
s 115
t 116
91
For the hexadecimal part, we will simply convert (116)10 denary to hexadecimal:
Place hexadecimal digits in appropriate positions (under appropriate powers of 16) so that the
total equates to 116:
256 16 1
0 7 4
Q3. The following tables show part of the ASCII code character set.
A 65 a 97
B 66 b 98
C 67 c 99
D 68 d 100
E 69 e 101
Working:
92
Exam Style Questions:
Question 1:
Answer:
93
Question 2:
Answer:
94
Question 3:
Answer:
95
Question 4:
Answer:
96
Question 5:
Answer:
97
Question 6:
Answer:
98
1.2.2 Representation of Sound:
The sounds waves are analogue in nature and computers cannot work with analogue data.
The sound wave is sampled for sound to be converted to binary, which is processed by a
computer.
The following table shows key terms related to sound along with their definitions:
Term Definition
Sampling It is the amplitude of analogue sound wave measured at regular/set time intervals.
Sampling
It is the number of samples taken in a second.
Rate
Sampling
It is the number of bits used to store/represent each sample.
Resolution
Sampling:
It is the amplitude/height of analogue sound wave measured at set/regular time intervals.
99
Sampling Rate:
It is the number of samples taken per second (1Hz means ‘one sample per second’).
It is the number of times that the amplitude/height of analogue sound wave is measured
per second.
1. Increasing the sampling rate results in more accurate digital representation of sound.
2. Increasing the sampling rate will result in smaller quantization error.
3. Increasing the sampling rate will result in larger file size.
Effects of changing the sampling rate from 44.1 kHz to 22.05 kHz:
Why sound is closer to the original when a higher sample rate is used:
Why the sound file size increases when a higher sample rate is used:
A voice is recorded twice. Each recording is the same length and has the same sampling
resolution.
The first recording has a sampling rate of 44 100 Hz. The second recording has a sampling
rate of 21 000 Hz.
How different sampling rates of 44 100 Hz and 21 000 Hz will affect the recording and the
sound file:
The sampling resolution of 44 100 Hz takes more samples per second, so the file size will be
larger whereas the sampling resolution of 21 000 Hz takes fewer samples per second, so the
file size will be smaller.
At a resolution of 44 100 Hz, the sound recording is a more accurate representation of the
voice whereas at the resolution of 21 000 Hz, the sound recording is a less accurate
representation of the voice.
100
A sound file is being downloaded from a web server. A choice of a sampling rate of 44.1 kHz
or 98 kHz is given before downloading the sound file.
98 kHz has a larger file size because it is recording more samples per second meaning more
binary values being stored per second.
Therefore, it will take more time to download.
98 kHz sound will be closer to the original because the samples will be closer together due
to smaller quantization error.
Sampling Resolution:
It is the number of bits used to store each sample or bits available to encode/represent
each sample.
It is sometimes referred to as bit depth.
It is usually 8-bit, 16-bit, 24-bit or 32-bit.
1. A larger sampling resolution means there is a greater range of values available to store each
sample // more bits per sample.
2. A larger sampling resolution will improve the accuracy of the sound // more accurate
representation of sound.
3. A larger sampling resolution will decrease the distortion of the sound.
4. Increased sampling resolution means a smaller quantization error.
5. A larger sampling resolution will result in a larger file size.
How different sampling resolutions affect the sound file and the sound it represents:
The sampling resolution is the number of bits used to store each sample.
Increasing the sampling resolution means a larger file size whereas decreasing the sampling
resolution means a smaller file size.
Increasing the sampling resolution gives a more accurate representation of analogue sound
whereas decreasing the sampling resolution gives a less accurate representation of the
analogue sound.
Increasing the sampling resolution means a greater range of values can be stored whereas
decreasing the sampling resolution gives a smaller range of values that can be stored.
Increasing the sampling resolution reduces the quantization errors whereas decreasing the
sampling resolution causes greater quantization errors.
101
Benefits of using a larger/higher sampling resolution:
1. It allows for larger dynamic ranges as dynamic range is approximately six times the bit
depth.
2. It allows more accurate representation/crisper sound quality.
3. It decreases the distortion of sound.
How the sampling rate and sampling resolution affect the file size of the soundtrack:
Increasing the sampling rate means more samples per second hence more bits per second
and a larger file size whereas decreasing the sampling rate means fewer samples per second
hence fewer bits per second and a smaller file size.
A higher sampling resolution means more bits per sample and a larger file size whereas a
lower sampling resolution means fewer bits per sample and a smaller file size.
The sound wave is sampled 88 200 times per second OR 88 200 samples/measurements are
taken per second.
Each sample is stored as a 32-bit binary number OR 32 bits are used to store each sample.
Compact Discs (CDs) have a 16-bit sampling resolution and a 44.1 kHz sample rate – that is
44 100 samples every second.
It is used to ensure that bit depth/sampling resolution is sufficient for good quality sound.
Using a higher bit depth/sampling resolution would mean bigger files, hence less music
content on each CD.
It can represent a dynamic range of about 90 dB which is basically the maximum dynamic
range of human hearing.
It is done for the purpose of compromising between quality and reasonable file size.
102
Exam Style Questions:
Question 1:
Answer:
103
Question 2:
Answer:
Question 3:
104
Answer:
Question 4:
Answer:
105
Question 5:
Answer:
Answer:
106
1.2.3 Representation of Images:
An image is a series of pixels that are converted to binary, which is processed by a
computer.
The following table shows key terms related to images along with their definitions:
Term Definition
Image
It is the number of pixels in the image.
Resolution
Bitmap Image:
It is an image made up of rows and columns of pixels (picture elements).
Each pixel has one color, and the color of each pixel is stored as a unique binary number.
A bitmap image is stored in a computer as a series of binary numbers.
A bitmap file has a file header.
107
Image File Header:
It stores data about the file contents/image/metadata (i.e., image size, number of colors
etc.)
1. File size.
2. Dimensions of the image in pixels // image resolution.
3. Color depth (bits per pixel, 1, 4, 8, 16, 24 or 32).
4. Type of compression used, if any.
Color Depth:
It is the number of bits used to represent each color.
An 8-bit color depth means that each pixel can be one of 256 colors (because 28 = 256).
However, modern computers have a 24-bit color depth, which means over 16 million
different colors can be represented.
1. Increasing the color depth means there are more bits per pixel to represent each color.
2. It results in more accurate digital representation of image.
3. Increasing the color depth will result in better image quality.
4. Increasing the color depth will result in larger file size because more bits per pixel are used.
How changing the color depth of an image affects its file size:
Increasing the color depth results in increased file size because more bits per pixel and
hence more data is stored.
Whereas decreasing the color depth results in smaller file size because fewer bits per pixel
and hence less data is stored.
How different color depths affect the image file and the image it represents:
The color depth is the number of bits used to represent each color.
Increasing the color depth means a larger file size whereas decreasing the color depth
means a smaller file size.
Increasing the color depth gives a better quality of image whereas decreasing the color
depth gives a poorer quality of the image.
Increasing the color depth means a greater range of values can be stored whereas
decreasing the color depth gives a smaller range of values that can be stored.
108
Number of bits required to store each pixel for a black and white image (2-color image):
A black and white image only requires 1 bit per pixel (21 = 2)
This means that each pixel can be one of two colors, corresponding to either 1 or 0 binary
value.
8 bits are needed, and each color is represented by one of 256 values.
Values 0 to 255 / 0000 0000 to 1111 1111.
256 = 28
A picture has been drawn and is saved as monochrome bitmap image. How many pixels are
stored in one byte:
A picture is drawn and is saved as a 16-color bitmap image. How many bits are used to
encode the data for one pixel:
Image Resolution:
It is the number of pixels in an image (per inch or per centimeter) OR it is the number of
pixels wide by the number of pixels high in an image.
For example, an image could contain 4096 x 3072 pixels (12 582 912 pixels in total).
This value determines the amount of detail an image has.
109
Factors affecting image resolution:
1. A larger image resolution means there is a greater range of pixels to represent each image.
2. A larger image resolution will improve the quality of the image. // more accurate
representation of image.
3. A larger image resolution will decrease the pixelation of the image.
4. A larger image resolution will result in a larger file size.
How a computer can store this black and white bitmap image:
Each pixel in the image requires only one bit (as there are only two colors (21 = 2).
The black color is represented by binary value 1 and white by 0 (or vice versa).
The bits are stored for each pixel in sequence e.g. 11111 01010 01010 01010 01010.
How the resolution and color depth affect the file size of the image:
Increasing the resolution and color depth means more pixels per centimeter and more bits
per color and a larger file size.
Decreasing the resolution and color depth means fewer pixels per centimeter and fewer bits
per color and a smaller file size.
1. As the number of pixels used to represent each image is increased, the size of the file will
also increase.
2. Larger image size means it takes longer to upload, download, or transfer images.
110
Exam Style Questions:
Question 1:
Answer:
Question 2:
111
Answer:
Question 3:
112
Answer:
Question 4:
Answer:
113
1 Data Representation
A single letter or character would use one byte of memory (8 bits); two characters would use two
bytes (16 bits).
The memory size system of numbering below is inaccurate as it is based on SI (base 10) system of
units where 1 kilo is equal to 1000. It only refers to some storage devices but is technically
inaccurate. However, it is included here for completeness:
1 exabyte (1 EB) 1 000 000 000 000 000 000 bytes 1024 PB
This system is no longer a part of the new syllabus and so it will not be used in this course.
However, you fill find some past paper questions related to this system as it was previously a part
of the syllabus.
114
Since the memory size is actually measured in terms of powers of 2, a memory size system has
been adopted by the IEC (International Electrotechnical Commission) that is based on the binary
system given below:
1 tebibyte (1 TiB) 240 1 099 511 627 776 bytes 1024 GiB
1 pebibyte (1 PiB) 250 1 125 899 906 842 624 bytes 1024 TiB
1 exbibyte (1 EiB) 260 1 152 921 504 606 846 976 bytes 1024 PiB
You can either memorize it by increasing the powers of 2, or simply by remembering that 1
kibibyte is 1024 bytes, so accordingly 1 mebibyte would be 1024 x 1 KiB (1024), and so 1 gibibyte
would be 1024 x 1 MiB (1024 x 1024) and so on.
This system is accurate, and all memories should be measured using the IEC system and
therefore, only the IEC system is covered in the syllabus.
115
Example Questions:
1 099 511 627 776 bytes // 1024 * 1024 * 1024 * 1024 // 240
116
1.3.2 Calculation of File Size:
In this section we will look at the calculation of the file size of an image file and a sound file, using
the information given. The information given may include:
1. image resolution
2. color depth
sample rate (in Hz) x sample resolution (in bits) x length of sample (in seconds)
2 x [sample rate (in Hz) x sample resolution (in bits) x length of sample (in seconds)]
117
Calculations Based Examples:
1) A camera detector has an array of 2048 by 2048 pixels and uses a color depth of 16. Find
the size of an image taken by this camera in MiB.
We will apply the formula = image resolution (in pixels) x color depth (in bits) to obtain the
answer in bits. Then we will convert bits to byte and then bytes to mebibyte (MiB) using following
information:
1 byte = 8 bits
1 KiB = 1024 bytes
1 MiB = 1024 KiB
Hence, 1 MiB can be taken as 1024 KiB where 1 KiB = 1024 bytes so (1 MiB = 1024 x 1024).
1. First calculate the image resolution by multiplying the number of pixels in vertical and
horizontal directions to find the total number of pixels:
2048 x 2048 = 4 194 304 pixels
2. Then multiply the number of pixels (image resolution) by color depth 16 given in bits:
4 194 304 x 16 = 67 108 864 bits
3. Then divide number of bits by 8 to find the number of bytes in the file:
67 108 864 / 8 = 8 388 608 bytes
4. Finally divide number of bytes by (1024 x 1024) to convert it to MiB (mebibytes):
8 388 608 / (1024 x 1024) = 8 MiB
2) A photograph is 1024 x 1080 pixels and uses a color depth of 32 bits. How many
photographs of this size would fit onto a memory stick of 64 GiB?
We will apply the formula = image resolution (in pixels) x color depth (in bits) to obtain the
answer in bits. Then we will convert bits to byte and then divide the bytes by 64 gibibyte (GiB) to
find out number of photographs that can fit onto a memory stick using following information:
1 byte = 8 bits
1 KiB = 1024 bytes
1 MiB = 1024 KiB
1 GiB = 1024 MiB
Hence, 1 GiB can be taken as 1024 MiB where 1 MiB = 1024 KiB and 1 KiB = 1024 bytes so
1 GiB = 1024 x 1024 x 1024.
118
1. First calculate the image resolution by multiplying the number of pixels in vertical and
horizontal directions to find the total number of pixels:
1024 x 1080 = 1 105 920 pixels
2. Then multiply the number of pixels (image resolution) by color depth 32 given in bits:
1 105 920 x 32 = 35 389 440 bits
3. Then divide number of bits by 8 to find the number of bytes in the file:
35 389 440 / 8 = 4 423 680 bytes
4. Then calculate the number of bytes in memory stick of 64 GiB (gibibytes):
64 GiB = 64 x 1024 x 1024 x 1024 bytes = 68 719 476 736 bytes
5. Then divide the memory stick size by the files size to find out how many photographs
would fit onto a memory stick of 64 GiB:
68 719 476 736 bytes / 4 423 680 bytes = 15 534 photographs
3) An audio CD has a sample rate of 44 100 and a sample resolution of 16 bits. The music
being sampled uses two channels to allow for stereo recording. Calculate the file size for a
60-minute recording in MiB.
We will apply the formula = 2 x [sample rate (in Hz) x sample resolution (in bits) x length of
sample (in seconds)] to obtain the answer in bits. Then we will convert bits to byte and then
bytes to mebibyte (MiB) using following information:
1 byte = 8 bits
1 KiB = 1024 bytes
1 MiB = 1024 KiB
Hence, 1 MiB can be taken as 1024 KiB where 1 KiB = 1024 bytes so (1 MiB = 1024 x 1024).
1. First calculate the number of seconds in 60 minutes by multiplying 60 with 60 to find out
the length of sample in seconds:
60 x 60 = 3600 seconds
2. Then multiply the sample rate 44 100 in Hz, sample resolution 16 in bits, and length of
sample 3600 in seconds:
44 100 x 16 x 3600 = 2 540 160 000 bits
3. Then multiply the number of bits with 2 since the recording is stereo and uses two
channels
2 540 160 000 x 2 = 5 080 320 000 bits
4. Then divide number of bits by 8 to find the number of bytes in the file:
5 080 320 000 / 8 = 635 040 000 bytes
5. Finally divide number of bytes by (1024 x 1024) to convert it to MiB (mebibytes):
635 040 000 / (1024 x 1024) = 605 MiB
119
Calculations Based Questions:
Q1. Kamil wants to store a 16-bit color image file. The image size is 1000 pixels.
Calculate the size of the file. Give your answer in bytes. Show your working.
Q2. Marley needs to store ten 8-bit color images in a file for his project. Each image is 500
pixels wide and 300 pixels high.
Calculate the total tile size in mebibytes (MiB) for all Marley's images. Show all your
working.
image resolution (in pixels) x color depth (in bits) x total number of images
Q3. Each image taken requires 1 MiB of storage. If the camera captures an image every 5
seconds over a 24-hour period, how much storage is required?
Give your answer in gibibytes and show all your working.
120
Q4. A security system records video footage. One minute of video requires 180 MiB of
storage. The recording system can store several hours of video footage.
Calculate how much storage would be needed for 2 hours of video footage. Show your
working and give the answer in gibibytes (GiB).
Answer = 2 GiB
Q6. The current status of the engine is sent to a computer in the aero plane. Each piece of
data collected is 8 bytes in size. Data collection occurs every 30 seconds. Calculate the
number of kibibytes that would be needed to store the data collected during a 10-hour
flight. Show your working.
(i) One piece of data = 8 bytes (ii) Data collected in 1 hour = 3600/30 = 120 times
Data collected = every 30 seconds Data collected in 10 hour = 120 x 10 = 1200 times
Time of flight = 10 hour One piece of data = 8 bytes
Seconds in 1 hour = 3600 1200 pieces of data = 8 x 1200 = 9600 bytes
*Answer needed in KiB* In KiB = 9600/1024 = 9.4 KiB
121
Exam Style Questions:
Question 1:
Answer:
122
Question 2:
Answer:
123
Question 3:
Answer:
Question 4:
124
Answer:
Question 5:
125
Answer:
Question 6:
126
Answer:
Question 7:
127
Answer:
Question 8:
128
Answer:
Question 9:
Answer:
129
Question 10:
Answer:
130
Question 11:
131
Answer:
132
1.3.3 Data Compression:
Purpose & Need of Compression:
The size of sound and image files can be very large and so compression exists to reduce the
size of the file.
It means reducing the file size by either temporarily (lossless compression) or permanently
(lossy compression) removing data.
uncompressed compressed
*compression algorithm applied*
file file
100 MB 30 MB
1. The data files are very large so it would take a long time to send the uncompressed file.
2. A higher bandwidth would be needed to transmit the uncompressed file.
3. A greater amount of storage space would be required for storing uncompressed files.
Benefits of Compression:
1. Compressing the file reduces its size and hence less storage space is required.
2. Since the file is smaller, it is downloaded, uploaded, and transmitted quicker/in shorter time.
3. It requires less bandwidth if transmitted.
4. It will require less time to transmit.
133
1.3.4 Lossy & Lossless Compression:
File compression can either be lossy or lossless:
Lossy compression reduces the file size by permanently removing data, e.g. reducing
resolution or color depth, reducing sample rate or sampling resolution.
Lossless compression reduces the file size without permanent loss of data, e.g. run length
encoding (RLE)
Working:
In an image, lossy compression may reduce the image resolution and/or the color depth (bit
depth).
In a sound file, lossy compression may reduce the sampling rate and/or the sampling
resolution.
134
i) In case of sound/music/audio files:
A compression algorithm called perceptual music shaping is used.
It involves removing unnecessary sounds such as removing background noise and sounds
humans can't hear very well (e.g. if two sounds played at the same time, softer sound is
removed).
It reduces the sample rate and sample resolution.
As a result, it reduces size and permanently removes certain parts of the sound without
affecting the quality too much.
After compression, due to smaller size, the music can be streamed faster, sent quicker,
uploaded faster, and downloaded faster as well.
Lossy compression techniques that can be used to reduce the size of the sound file:
Reduce sampling rate so fewer samples taken per second means less data is being stored.
Reduce sample resolution so fewer bits are used to represent each sample, so less data is
stored.
MP3 file format reduces file size by about 90%. How the music quality is apparently
retained:
MPEG-3 (MP3):
135
ii) In case of video files:
It uses a compression algorithm that permanently removes all the unnecessary data from
the file such as details that the human eye cannot see or the sound that the human ear
cannot hear (perceptual music shaping).
It reduces the color depth, so each pixel requires fewer bits.
It reduces the image resolution by decreasing the number of pixels per centimeter.
It removes the repeating frames or reduces frame rate.
It reduces the sample rate and sample resolution for the sound.
As a result, the size and quality of the video is reduced but it can still be viewed.
After compression, due to smaller size, the videos can be streamed faster, sent quicker,
uploaded faster, and downloaded faster as well.
MPEG-4 (MP4):
This format allows the storage of multimedia files rather than just sound (e.g. music, videos,
photos and animation etc.).
MP4 format allows videos to be streamed over the internet without losing any real
discernable quality.
It’s a highly versatile format that can also store audio, subtitles, and still images.
Lossy compression techniques that can be used to reduce the size of the image file:
Reduce the color depth so number of bits per color are reduced and so each pixel has fewer
bits.
Reduce image resolution so fewer pixels per unit measurement which means fewer binary
numbers are stored.
Reduce color palette/number of colors so fewer colors mean fewer bits needed to store
each color.
136
JPEG (Joint Photographic Experts Group):
1. It reduces the file size more than lossless hence saves more memory.
2. Due to smaller size, file can be downloaded, uploaded or sent quicker.
3. It will require less time and less bandwidth if transmitted.
137
Lossless File Compression:
Lossless compression is designed to lose none of the original detail.
It allows original file to be re-created exactly when uncompressed.
It is based on some form of replacement, for example RLE, FLAC etc.
By example: 000-1111-222222-333 = 3–0, 4–1, 6–2, 3–3 etc.
It can compress and reduce data to about 50% maximum.
Example:
Computers can compress text by finding repeated sequences and replacing them with
shorter representations such as any numerical value or a character.
138
Run-Length Encoding:
It is a lossless method of data compression.
It reduces the physical size of a string of adjacent, identical characters, pixels, or bytes etc.
The repeating string (a run) is encoded into two values.
The first value represents the number of identical data items (e.g. characters) in the run (run
count).
The second value is the code of the data item (e.g. ASCII code/color code of pixel etc.) in
the run (run value).
The run value and run count combination may be preceded by a control character.
For example: 000-1111-222222-333 = 3–0, 4–1, 6–2, 3–3 etc.
139
iii) In case of text files:
A compression algorithm Run-Length Encoding (RLE) is used, and no data is permanently
removed.
The groups of repeated characters are identified and replaced with a numerical value.
The value is then stored in an index/dictionary along with the number of times the character
occurs so the data can be restored.
For example, instead of storing aaaa, it will simply store a4
The original file/data is retrieved when uncompressed.
Why run-length encoding will sometimes increase the size of a text file:
The repeated sequences of characters rarely occur in text files as 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.
She sells sea shells on the seashore. The shells that she sells are sea shells I am sure.
140
Example Questions:
Question 1: How a computer can store this black and white bitmap image.
Each pixel in the image requires only one bit (as there are only two colors).
The black color is represented by binary value 1 and white by 0 (or vice versa).
The bits are stored for each pixel in sequence e.g. 11111 01010 01010 01010 01010.
RLE will store the color and the number of times it occurs.
In this case, it will store black and the number of times it occurs as well as white and its
occurrence e.g. B5, W1, B1, W1, B1, and so on.
A digital camera takes a bitmap image. The image is 2000 pixels wide by 1000 pixels high
with a color depth of 24-bits.
A second image is taken, this time in black and white. It has the same number of pixels, but
the file size is smaller.
For black and white, only 1 bit is needed to store the color of each pixel so the number of
pixels * bit depth is 2000 * 1000 * 1 (rather than 2000 * 1000 * 24).
This calculation results in a smaller figure for file size.
141
Question 2: How run-length encoding (RLE) is used to store the image with the following
color codes:
RLE will look for runs of consecutive pixel of the same color.
It stores the color value once and the number of times it occurs e.g. R2 P3 G1 B1 R2 P1 G2
and so on.
142
Question 4: The following diagrams show:
How RLE will compress the first three rows of this image:
143
Question 5: A section of bitmap image is shown. Each color is represented by a letter, such
as B is blue.
144
Exam Style Questions:
Question 1: Nigel wants to send a large text file electronically to Mashuda. Describe how the
size of the text file can be reduced. (4)
Question 2: Two types of compression are lossy and lossless. Choose the most suitable type
of compression for the following and explain your choice. (6)
Question 3: 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 choice. (4)
Lossless compression should be used so that the file can be restored to the exact
same/original state it was in before compression.
It is a computer program so no data should be lost.
If any data is lost, then it will not run correctly so lossy compression should not be used at
all.
Lossless compression will give the repeating words or sections of words a numerical value.
The value is then recorded in an index along with the words/sections of words so the data
can be restored when uncompressed.
145
Question 4: 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. Identity which type of compression would be most suitable for Nancy to use.
Explain your choice (4)
Lossy compression would be more suitable as it would reduce the file size more than
lossless.
It will remove all the unnecessary data from the file such as details that the human eye
cannot see (e.g. humans can only detect limited colors or differences in brightness).
The image quality will be reduced by decreasing number of pixels per centimeter (picture
resolution).
As a result, the size of the image is reduced without any real loss of quality.
Moreover, there is no requirement for the files to be exactly the same as original file so
lossless should not be used.
After compression, due to smaller size, the photos can be sent quicker, uploaded faster and
downloaded faster as well.
Question 5: 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. (3)
146
(b) Nico asks Audrey why she used lossy compression rather than lossless.
(i) State one advantage Audrey could give of using lossy rather than lossless to compress the
sound file. (1)
(ii) State one disadvantage Nico could give of using lossy rather than lossless to compress
the sound file. (1)
Question 7: 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.
Identity and describe a method the library could use to reduce the file size of a video as
much as possible. (4)
Compression should be used and the best choice of compression would be lossy.
It uses a compression algorithm that removes all the unnecessary data from the file such as
details that the human eye cannot see or the sound that the human ear cannot hear.
It reduces the color palette so each pixel requires fewer bits and decreases the quality by
decreasing the number of pixels per centimeter (video resolution).
It only stores what changes between frames.
As a result, the size and quality of the video is reduced but it can still be viewed.
147
Question 8:
148
Answer:
149
Question 9:
150
Answer:
Question 10:
151
Answer:
Question 11:
Answer:
152
Question 12:
153
Answer:
154
Question 13:
Answer:
155
Question 14:
Answer:
156