0% found this document useful (0 votes)
39 views708 pages

As p1 Theory

Uploaded by

leontachionat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views708 pages

As p1 Theory

Uploaded by

leontachionat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 708

A Level

Theory Fundamental
(9618)

Lesson Notes
Including Topical Past Papers
with Marking Scheme
Contents
About the developer of this workbook ....................................................................................................................7
Unit 1 Information Representation ..........................................................................................................................9
Data Representation.............................................................................................................................................9
1.2 Multimedia Graphics ................................................................................................................................... 56
1.2 Sound ........................................................................................................................................................... 95
1.3 Compression .............................................................................................................................................. 124
1.3 Data Storage .............................................................................................................................................. 154
Unit 2 Communication......................................................................................................................................... 156
Unit 3 Hardware .................................................................................................................................................. 221
Unit 4 Processor Fundamentals........................................................................................................................... 272
4.1 Central Processing Unit ............................................................................................................................. 272
4.2 Assembly language .................................................................................................................................... 312
4.3 Bit Manipulation ........................................................................................................................................ 358
Unit 5 System Software ....................................................................................................................................... 384
5.1 Operating System ...................................................................................................................................... 387
5.2 Language translators ................................................................................................................................. 446
Unit 6 Security, Privacy and Data Integrity .......................................................................................................... 473
6.1 Data Security.............................................................................................................................................. 475
6.2 Data Integrity ............................................................................................................................................. 491
Unit 7 Ethics and Ownership ............................................................................................................................... 501
Unit 8 Databases.................................................................................................................................................. 602
Unit 1 Information Representation
Topic You should be able to R A G
• Understand binary integers including, magnitudes, addition and subtraction
and understand how overflow can occur
Data • Convert between binary, denary, hexadecimal and Binary Coded
Representation Decimal(BCD)
• Understand binary representation of character data including
ASCII(American Standard Code for Information Interchange) and Unicode
• Understand bitmapped and vector image encoding and justify their use
• Estimate bitmap image sizes
Multimedia
• Understand representation of sound and the impact of changing the
sampling rate and resolution
• Understand the need for and use methods (lossy and lossless) of
Compression
compression for text, bitmap, vector graphics and sound files

Data Representation
Quick Revision
Binary – base two number system based on the values 0 and 1 only.
Bit – abbreviation for binary digit. A digit in the binary number system written using either of the
symbols 0 and 1
Byte: a group of eight bits treated as a single unit
Nibble: a group of four bits
Decimal prefix: A prefix to define the magnitude of a value. Examples are kilo, mega, giga and tera
representing factors of 103, 106, 109 and 1012 respectively.
Binary prefix: A prefix to define the magnitude of a value. Examples are kibi, mebi, gibi and tebi
representing factors of 210, 220, 230 and 240 respectively.
One’s complement – each binary digit in a number is reversed to allow both negative and positive
numbers to be represented.
Two’s complement – each binary digit is reversed and 1 is added in right-most position to produce
another method of representing positive and negative numbers.
Sign and magnitude – binary number system where left-most bit is used to represent the sign (0 = +
and 1 = –); the remaining bits represent the binary value.
Overflow: a condition when the result of a calculation is too large to fit into the number of bits
defined for storage
Hexadecimal – a number system based on the value 16 (uses the denary digits 0 to 9 and the letters A
to F).
Memory dump – contents of a computer memory output to screen or printer.
Binary-coded decimal (BCD) – number system that uses 4 bits to represent each denary digit.
Packed BCD: when two BCD nibbles are stored in one byte
ASCII (American Standard Code for Information Interchange) code – 7 bit coding system for all the
characters on a keyboard and control codes. It has codes for 128 characters.
Character set – a list of characters that have been defined by computer hardware and software. It is
necessary to have a method of coding, so that the computer can understand human characters.
Extended ASCII code is an 8-bit character set that represents 256 different characters, making it
possible to use characters such as é or ©. Extended ASCII is useful for European languages.
Unicode – 8 to 32 bit coding system which represents all the languages of the world (first 128
characters are the same as ASCII code). Global companies, like Facebook and Google, use the Unicode
character set because their users communicate in many different languages.
Representation of Text and Numbers in Computer
Text and numbers can be represented in computer as patterns of binary digits. To represent each character
(letter, digit or symbol) a character set is used. Character set is a set of characters can be understood by
computer.
1.1 Data Representation
Data is set of raw facts and figures required to solve a problem. Data can be in the form of numbers,
text, images, audio and video.
Number System:
Online lecture on youtube: https://www.youtube.com/watch?v=IxWau-hdg9c
“The system of counting and calculating is called number system.”
Number system is based on some characters called digits.
The word “digit” is derived from Latin word digitus means “finger” or “toe”, and English borrowed
from this to mean number.

In fact, the practice of calling numbers digits comes from the digits on your hands as these digits are
used in counting.
The number of digits is known as base or radix of the number system. For example binary number
system uses two characters 0 and 1 and its base is 2.
Some of the number systems, those are studied in A Level Computer Science are:
i) Denary (Decimal) number system
ii) Binary number system
iii) Hexadecimal number system
iv) BCD

Denary (Decimal) Number System:-


“The number system which is based on 10 characters from 0 to 9 is called denary (decimal)
system.”
It is the most common number system. The digits of decimal system are 0, 1, 2, 3, 4, 5, 6, 7, 8,
and 9. The value of each digit in a figure depends upon its weight. The weights are based on power of
10.

The weights of digits according to their positions are given below:


Position 5th 4th 3rd 2nd 1st
10,000s 1,000s 100s 10s 1s
4
Weight(Decimal 10 =10000 3
10 =1000 2
10 =100 101=10 100=1
Notation)

For example 76854 can be expressed as:

TTh Th H T O
7 6 8 5 4
Position 4 3 2 1 0
104=10000 103=1000 102=100 101=10 100=1
10,000s 1,000s 100s 10s 1s
Weight(Decimal Ten Thousands Thousands Hundreds Tens Units
Notation)
Binary Number System:
In computer data is stored in the form of electric charge ON and OFF,
represented by 1s and 0s. These “1’s” and “0’s” are called bit (being a
contraction of BInary digiT), and 8 bits make a byte to represent a single
character.

Its value is usually held in memory as an electrical charge stored in a capacitor. Modern
memory chips contain millions of these tiny capacitors, each of which is capable of storing
exactly one bit of information. A single bit can have one of two values
at any given time - one or zero. As we shall see, in order to represent
a number greater than one, we will have to use several bits.
“The number system which is based on 2 characters 0 and 1 is called
binary system.”
Using only 0 and 1 makes it easier to design the electronic circuits
that the computers will use. This is because, if the computer wants to
check a value in any part of the circuit, it only needs to detect whether
or not there is any electricity. If there is electricity, the value is 1, if
there is no electricity, the value is 0.
Binary numbers are fundamental to the way that all modern computers work. They are used
to represent any data stored within a computer system.

The weights of digits according to their positions are given below:


The value of each digit in a figure depends upon its weight. The weights are based on power
of 2.
The binary notation is a sequence of numbers are based on power of two and arrange from
right to left, as given below:

Position 5th 4th 3rd 2nd 1st


Weight 4
2 =16 23=8 22=4 21=2 20=1

Position 211 210 29 28 27 26 25 24 23 22 21 20


Binary 2048 1024 512 256 128 64 32 16 8 4 2 1
Notation
Binary notation is ….512 256 128 64 32 16 8 4 2 1
If a switch is on, it can represent the number 1. If it is off, it represents 0. These states can
also be interpreted as TRUE or FALSE. If you have enough switches, you can store all sorts
of data. You could ask a question such as ‘will you give me some money?’ and you can get
an answer in binary digits:
0 = NO 1 = YES
This is making use of just 1 bit of data. Add another bit and you can say more:
00 = NO 10 = MAYBE
01 = NEXT WEEK 11 = YES
The more binary digits you have, the more information you can store and process. Most
computers store bits of data in memory in groups of eight. Eight bits stored at one location is
called a byte. Sometimes it is useful to work on just half a byte. Half a byte is called a nibble.

1 1 1 1 1 1 1 1
Bit bit bit bit bit bit bit bit
Nibble Nibble
Byte
INTEGERS:
Integers are whole numbers. The range of values that can be stored as an integer depends
on whether or not the number is signed (i.e. positive or negative), and how much memory is
allocated for it in memory. Programming languages can generally represent integers that are
signed or unsigned, and of different sizes.

A single byte can represent unsigned numbers ranging in value from 0 to 255, or signed
integers ranging from -128 to +127. If two bytes are used, unsigned numbers
from 0 to 65,535 or signed numbers from -32,768 to 32,767 can be stored. Much larger
numbers can be represented if more bytes are made available.

For signed numbers, one bit is used to store the sign (+ or -) of the number, so the absolute
value of the biggest number that can be stored is only half that for unsigned numbers. The
number of bits used to represent an integer value will equal the number of bytes multiplied by
eight. An integer represented by n bits can represent 2n numbers.

The magnitude of a four-byte integer can thus be anything up to 2 (4×8) or 2 32 which means it
can hold an unsigned value of up to 4,294,967,296 (a tad over two billion). Negative numbers
can be represented in several different ways in binary number systems, although the most
commonly used method is two's complement (the subject of two's complement is dealt with
below).
Courtesy : http://www.technologyuk.net/mathematics/about-numbers/representing-numbers-
in-computers.shtml

Conversion of Positive Denary Integers into Binary:


Binary notation is used to convert a positive denary integer into binary numbers.
For example 12010 can be expressed as:
12010
Binary Notation: 128 64 32 16 8 4 2 1

Put the 1 under notations which are required to find sum equals to the number and 0 in
remaining places as 64+32+16+8=120
= 128 64 32 16 8 4 2 1
= 0 1 1 1 1 0 0 0

To convert a denary number using continuous division method:


Working

Division Remainder
Quotient
by 2 (decimal)

25 25/2 12 1

2 12 1 12/2 6 0

2 6 0 6/2 3 0

2 3 0 3/2 1 1

1 1
Conversion of Negative Integers into Binary:
There are two different methods to represent negative integers into binary
1) Sign-Magnitude Method
2) One’ Complement
3) Twos Complement Method
1) Sign-Magnitude Method:
In this method the left most bit (most-significant bit) is used for sign and remaining bits for
magnitude. 0 represents positive while 1 represents negative integers.
Here is the representation of +120 and -120 in sign magnitude method:

2) One’s Complement
The one’s complement of a negative binary number is the complement of its
positive counterpart, so to take the one’s complement of a binary number, all we
need to do is flip all bits. Thus the one’s complement of “1” is “0” and vice versa,
then the one’s complement of 100101002 is simply 011010112 as all the 1’s are
changed to 0’s and the 0’s to 1’s. For this NOT gate is applied on each bit.
3) Two’s Complement Method
The procedure to convert negative decimal numbers to binary is give below:
#1. Remove the negative sign (but don't forget about it)
#2. Convert the positive decimal number to binary
#3. Flip all bits (All 0s in 1s and all 1s in 0s) to obtain One’s complement.
#4. Add 1, two’s complement is obtained, it is the binary equivalent of negative integer
For example to convert -120 into binary
First binary equivalent of +120 is calculated
+120 = 0111 1000
Flip all bits to obtain One’s complement
1000 0111
Then 1 is added in the flipped binary number two’s complement is obtained
1000 0111
+1
-------------
-120 1000 1000

Binary-to-Denary Conversion:
1) Conversion of positive binary into denary:
Binary notation is used to convert binary number into denary numbers.
For example 0111 10002 can be converted as:
0111 10002
= 0 x 27 +1 x 26 +1 x 25 + 1 x 24 + 1 x 23 + 0 x 22 + 0 x 21 + 0 x 20
= 0 x 128 + 1 x 64 + 1 x 32 + 1 x 16 + 1 x 8 + 0 x 4 + 0 x 2 + 0 x 1
= 0+64+32 + 16 + 8 + 0 + 0 + 0
= 12010
2) Sign-Magnitude Method:
The sign bit (the left-most bit) is removed and then remaining bits (the magnitude bits) are
converted in denary and – sign is added.
For example 1111 10002 can be converted as:
(-) 111 10002
= (-) 1 x 26 +1 x 25 + 1 x 24 + 1 x 23 + 0 x 22 + 0 x 21 + 0 x 20
= (-) 1 x 64 + 1 x 32 + 1 x 16 + 1 x 8 + 0 x 4 + 0 x 2 + 0 x 1
= (-) 64+32 + 16 + 8 + 0 + 0 + 0
= -12010
3) Two’s complement method:
Firstly all bits are flipped to obtain one’s complement.
Then 1 is added to obtain two’s complement
And this two’s complement number is converted into denary number
For example
1000 1000 Original Value (sign bit separated for clarification)
0111 0111 One's Complement (Toggle all bits)
+1 Add 1 in One’s Complement
0111 1000 Result- Two’s Complement
0111 10002 = 12010 Convert the Two’s Complement into Denary
0 111 10002 = - 12010 so, because the original number was a negative number, we have
to remember that as a part of the result.
One of the benefits of using two's complement is that addition and subtraction can both be
carried out using binary addition. As continuous addition can perform as multiplication
(e.g 2 * 5= 2+2+2+2+2) and continuous subtraction produces results of division). Means all
arithmetic operations can be performed just addition using two’s complement method.
Note: A simple way to perform the 2's complement operation is to scan the bits from right to
left, keeping all of the digits up to and including the first logical 1. Then, change each bit.
1 0111101 Original Value
1 Keep the first 1 that is found
0 100001 Toggle the remaining bits
0 1000011 Result.
Binary Arithmetic
Courtesy : http://www.technologyuk.net/mathematics/about-numbers/representing-numbers-
in-computers.shtml

A computer uses a fixed number of bits to store each of the common data types. For
example, a byte (8 bits) is commonly used to represent alphanumeric characters, unsigned
integer values from 0 to 255, or signed integer values from -128 to +127.

For signed integer data types, the range of values that can be represented is only half that for
unsigned integer data types because the most significant bit is used to signify whether the
number is positive (0) or negative (1), leaving one less bit available to represent the absolute
value of the number.

The range of signed 4-bit integers that can be represented using this system (known as sign
and magnitude) is shown in the table below, and illustrates how the system works. Note that
there are two possible representations for zero (00002 = +010 and 10002 = -010 ).

4-bit Signed Binary Integers

Decimal Binary Decimal Binary

+0 0000 -0 1000

+1 0001 -1 1001

+2 0010 -2 1010

+3 0011 -3 1011

+4 0100 -4 1100

+5 0101 -5 1101

+6 0110 -6 1110

+7 0111 =7 1111
Binary Addition:
Binary addition is performed using sum and carry method just as we use in daily life for addition in
denary numbers.

Binary Subtraction
There are two different methods for binary subtraction.
1) Simple Borrowing method
Binary subtraction is one of the four binary operations, where we perform the subtraction
method for two binary numbers (comprising of only two digits, 0 and 1). This operation is
similar to the basic arithmetic subtraction performed on decimal numbers in Maths. Hence,
when we subtract 1 from 0, we need to borrow 1 from the next higher order digit, to reduce
the digit by 1 and the remainder left here is also 1.
(i) 0 – 0 = 0 (0 subtracted from 0 results 0)
(ii) 1 – 0 = 1 (0 subtracted from 1 results 1)
(iii) 1 – 1 = 0 (1 subtracted from 1 results 0)
(iv) 0 – 1 = 1 (1 cannot be subtracted from 0 so 1 is borrowed, 0 becomes 10 means 2, 2-1
results 1)
2) Two’s complement method
One of the benefits of using two's complement is that addition and subtraction can both be
carried out using binary addition. As continuous addition can perform as multiplication (e.g 2
* 5= 2+2+2+2+2) and continuous subtraction produces results of division). Means all
arithmetic operations can be performed just addition using two’s complement method.
In this method firstly two’s complement of negative integer is found out and then this is added
in positive integer. For example:
Overflow – the result of carrying out a calculation which produces a value too large for the
computer’s allocated data size.
• An overflow error will occur if the value is greater than 255 in an unsigned 8-bit register
• An overflow error will occur if the value is greater than +127 in a signed 8-bit register

For example in 8 bit +127 is the largest value which can be represented, and the sum of two
numbers is larger than +127, will produce a negative number which causes an overflow.
e.g. on adding +120 and +50 result should be + 170

(it starts with 1 means negative number)


Overflow may be due to the results of subtraction using two complement method, as in
following example 9 bit result is produced while data size is 8 bit, the 9 th bit is overflow:

Since the digital system is to work with 8-bits, only the first eight digits are used to provide the
answer to the sum, and we simply ignore the last bit (bit 9). This bit is call an “overflow” bit.
Overflow occurs when the sum of the most significant (left-most) column produces a carry
forward. This overflow or carry bit can be ignored completely or passed to the next digital
section for use in its calculations. Overflow indicates that the answer is positive. If there is no
overflow then the answer is negative.
Underflow
The result of carrying out a calculation which produces a value too small for the computer’s allocated
data size.
• An overflow error will occur if the value is smaller than -128 in a 8-bit register
Hexadecimal Numbers
A number system that has 16 digits is known as hexadecimal number system.
The digits of hexadecimal system are 0, 1, 2,3, 4, 5, 6, 7, 8, 9, A, B,
C, D, E, & F, whereas A represents 10, B represents 11 and so on
until F that represents 15.
Hexadecimal has 16 digits so it is also known as base 16 number
system.
Hexadecimal numbers are less prone to error, It is easier to convert
long binary numbers in hexadecimal than in denary. Hexadecimal
numbers are easier to read and understand than binary number
numbers.
Uses of Hexadecimal System:
Uses of Hexadecimal in HTML:
Hyper Text Mark-up Language is used to develop Websites. In HTML a
colour is specified according to the intensity of its Red, Green and Blue
(RGB) components, each represented by eight bits. Thus, there are 24
bits used to specify a web colour, and 16,777,216 colours that may be so
specified. It's easier for the human programmer to represent a 24-bit
integer, often used for 32-bit colour values, as #FF0099 instead of
111111110000000010011001

BINARY (BITS) HEX


1 1 1 1 = F
RR
1 1 1 1 = F
0 0 0 0 = 0
GG
0 0 0 0 = 0
1 0 0 1 = 9
BB
1 0 0 0 = 8
111111110000000010011001 FF0099

HTML TAG Name


<font color="#FF0000">RED</font> (RED)
<font color="#00FF00">GREEN</font> (GREEN) LIME
<font color="#0000FF">BLUE</font> (BLUE)
<font color="#FFFF00">YELLOW</font> (YELLOW)
<font color="#FF00FF">MAGENTA</font> (MAGENTA) FUCHSIA
<font color="#00FFFF">CYAN</font> (CYAN) AQUA
Uses of Hexadecimal in MAC Address:
MAC address is unique identification number of NIC (network interface card). It is 48 bits long, so 281
billion MAC addresses can be assigned computers.
MAC addresses are 48 bit long so they are very difficult to read, write and understand for example
0000 0000 0001 1100 1011 0011 0100 1111 0010 0101. To make them shorter and easy to
understand they are shown in 12 hexadecimal digits in 6 groups, like 00 – 1C – B3 – 4F – 25 – FE.
First 6 numbers (i.e. 00-1C-B3) are manufacturer identity while last 6 numbers (i.e. 4F-25-FE) are
serial number of NIC.
There are two types of MAC address:
UAA (Universally administered MAC address) are the most common MAC address set by
manufacturers. These are not changed.
LAA(Locally administered MAC address): These are changed locally, but they must be
unique.
There are a few reasons why the MAC address needs to be changed using LAA:
• Certain software used on mainframe systems needs all the MAC addresses of devices to fall into a
strict format; because of this, it may be necessary to change the MAC address of some devices to
ensure they follow the correct format.
• It may be necessary to bypass a MAC address filter on a router or a firewall; only 24 MAC
addresses with a certain format are allowed through, otherwise the devices will be blocked.
• To get past certain types of network restrictions it may be necessary to emulate unrestricted MAC
addresses; hence it may require the MAC address to be changed on certain devices connected to
the network.
Uses of Hexadecimal in Debugging:
Debugging allows programmers to detect, diagnose, and eliminate errors in a program. The source
debugger uses the hexadecimal values of the characters. Hex is often used in error messages. The
hex number refers to the memory location of the error. This helps programmers to find and then fix
problems.
Uses of Hexadecimal Memory Dump
Contents of memory are in binary numbers. Binary numbers are
long and difficult to understand.
Memory dump is a hexadecimal view (on screen or paper) of
computer data, from RAM or from a file or storage device. As
memory dump uses hexadecimal number to show memory
contents, it become a powerful fault tracing tool but requires
expertise in computer architecture.

Uses of Hexadecimal in Assembly Language:


Machine codes are written in binary language which is very long and difficult to understand.
Hexadecimal numbers are easier, faster and less error prone to write code.
In assembly language codes are written in hexadecimal. This can have many advantages to program
developers or when carrying out troubleshooting.
For example:
LDD A750 (assemble language)
A5E4 FFA4 (machine code using hexadecimal values)
1010 0101 1110 0100 1111 1111 1010 0100 (machine code using binary)
Uses of Hexadecimal in URL encoding:
Web addresses can be written using hexadecimal rather than denary. Hexadecimal codes are
preceded by a % sign. For example, the word “www.ruknuddin.com” is written as:
r u k n u d d i n
in hex %72 %75 %6B %6E %75 %64 %64 %69 %6E

w w w . r u k n u d d i n . c o m
%77 %77 %77 %2E %72 %75 %6B %6E %75 %64 %64 %69 %6E %2E %63 %6F %6D

Some characters are not allowed in URL. URL encoding converts characters into a format that can be
transmitted over the Internet.
For example
➢ %20 – is used in URL in place of <space> not allowed in a URL, %20 is the coding for a space (32
in denary)
➢ ? – separates the URL from all parameters or variables
e.g. for query to search Inqilabpatel in Google
https://www.google.com.pk/search?q=inqilab%20patel
here“q” is variable for query “?” separates it from URL
“https://www.google.com.pk/search”

while“%20”is used for the space between “inqilab” and “patel”

URL ? to separate %20 code for space


Variable from URL
Conversion of hexadecimal into binary
Separate the hex digits to find each equivalent in binary, and then piece them back together.
Worked example - What is the denary value of hex value 3A4F?
1. Separate the hex digits into 3, A, 4and F and find the equivalent binary numbers.
2. Convert binary number into denary
3 A 4 F
Hexadecimal Number
3 10 4 15
4 Bit Binary Notation 8 4 2 1 8 4 2 1 8 4 2 1 8 4 2 1
Calculation (Write 1s under binary 0 0 1 1 10 1 0 0 1 0 0 1 1 1 1
notation number total of which
equals the hexadecimal digit (2+1=3) (4+3+1=7) (4=4) (8+4+2+1= 15)
Binary Numbers 0011 1010 01001111
Convert 16 Bit Signed Binary Numbers to Hexadecimal:
There are two important points to keep in mind when converting Signed Binary to Hex:
#1. If the binary number is a signed number, then so is the hex number
#2. Hex numbers are just short-hand notations for binary
Convert Signed Binary 11001001101111012 to Hexadecimal
Solution: As done with unsigned numbers, group the binary digits into groups of 4 (i.e. nibble)
and replace with the appropriate hex character (starting at the binary (decimal) point).
1100 1001 1011 1101 = C9BD
Convert an 8 Bit Signed Binary Number to Decimal
Convert Signed Binary 10111101 to Decimal
Solution:
If the sign bit is a 0, the conversion is the same as an unsigned integer.
If the sign is a 1, we must first find the magnitude of the number. To do so, the number must
be negated by executing the two's complement operation. Note that the sign bit is included in
the operations performed on the number:
1 0111101 Original Value (sign bit separated for clarification)
0 1000010 One's Complement (Toggle all bits)
+1 Add 1 in One’s Complement
0 1000011 Result- Two’s Complement
010000112 = 6710 Convert the Two’s Complement into Denary
1 0111012 = - 6710 So, because the original number was a negative number, we have
to remember that as a part of the result.
Convert Signed Hex to Denary
At first Convert a 16 bit Signed Hex into binary
Then for positive numbers (Starting from 0) the conversion is the same as an unsigned
integer
For negative number (Starting from 1) Two’s Complement is calculated
Then Tow’s Complement is converted into Denary and ‘-‘ sign is added
Example: To convert Hex C9BD to Denary
C9BD Original Value
1100 1001 1011 1101 Binary Equivalent of C9BD
This number is negative, because the MSb (Most
Significant bit) is 1. We must now take the two's compliment
to find the magnitude of the number: You will note that this
is the same number as above, so our results are same
(Wow! that doesn't happen very often!)
1100100110111101 Original Binary Equivalent of C9BD
0011011001000010 One’s compliment (Toggle all bits)
+1 Add 1 in One’s Complement
0011011001000011 Result- Two’s Complement
Convert the Two’s Complement into Denary
0011011001000011
0 + 0 + 8192 + 4096 + 0 + 1024 + 512 + 0 + 0 + 64 + 0 + 0 + 0 + 0 + 2 + 1
= 13891 But, the original number was negative, so don't forget the
Negative sign
= -13891
C9BD=-13891
Binary Coded Decimals (BCD)
In electronic control systems, binary-coded decimal (BCD) is a method for representing
decimal numbers in which each decimal digit is represented by a sequence of binary digits.
This makes it relatively easy for the system to convert the numeric representation for printing
or display purposes, and speeds up decimal calculations. The main disadvantage is that
representing decimal numbers in this way takes up more space in memory than using a more
conventional binary representation.
The circuitry required to carry out calculations also tends to be more complex. The decimal
digits 0-9 are each represented using four bits. Additional bit combinations may be used to
represent sign values (+ or -) or other values (e.g. overflow or error conditions). The table
below shows the standard BCD encodings for the decimal digits 0-9. Note that values greater
than 1001 (1010, 1011, 1100, 1101, 1110, or 1111) are not valid BCD decimal values.

BCD Representation

Decimal BCD Encoding

0 0000

1 0001

2 0010

3 0011

4 0100

5 0101

6 0110

7 0111

8 1000

9 1001
The BCD encoding for the number 476 would therefore be:

As opposed to the normal binary representation:

Computers usually store data in blocks of 8 bits (called bytes). Two main methods of storing
BCD digits are used. In the first method (called zoned BCD), each 4-bit BCD representation of
a decimal digit is stored in the right-most four bits of a byte. The left-most four bits are all set
to zero, or all set to one in systems such as mainframe computers that use Extended Binary
Coded Decimal Interchange Code (EBCDIC), or to 0011 (in systems that use the American
Standard Code for Information Interchange (ASCII).
Applications of BCD:
BCD is used to represent string on numbers for
example:
ISBN-13 Bar Code is a 13 digit International Standard
Book Number. It is not an integer but a string of
integers. It is represented in BCD
BCD Usage in Alpha-Numeric Display and RTC
BCD was commonly used for displaying alpha-numeric in the
past but in modern-day BCD is still used with real-time clocks
or RTC chips to keep track of wall-clock time and it’s
becoming more common for embedded microprocessors to
include an RTC.
It’s very common for RTCs to store the time in BCD format.

A binary clock might use LEDs to express binary


values. With this clock each column of LEDs displays a
binary-coded decimal numeral.

7 Segment Displays and Thumbwheel Switches


Back in the days, before touchscreens, seven segment
displays, and thumbwheel switches were used for a
numerical interface between PLCs and humans.
Even before the PLC, these BCD type devices were the only graphical way to interface with
system circuits numerically.

1
2

4
8
Character Set:
Text and numbers can be encoded in a computer as patterns of binary digits. Hexadecimal is a
shortcut for representing binary. ASCII and Unicode are important character sets that are used as
standard.
ASCII (American Standard Code for Information Interchange)
The ASCII character set is a 7-bit set of codes that allows 128 different characters. That is enough for
every upper-case letter, lower-case letter, digit and punctuation mark on most keyboards. ASCII is
only used for the English language.
This table shows some examples of letters represented using the ASCII character set:

Character Denary Binary HEX Character Denary Binary HEX


Value Value Value Value
A 65 1000001 41 N 78 1001110 4E
B 66 1000010 42 O 79 1001111 4F
C 67 1000011 43 P 80 1010000 50
D 68 1000100 44 Q 81 1010001 51
E 69 1000101 45 R 82 1010010 52
F 70 1000110 46 S 83 1010011 53
G 71 1000111 47 T 84 1010100 54
H 72 1001000 48 U 85 1010101 55
I 73 1001001 49 V 86 1010110 56
J 74 1001010 4A W 87 1010111 57
K 75 1001011 4B X 88 1011000 58
L 76 1001100 4C Y 89 1011001 59
M 77 1001101 4D Z 90 1011010 5A
Extended ASCII
Extended ASCII code is an 8-bit character set that represents 256 different characters, making it
possible to use characters such as é or ©. Extended ASCII is useful for European languages.
Unicode
Unicode uses between 8 and 32 bits per character, so it can represent any characters from languages
from all around the world. It is commonly used across the internet. As it is larger than ASCII, it might
take up more storage space when saving documents.
Global companies, like Facebook and Google, would not use the ASCII character set because their
users communicate in many different languages.
ASCII Code
DEC HEX BIN Symbol DEC HEX BIN Symbol DEC HEX BIN Symbol
0 00 00000000 NUL 43 2B 00101011 + 86 56 01010110 V
1 01 00000001 SOH 44 2C 00101100 , 87 57 01010111 W
2 02 00000010 STX 45 2D 00101101 - 88 58 01011000 X
3 03 00000011 ETX 46 2E 00101110 . 89 59 01011001 Y
4 04 00000100 EOT 47 2F 00101111 / 90 5A 01011010 Z
5 05 00000101 ENQ 48 30 00110000 0 91 5B 01011011 [
6 06 00000110 ACK 49 31 00110001 1 92 5C 01011100 \
7 07 00000111 BEL 50 32 00110010 2 93 5D 01011101 ]
8 08 00001000 BS 51 33 00110011 3 94 5E 01011110 ^
9 09 00001001 HT 52 34 00110100 4 95 5F 01011111 _
10 0A 00001010 LF 53 35 00110101 5 96 60 01100000 `
11 0B 00001011 VT 54 36 00110110 6 97 61 01100001 a
12 0C 00001100 FF 55 37 00110111 7 98 62 01100010 b
13 0D 00001101 CR 56 38 00111000 8 99 63 01100011 c
14 0E 00001110 SO 57 39 00111001 9 100 64 01100100 d
15 0F 00001111 SI 58 3A 00111010 : 101 65 01100101 e
16 10 00010000 DLE 59 3B 00111011 ; 102 66 01100110 f
17 11 00010001 DC1 60 3C 00111100 < 103 67 01100111 g
18 12 00010010 DC2 61 3D 00111101 = 104 68 01101000 h
19 13 00010011 DC3 62 3E 00111110 > 105 69 01101001 i
20 14 00010100 DC4 63 3F 00111111 ? 106 6A 01101010 j
21 15 00010101 NAK 64 40 01000000 @ 107 6B 01101011 k
22 16 00010110 SYN 65 41 01000001 A 108 6C 01101100 l
23 17 00010111 ETB 66 42 01000010 B 109 6D 01101101 m
24 18 00011000 CAN 67 43 01000011 C 110 6E 01101110 n
25 19 00011001 EM 68 44 01000100 D 111 6F 01101111 o
26 1A 00011010 SUB 69 45 01000101 E 112 70 01110000 p
27 1B 00011011 ESC 70 46 01000110 F 113 71 01110001 q
28 1C 00011100 FS 71 47 01000111 G 114 72 01110010 r
29 1D 00011101 GS 72 48 01001000 H 115 73 01110011 s
30 1E 00011110 RS 73 49 01001001 I 116 74 01110100 t
31 1F 00011111 US 74 4A 01001010 J 117 75 01110101 u
32 20 00100000 75 4B 01001011 K 118 76 01110110 v
33 21 00100001 ! 76 4C 01001100 L 119 77 01110111 w
34 22 00100010 " 77 4D 01001101 M 120 78 01111000 x
35 23 00100011 # 78 4E 01001110 N 121 79 01111001 y
36 24 00100100 $ 79 4F 01001111 O 122 7A 01111010 z
37 25 00100101 % 80 50 01010000 P 123 7B 01111011 {
38 26 00100110 & 81 51 01010001 Q 124 7C 01111100 |
39 27 00100111 ' 82 52 01010010 R 125 7D 01111101 }
40 28 00101000 ( 83 53 01010011 S 126 7E 01111110 ~
41 29 00101001 ) 84 54 01010100 T 127 7F 01111111
42 2A 00101010 * 85 55 01010101 U
Memory Size Measurement
It should be pointed out here that there is some confusion in the naming of memory sizes.
The unit was established by the International Electro-technical Commission (IEC) in 1998, has
been accepted for use by all major standards organizations, and is part of the International System of
Quantities. The kibibyte was designed to replace the kilobyte in those computer science contexts in
which the term kilobyte is used to mean 1024 bytes. The interpretation of the kilobyte to denote
1024 bytes, conflicting with the SI definition of the prefix kilo (1000), is still common, mostly in informal
computer science contexts.
The IEC convention is now adopted by some organisations. Manufacturers of storage devices often
use the denary system to measure storage size. For example:
0 or 1 = 1 bit
4 bits = 1 nibbles
8 bits = 2 niblles = 1 byte
SI Units IEC Units
1 kilo byte = 1000 byte 1 kibi byte (1 KiB) = 1,024 bytes
1 mega byte = 1000,000 bytes 1 mebi byte (1 MiB) = 1,048,576 bytes
(1000 * 1000) (1,024 * 1,024)
1 giga byte = 1,000,000,000 bytes 1 gibi byte (1 GiB) = 1,073,741,824 bytes
(1,000,000 * 1000) (1,048,576 * 1,024)
1 tera byte = 1,000,000,000,000 bytes and so 1 tebi byte (1 TiB) = 1,099,511,627,776 bytes and
on. so on
(1,000,000,000 *1000) (1,073,741,824 * 1,024)

The IEC convention for computer internal memories (including RAM) becomes:
Example Question: 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 = 64000 files
– giving the difference of 1500 files [3]
Specimen Paper 9618/01 - SoW
1 (a) State one difference between a kibibyte and a kilobyte.
...................................................................................................................................................
.............................................................................................................................................. [1]
(b) Give the number of bytes in a mebibyte.
.............................................................................................................................................. [1]
(c) (i) Complete the following binary addition. Show your working. [2]
1 0 0 1 1 0 1 0
+ 1 1 1 1 0 1 1 1

(ii) Describe the error that occurred when you added the binary numbers in part (c)(i).
...........................................................................................................................................
...........................................................................................................................................
...................................................................................................................................... [2]
(d) Complete the binary subtraction. Show your working.
01100111
–00110010 [2]
-------------------------------
1b 9618 S21 P12
6 A computer uses the ASCII character set.
(a) State the number of characters that can be represented by the ASCII character set and
the extended ASCII character set.
ASCII ...........................................................
Extended ASCII ........................................................... [2]
(b) Explain how a word such as ‘HOUSE’ is represented by the ASCII character set.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
....................................................................................................................................... [2]
(c) Unicode is a different character set.
The Unicode value for the character ‘1’ is denary value 49.
(i) Write the hexadecimal value for the Unicode character ‘1’.
..................................................................................................................................... [1]
(ii) Write the denary value for the Unicode character ‘5’.
..................................................................................................................................... [1]
1ac 9618 S21 P12_13 - 1 Anya scans an image into her computer for a school project.
(c) 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.
(i) Convert the hexadecimal code FC into denary.
..................................................................................................................................... [1]
(ii) 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.
Working .............................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.............................................................................................................
Answer (in binary) ........................................ [3]
(iii) Hexadecimal 23 in two’s complement representation is 00100011. The denary number 10
needs to be subtracted from this value. Subtract the denary number 10 from the two’s
complement representation 00100011. Give your answer in binary. Show your working.
Working .............................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
....................................................................................................................................................
Answer (in binary) ........................................ [3]
2b 9618 W21 P12 - 4 A register stores the following binary number
1 1 0 0 1 1 0 1
(a) The binary value in the register represents an unsigned binary integer.
Convert the unsigned binary integer into denary.
............................................................................................................................................. [1]
(b) The binary value in the register represents a two’s complement binary integer.
Convert the two’s complement binary integer into denary.
............................................................................................................................................. [1]
(c) The binary value in the register represents a hexadecimal number.
Convert the binary number into hexadecimal.
............................................................................................................................................. [1]
(d) State why the value in the register cannot be interpreted as a Binary Coded Decimal
(BCD).
.....................................................................................................................................................
.......................................................................................................................................... [1]
(e) The binary contents of two registers are:
Register 1 0 0 1 1 1 1 0 1
Register 2 0 0 1 0 1 1 0 1
(i) Add the contents of Register 1 and Register 2. Show your working.
Answer .............................................................................................................................. [2]
(ii) Subtract the contents of Register 2 from the contents of Register 1. Show your working.

Answer .............................................................................................................................. [2]


2ac W21 P11 P13 –
1 (a) Draw one line from each binary value to its equivalent (same) value on the right. [5]

Binary Value 1 kibibyte

8 bits 1 gigabyte

8000 bits 1 byte

1000 kilobytes 1 kilobyte

1024 mebibytes 1 gibibyte

8192 bits 1 megabyte

1 mebibyte

(b) (i) Perform the following binary addition. Show your working.
10101010
+ 00110111 [2]
(ii) State how an overflow can occur when adding two binary integers.
.....................................................................................................................................................
......................................................................................................................... [1]
(c) Convert the hexadecimal value F0 into denary.
.....................................................................................................................................................
......................................................................................................................................... [1]
3a 9618 S22 P11 -
1 Computers store data in binary form.
(a) State the difference between a tebibyte and a terabyte.
...................................................................................................................................................
............................................................................................................................................. [1]
(b) Convert the signed denary value –100 into an 8-bit two’s complement binary integer.
Working .....................................................................................................................................
...................................................................................................................................................
Answer ............................................................................ [1]
(c) Convert the denary number 251 into hexadecimal. Show your working.
Working .....................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
...............................................................................................................................................
Answer ............................................................................ [2]
(d) Add the following unsigned binary integers.
01010000
+00111110 [1]
------------------------
3b 9618 S22 P12
3 (e) Convert the denary numbers 127 and 12 to 8-bit binary and then perform the subtraction
12 - 127 in binary.
Show your working.
127 in binary .............................................................................................................................
12 in binary ...............................................................................................................................
12 - 127 in binary .....................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
................................................................................................................................................... [3]

3c 9618 S22 P13


1 Text and numbers are examples of data stored in a computer.
(a) A character set is used to represent characters in a computer.
(i) Describe what is meant by a character set.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
........................................................................................................................................... [2]
(ii) Identify two character sets and state one difference between them.
Character set 1 ..................................................................................................................
Character set 2 ..................................................................................................................
Difference ..........................................................................................................................
........................................................................................................................................... [3]
(b) A computer can represent numerical data in different forms.
Complete the table by writing the answer to each statement. [5]
Statement Answer
The hexadecimal value 11 represented in denary
The smallest denary number that can be
represented by an unsigned 8-bit binary integer
The denary number 87 represented in Binary
Coded Decimal (BCD)
The denary number 240 represented in
hexadecimal
The denary number –20 represented in 8-bit two’s
complement binary

Working space
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................
5a 9608 S17 P11 – SoW
Q 4(d) (d) Computer scientists often write binary representations in hexadecimal.
(i) Write the hexadecimal representation for this instruction:
0 0 0 0 0 1 1 1 1 1 0 0 0 0 1 0
.......................................................................................................................................[2]
(ii) A second instruction has been written in hexadecimal as:
05 3F
Write the equivalent assembly language instruction, with the operand in denary.
.......................................................................................................................................[2]

7b 9608 S17 P12 -SoW


4 (a) The Accumulator is a register. The current contents of the Accumulator are:
1 1 0 1 1 0 1 1
The current contents of the Accumulator represent an unsigned binary integer.
(i) Convert the value in the Accumulator into denary.
.......................................................................................................................................[1]
(ii) Convert the value in the Accumulator into hexadecimal.
.......................................................................................................................................[1]
(iii) The current contents of the Accumulator represent a two’s complement binary integer.
Convert the value in the Accumulator into denary.
.......................................................................................................................................[1]
(b) The binary integer represents a character from the computer’s character set.
(i) Define the term character set.
...........................................................................................................................................
.......................................................................................................................................[1]
(ii) Explain the differences between the ASCII and Unicode character sets.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
.......................................................................................................................................[2]
(iii) The ASCII code for ‘A’ is 41 in hexadecimal.
Calculate the ASCII code in hexadecimal for ‘Z’. Show your working.
Working .............................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
ASCII code in hexadecimal for ‘Z’ ..................................................................................... [2]
7a 9608 S18 Q8c - SoW
8 (c) X is a register. The current contents of X are:
1 0 0 0 0 1 1 1
(i) The current contents of register X represent an unsigned binary integer.
Convert the value in X into denary.
.......................................................................................................................................[1]
(ii) The current contents of register X represent a Binary Coded Decimal.
Convert the value in X into denary.
.......................................................................................................................................[1]
(iii) The current contents of register X stores a two’s complement binary integer.
Convert the value in X into denary.
.......................................................................................................................................[1]
7c 9608 S18 P13 – SoW
3 (c) H is a register. The current contents of H are:
1 1 0 0 0 0 0 1
The current contents of register H represent an unsigned binary integer.
(i) Convert the value in register H into denary.
.......................................................................................................................................[1]

(ii) Convert the value in register H into hexadecimal.


.......................................................................................................................................[1]
(iii) The current contents of register H represent a two’s complement binary integer.
Convert the value in register H into denary.
.......................................................................................................................................[1]
(iv) State why register H does not currently contain a Binary Coded Decimal (BCD).
...........................................................................................................................................
.......................................................................................................................................[1]
Q1 9608 Summer 15 P11-12 - 1 (i) Convert the following binary number into hexadecimal.
1 0 1 1 1 0 0 0.....................................................................................................................[1]
(ii) Convert the following denary number into BCD format.
9 7...................................................................................................................................... [1]
(iii) Using two’s complement, show how the following denary numbers could be stored in an
8-bit register: [2]
114

- 93

Q 2 Summer 15 P13 - 1 (a) (i) Using two’s complement, show how the following denary
numbers could be stored in an8-bit registers: [2]
124

- 77
(ii) Convert the two numbers in part (a) (i) into hexadecimal.
124 ............................................................................................................................................
–77 ........................................................................................................................................[2]
(b) Binary Coded Decimal (BCD) is another way of representing numbers.
(i) Write the number 359 in BCD form.
............................................................................................................................................... [1]
(ii) Describe a use of BCD number representation.
.....................................................................................................................................................
............................................................................................................................................... [2]
Q 3 Winter 15 P12 - 3 A touch screen has three squares where a selection can be made:

(a) The x-coordinate of the centre of the three squares is held in three memory locations:
Address Memory contents
S 40 0000 1011 0100
T 41 0010 0101 0100
U 42 0100 0110 1100
(i) Give the hexadecimal value of the memory contents for U.
.....................................................................................................................................................
.............................................................................................................................................. [1]
(ii) Convert the denary number 40 into binary.
.....................................................................................................................................................
................................................................................................................................................ [1]
(b) Bitmap graphics are used to represent squares S, T and U.
These can be saved in a number of different image resolutions.
(i) Give the number of bits required to store each pixel for a black and white bitmap.
.......................................................................................................................................[1]
(ii) Identify how many bits are required to store each pixel for a 256-colour bitmap.
Explain your answer.
.....................................................................................................................................................
.....................................................................................................................................................
............................................................................................................................... [2]
Q 4 Summer 16 P11, 122 (a) Convert the following denary integer into 8-bit binary.
55 [1]

(b) Convert the following Binary Coded Decimal (BCD) number into denary.
10000011
...............................................................................................................................................[1]

(c) Convert the following denary integer into 8-bit two’s complement.
-102 [2]

(d) Convert the following hexadecimal number into denary.


4E
...............................................................................................................................................[1]
Q 5) Summer 16 P 13 2 (a) Convert the following 8-bit binary integer into denary.
01001101
...............................................................................................................................................[1]
(b) Convert the following denary number into Binary Coded Decimal (BCD).
82
...............................................................................................................................................[1]
(c) Convert the following two’s complement integer number into denary.
11001011
...................................................................................................................................................
...............................................................................................................................................[2]
(d) Convert the following denary number into hexadecimal. Show your working.
198
...............................................................................................................................................[2]
Q 7) Winter 2017 P11, P13 - 1 (a) Each of the following bytes represents an integer in two’s
complement form.
State the denary value.
(i) 0111 0111 Denary .................................................. [1]
(ii) 1000 1000 Denary .................................................. [1]
(iii) Express the following integer in two’s complement form.
-17 [1]

(iv) State in denary, the range of integer values that it is possible to represent in two’s
complement integers using a single byte.
Lowest value ..................................................
Highest value .................................................. [1]
(b) (i) Convert the following denary integer into Binary Coded Decimal (BCD).
653
.......................................................................................................................................[1]

(ii) A 3-digit BCD representation has been incorrectly copied. It is shown as:
0 1 0 0 1 1 1 0 0 0 1 0
State how you can recognise that this is not a valid BCD representation.
...........................................................................................................................................
.......................................................................................................................................[1]
(iii) Describe a practical application where BCD is used.
...........................................................................................................................................
.......................................................................................................................................[1]
Q 6) Winter 2016 P12 -
4 Hexadecimal, Binary Coded Decimal (BCD) and binary values are shown
below. Draw a line to link each value to its correct denary value. [4]
Hexadecimal, BCD, binary Denary
93
Hexadecimal:
3A –65

BCD representation: 58
0100 1001
–63
Binary integer:
01011101 73

Two’s complement binary


49
integer:11000001

-93

Q 10) Winter 2018 P11 - 4 (c) The current contents of a general purpose register (X) are:
X: 1 0 1 1 1 0 1 0
(i) The contents of X represent an unsigned binary integer.
Convert the value in X into denary.
.......................................................................................................................................[1]
(ii) The contents of X represent an unsigned binary integer.
Convert the value in X into hexadecimal.
.......................................................................................................................................[1]
(iii) The contents of X represent a two’s complement binary integer.
Convert the value in X into denary.
.......................................................................................................................................[1]
Q 11) Winter 2018 P11 - 3 (c) The current contents of a general purpose register (X) are:
X 1 1 0 0 0 0 0 1
(i) The contents of X represent an unsigned binary integer. Convert the value in X into denary.
...................................................................................................................................... [1]
(ii) The contents of X represent an unsigned binary integer. Convert the value in X into
hexadecimal.
...................................................................................................................................... [1]
(iii) The contents of X represent a two’s complement binary integer.
Convert the value in X into denary.
...................................................................................................................................... [1]
Q 12) Summer 2019 P12 - 3 (d) The ASCII character code for ‘A’ is 65 in denary.
(i) Convert the denary ASCII character code for ‘A’ into 8-bit binary. [1]

(ii) Convert the denary ASCII character code for ‘A’ into hexadecimal.
........................................................................................................................................... [1]
(iii) The Unicode character code for ‘G’ is 0047 in hexadecimal.
State, in hexadecimal, the Unicode character code for ‘D’.
............................................................................................................................................... [1]
Q 13) Winter 2019 P11
5 (a) The bit depth of an image dictates how many different colours can be represented by each pixel.
(i) State the number of different colours that can be represented by a bit depth of 8 bits.
..................................................................................................................................... [1]
(ii) One binary colour is represented by 0100 1110, Convert the unsigned binary number 0100 1110
into denary.
..................................................................................................................................... [1]
(b) Convert the denary number -194 into 12-bit two’s complement.
............................................................................................................................................. [1]
(c) (i) Convert the Binary Coded Decimal (BCD) value 0110 1001 into denary.
..................................................................................................................................... [1]
(ii) Identify one practical application where BCD is used.
...........................................................................................................................................
..................................................................................................................................... [1]
(d) One example of a character set used by computers is ASCII.
Describe how one character is represented in a character set.
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
.................................................................................................................................................. [2]
Q 14) Winter 2019 P13 - 4 (a) Convert the unsigned binary number 0101 1111 1100 into denary.
............................................................................................................................................. [1]
(b) Convert the denary number -239 into 12-bit two’s complement.
............................................................................................................................................. [1]
(c) Convert the two’s complement number 0110 0101 into denary.
............................................................................................................................................. [1]
(d) Convert the Binary Coded Decimal (BCD) value 0110 0101 into denary.
............................................................................................................................................. [1]
(e) Convert the denary number 222 into hexadecimal.
............................................................................................................................................. [1]

Q 15) Summer 20 P1 -1(c) The digital camera allows a user to add text to an image. The text
is encoded as ASCII values. The table shows the ASCII denary values for five characters.
Character ASCII denary value
a 97
b 98
c 99
d 100
e 101
(i) Give the 8-bit binary value for the ASCII character ‘b’.
.....................................................................................................................................................
............................................................................................................................................... [1]
(ii) Complete the table by writing the ASCII denary value for the character ‘t’ and its
hexadecimal equivalent. [2]
Character t
ASCII denary value
Hexadecimal value
Q 16) Summer 2020 P12 - 5 (a) The steps 1 to 6 describe the first pass of a two-pass assembler.
The following three statements are used to complete the sequence of steps.
A If it is already in the symbol table, it checks to see if the absolute address is known
When it meets a symbolic address, it checks to see if it is already in the symbol
B
table
C If it is known, it is entered
Write one of the letters A, B or C in the appropriate step to complete the sequence.
1. The assembler reads the assembly language instructions
The assembler translates assembly code into machine code.
The table shows the denary values for three assembler op codes.
Op code Denary value
LDD 194
ADD 200
STO 205
(i) Convert the denary value for the op code LDD into 8-bit binary. [1]

(ii) Convert the denary value for the op code STO into hexadecimal.
..................................................................................................................................... [1]
(iii) State why the denary value for the op code ADD cannot be represented in 8-bit two’s complement
form. Justify your answer.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
..................................................................................................................................... [2]

Q 17) Summer 2020 P13


7 (d) The hexadecimal colour value of the background of Xiaoming’s website is:913C8E
Complete the following table by converting each hexadecimal value to denary value. [2]
Red Green Blue
Hexadecimal value 91 3C 8E
Denary value
Q 18) Winter 20 P11
6 (a) Convert the following denary number into a 12-bit two’s complement binary form. [1]
-245

(b) Convert the following hexadecimal number into denary.


F0
.....................................................................................................................................................
............................................................................................................................................ [1]
(c) Convert the following unsigned binary integer into denary.
10101111
.....................................................................................................................................................
........................................................................................................................................... [1]
(d) Convert the following Binary Coded Decimal (BCD) into denary.
100001010011

.....................................................................................................................................................
............................................................................................................................................... [1]
Q 19) Winter 20 P12 - 1 Different types of data can be represented in a computer system.
(a) Numeric is one type of data.
(i) Convert the following denary number into Binary Coded Decimal (BCD).
105

..................................................................................................................................... [1]
(ii) Convert the following two’s complement binary integer into denary.
10111111

..................................................................................................................................... [1]
(iii) Convert the following hexadecimal number into denary.
AB

..................................................................................................................................... [1]
(b) Character is another type of data.
The following tables show part of the ASCII code character set.
Denary Denary
Character Character
value value
A 65 a 97
B 66 b 98
C 67 c 99
D 68 d 100
E 69 e 101
(i) Describe how the computer uses ASCII codes to represent characters.
.....................................................................................................................................................
.....................................................................................................................................................
...................................................................................................................................................
(ii) Convert the following string into ASCII codes.
Bed
.....................................................................................................................................................
............................................................................................................................................. [1]
(iii) Give the denary ASCII code for the following character.
H

…..................................................................................................................................... [1]

Q 20) Winter 20 P12 - 5 (d) The current contents of a general-purpose register X are:
X 1 1 0 0 1 0 1 0
(i) The contents of X represent an unsigned binary integer.
Convert the contents of X into denary.
............................................................................................................................... [1]
(ii) The contents of X represent a two’s complement binary integer.
Convert the contents of X into denary.
................................................................................................................................ [1]
(iii) State why the binary number in X cannot represent a Binary Coded Decimal (BCD).
.....................................................................................................................................................
.......................................................................................................................................... [1]
1.2 Multimedia Graphics
1.2 Multimedia Notes and guidance
Graphics
Candidates should be able to:
Show understanding of how data for a Use and understand the terms: pixel, file
bitmapped image are encoded header, image resolution, screen resolution,
colour depth, bit depth
Perform calculations to estimate the file size
for a bitmap image
Show understanding of the effects of Use the terms: image resolution, colour
changing elements of a bitmap image on the depth
image quality and file size
Show understanding of how data for a Use the terms: drawing object, property,
vector graphic are encoded drawing list
Justify the use of a bitmap image or a vector
graphic for a given task
Bitmap Images
Bit-map image – The images that are made up of small picture elements (pixels) are called bitmap
image.
Pixel – the smallest picture element that makes up an image, that has only one colour. It is the
smallest identifiable component of image.
Bit depth – number of bits used to represent the smallest unit in, for example, a sound or image file –
the larger the bit depth, the more the available colours in image and better the quality of the sound.
Colour depth – number of colours available in a pixel, e.g. 8 bit depth has colour depth of 256 (28 =
256).
Image resolution – number of pixels that make up an image, for example, an image could contain
4096 × 3192 pixels (12 738 656 pixels in total).
Screen resolution – number of horizontal and vertical pixels that make up a screen display. If the
screen resolution is smaller than the image resolution, the whole image cannot be shown on the
screen, or the original image will become lower quality.
Resolution – number of pixels per column and per row on a monitor or television screen.
Pixel density – number of pixels per square centimeter or per square inch.
Vector graphics – images that use 2D points to describe lines and curves and their properties that
are grouped to form geometric shapes.
Vector graphics are computer graphics, defined using mathematics and geometry such as
points, lines, curves, and shapes or polygon(s). Allowing for scalability. Objects and
properties stored mathematically.
Drawing list is a set of commands, the list of shapes involved in list an image, it a list that
stores the command and description required to draw each object.
Vector graphics are made up of drawing lists (set of command used to define objects and
their properties).
An object is a mathematical or geometrically defined construct such as a rectangle, line or
circle.
Property is data about the shapes, it defines one aspect of the appearance of the drawing
object.
Each of the objects has properties to tell the size, colour, position etc.
Bitmap Image

The images that are made up of small picture elements


(pixels) are called bitmap image.

How images are encoded and stored in computer:


The images are stored in computer as bitmaps
Each image is made up of tiny elements known as Pixel (Picture Element). Each pixels is a
single square of one colour. It is the smallest addressable element in an image. Each pixel is
of a single colour. The number of available colours in a pixel is known as Colour Depth.
The Colour depth of the image is determined by Bit Depth i.e. number of bits per pixel
The image quality is also determined by Pixel Density i.e. number of pixels per inch.
The total number of pixels in an image is known as Image Resolution.
The values of each pixel of the image is stored in binary numbers.
Courtesy : KhanAcademy
The Khan Academy team page includes this lovely photo of a dog looking at a computer
screen:
At normal resolution, it looks like there are blocks of similar color, like in the dog's fur or the
grey in the computer screen. These blocks are picture elements and known as pixels.
Let's zoom in to the pixels:
The Khan Academy team page includes this lovely photo of a dog looking at a computer
screen:
At normal resolution, it looks like there are
blocks of similar color, like in the dog's fur or
the grey in the computer screen. These blocks
are picture elements and known as pixels.
Pixels
Pixels are the smallest identifiable component of an image, that can contain only one colour.
Consider two a very simple image such as the two below, one has two colours - black and
white and other one has 8 colours (CMYK).

These images can be divided up into a grid of smaller elements, as shown below:

Each element in the grid of picture is called a pixel. The more pixels used, the finer the details
that can be represented.
As we mentioned earlier, computers can only handle and store 1s and 0s. Therefore let a
single colour within each pixel be represented by binary 1 (say for white) and let a different
colour (black perhaps) be represented by binary 0.
Image display
When a monitor or a printer displays a vector image it is rasterised - converted into a grid of pixels.
Regardless of the file type, an image will always be outputted onto a screen or printed in pixels.
Colour Depth is the number of colours a bit can store is colour depth while Bit Depth is the
number of bits per pixel. Colour depth is determined by bit depth (the number of bits per
pixel).
In the black and white image, only two colours are needed. This means it has a colour depth of 1 bit.
In black and white image below shows each 1 bit pixel containing either binary 1 or binary 0.

A 2-bit colour depth would allow four different values: 00, 01, 10, 11. This would allow for a range of
colours such as:

Colour
Binary code Colour
Number

0 00 Black
1 01 Dark grey

2 10 Light grey
3 11 White
11 11 11 00 00 00 00 11 11 11

11 11 11 10 00 00 10 11 11 11

11 11 11 10 00 00 10 11 11 11

10 10 10 10 10 10 10 10 10 10

01 01 01 01 01 01 01 01 01 01

11 01 11 11 11 11 11 11 01 11

00 01 01 11 11 11 11 00 01 01

00 11 01 11 11 11 11 00 11 01

00 11 01 11 11 11 11 00 11 01

00 11 01 11 11 11 11 00 11 01

A 3-bit colour depth allows 8 colours. The range of colours are:


Colour
Colour Binary code
No
R G B
Black 0 0 0 0
Blue 1 0 0 1
Green 2 0 1 0
Cyan 3 0 1 1
Red 4 1 0 0
Magenta 5 1 0 1
Yellow 6 1 1 0
White 7 1 1 1
Colour depth
The number of bits used to represent the colour of a single pixel
If bit depth is 8 and then there will be 256 colour (28=256). While in a true colour image there
are 24 bits per pixel generating 16 million colour image (224= 16,777,216) while only 10 million
colours can be recognized by an human eye.

Colour Depth Available Colours


Bit Depth
Available colours
Monochrome
1-bit 21 = 2
( Black & White)
2-bit 22 = 4 Grey Scale

3-bit 23 = 8 RGB 8 Colours

7-bit 27 = 128 128 Colours

8-bit= 1 byte 28 = 256 256 Colour


True colours
24-bit= 3 byte 224 = 16,777,216
16,777,216 Colours

Image Resolution refers to the number of pixels that make up an image; for example, an
image could contain 4096 × 3192 pixels (12 738 656 pixels in total) i.e. 12 Mega Pixel (MP)
image.
Pixel density, usually measured in dots per inch (dpi). Images on websites usually have a pixel
density of 72 dpi. This means that a 1-inch square contains a grid of pixels that is 72 pixels
wide by 72 pixels high. 72 x 72 = 5184 pixels per square inch.
Pixel density determines the image quality, more the pixel density, better the image quality.

Effects of changing elements of a bitmap image on the image quality and file size
The image quality is determined by image resolution and pixel density. When magnifying an image,
the number of pixels that makes up the image remains the same but the area they cover is now
increased. This means some of the sharpness could be lost. For example, look at following image:

Image A is the original. By the time it has been scaled up to make image F it has become pixelated
(‘fuzzy’). This is because images A and F have different pixel densities.
The main drawback of using high resolution images is the increase in file size. As the number of pixels
used to represent the image is increased, the size of the file will also increase. This impacts on how
many images can be stored on, for example, a hard drive. It also impacts on the time to download an
image from the internet or the time to transfer images from device to device.
Screen resolution refers to the number of horizontal pixels and the number of vertical pixels
that make up a screen display (for example, if the screen resolution is smaller than the image
resolution then the whole image cannot be shown on the screen or the original image will
now.
JPG or JPEG (Joint Photographic Experts Group)
PEG is the file compression format designed to make photo files smaller in size for storage and for
transmission. It uses lossy compression and compresses a file between factors of
5 to 15.
Image File Size Calculation
To calculate image file size, firstly number of pixels found out then these are
multiplied to find total number of pixels in an image that gives, image
resolution.
For example 2000 pixels wide and 2000 pixels high image will have 2000 ×
2000= 4,000,000 pixels. This is often referred to as a 4-megapixel image.
Then Image resolution is multiplied by bit depth.
Black & White image Grey Scale 8-Colour True Colour
Bit Depth=1 Bit Depth=2 Bit Depth= 3 Bit Depth=24
Image Size Image Size Image Size Image Size
= 4,000,000 x 1 bit = 4,000,000 x 2 bit = 4,000,000 x 3 bit = 4,000,000 x 24 bit
= 4,000,000 bit = 8,000,000 bit = 12,000,000 bit = 4,000,000 x 3 Byte
= 4,000,000 / 8 Byte = 8,000,000 / 8 Byte = 12,000,000 / 8 Byte = 12,000,000 Byte
= 500,000 Bytes = 1,000,000 Bytes = 1,500,000 Bytes = 12 MB
= 500 KB = 1 MB = 1.5 MB
Image Size = 500 KB Image Size = 1 MB Image Size = 1.5 MB Image Size = 12MB

Metadata
File header is also included in a bit-map image file. It usually also contains metadata.
Metadata means 'data about data' and provides information about the image. The information
includes:
• filename

• file format – e.g. JPEG, GIF or PNG


• dimensions (width and height)
• image resolution (number of pixels)
• bit depth (number of bits per pixel, usually 1, 8, 16, 24 or 32)
• colour depth (number of colours in a pixels)
• time and date the image was last changed
• camera settings when the photo was taken
• type of compression applied on the file
Vector graphics
Vector graphics are computer graphics defined using mathematics and geometry such as
points, lines, curves, and shapes or polygon(s). Allowing for scalability. Objects and
properties stored mathematically.
Vector graphics are defined in terms of points on a Cartesian plane, which are connected by
lines and curves to form polygons and other shapes.
Drawing list is a set of commands used to define a vector image.
Drawing list is the list of shapes involved in list an image, it a list that stores the command
and description required to draw each object.
Vector graphics are made up of drawing lists (set of command used to define objects and
their properties).
An object is a mathematical or geometrically defined construct such as a rectangle, line or
circle. Some objects that can be used in vector graphics are:
1. Line
2. Text
3. Rectangle
4. Circle
Property is data about the shapes, it defines one aspect of the appearance of the drawing
object.
Each of the objects has properties to tell the size, colour, position etc.
The properties needed to display a rectangle are:
• x, y coordinates of the object,
• width, height of the object
• fill colour
• stroke (colour), stroke-width
How vectors graphics are encoded in computer
In vector graphics each item is a drawing object. The drawing objects are created using
mathematical calculation.
Properties of each drawing object are stored for example the position/coordinates of each drawing
Object, line colours etc. Calculation for proportional size is stored rather than exact dimensions.
Courtesy: https://en.wikibooks.org/wiki/A-
level_Computing/AQA/Paper_1/Fundamentals_of_data_representation/Vector_graphics
Extension:SVG
There are several vector graphic formats out there, but an easy one to get started with
is Scalable Vector Graphics (SVGs). SVGs are very easy to create and are supported by all
modern major web browsers. To create a simple SVG, Copy the following into a text file and
save it as image.svg.
This file can be opened in browser

<svg xmlns="http://www.w3.org/2000/svg">
<svg xmlns="http://www.w3.org/2000/svg">
<rect width="120" height="80” x="40" y="150"
stroke="blue" stroke-width="5" fill="green" />
<rect width="20" height="80" x="50" y="230"
fill="black" />
<rect width="20" height="80" x="130" y="230"
fill="black" />
<rect width="15" height="50" x="22" y="150"
fill="brown" />
<rect width="15" height="50" x="162" y="150" fill="brown" />
<line x1="20" y1="50"
x2="200" y2="50"
stroke="red" stroke-width="3"/>
<circle cx="100" cy="100" r="50"
fill="red" stroke="black" stroke-width="5" />
<text x="20" y="40"> CompSci with Inqilab Patel </text>
</svg></svg>
Comparison between vector graphics and bit-map images
Vector graphic images Bit-map images
made up of geometric shapes which require made up of tiny pixels of different colours
definition/attributes

to alter/edit the design, it is necessary to possible to alter/edit each of the pixels to


change each of the geometric shapes change the design of the image
Vector graphics are scalable, no effect on Bitmap images can be resized, but image
image quality when enlarge or shrink quality is affected.

they do not require large file size since it is because of the use of pixels (which give
made up of simple geometric shapes very accurate designs), the file size is very
large

because the number of geometric shapes is


since images are built up pixel by pixel, the
limited, vector graphics are not usually very
final image is usually very realistic
realistic

file formats are usually .svg, .cgm, .odg file formats are usually .jpeg, .bmp, .png
1ac 9618 S21 P12_13 - 1 Anya scans an image into her computer for a school project.
(a) The scanned image is a bitmapped image.
(i) Complete the following table to describe the two terms about graphics.
Term Description
Pixel
………...........................................................................................................................
......................................................................................................................................
......................................................................................................................................
File
header ………...........................................................................................................................
......................................................................................................................................
......................................................................................................................................

(ii) 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.
Working .............................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
Answer .......................................... mebibytes [3]
(a) (i) The stem of Question 1(a) indicates that the question is about a bitmapped image, therefore,
the descriptions of the terms in this part question should refer to a bitmapped image. Simply stating
that a pixel is a picture element is not enough at this level of study. There needs to be a description of
what is meant by a picture element. While the inclusion of examples of the contents of a file header is
commendable, candidates must be aware that when asked for a description a list is not enough and
some further explanation is needed which should refer to the context given, in this case, a bitmap.

(ii) There were many good answers to this part question. The method for calculating the file size of an
image was usually correct. Some candidates multiplied the number of pixels by 8 to calculate the
number of bits required to store the image, but then did not divide by 8 to convert the bits to bytes.
Example Candidate Response – high Examiner comments

1 This is not a description of a pixel.

2
2 The candidate gives a correct
description, together with an
appropriate example.
Mark for (a)(i) = 1 out of 2

3 The candidate calculates the


number of pixels correctly and uses
the correct divisor.
Mark for (a)(ii) = 3 out of 3

4 The question refers to an image,


but the candidate’s answer refers
to text.
Mark for (b) = 1 out of 3
Example Candidate Response – high, continued Examiner comments

Mark for (c)(i) = 1 out of 1

5 5 The carry bits are clearly visible.


Mark for (c)(ii) = 3 out of 3

6
7 6 The two’s complement of -10
(negative 10) is seen.
7 The candidate adds the correct
value and the carry bits are clearly
visible.
Mark for (c)(iii) = 3 out of 3
Example Candidate Response – high, continued Examiner comments

8 The candidate refers to the legal


right of ownership.

Mark for (d) = 1 out of 2


8

Total mark awarded =


13 out of 17
How the candidate could have improved their answer
• (a) The candidate could have expanded on what they meant by a ‘picture element’.
• (b) The candidate states that it is an image that is compressed, but they could have described the
compression of the pixels of an image rather than the characters of a piece of text.
• (c)(ii) The candidate could have included a statement showing explicitly the conversion of denary 15 to
binary.
• (c)(iii) The candidate could have shown how the binary value for -10 was calculated in the space given for
working, rather than doing this on the side of the page.
• (d) The candidate could have added a second statement to describe what was meant by copyright. There
were two marks available for the question, so two distinct points were required.
Example Candidate Response – middle Examiner comments

1 The word ‘tiny’ is too vague.

2 A file header is not a file.

Mark for (a)(i) = 0 out of 2


2

3 The 3 is not required. The number


of pixels is already multiplied by
3 the number of bits needed for each
one.
4 4 The divisor is correct.

Mark for (a)(ii) = 1 out of 3

5 The question refers to an image,


but the candidate refers to
5 characters.
6 The candidate is awarded the
second mark under the error
carried forward rule.
6
Mark for (b) = 2 out of 3
Example Candidate Response – middle, continued Examiner comments

Mark for (c)(i) = 1 out of 1

7 The candidate clearly labels the


conversion of 15 to binary.
7
8 The carry bits are clearly seen.
8
Mark for (c)(ii) = 3 out of 3

9 The conversion of 10 to binary is


9
clear.
10 The candidate uses the method of

10 direct subtraction and the carry bits


are clear.
11 The candidate’s answer is
incorrect.
11
Mark for (c)(iii) = 2 out of 3
Example Candidate Response – middle, continued Examiner comments
12 The candidate identifies the right
to intellectual property.
12
13 ‘Action can be taken’ is not
enough.
Mark for (d) = 1 out of 2

13

Total mark awarded =


10 out of 17

How the candidate could have improved their answer


• (a) The candidate could have given more consideration to the terms used in the description.
• (b) The candidate stated that it was an image that was compressed, but they needed to describe the
compression of the pixels of an image rather than the characters of a piece of text.
• (c)(iii) The candidate needed to take more care in their subtraction, however their method was correct.
• (d) The candidate made two points, but their second point could be more precise.
Example Candidate Response – low Examiner comments

1
1 The candidate gives a description of
a pixel.
Mark for (a)(i) = 1 out of 2

2 The number of pixels is incorrect


and the candidate does not show a
divisor.
Mark for (a)(ii) = 0 out of 3

3 The candidate gives a description of


lossless compression, not a
description of a method of
accomplishing lossless compression.
Mark for (b) = 0 out of 3
Example Candidate Response – low, continued Examiner comments

Mark for (c)(i) = 1 out of 1

4 The candidate shows a denary


calculation method but the question
asks for a binary calculation.

5 The answer is correct binary.


4
Mark for (c)(ii) = 1 out of 3

5
6 The candidate’s conversion of
denary 10 to binary is correct.
7 The candidate adds the value
instead of subtracting it.

6 Mark for (c)(iii) = 1 out of 3

7
Example Candidate Response – low, continued Examiner comments

8 The candidate’s first statement is


8 too vague to be awarded marks.

9 The candidate identifies the legal


9
right of redress and is awarded a
mark.
Mark for (d) = 1 out of 2

Total mark awarded =


5 out of 17
How the candidate could have improved their answer
• (b) The candidate needed to describe a recognised method of lossless compression.
• (c)(ii) The candidate needed to ensure that they followed the instructions in the question.

Common mistakes candidates made in this question


• (a)(i) Many candidates included a list of examples without any descriptions. Others used examples that
were about any file and not specifically about a graphics file. Where the question gave a context,
candidates’ answers needed to be focussed on the context.
• (a)(ii) Many candidates multiplied the number of pixels by 8 to calculate the number of bits, but then forgot
to subsequently divide by 8 to get the number of bytes.
• (b) Candidates referred to characters when the question asked about an image. Where the
question gave a context, candidates’ answers needed to be focussed on the context.
• (c)(i) Some candidates gave the answer in binary instead of denary.
• (c)(ii) and (c)(iii) Some candidates did not make their working obvious. Carry bits needed to be clearly
visible.
(d) Many candidates described how copyright could be broken, for example, by plagiarism, rather than stating
that copyright gave protection against plagiarism.
2b 9618 W21 P12 - 5 Riya has created the following logo as a vector graphic.

(a) Complete the table by writing a description of each vector graphic term and give an
example for this logo. [4]
Term Description Example from logo

Property

Drawing
list

(b) Riya takes a photograph using a digital camera. The photograph is stored as a bitmap
image.
(i) Describe two differences between a vector graphic and a bitmap image.
1 ........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
2 ........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
........................................................................................................................................... [4]
Examiner Report
(a) Many candidates need to improve their understanding of the terms associated with vector graphics. There
was considerable confusion between a drawing list and a drawing object. Some candidates attempted to
describe a property without using a different word or without associating the property with a drawing object. A
suitable answer would be, ‘a property is an aspect of the appearance of a drawing object’. Examples given
were often generic rather than from the logo shown in the question.
(b) (i) The command word in this question is ‘describe’. This means that, at this level, it is not enough to
write, for example, ‘bitmap images pixelate when enlarged, vector graphic images do not’. A description
is expected to include the reasons why a bitmap image pixelates and why a vector graphic does not. The
question also asks for two differences.

(ii) Questions need to be read carefully. This question asks for two lossy methods of compression that can be
used on a photograph. Incorrect answers frequently described lossy compression and the effects of the
compression on the image, not methods of lossy compression. Statements such as, ‘use JPEG’ or ‘remove
colours the eye cannot see’ are not enough at this level when the question asks for a description. The
answer needs to include how using a JPEG or removing the colours would compress the photograph.

3b 9618 S22 P12


1 (a) Draw one line from each image representation term to its correct definition. [3]
Term Definition
The number of pixels wide by the number of
Pixel
pixels high

The smallest identifiable component of an


Bit depth
image

Image Stores data about the image file, e.g. file


resolution format, number of bits per pixel, file size

The number of bits used to represent each


File header
colour
(b) The following section of a bitmap image is 10 pixels wide and 5 pixels high. In this example, each
colour is represented by a letter, e.g. B is blue.
B B B B B B B B B B

Y Y P Y Y Y P Y Y Y

R R M R P K T T R R

B O P Y Y Y P G P P

R O R P P P R R R R
The complete image can have up to 256 colours.
(i) Identify the smallest number of bits that can be used to represent each colour in the complete
bitmap image.

..................................................................................................................................... [1]
(ii) Calculate an estimate for the file size of the section of the bitmap image shown, giving your answer
in bytes. Use your answer from part (b)(i). Show your working.
Working .............................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
Answer ................................... bytes [2]
(c) Describe how changing the colour depth of an image affects its file size.
5...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [2]
(d) The first row of pixels in the image from part (b) is shown:

B B B B B B B B

Explain how this row of pixels can be compressed using lossless compression.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [2]
Examiner Comments
(a) (a) There were many correct answers to this question. Some answers seemed to confuse the number of pixels
wide by the number of pixels high (the image resolution) with the number of bits used to represent each colour
(the bit depth).

(b) (b) (i) This question was also answered well, the most common incorrect answer was 9, presumably because
there were 9 different colours in the diagram.

(ii) The question asked for the answer in bytes, the answer to part 1(b)(i) was in bits. This was an example
of a situation where the questions needed to be read carefully. Some answers correctly calculated the size of the
image in bits, but then omitted to divide by 8 to bring the answer to bytes.

(c) (c) This was a question where answers needed to be exact. Vague answers such as ‘a change in colour depth
will increase the size of the file’ were common. This answer does not specify whether the change in colour
depth is an increase or a decrease. A precise answer is, ‘an increase in the colour depth will increase the size
of the file’.

(d) (d) Many answers correctly named or described a method of lossless compression. Run-length encoding was
easily the most popular choice. Some answers did not achieve both of the marks because their answer did not
explain how the method would have been applied to the row of pixels given in the question. This question was
set in a specific context and needed an answer to be applied rather than being completely generic.
9608 W15 P11, P13
8 (a) Six computer graphics terms and seven descriptions are shown below.
Draw a line to link each term to its correct description. [6]
Term Description
Value quoted for a monitor specification, such as 1024 × 768.
The larger the numbers, the more picture elements will be
displayed.

Measured in dots per inch (dpi); this value determines the


Bitmap graphic
amount of detail an image has

Image file
Picture element
header

Image resolution Image made up of rows and columns of picture elements

Image made up of drawing objects. The properties of each object


Pixel
determine its shape and appearance.

Screen Specifies the image size, number of colours, and other data
resolution needed to display the image data

Number of samples taken per second to represent some event in


Vector graphic
a digital format
(b) (i) A black and white image is 512 pixels by 256 pixels.
Calculate the file size of this image in kilobytes (KB) (1 KB = 1024 bytes).
Show your working.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.............................................................................................................................................. [2]
(ii) Give a reason why it is important to estimate the file size of an image.
.....................................................................................................................................................
.....................................................................................................................................................
...............................................................................................................................................[1]
Q 2) 9608 W 15 P12
3 A touch screen has three squares where a selection can be made:

(a) The x-coordinate of the centre of the three squares is held in three memory locations:
Address Memory contents
S 40 0000 1011 0100
T 41 0010 0101 0100
U 42 0100 0110 1100
(b) Bitmap graphics are used to represent squares S, T and U.
These can be saved in a number of different image resolutions.
(i) Give the number of bits required to store each pixel for a black and white bitmap.
.......................................................................................................................................[1]
(ii) Identify how many bits are required to store each pixel for a 256-colour bitmap.
Explain your answer.
.....................................................................................................................................................
.....................................................................................................................................................
................................................................................................................................................[2]

Q 3) 9608 S 2017 P11_13


3 (b) The computer also has bitmap software.
(i) Define the terms pixel and screen resolution.
Pixel ...................................................................................................................................
...........................................................................................................................................
Screen resolution ..............................................................................................................
........................................................................................................................................... [2]
(ii) A picture has been drawn and is saved as a monochrome bitmap image.
State how many pixels are stored in one byte.
.......................................................................................................................................[1]

(iii) A second picture has width 2048 pixels and height 512 pixels. It is saved as a 256-colour
image.
Calculate the file size in kilobytes. Show your working.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
................................................................................................................................................[3]
(iv) The actual bitmap file size will be larger than your calculated value.
State another data item that the bitmap file stores in addition to the pixel data.
...........................................................................................................................................,,,,,,,,,,
,,,,.......................................................................................................................................[1]
Q 4) 9608 S 17 P12
(b) The computer also has bitmap software.
(i) Define the term image resolution.
...........................................................................................................................................
.......................................................................................................................................[1]
(ii) A picture is drawn and is saved as a 16-colour bitmap image.
State how many bits are used to encode the data for one pixel.
.......................................................................................................................................[1]
(iii) A second picture has width 8192 pixels and height 256 pixels. It is saved as a 256-
colourbitmap.
Calculate the file size in kilobytes.
Show your working.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.................................................................................................................................................[3]
(iv) The actual bitmap file size will be larger than your calculated value as a bitmap file has a
file header. State two items of data that are stored in the file header.
1 ........................................................................................................................................
2 ....................................................................................................................................[2]
Q 5) 9608 S18 P11
2 A logo is designed as a bitmap image.
(a) Describe what is meant by a bitmap image.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.........................................................................................................................................[2]
(b) A black and white bitmap image is shown.

(i) Explain how a computer can store this bitmap image.


.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
..............................................................................................................................................[2]
(ii) The image is compressed before it is attached to an email.
Explain how run-length encoding (RLE) will compress the image.
.....................................................................................................................................................
.....................................................................................................................................................
.................................................................................................................................................[2]
(c) The finished logo is 500 pixels by 1000 pixels and uses 35 different colours.
Estimate the file size for the logo. Give your answer in kilobytes. Show your working.
Working .....................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
...............................................................................................................................................
...................................................................................................................................................
Answer ..................................................................................................................................[4]
(d) The logo is redesigned as a vector graphic.
State two benefits of a vector graphic compared to a bitmap image. Give a reason for each
benefit.
Benefit 1 ...................................................................................................................................
...................................................................................................................................................
Reason 1 ..................................................................................................................................
...................................................................................................................................................
Benefit 2 ...................................................................................................................................
...................................................................................................................................................
Reason 2 ..................................................................................................................................
............................................................................................................................................. [4]
Q 6) 9608 S18 P13
6 A black and white bitmap image is shown.

(a) State the minimum number of bits needed to represent each pixel in this image.
...............................................................................................................................................[1]
(b) Run-length encoding (RLE) is used to store the image with the following colour codes.

Colour Code
Black 1A
White 3B
Show how run-length encoding is used to store the image.
.....................................................................................................................................................
.....................................................................................................................................................
........................................................................................................................................... [3]
(c) An image has 30 different colours.
State the minimum number of bits needed to represent each pixel in the 30-colour image.
...............................................................................................................................................[1]
(d) When the image is saved, a header is added to the file.
State the purpose of the file header. Give two examples of the file header contents.
Purpose ....................................................................................................................................
...................................................................................................................................................
Example 1 .................................................................................................................................
...................................................................................................................................................
Example 2 .................................................................................................................................
...............................................................................................................................................[3]
(e) Graphics software is used to edit a digital photograph.
Give three features of graphics software that can be used to edit the photograph.
Describe the effect each has on the photograph.
Feature 1 ...................................................................................................................................
Effect .........................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
Feature 2 ...................................................................................................................................
Effect .........................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
Feature 3 ...................................................................................................................................
Effect .........................................................................................................................................
...................................................................................................................................................
................................................................................................................................................[6]
Q 7) 9608 W18 P11
1 A company is designing a website.
(a) The company creates a 4-colour bitmap image for the website as shown.
Each colour is represented by a letter, for example, G = grey, K = black.

G R G K W R

G R G K W R

G R G K W R

G R G K W R

G G G K K R

W W W W K R

(i) State the minimum number of bits needed to represent each pixel in the image in part (a).
...................................................................................................................................... [1]
(ii) Calculate the minimum file size of the image shown in part (a). Show your working.
Working .............................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
File size ............................................................................................................................. [3]
(b) The company takes a photograph of their office to put on the website. The photograph has
a resolution of 1000 pixels by 1000 pixels. Two bytes per pixel are used to represent the
colours.
(i) Estimate the file size of the photograph in megabytes. Show your working.
Working .............................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
Estimated file size ............................................................................................................. [4]
(ii) The file size of the photograph needs to be reduced before it is placed on the website.
Draw lines to link each method of reducing the file size of the image to:[5]
• its description and
• its compression type, where appropriate.
Compression
Description Method
type

Removes pixels Crop the


photograph
Lossy
Reduces number of
pixels per inch
Use run-length
encoding
Uses fewer bits per
pixel

Lossless
Stores colour code
Use fewer colours
and count of
repetitions

(c) The company has created a logo for the website. The logo is a vector graphic.
Describe two reasons why a vector graphic is a sensible choice for the logo.
Reason 1 ..................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
Reason 2 ..................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................[4]
Q 8) 9608 S19 P13
5 Xander creates a presentation that includes images, video and sound.
(a) The images are bitmap images. A bitmap image can be made up of any number of
colours.
Each colour is represented by a unique binary number.
Draw one line from each box on the left, to the correct box on the right to identify the
minimum number of bits needed to store each maximum number of colours.

Maximum number of colours Minimum number of bits


1

68 2

256 3

127 7

2 8

249 9
Q 9) 9608 W19 P12
6(d) Dominic’s tablet captures a video of Dominic to send to other people. The video is made
of a sequence of images and a sound file.
(i) Describe how the images and sound are encoded into a digital form.
Images ..............................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
Sound ................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
........................................................................................................................................... [4]
Q 10) 9608 S 20 P1
4 A digital camera takes a bitmap image. The image is 2000 pixels wide by 1000 pixels high
with a colour depth of 24-its.
(a) Calculate an estimate of the file size for the image. Give your answer in megabytes. Show
your working.
Working .....................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.................................................................................................................................................
Answer .......................................................... MB [3]
(b) 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.
.....................................................................................................................................................
.....................................................................................................................................................
...................................................................................................................................... [2]
Q 11) 9608 S20 P12
1 (b) Samira uses a computer to draw a logo for her hotel and saves it as a vector graphic.
The logo will be placed on the multimedia presentation and elsewhere, such as on signs at
the entrance of the hotel.
Samira emails the logo to a company that prints signs, and other documentation for the hotel.
(i) Describe how the logo is represented by the computer.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
........................................................... [3]
(ii) State two reasons why the hotel logo is saved as a vector graphic instead of a bitmapped
graphic.
1 ........................................................................................................................................
...........................................................................................................................................
2 ........................................................................................................................................
........................................................................................................................................... [2]
Q 12) 9608 S 20 P13
7 Xiaoming created the following logo using bitmapped graphics software.

(a) Describe how one typical feature of bitmapped graphics software was used to create the
logo.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.......................................................................................................................................[2]
(b) The finished 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.
Working .....................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
Answer ........................................................ KB [3]
(c) Xiaoming needs to use his logo on his business card, on his website and on large display
boards. He is told that he should have created a vector graphic logo instead of a bitmapped
graphic logo.
Describe one benefit of creating a vector graphic logo instead of a bitmapped graphic logo.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................ [2]
Q 13) 9608 W20 P13 - 7 Wilbur uses vector graphics to create a logo for his company.

(a) Describe how the logo is represented and encoded by the computer.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
............................................................................................................................ [4]
(b) 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.
(i) Calculate an estimate of the file size of the scanned image. Give your answer rounded to
the nearest MB. Show your working.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.............................................................................................................Answer
................................. MB [2]
(ii) 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.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
..................................................................................................................................... [3]
1.2 Sound
1.2 Multimedia Sound
Candidates should be able to: Notes and guidance
Show understanding of how sound is Use the terms: sampling, sampling rate,
represented and encoded sampling resolution, analogue and digital
data
Show understanding of the impact of Impact on file size and accuracy
changing the sampling rate and resolution

Sampling: Taking amplitude of sound wave at a regular interval of time is called Sampling,
for that sound wave is broken down into smaller pieces at a regular interval of time. These
smaller pieces are known as Sample and this process is known as Sampling.

Sampling resolution – number of bits used to represent sound amplitude (also known as bit
depth).
Sampling rate – number of sound samples taken per second.

Sound is a vibration that propagates as an acoustic wave, through a transmission


medium such as a gas, liquid or solid.
A sound waves are longitudinal as they consist of alternating compressions and rarefactions,
or regions of high pressure and low pressure, moving at a certain speed. The longitudinal
sound waves are converted into transverse waves.
How to capture a sound:
To record a sound microphone is used.
Microphone has a diaphragm. Diaphragm is attached with a moveable coil. Inside this
movable coil there is fixed magnet.
When sound waves strike diaphragm, causes vibration in it and the movable coil starts
moving to and fro around fixed magnet. This movement generates electrical signals. And in
this way sound is captured.

Conversion of Analogue Sound into Digital Format:


Sound waves are analogue values, these analogue values are converted into digital values to
manipulate and to store in computer.
ADC (Analogue to Digital Converter) is used to convert analogue sound waves into digital
values.
This conversion is done in following steps.
1. Firstly, a filter removes non-audible sound waves. Humans can hear sounds in
a frequency range from about 20 Hz to 20 kHz.
2. Then sound waves are sampled at a given time rate (Sound waves are broken down
thousands of smaller parts (samples) per second.)
3. The height/amplitude of each sound wave is determined.
4. Approximation is used when necessary.
5. At last sound wave values are stored in binary digits, depending upon number of bits
per sample.
Digital audio quality
Factors that affect the quality of digital audio include:
• Sample rate - The sample rate is how many samples, or measurements, of the sound are
taken each second. The more samples that are taken, the more detail about where the
waves rise and fall is recorded and the higher the quality of the audio. Also, the shape of
the sound wave is captured more accurately. Each sample represents the amplitude of the
digital signal at a specific point in time.
Sampling Rate Application
44.1 KHz Widely used in consumer audio and is the standard for audio CDs.
48 KHz Used in audio for movies.
96 KHz or 192 KHz Higher sampling rates are used to archival audio.
• Bit depth/Sampling Resolution Bit depth is the number of bits available for each sample.
The higher the bit depth, the higher the quality of the audio. The most common bit depths
are 16 bit, 24 bit and 32 bit.
Bit Depth Available Values Application
16 bit 65536 The most common bit depth in audio CD
24 bit Over 16 Million (16,777,216) It is commonly used in professional audio
record.
32 bit Over 4 Billion (4,294,967,296) It often used in digital audio workstations.
Benefits of Higher Bit Depth:
The higher the bit depth, the higher the quality of the audio.
Allows for larger dynamic ranges (dynamic range is approximately six times the bit
depth).
More accurate representation/crisper sound quality.
Increase in bit depth decreases the quantisation error.
Drawback of Higher Bit Depth:
Increasing bit depth also increases files size.
More disc and memory space is required.
Data will be transmitted slowly
Greater processing power will be required.
• Bit rate - The bit rate of a file tells us how many bits of data are processed every second.
Bit rates are usually measured in kilobits per second (kbps).
A common audio sample rate for music is 44,100 samples per second. The unit for the sample
rate is hertz (Hz). 44,100 samples per second is 44,100 hertz or 44.1 kilohertz (kHz).
Telephone networks and VOIP services can use a sample rate as low as 8 kHz. This uses
less data to represent the audio. At 8 kHz, the human voice can still be heard clearly - but
music at this sample rate would sound low quality.
Quantization, in mathematics and digital signal processing, is the process of mapping input
values from a large set (often a continuous set) to output values in a (countable) smaller set.
Rounding and truncation are typical examples of quantization processes. Quantization is
involved to some degree in nearly all digital signal processing, as the process of representing
a signal in digital form ordinarily involves rounding. Quantization also forms the core of
essentially all lossy compression algorithms.
The difference between an input value and its quantized value (such as round-off error) is
referred to as quantization error. A device or algorithmic function that performs quantization
is called a quantizer. An analog-to-digital converter is an example of a quantizer.
Features of Sound Editing Software
Recorded sound is often edited using software. Common features of such software include
the ability to
• edit the start/stop times and duration of a sample
• extract and save (or delete) part of a sample
• alter the frequency and amplitude of a sample
• fade in and fade out
• mix and/or merge multiple sound tracks or sources
• combine various sound sources together and alter their properties
• remove ‘noise’ to enhance one sound wave in a multiple of waves (for example, to
identify and extract one person’s voice out of a group of people)
• convert between different audio formats

2ac 9618 W21 P11 P13 – 7 Bobby is recording a sound file for his school project.
(a) He repeats the recording of the sound several times, with a different sample rate each
time.
(i) Describe the reasons why the sound is closer to the original when a higher sample rate is
used.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
..................................................................................................................................... [2]
(ii) Describe the reasons why the sound file size increases when a higher sample rate is
used.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
..................................................................................................................................... [2]
Example Question: 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.
...................................................................................................................................................................
.................................................................................................................................................
Example Question : Bytes, Kilobytes and Megabytes are units used for the amount of data stored in a
computer.
(a) State which of these units is most appropriate for the following items of data.
A one page text document: ...............................................................................................................
A ten minute movie clip: ....................................................................................................................
A person’s surname: .................................................................................................................... [3]
(b) A computer has a hard disk of 2 Terabytes.
How much is this in Gigabytes? You must show your working.
...................................................................................................................................................................................
...................................................................................................................................................................................
.................................................................................................................................................. [2]

4c 9618 w22 p13


1 A digital audio message needs to be recorded.
(a) Tick one box in each row to identify the effect of each action on the accuracy of the recording. [2]
Accuracy Accuracy Accuracy does
Action
increases decreases not change
Change the sampling rate from 40kHz to 60kHz.
Change the duration of the recording from 20
minutes to 40 minutes.
Change the sampling resolution from 24 bits to 16
bits.
(b) The audio message is recorded with a sampling rate of 50kHz and a sampling resolution of 16 bits.
The recording is 20 minutes in length. Calculate the file size of the recording.
Give your answer in megabytes and show your working.
Working .....................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
Answer ......................................... megabytes [2]
(c) A computer uses a buffer when playing the audio message.
Explain the purpose of a buffer in a computer system using one other example.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [3]
Q 2 9608 S15 P11-12
2 (a) Sound can be represented in a computer in a digital format.
(i) Give the definition of the term sampling.
.....................................................................................................................................................
.....................................................................................................................................................
......................................................................................................................................... [1]
(ii) Give one reason why 16-bit sampling is used in an audio compact disc (CD).
.....................................................................................................................................................
................................................................................................................................................[1]
(iii) Explain what is meant by the term sampling resolution.
.....................................................................................................................................................
.....................................................................................................................................................
............................................................................................................................................... [2]
(iv) Give one benefit and one drawback of using a higher sampling resolution.
Benefit .....................................................................................................................................
.....................................................................................................................................................
Drawback ...................................................................................................................................
..............................................................................................................................................[2]
(b) Describe two typical features found in software for editing sound files.
1 .................................................................................................................................................
....................................................................................................................................................
2 .................................................................................................................................................
..............................................................................................................................................[2]
(c) Explain the difference between lossless and lossy data compression techniques.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.............................................................[3]
Q 3) 9608 W15 P12
4 (a) Sound can be represented digitally in a computer.
Explain the terms sampling resolution and sampling rate.
Sampling resolution ..................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
Sampling rate ............................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[4]
(b) The following information refers to a music track being recorded on a CD:
• music is sampled 44 100 times per second
• each sample is 16 bits
• each track requires sampling for left and right speakers
(i) Calculate the number of bytes required to store one second of sampled music.
Show your working. ..................................................................................................................
...........................................................................................................................................
.......................................................................................................................................[2]
(ii) A particular track is four minutes long.
Describe how you would calculate the number of megabytes required to store this track.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
.......................................................................................................................................[2]
(c) When storing music tracks in a computer, the MP3 format is often used. This reduces file
size by about 90%.Explain how the music quality is apparently retained.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[3]
Q 4) 9608 S16 P11, 12
4 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.
(a) Describe how sampling is used to record the sound clips.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[3]
(b) The students use software to compress the sound clips before emailing them.
(i) Circle your chosen method of compression and justify your choice.
Lossy / Lossless
Justification: .......................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
.......................................................................................................................................[3]
Q 4) Summer 2017 P11_13
3 (a) 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 ...........................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
Explanation ...............................................................................................................................
................................................................................................................................................[2]
Q 5) Summer 17 P12
3 (a) 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.
Sampling resolution ..................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
Explanation ...............................................................................................................................
...............................................................................................................................................[3]

Q 6) Summer2018 P12
5 A student has recorded a sound track for a short film.
(a) Explain how an analogue sound wave is sampled to convert it into digital format.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[3]
(b) Explain the effects of increasing the sampling resolution on the sound file.
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[2]
(c) The original sound was sampled at 44.1kHz. The sample rate is changed to 22.05kHz.
Explain the effects of this change on the sound file.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[3]
(d) The student uses sound editing software to edit the sound file.
Name two features of sound editing software the student can use to edit the sound file.
Describe the purpose of each feature.
Feature 1 ...................................................................................................................................
Purpose .....................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
Feature 2 ...................................................................................................................................
Purpose .....................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
Q 7) Winter 2018 P11
1 A student is creating a short video and needs to record music to play in the background.
(a) The student uses a microphone to capture the music.
Explain how the microphone captures the music.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[3]
(b) An analogue-to-digital converter uses sampling to encode the sound.
Explain how different sampling resolutions affect the sound file and the sound it represents.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[3]
(c) The student needs to edit the sound file.
Describe two features of sound editing software that can be used to edit the sound file.
Feature 1 ..................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
Feature 2 ..................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
................................................................................................................................................[4]
Q 8) Summer 2019 P11
1 (d) A recording of a concert is stored as a file. The file is compressed using lossy
compression before it is streamed to users.
(i) State why this file needs to be compressed.
.....................................................................................................................................................
................................................................................................................................................ [1]
(ii) Define the term lossy compression.
.....................................................................................................................................................
............................................................................................................................................... [1]
(iii) The file could be compressed using lossless compression.
Explain why lossy compression is a more appropriate compression technique than lossless
for this file.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.............................................................................................................................................. [3]
6 A student records a video using a digital camera.
(d) A sound track is recorded for the video.
(i) Describe how a computer encodes the sound track.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
........................................................... [3]
(ii) Explain how the sampling rate and sampling resolution affect the file size of the
soundtrack.
Sampling rate .............................................................................................................................
....................................................................................................................................................
Sampling resolution ...................................................................................................................
.............................................................................................................................................. [2]
Q 9) Summer 2019 P13
5 Xander creates a presentation that includes images, video and sound.
(c) The sound track has a sampling rate of 88.2kHz and a sampling resolution of 32 bits.
State what is meant by a sampling rate of 88.2kHzand a sampling resolution of 32 bits.
Sampling rate of 88.2kHz
.....................................................................................................................................................
.....................................................................................................................................................
....................................................................................................................................................
Sampling resolution of 32 bits
................................................................................................................................……………...
.....................................................................................................................................................
................................................................................................................................................[2]
Q 10) Winter 2019 P12
6(d) Dominic’s tablet captures a video of Dominic to send to other people. The video is made of a
sequence of images and a sound file.
(i) Describe how the images and sound are encoded into a digital form.
Images ..............................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
Sound ................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
........................................................................................................................................... [4]
Q 11) Winter 2019 P13
2 (b) Leonardo uses the mobile phone to record his voice.
(i) Describe how sound sampling is used by the mobile phone to encode the sound.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
..................................................................................................................................... [2]
(ii) Leonardo records his voice twice. Each recording is the same length and has the same sampling
resolution.
The first recording has a sampling rate of 44100Hz. The second recording has a sampling rate of
21000Hz.
Describe how the different sampling rates will affect the recording and the sound file.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
..................................................................................................................................... [2]
(iii) Leonardo transfers the recordings to his laptop computer. He uses sound editing software to
delete some sections of the recordings, and copy and paste to replicate other sections.
Describe two other features of sound editing software Leonardo can use to edit the recordings.
1 ........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
2 ........................................................................................................................................
...........................................................................................................................................
........................................................................................................................................... [4]

Q 12) Summer 2020 P12


2 Amir has created a sound file using his desktop computer.
(a) Complete the table by writing the missing definitions and term about sound. [3]
Term Definition

....................................................................................................................
Sampling ....................................................................................................................
....................................................................................................................
....................................................................................................................

........................... The number of samples per unit time


...........................

....................................................................................................................
Sampling
....................................................................................................................
resolution
....................................................................................................................
....................................................................................................................
(b) The file is too large to be emailed and the file size needs to be reduced.
(i) Name one lossless compression technique that can be used to reduce the size of the
sound file.
.....................................................................................................................................................
............................................................................................................................................... [1]
(ii) Describe one lossy compression technique that can be used to reduce the size of the
sound file.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
................................................................................................................................................ [2]
Q 13) Winter 20 P11
5 Oscar is watching a concert on his laptop computer.
(a) The concert is streamed to his computer at the same time as it is taking place.
(i) Identify whether Oscar is using real-time or on-demand bit streaming. Justify your choice.
Streaming method .............................................................................................................
Justification .......................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
........................................................................................................................................... [3]
(ii) The video of the concert repeatedly stops and restarts while Oscar is watching it on his
laptop computer. His friend is watching the same video of the concert at the same time, in a
different location, but he does not experience the same problem as Oscar.
Give three possible reasons why Oscar’s video constantly stops and starts again.
1 ........................................................................................................................................
...........................................................................................................................................
2 ........................................................................................................................................
...........................................................................................................................................
3 ........................................................................................................................................
........................................................................................................................................... [3]
(b) (iii) Give another type of redundancy technique that can be used to compress a video.
.....................................................................................................................................................
............................................................................................................................................ [1]
(iv) MP4, WMV and AVI are all examples of a type of format that combines sound and image
components into a video.
Identify the type of format that combines the sound and image components into a video.
.....................................................................................................................................................
.............................................................................................................................................. [1]
7 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.

.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
................................... [4]
Marking Scheme
Q 1) Summer 15 P11-12
Q 2) Winter 15 P12
Q 3) Summer 16 P11, 12

Q 4) Summer 2017 P11_13

Q 5) Summer 17 P12
Q 6) Summer2018 P12
Q 7) Winter 2018 P11
Q 8) Summer 2019 P11
Q 9) Summer 2019 P13

Q 10) Winter 2019 P12


Q 11) Winter 2019 P13
Q 12) Summer 2020 P12
Q 13) Winter 20 P11
1.3 Compression
Candidates should be able to: Notes and guidance
Show understanding of the need for and
examples of the use of compression
Show understanding of lossy and lossless
compression and justify the use of a method in a
given situation
Show understanding of how a text file, bitmap Including the use of run-length encoding (RLE)
image, vector graphic and sound file can be
compressed

Lossless file compression – file compression method where the original file can be restored following
decompression. Lossless compression can compress up-to 50%
Lossy file compression – file compression method where parts of the original file cannot be recovered
during decompression, so some of the original detail is lost. (in MP3, 90% reduction in file size).
JPEG – Joint Photographic Expert Group – a form of lossy file compression based on the inability of
the eye to spot certain colour changes and hues.
MP3/MP4 files – file compression method used for music and multimedia files.
Audio compression – method used to reduce the size of a sound file using perceptual music shaping.
Perceptual music shaping – method where sounds outside the normal range of hearing of humans,
for example, are eliminated from the music file during compression.
Bit rate – number of bits per second that can be transmitted over a network. It is a measure of the
data transfer rate over a digital telecoms network.
Run length encoding (RLE) – a lossless file compression technique used to reduce text and photo files
in particular.
RLE: a lossless file compression method used for text, images and sound. It identifies
repeated characters in text/ repeated pixels in images/ repeated samples in sound, replaces
them with a one copy of character/pixel/sample and the number of times it occurs.
Compression Compression is a useful tool for reducing file sizes. When images, sounds or videos
are compressed, data is removed to reduce the file size.
Advantage of File Compression
➢ Compressed file occupies lesser storage space.
➢ Compressed file occupies lesser space in memory.
➢ File can be uploaded and download quickly.
➢ Lesser internet data is used in transmission of compressed file.
➢ To make it small enough to attach to an email.
This is very helpful when streaming and downloading files.
Streamed music and downloadable files, such as MP3s, are usually between 128 kbps and
320 kbps - much lower than the 1,411 kbps of an uncompressed file.
Videos are also compressed when they are streamed over a network. Streaming HD video
requires a high-speed internet connection. Without it, the user would experience buffering and
regular drops in quality. HD video is usually around 3 mbps. SD is around 1,500 kbps.
Lossy and lossless compression
Compression can be lossy or lossless.
Lossless compression means that as the file size is compressed but data is restored back to its
original state on uncompressing. Run Length Encoding is a method of lossless file
compression. Lossless compression is mostly used for documents and software, sometime
images and audio are also compressed using lossless compression.
Lossless compression can compress up-to 50%
Lossy compression permanently removes data. For example, an image file compressed to jpeg
using factor of 5 to 15 while an audio WAV file compressed to an MP3 (90% reduction in file
size). Lossy file compression is mostly used for images, audio and video files.
Benefits and drawbacks of file compression.
Lossy File Compression: Unnecessary data is removed permanently; file is compressed to smallest
possible file size.
Lossless File Compression: Nothing of the data is lost. Compressed file is not as small as in lossy
file compression.
Text file compression
Text and numbers are usually stored in an ASCII format.
Text files are also compressed. Lossless compression method is used for text and numbers.
Algorithm 1- Dictionary Coding:
These use complex algorithms that work on redundancy or repeated sections of words (e.g. OU in
yOUr, ctOUntry or mOUntain). Here in the original text there are 42 characters including spaces, after
compression the size become 31 characters long.

THIS SECTION Repeated words, such as ‘THIS’ 1 SECTION


SHOWS YOU could be put into a data dictionary S2S Y3 2 1
and be replaced by ‘1’. Repeated
HOW THIS W3LD WORK
word sections, such as ‘HOW’ and
WOULD WORK ‘OU’ could be replaced by the
numbers ‘2’ and ‘3’. Our phrase
then becomes

THIS 1
HOW 2
OU 3
Text compression typically works by finding similar strings within a text file, and replacing those
strings with a temporary binary representation to make the overall file size smaller. Computers can
compress text by finding repeated sequences and replacing them with shorter representations, a
character that isn't part of the original text.
For example, a quote having 84 characters
“Think left and think right and think low and think high. Oh, the thinks you can think up if only
you try!"
The computer also needs to store the table of replacements that it made, so that it can reconstruct the
original.

replacement original

$ think

& and

# you

The repeated words replaced with the character and the compressed file has 50 characters.
The compressed file is “$ left & $ right & $ low & $ high. Oh, the $s # can $ up if only # try!"
Algorithm 2: Run length encoding (RLE) on text data
One of the simplest examples of compression is RLE.
RLE is a basic form of data compression that converts consecutive identical values into a
code consisting of the character and the number marking the length of the run.
The more similar values there are, the more values can be compressed.
The sequence of data is stored as count and a single value.
For example, to compress a text string “aaaabbbbcccccccddddd” as “4a4b7c5d”

Character + Run Character + Run Character + Run Character + Run

a4 b4 C7 d5
3c 9618 S22 P13
1 Text and numbers are examples of data stored in a computer.
(a) (iii) Describe how lossless compression can be used to reduce the file size of a text file.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
................................................................................................................................................ [2]
(iv) Explain why lossy compression should not be used on a text file.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
................................................................................................................................................ [2]

1ab 9608 15 P11-12


2 (c) Explain the difference between lossless and lossy data compression techniques.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
................................................................................................................................................[3]
2(c) Any three from:
For full marks both techniques must be mentioned.
• lossless designed to lose none of the original detail/lossless allows original file to be recreated
exactly
• lossless technique based on some form of replacement
• mention of type of replacement, for example RLE, FLAC etc.
• by example: e.g. 000–1111–222222–333 = 3–0, 4–1, 6–2, 3–3 etc.
• maximum compression about 50%
• lossy may result in loss of detail compared to original file/lossy does not allow original file to be
re-created exactly
• lossy techniques make decision about what parts of sound/sound file are important and
discards other information
• only keeps sounds human ear can process/discards sounds most people cannot hear
• ... then applies lossless technique, for further reduction
• lossy compression can reduce to about 10%
• an example of jpeg, mp3 or other correct examples of compressed formats.
No double credit to opposite answers, e.g. lossless maintains detail, but lossy loses detail
just one mark. [3]

12b 9608 Winter 20 P12


2 One method of compressing a file is run-length encoding (RLE).
(a) Describe, using an example, how a text file is compressed using RLE.
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
.............................................................................................................................................................. [3]
(b) Explain why run-length encoding will sometimes increase the size of a text file.
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
............................................................................................................................................................... [2]
1 mark per bullet point to max 2 for description
• Instead of storing each repeated sequence of characters individually
2(a) … the character is stored and the number of consecutive occurrences
1 mark for using relevant example
• e.g. instead of storing aaaa , store a4
1 mark per bullet point to max 2
• Repeated sequences of characters rarely occur in text files // Most characters are
2(b) 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
Image File Compression
Images are all around us, from application icons to animated GIFs to photos. Image files can take up a
lot of space, so computers employ a range of algorithms to compress image files.
Lossy File Compression for Images
For lossy file compression of image file following steps are taken:
➢ A lossy file compression algorithm is used
➢ Bit Depth (bits per pixel) is reduced resulting in reduction in colour depth (number of
available colour) as well as file size (lesser number of bits lesser file size)
For example, Original image =1000 pixels
Bit depth File Size Colour Depth
16 bit 1000* 16/8=2000 byte 65536 Colours
8 bit 1000*8/8=1000 bytes 256
4 bit 1000*4/8=500 bytes 16 colours
➢ Pixel density (pixel per inch) is decreased resulting decrease in image resolution it to
reduce file size (lesser pixel lesser bits means lesser file size).
Bit Depth= 4
Image Resolution File Size Image quality

1000 pixels 1000*4/8= 500 byte

800 pixels 800*4/8=400 bytes

400 pixels 400*4/8=200 bytes

Reducing bit depth and pixel density reduces the file size but the removed data cannot be
put back so original image cannot be recreated.
Effect of reducing pixel density Effect on reducing bit depth

Lossless File Compression of Images


One of the simplest examples of lossless compression is RLE. To perform lossless
compression of image following steps are taken:
➢ A lossless file compression algorithm RLE is used
➢ Consecutive pattern on images are identified.
➢ Consecutive identical values converted into a code consisting of the image pattern
and the number marking the length of the run.
➢ The more similar values there are, the more values can be compressed.
➢ The sequence of data is stored as a single value and count.
For example, a Here's a simple image, a 16x11 black cup saucer icon with white background.

In run-length encoding, the computer replaces each row with numbers that say how many consecutive

pixels are the same color, For example, to compress 1st two rows of the image has 20 consecutive

white pixels, then 10 black pixels, and then 2 white pixels:

11111111111111111111 0000 0000 0011 or WWWW WWWW WWWW WWWW WWWW BBBB

BBBB BBWW

This would be represented after Run Length Encoding as follows (1st colour code then number of

pixels) : 1 20 0 10 1 2 or W 20 B 10 W 2

Colour Code + Repetition Colour Code + Repetition Colour Code + Repetition

1 20 0 10 12

or W 20 or B 10 or W 2

Here is another image


WWWWWWWWWWWWWWW YYY WWWWWWW YY R YY WWWWW YY RRR YY WWWWW
YY R YY WWWWWWW YYY WWWWWWWWW G WWWWWW GGG W G W GGG WWWWW
GGG WWWWWWWWW G WWWWWWWWWWWWWWWW
(121 Characters are there before compression)
This image is compressed in using RLE. Complete the representation of the image after RLW
W 15 Y3 W7

You will observe that 121 characters are compressed in 60 character


(60 characters in the compressed file)

Program code for Run Length Encoding


https://www.techiedelight.com/run-length-encoding-rle-data-compression-algorithm/
# Perform Run Length Encoding (RLE) data compression algorithm on str
def encode(s):

encoding = "" # stores output String


i=0
while i < len(s):
# count occurrences of character at index i
count = 1
while i + 1 < len(s) and s[i] == s[i + 1]:
count = count + 1
i=i+1
# append current character and its count to the result
encoding += str(count) + s[i]
i=i+1
return encoding
if __name__ == '__main__':
s="
WWWWWWWWWWWWWWWYYYWWWWWWWYYRYYWWWWWYYRRRYYWWWWWYYRYYWWW
WWWWYYYWWWWWWWWWGWWWWWWGGGWGWGGGWWWWWGGGWWWWWWWWWGW
WWWWWWWWWWWWWWW"
print(encode(s))
1ac 9618 S21 P12_13 - 1 Anya scans an image into her computer for a school project.
(b) The image is compressed using lossless compression.
Identify one method of lossless compression that can be used to compress the image and
describe how the method will reduce the file size.
Lossless compression method .................................................................................................
Description ................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................... [3]
1 mark for naming method, 1 mark per description to max 2
 Run-length encoding
1(b)
 Replace sequences of the same colour pixel
 … with colour code and number of identical pixels

2b 9618 W21 P12 - 5 Riya has created the following logo as a vector graphic.
b (ii) Riya needs to email the photograph. She compresses the photograph before sending it
using an email. Describe two lossy methods that Riya can use to compress the image.
Method 1 .....................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
Method 2 .....................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
............................................................................................................................................ [4]
1 mark for each bullet point to max 2 for each method
 Reduce bit depth
 ... reduces the number of bits per colour / pixel which means each pixel has fewer bits
5(b)(ii)  Reduce colour palette // reduce number of colours
 ... fewer colours mean fewer bits needed to store each colour
 Reduce image resolution
 ... fewer pixels per unit measurement means less binary to store
7c 9608 Summer 2018 P13
6 A black and white bitmap image is shown.

(a) State the minimum number of bits needed to represent each pixel in this image.
...............................................................................................................................................[1]
(b) Run-length encoding (RLE) is used to store the image with the following colour codes.
Colour Code
Black 1A
White 3B
Show how run-length encoding is used to store the image.
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[3]
(c) An image has 30 different colours.
State the minimum number of bits needed to represent each pixel in the 30-colour image.
...............................................................................................................................................[1]
(d) When the image is saved, a header is added to the file.
State the purpose of the file header. Give two examples of the file header contents.
Purpose ....................................................................................................................................
...................................................................................................................................................
Example 1 .................................................................................................................................
...................................................................................................................................................
Example 2 .................................................................................................................................
............................................................................................................................................... [3]
(e) Graphics software is used to edit a digital photograph.
Give three features of graphics software that can be used to edit the photograph.
Describe the effect each has on the photograph.
Feature 1 ...................................................................................................................................
Effect .........................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
Feature 2 ...................................................................................................................................
Effect .........................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
Feature 3 ...................................................................................................................................
Effect .........................................................................................................................................
...................................................................................................................................................
................................................................................................................................................ [6]
6(a) 1 1
1 mark for correct method (colour code and number of pixels)
1 mark for first 7 groups correct
6(b) 3
1 mark for remainder correct
3B 9 1A3 3B3 1A2 3B1 1A2 3B21A1 3B3 1A1 3B2 1A2 3B1 1A2 3B3 1A3 3B9
6(c) 5 1
1 mark for purpose
• Stores data about the file contents/image/metadata
Max 2 marks for examples of contents
•Confirmation that the file is a BMP // confirmation of file type
6(d) •File size 3
•Location / offset of image data within the file
•Dimensions of the image (in pixels) // image resolution
•Colour depth (bits per pixel, 1, 4, 8, 16, 24 or 32)
•Type of compression used (if any)
1 mark for naming tool,
1 mark for describing effect on the photograph e.g.
•Resize
•Increase / decrease the size of the image
•Crop
6(e)
•Remove part of the image
•Blur
•Reduce the focus
•Red eye reduction
•Reduces red (light reflected from human eyes)
Audio File Compression
Lossy File Compression of Audio using MP3:
This has become the standard for distributing digital music files on the internet. To perform
lossy file compression on audio file following steps are taken:
Lossy file compression algorithm is used Perceptual Music Shaping algorithm is the lossy file
compression for audio file.
It removes the background noise.
It removes sounds that are generally beyond the limits of most people’s hearing and does not
noticeably affect the quality of sound.
When using MP3 format, the size of the music track will be reduced by a factor of 10 (i.e. the size is
reduced by 90% and remaining file size is only 10% of original size).
The quality of MP3 files depends on the BIT RATE – this is the number of bits per second used when
creating the file. Bit rates are roughly between 80 and 320 kilobits per second; usually 200 or higher
gives a sound quality close to a normal CD.
For example, a 50-megabyte music CD can be reduced to 5 megabytes.
50 MB x 90/100= 45 MB reduced. 50 MB x 10/100=5 MB new file size.
Lossless File Compression of Audio File
For lossless file compression of audio file following steps are taken:
➢ A lossless file compression algorithm RLE is used
➢ Consecutive sound patterns are identified.
➢ Consecutive identical values converted into a code consisting of the sound pattern
and the number marking the length of the run.
➢ The more similar values there are, the more values can be compressed.
➢ The sequence of data is stored as a single value and count.
Video File Compression: a video is actually combination of sound and images
➢ 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.
2ac W21 P11 P13 –
7 Bobby is recording a sound file for his school project.
(b) Bobby wants to email the sound file to his school email address. He compresses the file
before sending the email.
(i) Explain the reasons why Bobby compresses the sound file.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
................................................................................................................................................ [2]
(ii) Bobby uses lossless compression.
Describe how lossless compression can compress the sound file.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
................................................................................................................................................ [2]
1 mark per bullet point
 Reduces the file size
7(b)(i) 2
 Faster to transmit/download
 Original file is too large for email storage/attachment
1 mark per bullet point to max 2e.g.
 Reduce amplitude to only the range used
 … limited amplitudes mean fewer bits per sample
7(b)(ii)  Run-length-encoding
 … Where consecutive sounds are the same record the binary value of
the sound and number of times it repeats
 Record the changes instead of the actual sounds
1ac 9618 S21 P12_13 - 1 Anya scans an image into her computer for a school project.
(b) The image is compressed using lossless compression.
Identify one method of lossless compression that can be used to compress the image and
describe how the method will reduce the file size.
Lossless compression method ...................................................................................................
Description ..................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
............................................................................................................................................. [3]

2b 9618 W21 P12 - 5 Riya has created the following logo as a vector graphic.
b (ii) Riya needs to email the photograph. She compresses the photograph before sending it
using an email. Describe two lossy methods that Riya can use to compress the image.
Method 1 .....................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
...................................................................................................................................................
Method 2 .....................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
............................................................................................................................................... [4]
2ac W21 P11 P13 –
7 Bobby is recording a sound file for his school project.
(b) Bobby wants to email the sound file to his school email address. He compresses the file
before sending the email.
(i) Explain the reasons why Bobby compresses the sound file.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
............................................................................................................................................... [2]
(ii) Bobby uses lossless compression.
Describe how lossless compression can compress the sound file.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
............................................................................................................................................... [2]

3c 9618 S22 P13


1 Text and numbers are examples of data stored in a computer.
(a) (iii) Describe how lossless compression can be used to reduce the file size of a text file.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
................................................................................................................................................ [2]
(iv) Explain why lossy compression should not be used on a text file.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
................................................................................................................................................ [2]

1ab 9608 15 P11-12


2 (c) Explain the difference between lossless and lossy data compression techniques.
……………………………………………………………..................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
................................................................................................................................................[3]
2(c) Any three from:
For full marks both techniques must be mentioned.
• lossless designed to lose none of the original detail/lossless allows original file to be recreated
exactly
• lossless technique based on some form of replacement
• mention of type of replacement, for example RLE, FLAC etc.
• by example: e.g. 000–1111–222222–333 = 3–0, 4–1, 6–2, 3–3 etc.
• maximum compression about 50%
• lossy may result in loss of detail compared to original file/lossy does not allow original file to be
re-created exactly
• lossy techniques make decision about what parts of sound/sound file are important and
discards other information
• only keeps sounds human ear can process/discards sounds most people cannot hear
• ... then applies lossless technique, for further reduction
• lossy compression can reduce to about 10%
• an example of jpeg, mp3 or other correct examples of compressed formats.
No double credit to opposite answers, e.g. lossless maintains detail, but lossy loses detail
just one mark. [3]
12b 9608 Winter 20 P12
2 One method of compressing a file is run-length encoding (RLE).
(a) Describe, using an example, how a text file is compressed using RLE.
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
............................................................................................................................................................... [3]
(b) Explain why run-length encoding will sometimes increase the size of a text file.
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
.............................................................................................................................................................. [2]

1 mark per bullet point to max 2 for description


• Instead of storing each repeated sequence of characters individually
2(a) … the character is stored and the number of consecutive occurrences
1 mark for using relevant example
• e.g. instead of storing aaaa , store a4
1 mark per bullet point to max 2
• Repeated sequences of characters rarely occur in text files // Most characters are
2(b) 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
Winter 15 P12
4 (c) When storing music tracks in a computer, the MP3 format is often used. This reduces
file size by about 90%.Explain how the music quality is apparently retained.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[3]
Summer 16 P11, 12
4 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.
(b) The students use software to compress the sound clips before emailing them.
(i) Circle your chosen method of compression and justify your choice.
Lossy / Lossless
Justification: .......................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
.......................................................................................................................................[3]
Students also email images to the radio station for use on its website.
These are compressed before sending using run-length encoding (RLE).
(ii) Explain what is meant by run-length encoding.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
.......................................................................................................................................[3]
(iii) The following diagrams show:
• the denary colour code that represents each colour
• the first three rows of a bitmap image
Colour
Colour symbol
code(denary)
B 153
W 255

Show how RLE will compress the first three rows of this image.
Row 1: ...............................................................................................................................
Row 2: ...............................................................................................................................
Row 3: ...........................................................................................................................[2]
Summer2018 P11
2 A logo is designed as a bitmap image.
(a) Describe what is meant by a bitmap image.
.....................................................................................................................................................
.................................................................................................................................................[2]
(b) A black and white bitmap image is shown.

(i) Explain how a computer can store this bitmap image.


.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
..............................................................................................................................................[2]
(ii) The image is compressed before it is attached to an email.
Explain how run-length encoding (RLE) will compress the image.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
............................................................................................................................................... [4]
7c 9608 Summer 2018 P13
6 A black and white bitmap image is shown.

(a) State the minimum number of bits needed to represent each pixel in this image.
...............................................................................................................................................[1]
(b) Run-length encoding (RLE) is used to store the image with the following colour codes.
Colour Code
Black 1A
White 3B
Show how run-length encoding is used to store the image.
.....................................................................................................................................................
.....................................................................................................................................................
.................................................................................................................................................[3]
(c) An image has 30 different colours. State the minimum number of bits needed to represent
each pixel in the 30-colour image. .....................................................................................[1]
(d) When the image is saved, a header is added to the file.
State the purpose of the file header. Give two examples of the file header contents.
Purpose ....................................................................................................................................
...................................................................................................................................................
Example 1 .................................................................................................................................
...................................................................................................................................................
Example 2 .................................................................................................................................
............................................................................................................................................... [3]
(e) Graphics software is used to edit a digital photograph.
Give three features of graphics software that can be used to edit the photograph.
Describe the effect each has on the photograph.
Feature 1 ...................................................................................................................................
Effect .........................................................................................................................................
.....................................................................................................................................................
.................................................................................................................................................
Feature 2 ...................................................................................................................................
Effect .........................................................................................................................................
.....................................................................................................................................................
.................................................................................................................................................
Feature 3 ...................................................................................................................................
Effect ........................................................................................................................................
.....................................................................................................................................................
............................................................................................................................................. [6]
6(a) 1 1
1 mark for correct method (colour code and number of pixels)
1 mark for first 7 groups correct
6(b) 3
1 mark for remainder correct
3B 9 1A3 3B3 1A2 3B1 1A2 3B21A1 3B3 1A1 3B2 1A2 3B1 1A2 3B3 1A3 3B9
6(c) 5 1
1 mark for purpose
• Stores data about the file contents/image/metadata
Max 2 marks for examples of contents
•Confirmation that the file is a BMP // confirmation of file type
6(d) •File size 3
•Location / offset of image data within the file
•Dimensions of the image (in pixels) // image resolution
•Colour depth (bits per pixel, 1, 4, 8, 16, 24 or 32)
•Type of compression used (if any)
1 mark for naming tool,
1 mark for describing effect on the photograph e.g.
•Resize
•Increase / decrease the size of the image
•Crop
6(e)
•Remove part of the image
•Blur
•Reduce the focus
•Red eye reduction
•Reduces red (light reflected from human eyes)
Q 6) Winter 2018 P11
1 A company is designing a website.
(a) The company creates a 4-colour bitmap image for the website as shown.
Each colour is represented by a letter, for example, G = grey, K = black.

G R G K W R
G R G K W R
G R G K W R
G R G K W R
G G G K K R
W W W W K R

(i) State the minimum number of bits needed to represent each pixel in the image in part (a).
...................................................................................................................................... [1]
(ii) Calculate the minimum file size of the image shown in part (a). Show your working.
Working ......................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
File size ............................................................................................................................. [3]
(b) The company takes a photograph of their office to put on the website. The photograph has
a resolution of 1000 pixels by 1000 pixels. Two bytes per pixel are used to represent the
colours.
(i) Estimate the file size of the photograph in megabytes. Show your working.
Working .............................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
...................................................................................................................................................
Estimated file size ............................................................................................................. [4]
(ii) The file size of the photograph needs to be reduced before it is placed on the website.
Draw lines to link each method of reducing the file size of the image to: [5]
• Its description and
• Its compression type, where appropriate.
Description Method Compression type

Removes pixels Crop the


photograph
Lossy
Reduces number of
pixels per inch
Use run-length
encoding
Uses fewer bits per
pixel
Lossless
Stores colour code and Use fewer colours
count of repetitions

(c) The company has created a logo for the website. The logo is a vector graphic.
Describe two reasons why a vector graphic is a sensible choice for the logo.
Reason 1 ..................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
Reason 2 ..................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [4]
Summer 2019 P11
1 (d) A recording of a concert is stored as a file. The file is compressed using lossy
compression before it is streamed to users.
(i) State why this file needs to be compressed.
.....................................................................................................................................................
.............................................................................................................................................. [1]
(ii) Define the term lossy compression.
.....................................................................................................................................................
.............................................................................................................................................. [1]
(iii) The file could be compressed using lossless compression.
Explain why lossy compression is a more appropriate compression technique than lossless
for this file.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
................................................................................................................................................ [3]
9608 2019 P11
5 (e) 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.
(i) A program written in a high-level language.
Lossy Lossless

Justification ................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
................................................................................................................................................ [2]
(ii) A photograph that needs to be emailed to a friend.
Lossy Lossless

Justification ................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
................................................................................................................................................ [2]
(iii) You need to upload a video that you have created to a website.
Lossy Lossless

Justification ................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
................................................................................................................................................ [2]
Q 9) 9608 20 P1
9 Utility programs are examples of system software.
(b) File compression is one example of a utility program. [1]
Tick (✓) one box on each row to indicate whether the action is an example of lossy
compression or lossless compression.
Action Lossy Lossless
Reducing the resolution of an image
Using run-length encoding on a text file
Reducing the sampling rate of a sound file
9608 2020 P12
2 (b) The file is too large to be emailed and the file size needs to be reduced.
(i) Name one lossless compression technique that can be used to reduce the size of the
sound file.
.....................................................................................................................................................
........................................................................................................................................... [1]
(ii) Describe one lossy compression technique that can be used to reduce the size of the
sound file.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.............................................................................................................................................. [2]
9608 Winter 20 P12
7 (b) 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.
(i) Calculate an estimate of the file size of the scanned image. Give your answer rounded to
the nearest MB. Show your working.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
....................................................................
Answer ................................. MB [2]
(ii) 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.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
............................................................................ [3]
1.3 Data Storage
Candidates should be able to: Notes and guidance
1 Understand how data storage is measured • Including:
– bit
– nibble
– byte
– kibibyte (KiB)
– mebibyte (MiB)
– gibibyte (GiB)
– tebibyte (TiB)
– pebibyte (PiB)
– exbibyte (EiB)
• The amount of the previous denomination
present in the data storage size, e.g.:
– 8 bits in a byte
– 1024 mebibytes in a gibibyte
2 Calculate the file size of an image file and a • Answers must be given in the units specified in
sound file, using information given the question
• Information given may include:
– image resolution and colour depth
– sound sample rate, resolution and length of
track
It should be pointed out here that there is some confusion in the naming of memory sizes.
There are two different methods:
1. Denary Prefix System used in SI Units. It is base 10 system. In this system 103 = 1000 i.e. Kilo
2. Binary Prefix System used in IEC Units (International Elcrtro-Technical Commission).
It is a base 2 system. In this system 210=1024 i.e. kibi
SI Units IEC units
1 Kilo Byte = 103= 1,000 byte 1 kibibyte (1 KiBi) = 210= 1024 bytes
1 Mega Byte = 106=1,000,000 bytes 1 mebibyte (1 MiBi) = 220= 1024 *1024 bytes
1 Giga Byte = 109=1,000,000,000 bytes 1 gibibyte (1 GiBi) =230= 1024 MiBi bytes
1 Tera Byte = 1012 = 1,000 GB 1 tebibyte (1 TiBi) =240= 1024 GiBi bytes
1 Peta Byte = 10151,000 TB 1 pebibyte (1 PiBi) =250= 1024 TiBi bytes
1 Exa Byte = 10121,000 PB 1 exbibyte (1 XiBi) =260= 1024 PiBi byte
and so on. and so on.
Image File Size Calculation
To calculate image file size, firstly number of
pixels found out then these are multiplied to
find total number of pixels in an image that
gives, image resolution.
For example 2048 pixels wide and 2048 pixels
high image will have 2048 × 2048 pixels. This
is often referred to as a 4-megapixel image.
Uncompressed raw Then Image resolution is multiplied by bit depth.
image
Black & White image Grey Scale 8-Colour True Colour
Bit Depth=1 Bit Depth=2 Bit Depth= 3 Bit Depth=24
Image Size Image Size Image Size Image Size
= 2048* 2048 * 1 bit = 2048* 2048 * 2 bit = 2048*2048*3 bit = 2048*2048*24 bit
= 2048*2048*1/8 Byte = 2048*2048*2/8 Byte = 2048*2048*3/8 Byte = 2048*2048*24/8
= 2048*2048*1/(8*1024) = 2048*2048*2 = 2048*2048*3 Byte
= 512 KiB /(8*1024*1024) /(8*1024*1024) = 2048*2048*24
= 1 MiB = 1.5 MiB /(8*1024*1024)
= 12 MiB
Image Size = 512 KiB Image Size = 1 MiB Image Size = 1.5 MiB Image Size = 12MiB
Unit 2 Communication
Topic You should be able to R A G
• Understand networking including LANs (local area networks), WANs (wide
area networks), devices, models (client-server and peer-to-peer), wireless and
wired communication, routers, ethernet
Communication • Understand the difference between the World Wide Web (WWW) and the
Internet
• Understand the use of IP addressing, Uniform Resoruce Locator (URL) and
Domain Name Service (DNS)

ARPAnet – Advanced Research Projects Agency Network.


WAN – wide area network (network covering a very large geographical area).
LAN – local area network (network covering a small area such as a single building).
MAN – metropolitan area network (network which is larger than a LAN but smaller than a WAN,
which can cover several buildings in a single city, such as a university campus).
File server – a server on a network where central files and other data are stored. They can be
accessed by a user logged onto the network.
Hub – hardware used to connect together a number of devices to form a LAN that directs
incoming data packets to all devices on the network (LAN).
Switch – hardware used to connect together a number of devices to form a LAN that directs
incoming data packets to a specific destination address only.
Router – device which enables data packets to be routed between different networks (for example,
can join LANs to form a WAN).
Modem – modulator demodulator. A device that converts digital data to analogue data (to be sent
down a telephone wire); conversely it also converts analogue data to digital data (which a computer
can process).
WLAN – wireless LAN.
(W)AP – (wireless) access point which allows a device to access a LAN without a wired connection.
PAN – network that is centred around a person or their workspace.
Client-server – network that uses separate dedicated servers and specific client workstations.
All client computers are connected to the dedicated servers.
Spread spectrum technology – wideband radio frequency with a range of 30 to 50 metres.
Node – device connected to a network (it can be a computer, storage device or peripheral device).
Peer-to-peer – network in which each node can share its files with all the other nodes. Each node has
its own data and there is no central server.
Thin client – device that needs access to the internet for it to work and depends on a more powerful
computer for processing.
Thick client – device which can work both off line and on line and is able to do some processing even
if not connected to a network/internet.
Packet – message/data sent over a network from node to node (packets include the address of the
node sending the packet, the address of the packet recipient and the actual data.
Topology: the configuration of a network that defines how the various devices on the network are
connected
Bus network topology – network using single central cable in which all devices are connected to this
cable so data can only travel in one direction and only one device is allowed to transmit at a time.
Star network topology – a network that uses a central hub/switch with all devices connected to this
central hub/switch so all data packets are directed through this central hub/switch.
Mesh network topology – interlinked computers/devices, which use routing logic so data packets are
sent from sending stations to receiving stations only by the shortest route.
Hybrid network – network made up of a combination of other network topologies.
Cloud storage – method of data storage where data is stored on off-site servers.
Private cloud: owned by and only accessed by an organisation
Public cloud: owned by a cloud service provider for general access
Data redundancy – situation in which the same data is stored on several servers in case of
maintenance or repair.
Wi-Fi – wireless connectivity that uses radio waves, microwaves. Implements IEEE 802.11 protocols.
Bluetooth – wireless connectivity that uses radio waves in the 2.45 GHz frequency band.
Spread spectrum frequency hopping – a method of transmitting radio signals in which a device picks
one of 79 channels at random. If the chosen channel is already in use, it randomly chooses another
channel. It has a range up to 100 metres.
WPAN – wireless personal area network. A local wireless network which connects together devices in
very close proximity (such as in a user’s house); typical devices would be a laptop, smartphone, tablet
and printer.
Twisted pair cable – type of cable in which two wires of a single circuit are twisted together. Several
twisted pairs make up a single cable.
Coaxial cable – cable made up of central copper core, insulation, copper mesh and outer insulation.
Fibre optic cable – cable made up of glass fibre wires which use pulses of light (rather than electricity)
to transmit data.
Gateway – device that connects LANs which use different protocols.
Repeater – device used to boost a signal on both wired and wireless networks.
Repeating hubs – network devices which are a hybrid of hub and repeater unit.
Bridge – device that connects LANs which use the same protocols.
Softmodem – abbreviation for software modem; a software-based modem that uses minimal
hardware.
NIC – network interface card. These cards allow devices to connect to a network/internet (usually
associated with a MAC address set at the factory).
WNIC – wireless network interface cards/controllers.
Ethernet – protocol IEEE 802.3 used by many wired LANs.
Conflict – situation in which two devices have the same IP address.
Broadcast – communication where pieces of data are sent from sender to receiver.
Collision – situation in which two messages/data from different sources are trying to transmit along
the same data channel.
CSMA/CD – carrier sense multiple access with collision detection – a method used to detect collisions
and resolve the issue.
Bit streaming – contiguous sequence of digital bits sent over a network/internet.
Buffering – store which holds data temporarily.
Bit rate – number of bits per second that can be transmitted over a network. It is a measure of
the data transfer rate over a digital telecoms network.
On demand (bit streaming) – system that allows users to stream video or music files from a central
server as and when required without having to save the files on their own computer/tablet/phone.
Real-time (bit streaming) – system in which an event is captured by camera (and
microphone) connected to a computer and sent to a server where the data is encoded. The user can
access the data ‘as it happ
Internet – massive network of networks, made up of computers and other electronic devices; uses
TCP/IP communication protocols.
World Wide Web (WWW) – collection of multimedia web pages stored on a website, which uses the
internet to access information from servers and other computers.
HyperText Mark-up Language (HTML) – used to design web pages and to write http(s) protocols, for
example.
Uniform resource locator (URL) – specifies location of a web page (for example,
www.inqilabpatel.com).
Web browser – software that connects to DNS to locate IP addresses; interprets web pages sent to a
user’s computer so that documents and multimedia can be read or watched/listened to.
Internet service provider (ISP) –
company which allows a user to connect to the internet. They will usually charge a monthly fee for
the service they provide.
Public switched telephone network (PSTN) – network used by traditional telephones when making
calls or when sending faxes.
Voice over Internet Protocol (VoIP) – converts voice and webcam images into digital packages to be
sent over the internet.
Internet protocol (IP) – uses IPv4 or IPv6 to give addresses to devices connected to the internet.
IPv4 – IP address format which uses 32 bits, such as 200.21.100.6.
Classless inter-domain routing (CIDR) – increases IPv4 flexibility by adding a suffix to the IP address,
such as 200.21.100.6/18.
IPv6 – newer IP address format which uses 128 bits, such as A8F0:7FFF:F0F1:F000:3DD0:
256A:22FF:AA00.
Zero compression – way of reducing the length of an IPv6 address by replacing groups of zeroes by a
double colon (::); this can only be applied once to an address to avoid ambiguity.
Sub-netting – practice of dividing networks into two or more sub-networks.
Private IP address – an IP address reserved for internal network use behind a router.
Public IP address – an IP address allocated by the user’s ISP to identify the location of their device on
the internet.
Domain name service (DNS) – (also known as domain name system) gives domain names for internet
hosts and is a system for finding IP addresses of a domain name.
JavaScript® – object-orientated (or scripting) programming language used mainly on the web to
enhance HTML pages.
PHP – hypertext processor; an HTML-embedded scripting language used to write web pages.
Bandwidth: a measure of the amount of data that can be transmitted per second
Explain the purpose and benefits of networking devices.
Computer Network
A computer network is a set of computers connected together for the purpose of sharing
resources. The most common resource shared today is connection to the Internet. Other
shared resources can include a printer or a file server. The Internet itself can be considered a
computer network.
A computer network is a set of
connected computers. Computers on a
network are called nodes. The connection
between computers can be done via
cabling, most commonly the Ethernet
cable, or wirelessly through radio waves.
Connected computers can share
resources, like access to the Internet,
printers, file servers, and others. A
network is a multipurpose connection, which allows a single computer to do more.

Characteristics of LAN and WAN

The two main types of networks are local area


networks (LANs) and wide area networks
(WANs).Generally, a network over short
distances is called a local area network (LAN)
while those over great distances are wide area
networks (WAN). Whether a network is a WAN
or a LAN, it allows the computers to:

● communicate with one another


● share information centrally
● share copies of software
● give access to data and program files to multiple users.

Local area networks (LANs)


A local area network (LAN) is formed when devices are based geographically close to each
other, for example, in the same building or across one site. A network in your home,
workplace, or school could be a LAN. Note that the word 'local' doesn't refer to a geographical
area, such as neighbourhood, city, or region.

In a LAN there is the added benefit of being able to share hardware. For example, the
classroom with 20 computers may only have one or two printers. Also, those printers may be
of different types and used for different tasks. This means that the type of printer used is
dependent on the job that the user wants it to do rather than on the type of printer that
happens to be connected to the computer from which the printout is sent.

The benefits of connecting PCs in a LAN included the following:

• The expense of installing application software on each individual PC could be saved by


installing the software on an application server attached to the LAN instead.

• A file server could be attached to the LAN that allowed users to store larger files and
also allowed files to be shared between users.

• Instead of supplying individual printers to be connected to a user’s PC, one or more


printers could Managers in organisations could use electronic mail to communicate
with staff rather than sending round memos on paper.

• The ‘paper-less office’ became a possibility, where files were to be stored in digital
form
on a file server rather than as paper copies in a filing cabinet.

Today, a typical LAN is characterised by the following:

• It will be used by an organisation or a company within a site or branch.

• It will be owned by the organisation or company.

• It will be one of many individual LANS at one site.

• The transmission medium will be twisted pair cable or WiFi.

• The LAN will contain a device that allows connection to other networks.

• There will be end-systems connected which will be user systems or servers


Wide area networks (WANs)

When devices are connected across a wider geographical area, they form a wide area
network (WAN). Often lots of LANs are connected together to create a WAN. There are many
examples of WANs, such as a bank connecting all of its cash machines together across the
country, or regional police stations connecting together to share information.

The largest example of a WAN is the internet, which allows LANs in homes, businesses,
universities, or anywhere else to connect to each other by utilising an internet service provider
(ISP). For example, if you connect your mobile phone to your WiFi router when you are at
home, you are connecting to your home LAN. If you then use your phone to access a website
or a social media app, you have connected to the internet, which is a WAN.
The benefits of having the computers connected by a WAN were:
• a ‘job’ could be run on a remote computer that had the required application software
• a data archive that was stored on a remote computer could be accessed
• a message could be transmitted electronically to a user on a remote computer.
Today, a typical WAN is characterised by the following.
• It will be used by an organisation or a company to connect sites or branches.
• It will not be owned by the organisation or company.
• It will be leased from a public switched telephone network company (PSTN).
• A dedicated communication link will be provided by the PSTN.
• The transmission medium will be fibre-optic cable.
• Transmission within the WAN will be from switch to switch.
• A switch will connect the WAN to each site.
• There will not be any end-systems connected directly to the WAN.
Following are different types of networks.

WAN: 100 km to over 1000 km


MAN (Metropolitan Area Network): 1 to 100 km
LAN: 10 m to 1000 m
PAN (Personal Area Network sometime known as home system): 1 m to 10 m
Cloud Computing
Cloud computing means storing and accessing data and programs over the internet instead of
user’s computer's hard drive.
Cloud Services are often divided into three categories based on who has access to the
services or infrastructure: Private, Public and Hybrid. We use cloud services almost everyday
and in various forms. For example, we listen to streamed music or watch movies via the
Internet, we store our documents and photos on OneDrive and other cloud storage systems,
we manage our mail via Outlook, and even use our smartphones to book taxis. All these
services are provided to us via cloud-based services.
Cloud Storage Services offer unlimited data, anywhere, and can be accessed from your
smartphone, laptop, desktop, or any other device that has the relevant application and is
connected to the Internet. Cloud Storage Services usually employ advanced information
compression functions and in some cases encryption, thus ensuring greater security and
mobility of data.

Categories of Cloud Computing Services


Cloud computing can be divided into three main services

These services constitute what is known as the Cloud Computing Stack with SaaS at the top,
PaaS in the middle, and IaaS on the bottom.
Types of cloud computing
Not all clouds are the same and not one type of cloud computing is right
for everyone. Several different models, types, and services have evolved
to help offer the right solution for your needs.
First, you need to determine the type of cloud deployment, or cloud
computing architecture, that your cloud services will be implemented on.
There are three different ways to deploy cloud services: on a public
cloud, private cloud, or hybrid cloud.
Private cloud
Private cloud is cloud infrastructure owned, operated and accessed by an organisation,
whether managed internally or by a third party, and hosted either internally or externally.
A private cloud refers to cloud computing resources used exclusively by a single business or
organization. A private cloud can be physically located on the company’s on-site datacentre.
Some companies also pay third-party service providers to host their private cloud. A private
cloud is one in which the services and infrastructure are maintained on a private network.
Public cloud
Public cloud is owned by a cloud service provider for general access. Cloud services are
considered "public" when they are delivered over the public Internet, and they may be offered
as a paid subscription, or free of charge.
Public clouds are owned and operated by a third-party cloud service providers, which deliver
their computing resources, like servers and storage, over the Internet.
Hybrid cloud
Hybrid cloud is a composition of a public cloud and a private environment, such as a private
cloud or on-premises resources, that remain distinct entities but are bound together, offering
the benefits of multiple deployment models. Hybrid cloud can also mean the ability to connect
collocation, managed and/or dedicated services with cloud resources.
Advantages of Cloud Computing
Advantages of cloud computing are given below:
1) Back-up and restore data
Once the data is stored in the cloud, it is easier to get back-up and restore that data using the
cloud.
2) Improved collaboration
Cloud applications improve collaboration by allowing groups of people to quickly and easily
share information in the cloud via shared storage.
3) Excellent accessibility
Cloud allows quickly and easily access store information anywhere, anytime in the whole
world, using an internet connection. An internet cloud infrastructure increases organization
productivity and efficiency by ensuring that data is always accessible.
4) Low maintenance cost
Cloud computing reduces both hardware and software maintenance costs for organizations.
5) Mobility
Cloud computing allows us to easily access all cloud data via mobile.
6) Services in the pay-per-use model
Cloud computing offers Application Programming Interfaces (APIs) to the users for access
services on the cloud and pays the charges as per the usage of service.
7) Unlimited storage capacity
Cloud offers a huge amount of storing capacity for storing important data such as documents,
images, audio, video, etc. in one place.
8) Data security
Data security is one of the biggest advantages of cloud computing. Cloud offers many
advanced features related to security and ensures that data is securely stored and handled.
Disadvantages of Cloud Computing
A list of the disadvantage of cloud computing is given below -
1) Internet Connectivity
Good internet connectivity is the basic requirement for cloud computing. Data from the cloud
cannot be accessed from cloud without good internet connectivity.
2) Vendor lock-in
Vendor lock-in is the biggest disadvantage of cloud computing. Organizations may face
problems when transferring their services from one vendor to another. As different vendors
provide different platforms, that can cause difficulty moving from one cloud to another.
3) Limited Control
As we know, cloud infrastructure is completely owned, managed, and monitored by the
service provider, so the cloud users have less control over the function and execution of
services within a cloud infrastructure.
4) Security
Although cloud service providers implement the best security standards to store important
information. But, before adopting cloud technology, user should be aware that all data and
organization's sensitive information is sent to a third party, i.e., a cloud computing service
provider. While sending the data on the cloud, there may be a chance that organization's
information is hacked by Hackers.
Explain the benefits and drawbacks of a client-server and peer-to-peer network.
Peer-to-peer network
A network where there is not central computer, workstations known as peers or nodes are
equally participants in data sharing. They are equally privileged and equipped in the
application. Each peer (workstation or node) can act as a client and request a file from
another peer or it can act as a server when another peer requests the download of a file.
A peer-to-peer network operates with each peer (networked computer) storing some of the
files.
Characteristics of Peer to Peer Computing
The different characteristics of peer to peer networks are as follows −
• There is no central computer
• Computers in this network are known as
Peer or Node
• It is suitable for small networks like a
groups of a dozen or less computers.
• All peers can act as both client (request
a file or resource) and as servers
(provide file or resources)
• Peers store their data using individually
Advantages of Peer to Peer Computing
Some advantages of peer to peer computing are as follows −
• Each computer in the peer to peer network manages itself. So, the network is quite
easy to set up and maintain.
• It is easy to scale the peer to peer network and add more nodes. This only increases
the data sharing capacity of the system.
• None of the nodes in the peer to peer network are dependent on the others for their
functioning.
Disadvantages of Peer to Peer Computing
Some disadvantages of peer to peer computing are as follows −
• It is difficult to backup the data as it is stored in different computer systems and there is
no central server.
• It is difficult to provide overall security in the peer to peer network as each system is
independent and contains its own data.
Client-Server Model
Client Server Architecture is a computing model in which the server hosts, delivers and
manages most of the resources and services to be consumed by the client. This type of
architecture has one or more client computers connected to a central server over a network or
internet connection. This system shares computing resources. Client/server architecture is
also known as a networking computing model or client/server network because all the
requests and services are delivered over a network.
In modern days the client is a web browser connected to the Internet. The server is a web
server hosted on the Internet.
Advantages of Client-Server Model
– files and resources are centralised
– creation of security / manage security
– user needs user name and password to access network
– centralised back-up
– intranet capability
– Internet monitoring
– clients can be less powerful machines, therefore less expensive to buy
– saving resources on server reduces the burden on the client
The server provides an application and the client uses the application. There are two options
for how the client functions a thin-client and a thick-client
Thin Clients Thick Clients
a client that only provides input and a client that carries out at least some of
Definition
receives output from the application the processing itself
chooses an application to run on chooses an application provided by the
the server server
Sends input data to the server possibly carries out some processing
when requested by the application. before running the application on the
How they
server and also after receiving output
work
from the application
Receives output from the Alternatively, possibly downloads the
application application from the server and runs the
application itself.
• less expensive to expand (low • more robust (device can carry out
Pros powered and cheap devices can processing even when not connected
be used) to server)
• all devices are linked to a server • clients have more control (they can
(data updates and new software store their own programs and
installation done centrally) data/files)
• server can offer protection against
hacking and malware

• high reliance on the server; if the • less secure (relies on clients to keep
server goes down or there is a their own data secure)
break in the communication link • each client needs to update data and
Cons then the devices cannot work software individually
• despite cheaper hardware, the • data integrity issues, since many
start-up costs are generally higher clients access the same data which
than for thick clients can lead to inconsistencies
Software •always relies on a connection to a •can run some of the features of the
remote server or computer for it to software even when not connected to
work a server
•requires very few local resources •relies heavily on local resources
(such as SSD, RAM memory or •more tolerant of a slow network
computer processing time) connection
•relies on a good, stable and fast • can store data on local resources
network connection for it to work such as HDD or SSD
•data is stored on a remote server
or computer
Comparison of peer-to-peer network and client-server architecture
Peer-to-Peer Model Client-Server model
There is no central computer, all computers In this network some computers are servers
are equally participant in file and resource and others are clients
sharing Some computers are servers and others host,
deliver and manages most of the resources
There is one or more central computers work
as server
Peer or node is a computer in this model Servers are computers provides resources
A client is a computer that provides a user with
access to a network
Suitable for small networks suitable for large networks
Easy to setup and add or remove peers Difficult to setup and add or remove servers
or clients
Data is saved individually Data is saved centrally
No control on downloading and using files File downloading and access can be
controlled
Less secure Can be better protected
Parts of files can be downloaded from
different peers
Network Topologies
Describe the characteristics, benefits and drawbacks, of different network topologies.
Network Topology
Topology defines the structure of the network of how all the components are interconnected
to each other.
Bus Topology:
The bus topology is the simplest network arrangement. It has one cable that connects every
device on the network, which is called the backbone. At each end of the main cable there is a
small device called a terminator which absorbs the signals when they reach the end, to
prevent interference. Each device must be connected to the main cable to join the network.
Advantages Disadvantages
A relatively low number of cables are A collision of signals occur if more than one
needed so it is cheap to install device transmit data at the same time
Simple to add additional devices The possibility of collisions increases on
networks with high traffic
If the backbone cable breaks the whole
network will fail
Star Topology

In a star topology, each device is connected to a central device, either a switch or a hub,
which gives it a star formation.

The main difference between a hub and a switch is that a hub will send every signal to every
device on the network, while a switch will only send each signal to the intended recipient
device.

Star topology advantages Star topology disadvantages


• If one cable is damaged only the affected • If the hub or switch fails the whole
node will be disconnected from the network network will fail
• Additional devices can be easily added to • More cables are required than for a
the network by connecting them to the hub bus network which increases the cost
or the switch of this network
• It is more secure than a bus network as
signals can be directed to their intended
recipient
Mesh Topology
In a mesh topology, every node is connected to every other node. Consequently, a greater
amount of cabling is required, but this arrangement can increase the speed and reliability of
the network. Unlike the star topology, there is no central point. Due to the reliability of mesh
networks, they are often used by emergency services that depend on efficient and reliable
communication.
Mesh topology advantages Mesh topology disadvantages
• Effective for networks with high data traffic • Large networks require a substantial
and where response times are critical amount of cabling which is expensive
because of the direct connections from • It is not always possible to find routes
node to node within a building for all the cabling
• Alternative transmission routes via other • Maintenance costs are high due to the
nodes make the network more reliable, due amount of cabling
to a reduction in collisions of data, and the
avoidance of faulty cables
• Direct connections result in quicker
transmission speeds
Peer-to-Peer and Mesh
A peer-to-peer (P2P) network is a type of network where all nodes are connected to each other
without a central server. In contrast, a mesh network is a highly distributed network that uses special
routing technology. In standard routing technology, the routes which data packets take are fixed. In
mesh networks, the software decides dynamically or ad-hoc which route data packets take.
Both P2P and mesh networks are decentralized networks that do not rely on a central server.
However, mesh networks create a new infrastructure that is much more thoroughly distributed than
P2P networks. Mesh networks increase the system’s total bandwidth by forming new infrastructure
by connecting directly (and often through multiple alternate paths).
Wired and wireless
In a network computer can be connected with each using wires or wirelessly.
Wired Network Wireless Network
A wired network uses cables to connect A wireless network allows devices to stay
devices, such as laptop or desktop connected to the network but roam
computers, to the Internet or another untethered to any wires.
network.
A wired network has some disadvantages Access points amplify Wi-Fi signals, so a
when compared to a wireless network. The device can be far from a router but still be
biggest disadvantage is that your device is connected to the network. When you connect
tethered to a hub/switch. The most common to a Wi-Fi hotspot at a cafe, a hotel, an
wired networks use cables connected at one airport lounge, or another public place, you're
end to an Ethernet port on the network connecting to that business's wireless
hub/switch and at the other end to a network.
computer or other device.
Network Hardware
Including switch, server, Network Interface Card (NIC), Wireless Network Interface Card (WNIC),
Wireless Access Points (WAP), cables, bridge, repeater
Describe the role and function of a router in a network

Network interface controller (NIC)


A network interface controller (NIC) is required for a computer to connect to a network. It is a
circuit board that enables the computer to transmit and receive data in the network using an
Ethernet port, WiFi aerial/s, or both. Each NIC is assigned a unique address called a MAC
address.
Wireless Network interface controller (WNIC)
A wireless network interface controller (WNIC) is a network interface controller which
connects to a wireless network, such as Wi-Fi or Bluetooth, rather than a wired network, such
as a Token Ring or Ethernet. A WNIC, just like other NICs, uses an antenna to communicate
via radio waves.
Wireless access point (WAP)
A wireless access point (WAP), or more generally just access point (AP), is a networking
hardware device that allows other Wi-Fi devices to connect to a wired local area network
(LAN). As a standalone device, the Access Point may have a wired connection to a router,
but, in a wireless router, it can also be an integral component of the router itself.
Hub
A Hub is a networking device that allows you to connect multiple PCs to a single network. It is
used to connect segments of a LAN. A hub stores various ports, so when a packet arrives at
one port, it is copied to various other ports. Hub works as a common connection point for
devices in a network.
Switch
A network switch is a computer networking device that connects various devices together on
a single computer network. It may also be used to route information in the form of electronic
data sent over networks. Since the process of linking network segments is also called
bridging, switches are usually referred to as bridging devices.
Hub Switch
Hub is a broadcast type transmission. Switch is a Unicast, multicast and broadcast
type transmission.
Hub is not intelligent device Switch is an intelligent device
A hub is to send out a message from one A switch is able to handle the data and
port to other ports. For example, if there are knows the specific addresses to send the
three computers of A, B, C, the message message. It can decide which computer is
sent by a hub for computer A will also come the message intended for and send the
to the other computers. But only computer A message directly to the right computer.
will respond and the response will also go
out to every other port on the hub.
Therefore, all the computers can receive the
message and computers themselves need
to decide whether to accept the message.

Routers
A router is a networking device that forwards data packets between computer networks.
Routers perform the traffic directing functions on the Internet. Data sent through the internet,
such as a web page or email, is in the form of data packets. A packet is typically forwarded
from one router to another router through the networks that constitute an internetwork (e.g.
the Internet) until it reaches its destination node.
A router is connected to two or more data lines from different IP networks. When a data
packet comes in on one of the lines, the router reads the network address information in the
packet header to determine the ultimate destination. Then, using information in its routing
table or routing policy, it directs the packet to the next network on its journey.
The role of the router is to forward data to the correct recipient.
Bridge
A network bridge is a computer networking device that creates a single, aggregate network
from multiple communication networks or network segments. This function is called network
bridging. Bridging is distinct from routing. Routing allows multiple networks to communicate
independently and yet remain separate, whereas bridging connects two separate networks as
if they were a single network
Gateway
A gateway, as the name suggests, is a passage to connect two networks together that may
work upon different networking models. They basically work as the messenger agents that
take data from one system, interpret it, and transfer it to another system. Gateways are also
called protocol converters and can operate at any network layer. Gateways are generally
more complex than switch or router.
Transmission media
There are two main cable technologies used for the transmission of data on a network:
copper and fiber-optic cables.

Copper cables
Copper cables are the most common type used
in Ethernet networks. Copper cables use
electrical signals to transmit information. There
are three types of copper cables:

• Coaxial: the same type as the cable used to connect TVs to aerials. It has one single
copper core wire.
• Unshielded twisted pair (UTP): up to eight copper wires are twisted around each
other in pairs and then all pairs are twisted around each other. The arrangement
reduces electrical interference. UTPs are the most common type of cables used in
Ethernet networks.
• Shielded twisted pair (STP): the same structure as the unshielded twisted pair cable.
However, a layer of shielding is added to further prevent interference.

Advantages of Copper Cabling


• copper cabling is less expensive to install
• copper cable is easier to install because it is more flexible
• it is easier to make terminations using copper cabling
• the expertise in use of copper cabling is more extensive
• has been around for years … so very little is “unknown” about installations using
this type of cabling
Fibre-optic cables
Fibre-optic cables contain clusters of thin glass or plastic fibres. It works by transmitting light
through the cable which is reflected by the cable's internal wall until it reaches the recipient.

Fibre-optic cables can preserve a good signal strength for up to 100km and are not affected
by electrical interference therefore, they exceed the performance of copper wires, although
they also can be very expensive.

Advantages of Fibre-optic
➢ fibre optic cables have greater bandwidth
➢ fibre optic cables need less signal boosting // can transmit over longer distances
➢ fibre optic cables have greater security (more difficult to “tap” into)
➢ fibre optic cables are immune to electromagnetic and other effects
➢ fibre optic cabling is lighter in weight (easier to install)
➢ fibre optic cables consume less power
Wi-Fi
Wi-Fi is the wireless technology used to connect computers, tablets, smartphones and
other devices to the internet.
Wi-Fi is the radio signal sent from a wireless router (WAP-Wireless Access Point) to a nearby
device, which translates the signal into data you can see and use. The device transmits a
radio signal back to the router, which connects to the internet by wire or cable.
What Are Collisions?
A network collision occurs when more than one device attempts to send a packet on a
network segment at the same time.
Ethernet uses CSMA/CD (Carrier Sense Multiple Access/Collision Detect) as its collision
detection method. Here is a simplified example of Ethernet operation:

1. Station A wishes to send a frame. First, it checks if the medium is available (Carrier
Sense). If it isn't, it waits until the current sender on the medium has finished.
2. Suppose Station A believes the medium is available and attempts to send a frame.
Because the medium is shared (Multiple Access), other senders might also attempt to
send at the same time. At this point, Station B tries to send a frame at the same time as
Station A.
3. Shortly after, Station A and Station B realize that there is another device attempting to
send a frame (Collision Detect). Each station waits for a random amount of time before
sending again. The time after the collision is divided into time slots; Station A and Station
B, each pick a random slot for attempting a retransmission.
4. Should Station A and Station B attempt to retransmit in the same slot, they extend the
number of slots. Each station then picks a new slot, thereby decreasing the probability of
retransmitting in the same slot.
Bit Streaming
Show understanding of bit streaming
Methods of bit streaming, i.e. real-time and on-demand
Importance of bit rates / broadband speed on bit streaming

Bit streaming is a sequence of bits (digital signals) over a communication over a


communication path (internet). It is used to transfer of data at high speed.
Bit streaming requires fast broadband connection and some form of buffering.
Bits arrive in the same order as sent.
Bit Streaming is a contiguous sequence of bits, representing a stream of data, transmitted
continuously over a communication path serially.
Because of the file sizes involved, streamed media is always compressed to a sequence of
bits - a ‘bit stream’. Generic compression techniques can convert the byte stream to a bit
stream with fewer bits overall. For the decoding process at the receiver end to work properly,
the data must be transferred as a bit stream.
Benefits of bit streaming:
➢ video or audio files can be played without waiting for a whole file to be downloaded
➢ data is erased after being played automatically so no need to store large files on user’s
computer
➢ allows on demand playback
➢ allows live broadcast
➢ no specialist software is required for playback in browser
Problems in bit streaming
– video stops / hangs if very slow Internet / broadband speed low
– video stops / hangs if inadequate buffering capacity
– loss of Internet means can’t access films / files
– may require specific software to run the files / films
– viruses can be downloaded from the websites
Bandwidth
Bandwidth is the term used to describe the volume of data that can be sent or received. It isn't
the speed of data, but the amount of data, the volume of data.
There are two different types of Bit Streaming and these are Real-Time Bit Streaming and
On-Demand Bit Streaming.
Real-Time Bit Streaming
Real-Time Bit Streaming is a live streaming of currently an ongoing event. This involves
taking videos from live sources, such as webcams, camcorders, etc. and broadcasting it live
over the internet to audience.
Real time streaming cannot be paused or re-winded, as any data that is not immediately used
(e.g. video data outputted to the screen) is discarded.
Features:
Low latency (delay) is prioritised over quality – packets that don’t arrive in time are discarded.
If the data cannot be reliably streamed at the current bit-rate (quality) then a lower bit-rate and
quality will be used.
Used for:
Live sports television broadcasts
Online Gaming
Some financial data
Some weather data
Live streaming services (e.g. Twitch)
Controlling UAVs and other autonomous devices.
On-Demand Bit Streaming
On-Demand Bit Streaming is watching an already existing or recorded video. Viewers can
watch the video over and over again.
On demand bit streaming is used to transmit data that has been pre-recorded. The player
buffers (waits and saves up packets) until the data can be streamed in the bit-rate selected
before starting playback
Features:
Data integrity is prioritised over latency.
If there is insufficient bandwidth to handle the bit stream then buffering will occur and the
output will pause or drop frames until the bandwidth increases or a lower bit rate stream is
selected.
Used for:
Movie playback
Music streaming (not live radio)
Video streaming sites such as media websites (YouTube)
World Wide Web and The Internet
Explain the difference between the internet and the WWW.

Internet and World Wide Web


The internet and the World Wide Web (WWW) are two related but distinct concepts.
The internet refers to a infrastructure or global network of computers and servers that are connected
to each other. It enables communication and exchange of data between computers and devices
around the world using a set of protocols and standards.
On the other hand, the World Wide Web (WWW or simply the web) is a collection of interconnected
documents and resources, including text, images, videos, and other multimedia content, that can be
accessed over the internet using web browsers. The web pages are written in HTML and stored on
web servers. The web pages are accessed using URL in browsers. The web is essentially an application
that runs on top of the internet, allowing users to access and interact with information and services
from anywhere in the world.
In other words, the internet is the underlying infrastructure that allows computers and devices to
communicate with each other, while the World Wide Web is one of the applications or services that
runs on top of that infrastructure.
To summarize, the internet is the network of networks that connects computers and devices around
the world, while the World Wide Web is a platform that uses the internet to provide access to
information and services over the web.
S No Internet WWW
1 Internet is global network of networks WWW stands for World Wide Web
2 Internet is a mean of connecting a World Wide Web is a collection of
computer to any other computer information, which is accessed via internet.
anywhere in the world
3 Internet is infra structure. www is a service on top of that infrastructure.
4 Internet is super set of www. www is a subset of the internet.
5 Internet uses TCP & IP. Uses URLs to specify the locations of websites
and web pages
Internet

World Wide Web e-mail


File
sharing
ftp

1ac 9618 S21 P11-13


4d Melinda sends emails from her webmail account (email account accessed through a website).
Explain whether Melinda is using the internet, or the World Wide Web (WWW), or both.
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
............................................................................................................................................................. [3]

1 mark for identifying that she is using both.1 mark per bullet point for justification
using internet because sending data on the infrastructure
using WWW because accessing a website (that is stored on a webserver operated by the webmail)
that is part of the WWW
Internet Hardware
Describe the hardware that is used to support the internet
Including modems, PSTN (Public Switched Telephone Network), dedicated lines, cell phone network
Following hardware are required to connect with internet
• Modem
• Router
• PSTN
• Dedicated Lines
• Cell phone network
Other requirements are
• ISP
• Web browser
Modem
A modem is a hardware device that changes the digital signal produced by the computer into
one that can be transmitted over the public telephone line, i.e. an analogue signal. A second
modem is required at the receiving device in order to convert the analogue signal back into a
digital signal, which can be then processed by the computer.
Routers
A router is a networking device that forwards data packets between computer networks.
Routers perform the traffic directing functions on the Internet. Data sent through the internet,
such as a web page or email, is in the form of data packets. A packet is typically forwarded
from one router to another router through the networks that constitute an internetwork (e.g.
the Internet) until it reaches its destination node.
A router is connected to two or more data lines from different IP networks. When a data
packet comes in on one of the lines, the router reads the network address information in the
packet header to determine the ultimate destination. Then, using information in its routing
table or routing policy, it directs the packet to the next network on its journey.
The role of the router is to forward data to the correct recipient.
Public Switch Telephone Network (PSTN)
The telephone network system, public switched telephone network (PSTN), is used to
connect computers/devices and LANs between towns and cities. Satellite technology is used
to connect to other countries.
PSTN (Circuit switching) uses a dedicated channel/circuit which lasts throughout the
connection: the communication line is effectively ‘tied up’.
Now telephone lines have changed from copper cables to fibre optic cables, which permits
greater bandwidth and faster data transfer rates (and less risk of data corruption from
interference). Fibre optic telephone networks are usually identified as ‘fast broadband’. High
speed broadband has allowed WLANs to be developed by using WAPs.
High speed communication links allow telephone and video calls to be made using a
computer and the internet. Telephone calls require either an internet-enabled telephone
connected to a computer (using a USB port) or external/internal microphone and speakers.
Video calls also require a webcam. When using the internet to make a phone call, the user’s
voice is converted to digital packages using Voice over Internet Protocol (VoIP). Data is split
into packages (packet switching) and sent over the network via the fastest route.

Cellular networks and satellites


Other devices, such as mobile phones, use the cellular network. Here, the mobile phone
providers act as the ISPs and the phones contain communication software which allows them
to access the telephone network and also permits them to make an internet connection.
Satellites are an important part of all network communications that cover vast distances. Due
to the curvature of the Earth, the height of the satellite’s orbit determines how much coverage
it can give.
IP Addressing
Explain the use of IP addresses in the transmission of data over the internet
Explain how a Uniform Resource Locator (URL) is used to locate a resource on the World Wide Web
(WWW) and the role of the Domain Name Service (DNS)

An IP address (internet protocol address) is a numerical representation that uniquely identifies


a specific interface on the network. Each computer or device connected to the Internet has an
Internet Protocol (IP) address.
IPv4
IPv4 is the most common IP address. It consists of 32 bits to represent more than 4 billion
computers. 32 bits of IP v4 are divided into 4 sections of 8 bits each. Each section is
represented in denary numbers ranging from 0 – 255. e.g. 172. 16. 254. 1
Range 0 – 255 (256 Possibilities in each)
Total addresses = 256 x 256 x 256 x 256 = 4.3
Billion.
4.2 Billion Addresses is not enough for the
modern world as the world has 7 Billion plus
inhabitants and many people have more than one
internet connected device.
Classes of IP Address
Internet Protocol hierarchy contains several classes of IP Addresses to be used efficiently in
various situations as per the requirement of hosts per network. Broadly, the IPv4 Addressing
system is divided into five classes of IP Addresses. All the five classes are identified by the
first octet of IP Address.
Internet Corporation for Assigned Names and Numbers is responsible for assigning IP
addresses.
The first octet referred here is the left most of all. The octets numbered as follows depicting
dotted decimal notation of IP Address −

The number of networks and the number of hosts per class can be derived by this formula −
When calculating hosts' IP addresses, 2 IP addresses are decreased because they
cannot be assigned to hosts, i.e. the first IP of a network is network number and the last
IP is reserved for Broadcast IP.
Class A Address
The first bit of the first octet is always set to 0 (zero). Thus the first octet ranges from 1 – 127,
i.e.

Class A addresses only include IP starting from 1.x.x.x to 126.x.x.x only. The IP range
127.x.x.x is reserved for loopback IP addresses.
The default subnet mask for Class A IP address is 255.0.0.0 which implies that Class A
addressing can have 126 networks (27-2) and 16777214 hosts (224-2).
Class A IP address format is thus: 0NNNNNNN.HHHHHHHH.HHHHHHHH.HHHHHHHH
Class B Address
An IP address which belongs to class B has the first two bits in the first octet set to 10, i.e.

Class B IP Addresses range from 128.0.x.x to 191.255.x.x. The default subnet mask for Class
B is 255.255.x.x.
Class B has 16384 (214) Network addresses and 65534 (216-2) Host addresses.
Class B IP address format is: 10NNNNNN.NNNNNNNN.HHHHHHHH.HHHHHHHH
Class C Address
The first octet of Class C IP address has its first 3 bits set to 110, that is −

Class C IP addresses range from 192.0.0.x to 223.255.255.x. The default subnet mask for
Class C is 255.255.255.x.
Class C gives 2097152 (221) Network addresses and 254 (28-2) Host addresses.
Class C IP address format is: 110NNNNN.NNNNNNNN.NNNNNNNN.HHHHHHHH
Class D Address
Very first four bits of the first octet in Class D IP addresses are set to 1110, giving a range of

Class D has IP address range from 224.0.0.0 to 239.255.255.255. Class D is reserved for
Multicasting. In multicasting data is not destined for a particular host, that is why there is no
need to extract host address from the IP address, and Class D does not have any subnet
mask.
Class E Address
This IP Class is reserved for experimental purposes only for R&D or Study. IP addresses in
this class ranges from 240.0.0.0 to 255.255.255.254. Like Class D, this class too is not
equipped with any subnet mask.
Class IPv4 1st Octet Denary NetIDs Host IDs
A 1st octet starts with 0 0000 0000 – 0111 1111 0-127 8 24
B 1st octet starts with 10 1000 0000 – 1011 1111 128-191 16 16
C 1st octet starts with 110 1100 0000 – 1101 1111 192-223 24 8
D 1st octet starts with 1110 1110 0000 – 1110 1111 224-239 Multi cast
E 1st octet starts with 1111 1111 0000 – 1111 1111 240-255 E
Classless inter-domain routing (CIDR)
The first approach developed for improving the addressing scheme is called ‘classless inter-
domain routing’ (CIDR). This retains the concept of a netID and a hostID but removes the
rigid structure and allows the split between the netID and the hostID to be varied to buit
individual need. The simple method used to achieve this is to add an 8-bit suff ix to the
address that specifies the number of bits for the netID. If, for instance, we define the suff ix as
21, that means that 21 bits are used for the netID and there are 11 bits remaining (of a 32-bit
address) to specify hostIDs allowing 211 (i.e. 2048) hosts.
Sub-Net
By using sub-netting, one single IP address can be used to have smaller sub-networks which
provides better network management capabilities.
Sub-net Masking
A subnetwork or subnet is a logical subdivision of an IP network.[1]:1,16 The practice of
dividing a network into two or more networks is called sub-netting.
Computers that belong to a subnet are
addressed with an identical most-significant
bit-group in their IP addresses. This results
in the logical division of an IP address into
two fields: the network number or routing
prefix and the rest field or host identifier.
The rest field is an identifier for a specific host or network interface.
Public IP Addresses
Each LAN connected to the internet has a single public IP Address. This is the address seen
by other computers and networks on the Internet and is the address attached to packets sent
across the Internet.
Private IP Addresses
Computers within a LAN have their own private IP Address that is different to their Public IP
Address. This private IP Address is either:
o Issued by the Server / Router using Dynamic Host Configuration Protocol (DHCP)
o Set manually by the computer user themselves.
Range of private IP addresses
Lower bound Upper bound
10.0.0.0 10.255.255.255
172.16.0.0 172.31.255.255
192.168.0.0 192.168.255.255
Differences between public & private IP Address:
Private IP Address Public IP Address
Private address can only be reached Public address can be reached across the
internally/through the LAN/Intranet // private Internet.
address cannot be reached across the
Internet
NAT (Network Address Translation) is No need of NAT box
necessary for a private IP address to access
the Internet directly.
A private address is more secure than a A public address is less secure
public address
Private addresses are assigned by the router Public addresses are provided by ISP
or network administrator.
Private addresses (are unique within their Public addresses are unique (to the
network, but) can be duplicated within other Internet)
(discrete) networks.
10.0.0.1 to 10.255.255.254 and 172.16.0.1 to IP addresses from the private address
172.31.255.254 and 192.168.0.1.to space are never assigned as public
192.168.255.254 form the private address
space
There are 2 main types of Public IP Addresses: Static and Dynamic
Static IP Addresses
These are mainly used by:
o Businesses with LANs that need to be accessed externally from the internet
o Website Hosts
o Gamers who want the fastest, most reliable internet service
Static IP addresses stay the same, which mean that data is always sent in the most efficient
manner. However a static IP address opens your network up to attackers.
Dynamic IP addresses
Most home internet users are issued with a dynamic IP address when their router connects to
the internet and the IP address is renewed every month or so. Each time it is renewed a new
IP Address is drawn from the pool.
This sharing of IP addresses allows the internet to continue to function even when there are
more devices in the world than there are available IP addresses (4 billion different ip
addresses are available in total for IPV4 addresses). It is also potentially harder to hack as a
network’s IP address is constantly changing.
The limited number of addresses available on the internet using IPV4 led to the development
of IPV6, though this technology is still in the process of being rolled out…
IP Version 6
IPv6 is 128 Bit Address,
340,282,366,920,938,463,463,374,607,431,768,211,456 Addresses.
Probably enough for the foreseeable future.
Advantages
o Future proof – plenty of unique addresses for each device.
o Security built in to the profile
o Allows for QOS packet prioritising.
Disadvantages
o A bit more overhead in packet size
o Many legacy devices and systems still don’t fully support IPv6 so we still need IPv4 backup.
Compressing IPv6 Addresses
IP Version 6 addresses are incredibly long, which makes them difficult humans to read/write,
even when represented using hexadecimal. Fortunately IP Version 6 Addresses can be
Shortened (Compressed). Take a look at the video to see how this can be done.
Today there are combinations of 1Pv4 approaches in use and these allow the Internet to
continue to function. Respected sources argue that this cannot continue beyond the current
decade. There must soon be a migration to IP version 6 (1Pv6), which uses a 128-
bitaddressing scheme allowing 2128 different addresses, a huge number! In practice, this will
allow more complex structuring of addresses. Documenting these addresses is not going to
be fun. The addresses are written in a colon hexadecimal notation. The code is broken
into16-bit parts with each of these represented by four hexadecimal characters. Fortunately,
some abbreviations are allowed.
1Pv6 address Comment
68E6:7C48:FFFE:FFFF:3D20:1180:695A:FF01 A full address
72E6:0000:0000:CFFE:3D20:1180:295A:FF01
:0000:0000: has been replaced by::
72E6::CFFE:3D20:1180:295A:FF01
6C48:0023:FFFE:FFFF:3D20:1180:095A:FF01
Leading zeros omitted
6C48:23:FFFE:FFFF:3D20:1180:95A:FF01
192.31.20.46
An 1Pv4 address used in1Pv6
::192.31.20.46
NAT
Network Address Translation (NAT) is designed for IP address conservation. It enables
private IP networks that use unregistered IP addresses to connect to the Internet. NAT
usually connecting two networks together, and translates the private (not globally unique)
addresses in the internal network into legal addresses, before packets are forwarded to
another network.
As part of this capability, NAT can be configured to advertise only one address for the entire
network to the outside world. This provides additional security by effectively hiding the entire
internal network behind that address. NAT offers the dual functions of security and address
conservation and is typically implemented in remote-access environments.

Range of Private IPs


Lower bound Upper bound
10.0.0.0 10.255.255.255
172.16.0.0 172.31.255.255
192.168.0.0 192.168.255.255
Uniform Resource Locator (URL):
URL stands for Uniform Resource Locator. It is the address of a web page. Each page has its own
unique web address (URL).
This is how a computer locates the web page that user is trying to find.
An example of a URL is: http://inqilabpatel.com/computer2210.html.
In this example
➢ “http” enables browser to know what protocol is being used to access information in the domain
➢ “ruknuddin.com” is called the domain name.
➢ "computer2210.html" refers to the specific page.

URL encoding:
Web addresses can be written using hexadecimal rather than denary. Hexadecimal codes are
preceded by a % sign. For example, the word “www.ruknuddin.com” is written as:
r u k n u d d i n
in hex %72 %75 %6B %6E %75 %64 %64 %69 %6E

w w w . r u k n u d d i n . c o m
%77 %77 %77 %2E %72 %75 %6B %6E %75 %64 %64 %69 %6E %2E %63 %6F %6D

Some characters are not allowed in URL. URL encoding converts characters into a format that can be
transmitted over the Internet.
For example
➢ %20 – is used in URL in place of <space> not allowed in a URL, %20 is the coding for a space (32
in denary)
➢ ? – separates the URL from all parameters or variables
e.g. for query to search Inqilabpatel in Google
https://www.google.com.pk/search?q=inqilab%20patel
here “q” is variable for query “?” separates it from URL
“https://www.google.com.pk/search”

while“%20” is used for the space between “inqilab” and “patel”

URL ?to separate %20 code for space


Variable from URL

HYPERTEXT MARK-UP LANGUAGE (HTML) is used when writing and developing web pages.
HTML isn’t a programming language but is simply a mark-up language. A mark-up language is used in
the processing, definition and presentation of text (for example, specifying the colour of the text).
HTML uses <tags> which are used to bracket a piece of code;
Example Question 2.4:

Consider the URL:


http://cie.org.uk/computerscience.html
(i) Give the meaning of the following parts of the URL.
http .......................................................................................................................................................
........................................................................................................................................................
cie.org.uk ...........................................................................................................................................
...................................................................................................................................................................
.....................................................................................................................................................
computerscience.html ........................................................................................................................
...................................................................................................................................................................
................................................................................................................................................ [3]
(ii) Sometimes the URL contains the characters %20 and ?.
Describe the function of these characters.
%20 ...................................................................................................................................................
............................................................................................................................................................
? .........................................................................................................................................................
....................................................................................................................................................... [2]
Domain Name Server (DNS):
Domain Name Servers (DNS) are the Internet's equivalent of a phone book. They maintain a directory
of domain names and translate them to Internet Protocol (IP) addresses.
1. User types URL of a website in web browser address bar.
2. The web browser sends the request of URL to DNS of internet service provider (ISP).
3. DNS searches the IP address of the URL.
4. URL is translated into machine friendly IP address by DNS.
5. The translated IP address is sent to browser.
6. Browser sends http get command to the server of the IP address where website is hosted.
7. The web server sends HTML data to the client web browser.
8. Web page is displayed on client’s browser.

1. User types inqilabpatel.com


2. Browser requests DNS to lookup IP address

DNS Server
3. DNS looks up IP address to browser

User

4. Browser makes HTTP Request to Web Server

Web Server 5. Web Server HTTP response in the form of html data

Example Question2.5:
(a) A web page offers a link for users to request another web page. The requested web page contains
HTML code.
Put each statement in the correct sequence by writing the numbers 1 to 5 in the right-hand column.

Statement Sequence
No
The requested web page is displayed on the client computer
The user clicks on the hyperlink and the web page is requested from the
web server
The requested web page content is transmitted to the client computer
The client computer processes the html code using the web browser
software
The web server locates the requested web page
0 9618/1 Specimen paper Q2 - SoW
2 Yvette runs a company that books walking holidays for groups of people. She has a website that
customers use to book the holidays.
(a) The website has a URL and an IPv6 address. Describe, using an example, the format of an IPv6
address.
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
.............................................................................................................................................................. [4]
(b) An IP address can be static or dynamic. Describe static and dynamic IP addresses.
Static .........................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
..................................................................................................................................................................
Dynamic ……………......................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
............................................................................................................................................................. [4]
(c) Yvette’s company has a LAN (Local Area Network) that has hybrid topology.
(i) Describe the characteristics of a LAN.
....................................................................................................................................................................
....................................................................................................................................................................
............................................................................................................................................................... [2]
(ii) The LAN has a range of different topologies. One subnetwork connects four computers and one
server set up as a star topology.
Describe how packets are transmitted between two of the computers in this subnetwork.
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
.......................................................................................................................................................... [3]
(d) The LAN has both wired and wireless connections.
(i) Ethernet cables connect the computers to the server.
Identify three other hardware components that might be used to set up the LAN.
1 ........................................................................................................................................
...........................................................................................................................................
2 ........................................................................................................................................
...........................................................................................................................................
3 ........................................................................................................................................
...................................................................................................................................... [3]
(ii) Describe how Carrier Sense Multiple Access/Collision Detection (CSMA/CD) manages collisions
during data transmission.
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
......................................................................................................................................................... [3]
0 9618/1 Specimen paper Q2 - SoW
1b 9618 S21 P12
5 (c) Seth accesses both software and data using cloud computing.
(i) Give two benefits of storing data using cloud computing.
1 ........................................................................................................................................
...........................................................................................................................................
2 ........................................................................................................................................
........................................................................................................................................... [2]
(ii) Give two drawbacks of Seth using cloud computing.
1 ........................................................................................................................................
...........................................................................................................................................
2 ........................................................................................................................................
........................................................................................................................................... [2]
5 (d) Draw one line from each term to its most appropriate description. [4]
Term Description
It is only visible to devices within the
Local Area Network (LAN)

It increments by 1 each time the device


Public IP address
connects to the internet

A new one is reallocated each time a


Private IP address
device connects to the internet

Dynamic IP address It can only be allocated to a router

It is visible to any device on the


Static IP address
internet

It does not change each time a device


connects to the internet
1b 9618 S21 P12
7a 9608/11 Jun 18 Q1, Q5a, b SoW
1 Four communication media and five features are shown.
Draw one or more lines from each communication media to the appropriate feature(s). [6]
Communication media Feature
Can be twisted pair or co-axial
Fibre-optic cable
Transmits light pulses
Radio waves
Large range of wavelengths
Copper cable
Least likely to have interference
Satellite
Wireless transmission
5 A college has a client-server network.
(a) The college has a file server and other servers.
State the purpose of two other servers in the college network.
Server 1 ....................................................................................................................................
Server 2
....................................................................................................................................[2]
(b) The students use the network to access the Internet.
One student stated, ‘The Internet and the World Wide Web are the same thing’.
Tick (✓) one box to indicate whether this statement is true or false.
True False

Justify your choice.


...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.....................................................................................................................................................
.................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[5]
5b 9608/12 Jun 17 Q6a, b
6 Downloading a file from a website is an example of a client-server application.
(a) Describe what is meant by the term client-server for this application.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.................................................................................................................................................[2]
(b) The following sequence of steps (1 to 5) describes what happens when someone uses
their personal computer (PC) to request a web page. The web page consists of HTML tags
and text content only. Four of the statements from A, B, C, D, E and F are used to complete
the sequence.
A Browser software interprets the script, renders the page and displays.
B Browser software renders the page and displays.
C Browser software compiles the script, renders the page and displays.
D The web server retrieves the page.
The Domain Name Service (DNS) uses the domain name from the browser to
E
look up the IP address of the web server.
F The web server sends the web page content to the browser.
Write one of the letters A to F in the appropriate row to complete the sequence.
1. The user keys in the Uniform Resource Locator (URL) into the browser software.
2. ....................................
3. ....................................
4. ....................................
5. .................................... [4]
8a 9608/11 Nov 18 Q2
2 Computer A needs to access a web page.
(a) State how Computer A could access the web page without using a Domain Name
Service(DNS).
.....................................................................................................................................................
.................................................................................................................................................[1]
(b) (i) The following table shows four IPv6 addresses. [4]
State if each address is valid or invalid.
IP address Valid or invalid
21E5:69AA:FFFF:1:E100:B691:1285:F56E
::255.255.255.255
59FB::1005:CC57:6571
56FE::2159:5BBC::6594
(ii) The following table shows four statements about either public or private IP addresses.
Tick ( ) one box in each row to indicate whether each statement refers to a public or a private
IP address. [4]
Statement Public Private
192.168.2.1 is an example of this type of address
Assigned by the Internet Service Provider (ISP)
IP address cannot be duplicated in different networks
Network Address Translation (NAT) is necessary to access the Internet directly
(c) One type of transmission media is copper cable. Give two additional types of transmission
media.
1 ................................................................................................................................................
2 .............................................................................................................................................[2]
8b 9608/12 Nov 18 Q2
2 Gopal types of the Uniform Resource Locator (URL) of a website into a web browser.
(a) The following sequence (1 to 5) describes the steps that take place. There are three
missing statements.
1 Gopal types into the web browser.
2 ......................................
3 DNS looks up the URL in table
4 ......................................
5 ......................................
Three statements A, B and C are used to complete the sequence.
A DNS finds corresponding IP address
B Web browser sends URL to Domain Name Service (DNS)
C DNS returns IP address to web browser
Write one of the letters A to C in the appropriate rows (2, 4 and 5) to complete the sequence.
[2]
(b) Describe the purpose of an IP address.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
..............................................................................................................................................[2]
(c) A telecommunications operator has installed fibre-optic cables in Gopal’s neighbourhood.
(i) Give three benefits of fibre-optic cable over copper cable.
1 ........................................................................................................................................
...........................................................................................................................................
2 ........................................................................................................................................
...........................................................................................................................................
3 ........................................................................................................................................
........................................................................................................................................... [3]
(ii) Give two drawbacks of fibre-optic cable over copper cable.
1 ........................................................................................................................................
...........................................................................................................................................
2 ........................................................................................................................................
........................................................................................................................................... [2]
3a 9608 Summer 16 Paper 31-32-33 - SoW
1 A Local Area Network (LAN) consists of four computers and one server. The LAN uses a
bus topology.
(a) Complete the diagram below to show how the computers and the File server are
connected. [2]
(b) Computer C sends a data packet to Computer A. Three statements are given below.
Tick (✓) to show whether each statement is true or false. [3]
Statement True False
Computer C uses the IP address of Computer A to indicate that the packet
is for Computer A.
Computer B can read the packet sent from Computer C to Computer A.
The File server routes the packet to Computer A.
(c) Computer A starts transmitting a packet to Computer C. At exactly the same time, the
Fileserver starts transmitting a packet to Computer D. This causes a problem.
(i) State the name given to this problem.
...........................................................................................................................................
.......................................................................................................................................[1]
(ii) Give three steps taken by both Computer A and the File server to allow them to transmit
their packets successfully.
Step 1 ................................................................................................................................
...........................................................................................................................................
Step 2 ................................................................................................................................
...........................................................................................................................................
Step 3 ................................................................................................................................
.......................................................................................................................................[3]
(d) Adding a switch to the LAN changes its topology. Explain how the use of a switch
removes the problem identified in part (c)(i).
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.........................................................................................................................................[4]
5a 9608/31 Jun 17 Q5aii - SoW
5 (a) A web browser is used to request and display a page stored on an internet web server.
Explain how each of the following items is used in this event.
(ii) Router: ...............................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
....................................................................................................................................... [2]
6a 9608/31 Nov 17 Q1 – SoW
1 A Local Area Network (LAN) consists of three computers, one server and a switch. The LAN
uses a star topology.
(a) Complete the following diagram to show how the computers, the server and the switch
could be connected. [1]

(b) There are four statements in the following table. For each statement, place a tick (✓) in
the appropriate column to indicate whether it is true or false. [4]
Statement True False
The server can send packets to Computer B and Computer C at the same
time.
The network software on each computer needs to include collision detection
and avoidance.
Computer B can read a packet sent from the server to Computer C.
Computer A can send a packet to Computer B and at the same time the
server can be sending a packet to Computer C.
(c) The LAN shown in part (a) will be connected to the Internet.
(i) A router will be attached to one of the devices on the LAN.
State the device used. Give a reason for your choice.
Device ........................................................................................................................................
Reason ......................................................................................................................................
.....................................................................................................................................................
.............................................................................................................................................. [2]
(ii) Explain why a router is required.
.....................................................................................................................................................
.....................................................................................................................................................
............................................................................................................................................... [2]
6a 9608/31 Nov 17 Q1 – SoW
6b 9608/32 Nov 17 Q1 - SoW
1 A Local Area Network (LAN) consists of three computers, one server and a router
connected to the Internet. The LAN uses a bus topology.
(a) Complete the following diagram to show how the computers, the server and the router
could be connected.
[2]

(b) There are four statements in the following table. For each statement, place a tick (3) in the
appropriate column to indicate whether it is true or false.
[4]
Statement True False
The server can send packets to Computer B and the router at the same time.
Computer C uses the IP address of a web server to send a request for a web page
on the web server.
Computer B can read a packet sent from Computer A to Computer C.
The server can read all incoming packets from the Internet.
(c) The user on Computer A and the user on Computer B are both using the Internet at the
same time. On a few occasions, Computer A and Computer B start transmitting packets to the
router at exactly the same time. This causes a problem called a collision.
(i) Explain what is meant by a collision in this context.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
..................................................................................................................................................[2
]
(ii) As a result of the collision, both Computer A and Computer B stop transmitting.
Computer A must carry out a number of steps to ensure the successful transmission of its
packet.
Give two of the steps.
Step 1 ................................................................................................................................
Step 2 ................................................................................................................................ [2]
(d) The LAN topology is redesigned.
(i) Describe the changes that could be made to the LAN topology to overcome the problem
identified in part (c).
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
.......................................................................................................................................[2]
(ii) Explain how the redesign has overcome the problem.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
.......................................................................................................................................[2]
6b 9608/32 Nov 17 Q1 - SoW
7a 9608/31 Jun 18 Q3a - SoW
3 Star and bus are two types of topology that can be used in a Local Area Network (LAN)

(a) (i) State one benefit and one drawback of the star topology.
Benefit .....................................................................................................................................................
.................................................................................................................................................................
Drawback ................................................................................................................................................
...........................................................................................................................................................[2]
(ii) State one benefit and one drawback of the bus topology.
Benefit .....................................................................................................................................................
.................................................................................................................................................................
Drawback ................................................................................................................................................
...........................................................................................................................................................[2]
7a 9608/31 Jun 18 Q3a - SoW
3a 9608 Summer 16 Paper 31-32-33 – SoW
1 A Local Area Network (LAN) consists of four computers and one server. The LAN uses a bus
topology.
(a) Complete the diagram below to show how the computers and the File server could be connected.
[2]

(b) Computer C sends a data packet to Computer A.


Three statements are given below. Tick (✓) to show whether each statement is true or false. [3]
Statement True False
Computer C uses the IP address of Computer A to indicate that the packet is for Computer A.
Computer B can read the packet sent from Computer C to Computer A.
The File server routes the packet to Computer A.

(c) Computer A starts transmitting a packet to Computer C. At exactly the same time, the Fileserver
starts transmitting a packet to Computer D. This causes a problem.
(i) State the name given to this problem.
...........................................................................................................................................
....................................................................................................................................... [1]
(ii) Give three steps taken by both Computer A and the File server to allow them to transmit their
packets successfully.
Step 1 ................................................................................................................................
...........................................................................................................................................
Step 2 ................................................................................................................................
...........................................................................................................................................
Step 3 ................................................................................................................................
....................................................................................................................................... [3]

(d) Adding a switch to the LAN changes its topology. Explain how the use of a switch removes the
problem identified in part (c)(i).
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
................................................................................................................................................. [4]
Unit 3 Hardware
Topic You should be able to R A G
• Understand the need for and the operation of input, output and
storage devices including embedded systems
Hardware
• Understand and use logic gates with a maximum of two inputs
• Construct logic circuits, truth tables and logic expressions

System
A system is an arrangement in which all its unit assemble work together according to a set of rules and
all its subcomponents depend on each other.
Embedded System
As its name suggests, Embedded means something that is attached to
another thing.
In an embedded system, microprocessor is installed in different devices so as they can be programmed.
Smart phones, tablet and computers are used to set values in these devices and to control them.
Embedded system may or may not be connected with internet.
The Internet of things (IoT) describes the network of physical
objects—“things”—that are embedded with sensors, software,
and other technologies for the purpose of connecting and
exchanging data with other devices and systems over
the Internet.
Memory cache – high speed memory external to processor
which stores data which the processor will need again.
Random access memory (RAM) – primary memory unit that can be written to and read from.
Read-only memory (ROM) – primary memory unit that can only be read from.
Dynamic RAM (DRAM) – type of RAM chip that needs to be constantly refreshed.
Static RAM (SRAM) – type of RAM chip that uses flip-flops and does not need refreshing.
Refreshed – requirement to charge a component to retain its electronic state.
Programmable ROM (PROM) – type of ROM chip that can be programmed once.
Erasable PROM (EPROM) – type of ROM that can be programmed more than once using ultraviolet
(UV) light.
Hard disk drive (HDD) – type of magnetic storage device that uses spinning disks.
Latency – the lag in a system; for example, the time to find a track on a hard disk, which depends on
the time taken for the disk to rotate around to its read-write head.
Fragmented – storage of data in non-consecutive sectors; for example, due to editing and deletion of
old data.
Removable hard disk drive – portable hard disk drive that is external to the computer; it can be
connected via a USB part when required; often used as a device to back up files and data.
Solid state drive (SSD) – storage media with no moving parts that relies on movement of electrons.
Electronically erasable programmable read-only memory (EEPROM) – read-only (ROM) chip that can
be modified by the user, which can then be erased and written to repeatedly using pulsed voltages.
Flash memory – a type of EEPROM, particularly suited to use in drives such as SSDs, memory cards
and memory sticks.
Optical storage – CDs, DVDs and Blu-rayTM discs that use laser light to read and write data.
Dual layering – used in DVDs; uses two recording layers.
Birefringence – a reading problem with DVDs caused by refraction of laser light into two
beams.
Binder 3D printing – 3D printing method that uses a two-stage pass; the first stage uses dry powder
and the second stage uses a binding agent.
Direct 3D printing – 3D printing technique where print head moves in the x, y and z
directions. Layers of melted material are built up using nozzles like an inkjet printer.
Digital to analogue converter (DAC) – needed to convert digital data into electric currents that can
drive motors, actuators and relays, for example.
Analogue to digital converter (ADC) – needed to convert analogue data (read from sensors, for
example) into a form understood by a computer.
Organic LED (OLED) – uses movement of electrons between cathode and anode to produce an on-
screen image. It generates its own light so no back lighting required.
Screen resolution – number of pixels in the horizontal and vertical directions on a
television/computer screen.
Touch screen – screen on which the touch of a finger or stylus allows selection or manipulation of a
screen image; they usually use capacitive or resistive technology.
Capacitive – type of touch screen technology based on glass layers forming a capacitor, where fingers
touching the screen cause a change in the electric field.
Resistive – type of touch screen technology. When a finger touches the screen, the glass layer
touches the plastic layer, completing the circuit and causing a current to flow at that point.
Virtual reality headset – apparatus worn on the head that covers the eyes like a pair of goggles. It
gives the user the ‘feeling of being there’ by immersing them totally in the virtual reality experience.
Sensor – input device that reads physical data from its surroundings

Key terms
Memory cache – high speed memory external to processor which stores data which the processor will
need again.
Random access memory (RAM) – primary memory unit that can be written to and read from.
Read-only memory (ROM) – primary memory unit that can only be read from.
Dynamic RAM (DRAM) – type of RAM chip that needs to be constantly refreshed.
Static RAM (SRAM) – type of RAM chip that uses flip-flops and does not need refreshing.
Refreshed – requirement to charge a component to retain its electronic state.
Programmable ROM (PROM) – type of ROM chip that can be programmed once.
Erasable PROM (EPROM) – type of ROM that can be programmed more than once using ultraviolet
(UV) light.
Hard disk drive (HDD) – type of magnetic storage device that uses spinning disks.
Latency – the lag in a system; for example, the time to find a track on a hard disk, which depends on
the time taken for the disk to rotate around to its read-write head.
Fragmented – storage of data in non-consecutive sectors; for example, due to editing and deletion of
old data.
Removable hard disk drive – portable hard disk drive that is external to the computer; it can be
connected via a USB part when required; often used as a device to back up files and data.
Solid state drive (SSD) – storage media with no moving parts that relies on movement of electrons.
Electronically erasable programmable read-only memory (EEPROM) – read-only (ROM) chip that can
be modified by the user, which can then be erased and written to repeatedly using pulsed voltages.
Flash memory – a type of EEPROM, particularly suited to use in drives such as SSDs, memory cards
and memory sticks.
Optical storage – CDs, DVDs and Blu-rayTM discs that use laser light to read and write data.
Dual layering – used in DVDs; uses two recording layers.
Birefringence – a reading problem with DVDs caused by refraction of laser light into two beams.
Binder 3D printing – 3D printing method that uses a two-stage pass; the first stage uses dry powder
and the second stage uses a binding agent.
Direct 3D printing – 3D printing technique where print head moves in the x, y and z directions. Layers
of melted material are built up using nozzles like an inkjet printer.
Digital to analogue converter (DAC) – needed to convert digital data into electric current.
Analogue to digital converter (ADC) – needed to convert analogue data (read from sensors, for
example) into a form understood by a computer.
Organic LED (OLED) – uses movement of electrons between cathode and anode to produce an on-
screen image. It generates its own light so no back lighting required.
Screen resolution – number of pixels in the horizontal and vertical directions on a
television/computer screen.
Touch screen – screen on which the touch of a finger or stylus allows selection or manipulation of a
screen image; they usually use capacitive or resistive technology.
Capacitive – type of touch screen technology based on glass layers forming a capacitor, where fingers
touching the screen cause a change in the electric field.
Resistive – type of touch screen technology. When a finger touches the screen, the glass layer
touches the plastic layer, completing the circuit and causing a current to flow at that point.
Virtual reality headset – apparatus worn on the head that covers the eyes like a pair of goggles. It
gives the user the ‘feeling of being there’ by immersing them totally in the virtual reality experience.
Sensor – input device that reads physical data from its surroundings.

Logic proposition: a statement that is either TRUE or FALSE


Problem statement: an informal definition of an outcome which is dependent on one logic
proposition or a combination of two or more logic propositions
Logic expression: logic propositions combined using Boolean operators, which may be equated to a
defined outcome
Logic gates – a component of a logic circuit that has an operation matching that of a Boolean
operator. It is an electronic circuits which rely on ‘on/off’ logic. The most common ones are NOT,
AND, OR, NAND, NOR and XOR.
Logic circuit – formed from a combination of logic gates and designed to carry out a particular task.
The output from a logic circuit will be 0 or 1.
Truth table – a method of checking the output from a logic circuit. They use all the possible binary
input combinations depending on the number of inputs; for example, two inputs have 22 (4) possible
binary combinations, three inputs will have 23 (8) possible binary combinations, and so on.
Boolean algebra – a form of algebra linked to logic circuits and based on TRUE and FALSE.

INPUT OR AND NAND NOR XOR

A B

X=A + B X=A . B X = ̅̅̅̅̅̅


𝑨 .𝑩 X = ̅̅̅̅̅̅̅̅̅
𝑨+ 𝑩 A⊕B
0 0 0 0 1 1 0
0 1 1 0 1 0 1
1 0 1 0 1 0 1
1 1 1 1 0 0 0

0 9618/1 Specimen paper Q4, 5 - SoW


4 A cake factory uses machines to make cakes .
(a) Complete the following descriptions of types of system. Write the correct missing term in
the spaces.
The factory uses a .................................................. system to record data such as the number
of cakes being produced each hour.
When the data collected from sensors are analysed and used as
.................................................. it is a .................................................. system. One example
of this system, used in the factory, is to maintain a constant temperature in the ovens. It uses
a .................................................. to measure the values. [4]
(b) Cake mixture is mixed in a large pot. A conveyer belt moves the cake tins beneath the pot.
The conveyer belt stops and a set quantity of the cake mixture fills the cake tin. The conveyer
belt then moves and another cake tin is positioned beneath the pot.
Explain how the control system will ensure the correct amount of mixture is placed in the cake
tins.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
......................................................................................................................[5]
(c) The cake factory has servers that store its confidential recipes and control the factory
machines.
(i) Describe the implications of a hacker gaining access to the cake factory’s servers.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.................................................................................................................................. [4]
(ii) Explain how the company could protect its data against hackers.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.......................................................................... [4]
(d) The machines have a counter to record the number of cake tins filled. Each time a cake tin
is filled, the counter is increased by 1. The value is stored in an 8-bit register, the current
value is shown.
0 0 0 0 1 0 0 1
(i) Show the value of the binary number after another five cake tins have been filled. [1]

(ii) The following table shows some assembly language instructions for a processor which
has one general purpose register, the Accumulator (ACC).
Instruction
Op Explanation
Operand
code
AND #n Bitwise AND operation of the contents of ACC with the operand
Bitwise AND operation of the contents of ACC with the contents of
AND <address>
<address>
XOR #n Bitwise XOR operation of the contents of ACC with the operand
Bitwise XOR operation of the contents of ACC with the contents of
XOR <address>
<address>
OR #n Bitwise OR operation of the contents of ACC with the operand
OR <address> Bitwise OR operation of the contents of ACC with the contents of <address>
Bits in ACC are shifted logically n places to the left. Zeros are introduced on
LSL #n
the right hand end
Bits in ACC are shifted logically n places to the right. Zeros are introduced
LSR #n
on the left hand end.
At the end of each day, the register is reset to 0. Write the assembly language statement to
reset the register to 0.
.....................................................................................................................................................
.......................................................................................................................................... [2]
(iii) A two-place logical shift to the left is performed on the binary number shown in part (d).
Show the result of this logical shift. [1]
(iv) State the mathematical result of a one-place logical shift to the right on a binary
number.
.....................................................................................................................................................
............................................................................................................................ [1]
(e) The factory servers run software that makes use of Artificial Intelligence (AI).
Explain how the use of AI can help improve the safety and efficiency of the factory.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.............................................................................................................................................. [3]
5 (a) Draw a logic circuit diagram for the logic expression:
X = NOT (A OR B OR C) OR (B AND C AND D) [4]

(b) Complete the truth table for the logic expression: [4]
X = (A XOR B) OR NOT (A OR B OR C)
Working
A B C X
space
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
1b 9618 S21 P12
3 A logic expression is given:
S = (A AND B AND C) OR (B XOR C)
(a) Draw the logic circuit for the given expression. [4]

(b) Complete the truth table for the logic expression: [2]
S = (A AND B AND C) OR (B XOR C)
A B C Working space S
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
3a 9608/31 Jun 16 Q6 – SoW
6 An intruder detection system for a large house has four sensors. An 8-bit memory location
stores the output from each sensor in its own bit position. The bit value for each sensor
shows:
• 1 – the sensor has been triggered
• 0 – the sensor has not been triggered
The bit positions are used as follows:

The output from the intruder detection system is a loud alarm.

(a) (i) State the name of the type of system to which intruder detection systems belong.
....................................................................................................................................... [1]
(ii) Justify your answer to part (i).
.....................................................................................................................................................
............................................................................................................................. [1]
(b) Name two sensors that could be used in this intruder detection system. Give a reason for
your choice.
Sensor 1 ...................................................................................................................................
Reason .....................................................................................................................................
...................................................................................................................................................
Sensor 2 ...................................................................................................................................
Reason .....................................................................................................................................
...............................................................................................................................................[4]
The intruder system is set up so that the alarm will only sound if two or more sensors have
been triggered. An assembly language program has been written to process the contents of
the memory location. The table shows part of the instruction set for the processor used.
Instruction
Explanation
Op code Operand
LDD <address> Direct addressing. Load the contents of the given address to ACC
STO <address> Store the contents of ACC at the given address
INC <register> Add 1 to the contents of the register (ACC or IX)
ADD <address> Add the contents of the given address to the contents of ACC
Bitwise AND operation of the contents of ACC with the contents of
AND <address>
<address>
CMP #n Compare the contents of ACC with the number n
JMP <address> Jump to the given address
Following a compare instruction, jump to <address> if the compare
JPE <address>
was True
Following a compare instruction, jump to <address> if the content of
JGT <address>
ACC is greater than the number used in the compare instruction
END End the program and return to the operating system
(c) Part of the assembly code is:
Op code Operand
SENSORS: B00001010
COUNT: 0
VALUE: 1
LOOP: LDD SENSORS
AND VALUE
CMP #0
JPE ZERO
LDD COUNT
INC ACC
STO COUNT
ZERO: LDD VALUE
CMP #8
JPE EXIT
ADD VALUE
STO VALUE
JMP LOOP
EXIT: LDD COUNT
TEST: CMP …
JGT ALARM
(i) Dry run the assembly language code. Start at LOOP and finish when EXIT is reached.[4]
BITREG COUNT VALUE ACC
B00001010 0 1

(ii) The operand for the instruction labeled TEST is missing. State the missing operand.
....................................................................................................................................... [1]
(iii) The intruder detection system is improved and now has eight sensors.
One instruction in the assembly language code will need to be amended.
Identify this instruction .......................................................................................................
Write the amended instruction ...................................................................................... [2]
5a 9608/12 Jun 17 Q2 – SoW
2 (a) The first column of the following table gives features of different types of printer.
Put a tick (3) in the cells to show which features describe a laser and an inkjet printer. [2]
Type of printer
Laser Inkjet
Impact printer
Non-impact printer
Line printer
Page printer
(b) Two of the components of an inkjet printer are a stepper motor and a print head.(c) A
student has an old working laptop computer. It has a small capacity internal disk drive with
almost all the storage space taken up by the operating system and application programs. She
needs to buy an external storage device to store her data files.
(i) List two suitable devices.
Device 1 ............................................................................................................................
Device 2 ............................................................................................................................[2]
(ii) Describe one advantage of choosing one of the devices.
Advantage of choosing device 1 / 2 (circle)
...........................................................................................................................................
.......................................................................................................................................[1]
Describe how each component is used when printing a page.
(i) Print head ..........................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
.......................................................................................................................................[5]
(ii) Stepper motor
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
...............................................................................................................................................[2]
5c 9608/13 Jun 17 Q2- SoW
2(a) (i) The following sequence of steps (1 to 7) describe how a single page is printed on a
laser printer.
The statements A, B, C and D are used to complete the sequence.
The paper passes through a fuser, which heats up the paper. The toner melts and
A
forms a permanent image on the paper.
B The electrical charge is removed from the drum and the excess toner is collected.
C The image is converted on the drum into an electrostatic charge.
The oppositely-charged paper picks up the toner particles from the drum. After
D
picking up the toner, the paper is discharged to stop it clinging to the drum.
Complete the sequence by writing one of the letters A, B, C or D on the appropriate row.
1. A laser beam and a rotating mirror are used to draw an image of the page on the
photosensitive drum.
2. .........................
3. Electrostatic charge attracts toner.
4. The charged paper is rolled against the drum.
5. .........................
6. .........................
7. ......................... [3]
(ii) A computer user has a laser printer to print letters and documents. The user also prints
digital photographs taken using a digital camera.
State the most suitable type of printer for printing the photographs.
.......................................................................................................................................[1]
(b) The user is considering the purchase of a new laptop computer. She has read many
product reviews and knows that there are different types of internal secondary storage
available.
List two options for internal secondary storage.
Option 1 ....................................................................................................................................
Option 2 ....................................................................................................................................
Describe one advantage of one of the options.
Advantage of choosing option 1 / 2 (circle)
...................................................................................................................................................
...............................................................................................................................................[3]
6a 9608/11 Nov 17 Q5 - SoW
5 A Personal Computer (PC) has a number of input and output devices.
(a) (i) Name three components of a speaker.
1 .................................................................................................................................................
2 .................................................................................................................................................
3 ............................................................................................................................................ [3]
(ii) Explain the basic internal operation of a speaker.
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
............................................................................................................................................................. [4]
(b) (i) The user is considering the purchase of a removable device for secondary storage.
Name one suitable device.................................................................................................................. [1]
(ii) Describe two possible uses for this device on a home Personal Computer (PC).
1 ................................................................................................................................................................
..................................................................................................................................................................
2 ................................................................................................................................................................
............................................................................................................................................................. [2]
6b 9608/12 Nov 17 Q6 - SoW
6 (a) A personal computer (PC) is extensively used for a wide range of applications, including
the three shown in the following table. Write in the table, a suitable input device, output
device, or both needed for each application.
Do not give a monitor, keyboard or mouse in your answers. [3]
Input Output
Application
device device
Capture the text from a paper document, in order that the text can be
word processed
Producing a replica of a small plastic component from a washing machine
A museum has interactive information facilities throughout the building
(b) Explain the basic internal operation of a hard disk drive.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
............................................................................................................................................[4]
7a 9608 S18 P11
4 (a) An alarm system (X) is enabled and disabled using either a switch (A) or a remote
control (B). There are two infra-red sensors (C, D) and one door pressure sensor (E).
Parameter Description ofparameter Binary value Condition
1 Switch enabled
A Switch
0 Switch disabled
1 Remote enabled
B Remote control
0 Remote disabled
1 Activated
C Infra-red sensor
0 Not activated
1 Activated
D Infra-red sensor
0 Not activated
Door pressure 1 Activated
E
sensor 0 Not activated
The alarm sounds (X = 1) if the alarm is enabled and any one or more of the sensors is
activated. Draw a logic circuit to represent the alarm system. [3]

(b) Complete the truth table for the logic expression: X = A OR (B XOR C) [4]
A B C Working space X
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
7 A student plays computer games on a games console.
(a) Identify two input devices and one output device used in a games console.
Input device 1 ...........................................................................................................................
Input device 2 ...........................................................................................................................
Output device .........................................................................................................................[3]

(b) The games console has random access memory (RAM) and read only memory (ROM).
(i) State two differences between RAM and ROM.
Difference 1 .......................................................................................................................
...........................................................................................................................................
Difference 2 .......................................................................................................................
........................................................................................................................................... [2]

(ii) Give one use for RAM in the games console.


.....................................................................................................................................................
................................................................................................................................................[1]

(iii) Give one use for ROM in the games console.


.....................................................................................................................................................
................................................................................................................................................[1]
7b 9608 S18 P12
2 (a) A greenhouse control system has four input parameters (H, D, T, W) and two outputs (X,
Y).
Parameter Description ofparameter Binary value Condition
0 Too low
H Humidity
1 Acceptable
0 Night
D Day
1 Day
0 Too high
T Temperature
1 Acceptable
0 Closed
W Windows
1 Open
The watering system turns on (X = 1) if:
either it is daytime and the temperature is too high
or the humidity is too low.
The fan turns on (Y = 1) if the temperature is too high and the windows are closed.
Draw a logic circuit to represent the greenhouse control system. [6]

(b) Complete the truth table for the logic expression: X = NOT A AND (B NAND C) [4]
A B C Working space X
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
8a 9608/11 Nov 18 Q1a - SoW
1 A student is creating a short video and needs to record music to play in the background.
(a) The student uses a microphone to capture the music.
Explain how the microphone captures the music.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
...............................................................................................................................................[3]
5a 9608/31 Jun 17 Q3a, b, 6 - SoW
3 Consider the following logic circuit, which contains a redundant logic gate.

(a) Write the Boolean algebraic expression corresponding to this logic circuit.
X = ........................................................................................................................................[3]
(b) Complete the truth table for this logic circuit. [2]
A B C Working space X
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
6 A computer system is used to manage some of the functions in a vehicle. The vehicle has a
number of sensors and actuators. One sensor is used to monitor the moisture on the screen.
If the moisture exceeds a pre-set value, the windscreen wiper motor turns on automatically.
The software used in the computer system is dedicated to the sensor management functions.
When the system starts, the software runs some initial tasks. It then loops continuously until
the system is switched off.
(a) (i) State the name given to the type of system described.
....................................................................................................................................... [1]
(ii) Explain your answer to part (i).
.....................................................................................................................................................
............................................................................................................................. [1]
(b) Within the software loop, the value of each sensor is read in turn. The value read from the
sensor is then processed.
State two drawbacks with this method of reading and processing sensor data.
Drawback 1 ...............................................................................................................................
...................................................................................................................................................
Drawback 2 ...............................................................................................................................
..............................................................................................................................................[2]
(c) An alternative method of reading and processing sensor data is to use interrupts. Each
sensor is connected so that it can send an interrupt signal to the processor if its value
changes. On receipt of an interrupt signal, the processor carries out a number of steps as
shown in the following diagram.
(i) State the purpose of step 1.
…………………............................................................................................................................
.....................................................................................................................................................
............................................................................................................................................ [1]
(ii) State the purpose of step 6.
.....................................................................................................................................................
.....................................................................................................................................................
................................................................................................................................................ [1]
(iii) Explain how the current task is saved in step 2.
.....................................................................................................................................................
.....................................................................................................................................................
............................................................................................................................................... [2]
(iv) State two benefits of using interrupts to read and process the sensor data.
Benefit 1 ....................................................................................................................................
..................................................................................................................................................
Benefit 2 ...................................................................................................................................
........................................................................................................................................... [2]
(v) The interrupt handler in step 3 has to test each bit of a 16-bit register to discover the
source of the interrupt.
The contents of the 16-bit register are loaded into the 16-bit accumulator:

An instruction is required to achieve the following:


• If bit 9 is zero, set the accumulator to zero.
• If bit 9 is one, set the accumulator to a non-zero value.
Write this instruction using an appropriate bitwise operation.
....................................................................................................................................... [2]
5b 9608/32 Jun 17 Q3a, b Q6 - SoW
3 A logic circuit is shown:

(a) Write the Boolean algebraic expression corresponding to this logic circuit:
S = ........................................................................................................................................[4]
(b) Complete the truth table for this logic circuit: [2]
Working space
P Q R S

0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
6 A large office building has many floors. On each floor there are security sensors and
security cameras. There is the same number of sensors on each floor. The building has a
single security room. The images from the security cameras are output on monitors (one
monitor for each floor) placed in the security room.
The data from the sensors are read and processed by a computer system. Sensor readings
and warning messages can be displayed on the monitors.
(a) (i) State the name given to the type of system described.
.......................................................................................................................................[1]
(ii) Explain your answer to part (i).
.....................................................................................................................................................
..............................................................................................................................................[1]
(iii) State two sensors that could be used in this system.
Sensor 1 ............................................................................................................................
Sensor 2 ............................................................................................................................ [2]
(b) A software routine:
• checks the readings from the sensors
• outputs readings and warning messages to the monitors
• loops continuously.
The routine uses the following pseudocode variables:
Identifier Data type Description
FloorCounter INTEGER Loop counter for number of floors
SensorCounter INTEGER Loop counter for number of sensors
NumberOfFloors INTEGER Stores the number of floors
NumberOfSensors INTEGER Stores the number of sensors
ForEver BOOLEAN Stores value that ensures continuous loop
(i) Complete the following pseudocode algorithm for the routine.
01 ForEver ...............................................................................................................
02 REPEAT
03 FOR FloorCounter1 TO NumberOfFloors
04 FOR SensorCounter 1 TO
......................................................................
05 READ Sensor(SensorCounter)on Floor(FloorCounter)
06 IF Sensor value outside range
07 THEN
08 OUTPUT “Problem on Floor ”, FloorCounter
09 ENDIF
10 ENDFOR
11 ENDFOR
12 //
13 // Delay loop
14 // Delay loop
15 //
16 UNTIL
.........................................................................................................................[3]
(ii) A delay needs to be introduced before the loop is processed again.
Write a FOR loop, in pseudocode, to replace lines 13 and 14.
...........................................................................................................................................
.......................................................................................................................................[1]
(iii) Give a reason for this delay in the system.
...........................................................................................................................................
.......................................................................................................................................[1]
(c) An alternative method of reading and processing sensor data is to use interrupts. Each
sensor is connected so that it can send an interrupt signal to the processor if its value
changes.
On receipt of an interrupt signal, the processor carries out a number of steps as shown in the
following diagram.

(i) State the purpose of step 3.


...........................................................................................................................................
.......................................................................................................................................[1]
(ii) Explain what happens at step 4.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
.................................................................................................................
6a 9608/31 Nov 17 Q5ai Q6a, b - SoW
6 A large warehouse stores goods that must be kept above a temperature of 15 degrees
Celsius. The warehouse has six temperature sensors which are each placed at a different
location in the warehouse. A computer system is programmed to turn on appropriate heaters
when one of the sensors is below the minimum temperature.
(a) (i) State the name given to the type of system described.
...................................................................................................................................... [1]
(ii) Justify your answer to part (i).
...........................................................................................................................................
...................................................................................................................................... [1]
(b) Sensors and heaters are two types of device used in this system.
State two other devices that are used. Justify your choice.
Device 1 ....................................................................................................................................
Justification ...............................................................................................................................
...................................................................................................................................................
Device 2 ....................................................................................................................................
Justification ...............................................................................................................................
.............................................................................................................................................. [4]
(c) The computer system stores the temperature readings for the six sensors in six 8-bit
memory locations.
Six of the bits in an 8-bit register, LOWREG, are used to indicate whether a particular reading
is below the minimum temperature. A value of 1 means the reading is below the minimum
temperature. For example:
This pattern of bits in LOWREG shows that sensor 5, sensor 4 and sensor 1 have readings
below the minimum temperature.
The following table shows part of the instruction set for a processor which has one general
purpose register, the Accumulator (ACC), and an Index Register (IX).
Instruction Explanation
Op code Operand
LDD <address> Direct addressing. Load the contents of the given address to ACC.
LDR #n Immediate addressing. Load the number n to IX.
Indexed addressing. Form the address from <address> + the contents of the
LDX <address>
index register. Copy the contents of this calculated address to ACC.
STO <address> Store the contents of ACC at the given address.
INC <register> Add 1 to the contents of the register (ACC or IX).
ADD <address> Add the contents of the given address to the ACC.
OR <address> Bitwise OR operation of the contents of ACC with the contents of address.
CMP #n Compare the contents of ACC with number n.
CMP <address> Compare the contents of ACC with the contents of <address>.
JMP <address> Jump to the given address.
JPE <address> Following a compare instruction, jump to <address> if the compare was True.
Following a compare instruction, jump to <address> if the content of ACC is
JGE <address>
greater than or equal to the number used in the compare instruction.
Part of the assembly language code for updating LOWREG is:
Label Op code Operand
LOWTEMP: 15
LOWREG: B00000000
COUNTER: 1
START: LDR #0
LOOP: LDX 8000
CMP LOWTEMP
JGE TEMPOK
LDD LOWREG
OR COUNTER
STO LOWREG
TEMPOK: LDD COUNTER
Q1: CMP #32
JPE HEATON
ADD COUNTER
STO COUNTER
INC IX
JMP LOOP
HEATON: LDD LOWREG
(i) The code uses six memory locations to store the temperature readings. It stores readings
for sensors 1 to 6 at addresses 8000 to 8005.
At a particular time, the memory locations store the following data.
8000 8001 8002 8003 8004 8005
17 14 15 15 16 14
Dry run the assembly language code starting at START and finishing when the loop has been
processed twice. [4]

LOWTEMP LOWREG COUNTER ACC IX


15 B00000000 1

(ii) Explain why the operand of the instruction labelled Q1 has the value 32.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.............................................................................................................................................. [2]
(iii) The code beginning at the instruction labelled HEATON must make the system turn on
the heaters in those areas that are below the minimum temperature.
Describe what this code will have to do.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
................................................................................................................................................ [3]
6b 9608/32 Nov 17 -Q6 – SoW
6 The environment in a very large greenhouse is managed by a computer system. The
system uses a number of different sensors that include temperature sensors. In addition, the
system controls a number of heaters, windows and sprinklers.
(a) State one other type of sensor that could be used with this system.
Justify your choice.
Sensor ......................................................................................................................................
Justification ...............................................................................................................................
..............................................................................................................................................[2]
(b) Describe why feedback is important in this system.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
...............................................................................................................................................[3]
(c) (i) The system makes use of a number of parameters. These parameters are used in the
code that runs the system.
State one of the parameters used in controlling the temperature in the greenhouse.
.......................................................................................................................................[1]
(ii) Explain how the parameter identified in part (c)(i) is used in the feedback process.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.............................................................................................................................................[2]
(d) There are eight temperature sensors numbered 1 to 8. Readings from these sensors are
stored in four 16-bit memory locations. The memory locations have addresses from 4000 to
4003. Each memory location stores two sensor readings as two unsigned binary integers.
Sensor 1 reading is stored in bits 8 to 15 of address 4000; Sensor 2 reading is stored in bits 0
to 7 of address 4000 and so on. The diagram shows that the current sensor 1 reading has a
value of 97.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
4000 0 1 1 0 0 0 0 1 0 0 1 1 1 0 0 1
4001 1 1 0 0 0 0 0 0 1 0 1 0 0 0 0 0
4002 0 0 0 1 0 1 0 0 0 0 0 0 1 1 0 1
4003 1 0 0 0 0 0 1 0 1 1 0 0 0 1 0 1
(i) Give the denary value of the current reading for Sensor 5.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
.......................................................................................................................................[1]
(ii) The following table shows part of the instruction set for a processor. The processor has
one general purpose register, the Accumulator (ACC).
Instruction
Explanation
Op code Operand
Direct addressing. Load the contents of the location at the given
LDD <address>
address to ACC.
AND #n Bitwise AND operation of the contents of ACC with the operand.
Bitwise AND operation of the contents of ACC with the contents of
AND <address>
<address>.
XOR #n Bitwise XOR operation of the contents of ACC with the operand.
Bitwise XOR operation of the contents of ACC with the contents of
XOR <address>
<address>.
OR #n Bitwise OR operation of the contents of ACC with the operand.
Bitwise OR operation of the contents of ACC with the contents of
<address>.
OR <address>

<address> can be an absolute address or a symbolic address.


Bits in ACC are shifted n places to the left. Zeros are introduced on the
LSL #n
right hand end.
Bits in ACC are shifted n places to the right. Zeros are introduced on the
LSR #n
left hand end.
The reading for Sensor 5 is used in a calculation. The calculation is carried out by two
assembly language instructions. The first instruction loads the contents of the 16-bit location
that contains the value for Sensor 5.
The second instruction moves the bits in Sensor 5 so that the 16-bit value is the value of
Sensor 5.
Complete the two instructions in the following code. Use the instruction set provided.

LDD ............................ // load the contents of the 16-bit location containing the
value for Sensor 5 into the Accumulator
.................................... // move the bits in the Accumulator so that the
Accumulator stores the value of Sensor 5 as an
unsigned 16-bit binary integer [3]
7a 9608 P31 Q7
Q 7 A museum stores antique items that need to be kept at constant temperature.
The museum is not sure about the actual temperatures. The museum installs some
equipment. This records the temperatures every hour and ensures the temperature stays
within a set range.
(a) Identify the type of system described.
...............................................................................................................................................[1]
(b) The system has a temperature sensor. Identify two other items of hardware that the
museum can use for the type of system identified. Describe the purpose of each item.
Item 1 ........................................................................................................................................
Purpose ....................................................................................................................................
...................................................................................................................................................
Item 2 ........................................................................................................................................
Purpose ....................................................................................................................................
...............................................................................................................................................[4]
(c) The equipment records the temperature in all seven rooms in the museum.
Each recording is stored as two successive bytes in memory. The format is as shown.
Temperature Room
7 6 5 4 3 2 1 0

Byte 1 Byte 2
The room is indicated by the setting of one of the bits in Byte 2 to 1. For example, room 7 is
indicated by setting bit 7 to 1. Bit 0 of Byte 2 is a flag:
• The flag’s initial value is zero.
• When the reading has been processed, the flag’s value is set to 1.
Byte 1 contains the temperature reading as an unsigned integer.
One reading returns the following binary data.
Temperature Room
7 6 5 4 3 2 1 0
1 0 1 1 0 0 1 1 0 0 1 0 0 0 0 1
Byte 1 Byte 2
(i) Analyse the data contained in the two bytes.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
......................................................[3]
(ii) The system receives a temperature reading of 238 from room number 4. [2]
Complete the bytes to show the two bytes for this recording. The reading has not yet been
processed.

7 6 5 4 3 2 1 0

Byte 1 Byte 2
7b 9608 S18 P32
6 (a) There are five scenarios on the left and two types of system on the right.
Draw a line to link each scenario to its correct type of system. [2]
Scenario System
Car speed display

Aero plane autopilot Control

Rollercoaster

Recording the rainfall at a Monitoring


weather station

Robot loading a part on to a


conveyor belt
(b) Mary has six fish tanks. The temperature of the water in each tank needs to be within a
specific range. Identify three items of hardware that Mary can add to her tanks to help
maintain the temperature. Describe the purpose of each item.
Item 1 .........................................................................................................................................
Purpose .......................................................................................................................................
....................................................................................................................................................
Item 1 .........................................................................................................................................
Purpose .......................................................................................................................................
....................................................................................................................................................
Item 3 ........................................................................................................................................
Purpose ....................................................................................................................................
...............................................................................................................................................[6]
(c) A temperature reading is taken from each tank once per minute. The temperature reading
is stored as two successive bytes. The format is shown:
Fish tank Temperature reading
7 6 5 4 3 2 1 0

Byte 1 Byte 2
The fish tank number is indicated by setting one of the bits in Byte 1 to 1. For example, fish
tank number 5 is indicated by setting bit 5 to 1.
Bit 7 of Byte 1 is a flag:
• the flag’s initial value is zero
• when the reading has been processed, the flag’s value is set to 1
Bit 0 of Byte 1 is unused.
Byte 2 contains the temperature reading as a two’s complement integer.
(i) After a temperature reading has been taken, the bytes contain the following data.
7 6 5 4 3 2 1 0
0 0 0 0 1 0 0 0 0 0 0 0 1 0 1 1
Byte 1 Byte 2
Analyse the data contained in the two bytes.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
....................................................................[3]
(ii) The system receives a temperature reading of -2 from fish tank number 4.
Complete the bytes to show the values for this reading after it has been processed. [2]
7 6 5 4 3 2 1 0

Byte 1 Byte 2
(d) A hardware device to affect the temperature of each tank is on or off depending on the
value of a bit in memory location 6753.
If bit 4 is 1, then the hardware device in fish tank 4 is on.
Write assembly language instructions to set bit 4 of memory location 6753 to 1 without
changing any other bits. Use the instruction set provided.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
....................................................................[3]

Marking Schemes
3a 9608/31 Jun 16 Q6 – SoW
0 9618/1 Specimen paper Q4, 5 - SoW
5b 9608/32 Jun 17 Q3a, b, Q6a - SoW
5a 9608/11 Jun 17 Q2 – SoW
5c 9608/13 Jun 17 Q2- SoW
5b 9608/12 Jun 17 Q2 - SoW
6a 9608/11 Nov 17 Q5 - SoW
6b 9608/12 Nov 17 Q6 - SoW
7a 9608 S18 P11

7b 9608 S18 P12

8a 9608/11 Nov 18 Q1a - SoW


7b 9608 S18 P32
5a 9608/31 Jun 17 Q3a, b, 6 - SoW
5b 9608/32 Jun 17 Q3a, b Q6 - SoW
6a 9608/31 Nov 17 Q5ai Q6a, b - SoW
6b 9608/32 Nov 17 Q5a -Q6 – SoW
7a 9608 P31 Q7
Unit 4 Processor Fundamentals
4.1 Central Processing Unit
Topic You should be able to R A G
• Understand the Von Neuman model for a computer system including the
Fetch-Execute (F-E) cycle, interrupts and ports
Processor
• Understand the role of an assembler, a simple assembly language
Fundamentals
program that includes different modes of addressing and bit
manipulation

Key terms
Von Neumann architecture – computer architecture which introduced the concept of the stored
program in the 1940s.
Arithmetic logic unit (ALU) – component in the processor which carries out all arithmetic and logical
operations.
Control unit – ensures synchronisation of data flow and programs throughout the computer by
sending out control signals along the control bus.
System clock – produces timing signals on the control bus to ensure synchronisation takes place.
Immediate access store (IAS) – holds all data and programs needed to be accessed by the control
unit.
Accumulator – temporary general purpose register which stores numerical values at any part of a
given operation.
Register – temporary component in the processor which can be general or specific in its use that
holds data or instructions as part of the fetch-execute cycle.
Status register – used when an instruction requires some form of arithmetic or logical processing.
Flag – indicates the status of a bit in the status register, for example, N = 1 indicates the result of an
addition gives a negative value.
Address bus – carries the addresses throughout the computer system.
Data bus – allows data to be carried from processor to memory (and vice versa) or to and from
input/output devices.
Control bus – carries signals from control unit to all other computer components. Unidirectional –
used to describe a bus in which bits can travel in one direction only. Bidirectional – used to describe a
bus in which bits can travel in both directions.
Clock cycle – clock speeds are measured in terms of GHz; this is the vibrational frequency of the clock
which sends out pulses along the control bus – a 3.5 GHZ clock cycle means 3.5 billion clock cycles a
second.
Overclocking – changing the clock speed of a system clock to a value higher than the
factory/recommended setting.
BIOS – basic input/output system.
Cache memory – a high speed auxiliary memory which permits high speed data transfer and retrieval.
Core – a unit made up of ALU, control unit and registers which is part of a CPU. A CPU may contain a
number of cores.
Dual core – a CPU containing two cores.
Quad core – a CPU containing four cores.
Port – external connection to a computer which allows it to communicate with various peripheral
devices. A number of different port technologies exist.
Universal Serial Bus (USB) – a type of port connecting devices to a computer.
Asynchronous serial data transmission – serial refers to a single wire being used to transmit bits of
data one after the other. Asynchronous refers to a sender using its own clock/timer device rather
sharing the same clock/timer with the recipient device.
High-definition multimedia interface (HDMI) – type of port connecting devices to a computer
transmitting audio and video both.
Video Graphics Array (VGA) – type of port connecting devices to a computer, transmitting video
signals only.
High-bandwidth digital copy protection (HDCP) – part of HDMI technology which reduces risk of
piracy of software and multimedia.
Fetch-execute cycle – a cycle in which instructions and data are fetched from memory and then
decoded and finally executed.
Program counter (PC) – a register used in a computer to store the address of the instruction which is
currently being executed.
Current instruction register – a register used to contain the instruction which is currently being
executed or decoded.
Register Transfer Notation (RTN) – short hand notation to show movement of data and instructions
in a processor, can be used to represent the operation of the fetch-execute cycle. Interrupt – signal
sent from a device or software to a processor requesting its attention; the
processor suspends all operations until the interrupt has been serviced.
Interrupt priority – all interrupts are given a priority so that the processor knows which need to be
serviced first and which interrupts are to be dealt with quickly.
Interrupt service routine (ISR) or interrupt handler – software which handles interrupt requests (such
as ‘printer out of paper’) and sends the request to the CPU for processing.

Von Neumann Architecture


The idea about how computers should be built was proposed by John von Neumann in 1945.
Von Neumann gave an idea how to build computer. This idea is also called the von Neumann Architecture or
Model.
A computer should have input/output devices, Arithmetic Logic Unit (ALU), Control Unit
(CU) and computer memory (storage device).
Firstly, programs should be stored in computer’s memory (storage devices).
From storage devices programs should be loaded into CPU (ALU & CU) for execution.
This is still the basis for computers today.
Before 1949, computers could execute commands, but they could not remember what they did as they
were not able to store these commands.
Stored Program Concept:
The idea given by von Neumann, according to this concept computer should have storage device to store data
and instruction to be processed. Data and instructions are first stored in secondary storage (HDD or SSD). Then
they are loaded in main memory (RAM). From main memory data and instructions are fetched in registers
inside CPU. Decoder of CU decodes the instruction and ALU executes the instructions and results are stored
firstly in main memory and then in secondary storage.
Examiner Comments on Question to explain Stored Program Concept
This question appeared to be very challenging for candidates. Many candidates described the fetch execute cycle. It would
be helpful if candidates understood that the stored program concept is a specific infrastructure for the central processing
unit and not the fetch execute cycle. It would be encouraging to see candidates demonstrate a more confident level of
knowledge of the stored program concept.

AL CU
CP
U
Register
U
Store
Fetch

Cach

RAM
Save
Load
Components of von Neumann Model
Von Neumann Model has following four components:
1. Input/Output Devices
2. Memory Unit
3. Control Unit
4. Arithmetic Logic Unit
Input/output (I/O) Devices
The Input/output (I/O) components of a computer are hardware devices that are responsible for getting data from the
computer to the user or from the user to the computer.
Data going from the user to the computer is called "input." The two main input devices are the mouse and the keyboard.
Output devices are used to transmit data from the computer's memory to the user. The two output devices almost every
computer system has are the monitor and the printer.
Memory Unit
Computer has several types of memory. Memory unit in the Von Neumann model is the main memory, also called RAM or
Random Access Memory. It also refers as Immediate Access Store (IAS).
Immediate Access Store (i.e. main memory) holds data and instructions when they are waiting to be processed.
What distinguishes a computer from a calculator is the ability to run a stored program; main memory allows the computer
to do that.
RAM can be thought of as a sequence of boxes, called cells, each of which
can hold a certain amount of data.
The remaining three components of the von Neumann model of a computer
are found inside the Processor.
Control Unit
The control unit controls the sequencing and timing of all operations. It
contains a "clock," that is actually a quartz crystal that vibrates million times
per second. The clock emits an electronic signal for each vibration. Each
separate operation is synchronized to the clock signal. For example 1st pc
operates at 4.7 MHz means 4.7 million instructions per second.
The functions of CU are given below:
• Fetches the data and instructions from memory into CPU.
• Decodes the instructions.
• Controls processing speed using system clock.
• Manages all activities of computer.
Arithmetic & Logic Unit (ALU)
Arithmetic unit perform arithmetical operations like +, -, *, and / while logical unit are to compare two quantities. Logical
operations are important in computer programming.
ALU can be thought of as being similar to a calculator, except that, in addition to normal math, it can also do logical
(true/false) operations.
The functions of ALU are given below:
• The arithmetic unit carries out arithmetic like addition, division.
• The logic unit enables the processor to make comparison like =, <, > and logical decisions like AND, OR, NOT.
• The arithmetic logic unit carries out communication with peripheral devices.
• It also carries out bit shifting operation.
Register:
Registers are located on the CPU, and used temporarily for storing data. Because the registers are close to the
ALU, they are made out of fast memory, efficiently speeding up calculations.
Registers store data fetched from Immediate Access Store i.e. main memory.
Immediate Access Store (i.e. main memory) holds data and instructions when they are waiting to be processed.
Register Holds data or instructions temporarily when they are being processed.
There are 16 registers. Some examples are
a) Program Counter (PC) - an incrementing counter that keeps track of the next memory address of
the instruction that is to be executed once the execution of the current instruction is completed.
b) Memory Address Register (MAR) - the address in main memory that is currently being read or
written
c) Memory Buffer/Data Register (MBR/MBR) - a two-way register that holds data fetched from
memory (and ready for the CPU to process) or data waiting to be stored in memory
d) Current Instruction register (CIR) - a temporary holding ground for the instruction that has just
been fetched from memory
e) Accumulator Register (ACC) is used for storing data for ALU to process and the results those
are produced by the ALU.
f) Index Register (IX) A hardware element which holds a number that can be added to (or, in some
cases, subtracted from) the address portion of a computer instruction to form an effective address.
Also known as base register. An index register in a computer's CPU is a processor register used
for modifying operand addresses during the run of a program.
g) Status Register A status register, flag register, or condition code register (CCR) is a
collection of status flag bits for a processor. This is a list of the most common CPU status
register flags, implemented in almost all modern processors.
Flag Name Description

Z Zero flag Indicates that the result of an arithmetic or logical operation (or, sometimes,
a load) was zero.

C Carry flag Enables numbers larger than a single word to be added/subtracted by


carrying a binary digit from a less significant word to the least significant
bit of a more significant word as needed. It is also used to extend bit
shifts and rotates in a similar manner on many processors (sometimes done
via a dedicated X flag).

S/N Sign flag Indicates that the result of a mathematical operation is negative. In some
Negative processors, the N and S flags are distinct with different meanings and usage:
flag One indicates whether the last result was negative whereas the other
indicates whether a subtraction or addition has taken place.

V / O / W Overflow Indicates that the signed result of an operation is too large to fit in the
flag register width using two's complement representation.
Buses: ''The set of wires used to travel signals to and from CPU and different components of computer is called
Bus.''
Bus is a group of parallel wires that is used as a communication path. As a wire transmits a
single bit so 8-bits bus can transfer 8 bits (1 byte) at a time and 16-bits bus can transfer 16 bits (2
bytes) and so on. There are three types of buses according to three types of signals, these are:
a) Data Bus: ''The buses which are used to transmit data between CPU, memory and peripherals are
called Data Bus.''
b) Address Bus: ''The buses which are connecting the CPU with main memory and used to identify
particular locations (address) in main memory where data is stored are called Address Buses.''
c) Control Bus: The wires which are used to transmit the control signals (instructions) generated by
Control Unit to the relevant component of the computer.
Example Question: Complete following figure using name of registers as abbreviations, like PC:
Example Question) (a) One of the key features of von Neumann computer architecture is the use of
buses. Three buses and three descriptions are shown below.
Draw a line to connect each bus to its correct description.
This bus carries signals used to coordinate
Address bus
the computer’s activities

Control bus This bi-directional bus is used to exchange


data between processor, memory and input/
output devices
Data bus
This uni-directional bus carries signals
relating to memory addresses between
processor and memory
b)

The diagram above shows a simplified form of processor architecture.


Name the three buses labelled A, B and C.
A ............................................................................................................................................
B ............................................................................................................................................
C .................................................................................................................................... [3]
Little Man Computer
Little Man Computer - CPU simulator (peterhigginson.co.uk)

The Little Man Computer (LMC) is an instructional model of a computer, created by Dr. Stuart
Madnick in 1965.[1] The LMC is generally used to teach students, because it models a simple von
Neumann architecture computer—which has all of the basic features of a modern computer. It can be
programmed in machine code (albeit in decimal rather than binary) or assembly code. [2][3][4]

The LMC model is based on the concept of a little man shut in a closed mail room (analogous to a
computer in this scenario). At one end of the room, there are 100 mailboxes (memory), numbered 0
to 99, that can each contain a 3 digit instruction or data (ranging from 000 to 999). Furthermore,
there are two mailboxes at the other end labeled INBOX and OUTBOX which are used for receiving
and outputting data. In the center of the room, there is a work area containing a simple two function
(addition and subtraction) calculator known as the Accumulator and a resettable counter known as
the Program Counter. The Program Counter holds the address of the next instruction the Little Man
will carry out. This Program Counter is normally incremented by 1 after each instruction is executed,
allowing the Little Man to work through a program sequentially.

Courtesy: Wikipedia and https://peterhigginson.co.uk/lmc/


Numeric instruction code - LMC Instruction Set:
LMC Instruction is 3-digit code, 1st digit is opcode and last two digits are operand. Here are some examples:
Description Assembly Language Code LMC Code
To input data from user into Accumulator, overwrite INP 901
whatever value was in the accumulator (destructive)
To output data from accumulator. OUT 902
To Add contents of Accumulator with memory contents ADD <memory address> 1xx
To Subtract memory contents from values stored in SUB <memory address> 2xx
accumulator.

Description Assembly Language Code LMC Code


To Store contents of Accumulator into a memory location STA <memory address> 3xx
To Load values from memory location into accumulator LDA <memory address> 5xx
To stop the program HLT 000
Example program
This program (instruction 901 to instruction 000) is written just using numeric codes. The program takes
two numbers as input and outputs the sum.

LMC
Assembly
Numeric Operation Comments
Code
code
INPUT the first number, enter into
INP 901 INBOX --> ACCUMULATOR
calculator
STA 08 308 ACCUMULATOR --> MEMORY[08] STORE in memory location 08
INPUT the second number, enter into
INP 901 INBOX --> ACCUMULATOR
calculator (erasing whatever was there)
ACCUMULATOR = ADD the second number in the
ADD 08 108
ACCUMULATOR + MEMORY[08] calculator’s first number.
STA 09 309 ACCUMULATOR → MEMORY[09] STORE the sum in memory location 09
OUTPUT the calculator's result to the
OUT 902 ACCUMULATOR --> OUTBOX
OUTBOX
HLT 000 (no operation performed) HALT the LMC
Factors affecting performance of PC:
Performance of a PC is dependent on Bus Width, Clock
Speed, Cache and Cores.
1. Bus Width: Buses are wires used to transmit data. The
size of a bus, known as its width, it determines how much
data can be transmitted at one time. More the number of
wire higher the possible combinations. For example a 8-
wired address bus can transmit address ranging from 0000 0000 till 1111 1111 means 256
addresses.
2. Clock Speed: The clock speed - also known as clock rate - indicates how fast the CPU can run.
This is measured in megahertz (MHz) or gigahertz (gHz) and corresponds with how many
instruction cycles the CPU can deal with in a second. The clock defines the clock cycle which
synchronises all computer operations. As mentioned earlier, the control bus transmits timing
signals, ensuring everything is fully synchronised. By increasing clock speed, the processing
speed of the computer is also increased (a typical current value is 3.5 GHz – which means 3.5
billion clock cycles a second). Although the speed of the computer may have been increased, it is
not possible to say that a computer’s overall performance is necessarily increased by using a
higher clock speed. Four other factors need to be considered.
Overclocking: the clock speed can be changed by accessing the BIOS basic input/output
system (BIOS) and altering the settings. However, using a clock speed higher than the computer
was designed for can lead to problems, such as
– execution of instructions outside design limits, which can lead to seriously unsynchronised
operations (in other words, an instruction is unable to complete in time before the next one is due
to be executed) and the computer would frequently crash and become unstable
– serious overheating of the CPU leading to unreliable performance.
3. The use of cache memory can also improve processor performance. It is similar to RAM in that its
contents are lost when the power is turned off. Cache uses SRAM whereas most computers use
DRAM for main memory. Therefore, cache memories will have faster access times, since there is
no need to keep refreshing, which slows down access time.
When a processor reads memory, it first checks out cache and then moves on to main memory if
the required data is not there. Cache memory stores frequently used instructions and data that
need to be accessed faster. This improves processor performance.
4. The use of a different number of cores (one core is made up of an ALU, a CU and the registers)
can improve computer performance. Many computers are dual core (the CPU is made up of two
cores) or quad core (the CPU is made up of four cores). The idea of using more cores alleviates
the need to continually increase clock speeds. However, doubling the number of cores does not
necessarily double the computer’s performance since we have to take into account the need for
the CPU to communicate with each core; this will reduce overall performance. For example
– dual core has one channel and needs the CPU to communicate with both cores, reducing some
of the potential increase in its performance
– quad core has six channels and needs the CPU to communicate with all four cores, considerably
reducing potential performance.
Two cores, one channel (left) and four cores, six channels (right)

Fetch-Execute Cycle:
At its core, all the computer ever does is, execute one instruction in memory after another, over and over. Although there
are many different possible (assembly language) instructions that the computer can execute, the basic steps involved in
executing an instruction are always the same, and they are called the instruction cycle.
1. Fetch the instruction (transfer the instruction from main memory to the decoder)
2. Decode the instruction (from machine language)
3. Execute the instruction (e.g., add, divide, load, store...)
4. Store the result (for instructions like ADD, place the 'answer' in the specified register.)
The control unit guides the computer's components through this cycle to execute one instruction.
When that instruction is done, the cycle starts all over again with the next instruction.
Q 4.1) Summer 15 P11_P12Q 4.3 (a) Explain how the width of the data bus and system clock speed affect the
performance of a computer system.
Width of the data bus ......................................................................................................
Clock speed ..................................................................................................................[3]
(b) The table shows six stages in the von Neumann fetch-execute cycle. [6]
Put the stages into the correct sequence by writing the numbers 1 to 6 in the right hand column
Sequence
Description of stage
number
the instruction is copied from the Memory Data Register (MDR) and placed in the Current
Instruction Register (CIR)
the instruction is executed
the instruction is decoded
the address contained in the Program Counter (PC) is copied to the Memory Address Register
(MAR)
the value in the Program Counter (PC) is incremented so that it points to the next instruction to
be fetched
the instruction is copied from the memory location contained in the Memory Address Register
(MAR) and is placed in the Memory Data Register (MDR)
Marking Scheme
Width of the data bus
• the width of the data bus determines the number of bits that can be simultaneously transferred
• increasing the width of the data bus increases the number of bits/amount of data that can be moved at
one time (or equivalent)
• hence improving processing speed as fewer transfers are needed
• By example: e.g. double the width of the data bus moves 2x data per clock pulse
Clock speed
• determines the number of cycles the CPU can execute per second
• increasing clock speed increases the number of operations/number of fetch-execute cycles that can be
carried out per unit of time
• however, there is a limit on clock speed because the heat generated by higher clock speeds cannot be
removed fast enough

Register notation
To describe the cycle we can use register notation. This is a very simple way of noting all the steps
involved. In all cases brackets e.g. [PC], means that the contents of the thing inside the brackets are
loaded. In the case of the first line, the contents of the program counter are loaded into the Memory
Address Register.
MAR  [PC]
MBR  [Memory] ; PC [PC] +1 (Increment the PC for next cycle at the same time)
CIR  [MBR]
CIR sends instruction to Decoder of control unit
Decoder decodes
Or ACC [MBR]
ACC sends data to ALU
ALU executes
Detailed description of Fetch-Decode-Execute Cycle
To better understand what is going on at each stage we'll now look at a detailed description:
The contents of the Program Counter, the address of the next instruction to be executed, is placed
into the Memory Address Register

The address is sent from the MAR along the address bus to the Main Memory. The instruction at that
address is found and returned along the data bus to the Memory Buffer Register. At the same time
the contents of the Program Counter is increased by 1, to reference the next instruction to be
executed.

The MBR loads the Current Instruction Register with the instruction to be decoded by decoder of
control unit or the MBR loads Accumulator with the data to be executed.
The instruction is decoded and executed using the ALU if necessary.
The Cycle starts again!
Q 4.4) Complete the following diagrams showing each step of the fetch decode execute cycle:
Interrupt Handling

Interrupt are signals sent by hardware, software, or user to seek attention of processor.

Interrupts play important role in multi-tasking.

Interrupts may be generated by hardware like user has pressed a key on keyboard, moved mouse, or
printer become out of ink. Interrupts are also generated by software like antivirus has detected a virus,
or user has tried to divide a number by zero. In all these situations, processor’s instructions are
required.

Interrupt Service Routines ISRs are modules used to deal with the interrupts.

Interrupts are detected at the start or end of a fetch-execute cycle.

Interrupts have different priorities. When a higher priority interrupt is detected then associated ISRs
are immediately started. For lower priority interrupts, associated ISR are started after completion of
current Fetch execute cycle.

Before loading ISR all the contents of registers are stored in Interrupt Handler and then FE Cycles of
ISR are started, and new interrupts are disabled.

After completion of all FE Cycles of ISR, interrupts are enabled. If new interrupt is detected then its
ISR is loaded in CPU or the tasks from interrupt handler are loaded, to be resume the task has been
paused.

Here are the steps of dealing with interrupts.


1ac 9618 S21 P12_13 – 3 A processor has one general purpose register, the Accumulator
(ACC), and several special purpose registers.
(a) Complete the following description of the role of the registers in the fetch-execute cycle by
writing the missing registers.
The ........................................................................ holds the address of the next instruction to
be loaded. This address is sent to the ........................................................................ .
The ............................................................................ holds the data fetched from this address.
This data is sent to the ............................................................................ and the Control Unit
decodes the instruction’s opcode.
The ............................................................................ is incremented. [5]

1b 9618 S21 P12


5 Seth uses a computer for work.
(a) Complete the following descriptions of internal components of a computer.
The ............................................ transmits the signals to coordinate events based on the
electronic pulses of the ............................................................ .
The .................................. carries data to the components, while the ........................................
.................. carries the address where data needs to be written to or read from.
The .......................... performs mathematical operations and logical comparisons. [5]

(b) Describe the ways in which the following factors can affect the performance of his laptop
computer.
Number of cores …...................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
Clock speed ............................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
................................................................................................................................................ [4]

2b 9618 W21 P12 –


8 The Von Neumann model for a computer system uses registers.
(a) Describe the role of the following special purpose registers in the fetch-execute (F-E)
cycle.
(i) Memory Address Register (MAR) .....................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
Memory Data Register (MDR) ...........................................................................................
...........................................................................................................................................
...........................................................................................................................................
........................................................................................................................................... [4]
(ii) Another special purpose register is the Index Register.
Identify one other special purpose register used in the Von Neumann model for a computer
system.
...........................................................................................................................................
..................................................................................................................................... [1]

2ac W21 P11 P13 –


6 (a) There are two errors in the following register transfer notation for the fetch-execute
cycle.
1 MAR  [PC]
2 PC  [PC] - 1
3 MDR  [MAR]
4 CIR  [MDR]
Complete the following table by:
• identifying the line number of each error
• describing the error
• writing the correct statement. [4]
Line
Description of the error Correct statement
number
3a 9618 S22 P11 –
6 (a) A computer system is designed using the basic Von Neumann model.
(i) Describe the role of the registers in the Fetch-Execute (F-E) cycle.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.......................................................................................................................................... [5]
(ii) Describe when interrupts are detected in the F-E cycle and how the interrupts are
handled.
Detected ............................................................................................................................
...........................................................................................................................................
Handled .............................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
........................................................................................................................................... [5]
(b) Identify one factor that can affect the performance of the computer system and state how
it impacts the performance.
Factor .......................................................................................................................................
Impact .......................................................................................................................................
.....................................................................................................................................................
............................................................................................................................................. [2]
3c 9618 S22 P13
2 (a) The Fetch-Execute (F-E) cycle is represented in register transfer notation.
Describe each of the given steps. [3]
Step Description

......................................................................................................
PC [PC] + 1
......................................................................................................
......................................................................................................

......................................................................................................
MDR [[MAR]]
......................................................................................................
......................................................................................................

......................................................................................................
MAR [PC]
......................................................................................................
......................................................................................................

(b) Explain how interrupts are handled during the F-E cycle.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
............................................................................................................................................... [5]
4a 9618 W22 P11
5 (a) State what is meant by the stored program concept in the Von Neumann model of a computer system.
…................................................................................................................................................................................
............................................................................................................................................................................ [1]
(b) A Central Processing Unit (CPU) contains several special purpose registers and other components.
(i) State the role of the following registers.
Program Counter (PC) .............................................................................................................................................
...................................................................................................................................................................................
...................................................................................................................................................................................
Index Register (IX) ....................................................................................................................................................
...................................................................................................................................................................................
...................................................................................................................................................................................
Status Register (SR) ..................................................................................................................................................
...................................................................................................................................................................................
............................................................................................................................................................................. [3]
(i) Tick (✓) one box in each row to identify the system bus used by each CPU component. [1]

CPU component Data bus Address bus Control bus

System clock

Memory Address Register (MAR)

[1]
(ii) Describe the purpose of the Control Unit (CU) in a CPU.
…………………………………………………………………...............................................................................................................
...................................................................................................................................................................................
...................................................................................................................................................................................
............................................................................................................................................................................. [2]
(c) Describe the purpose of an interrupt in a computer system.
…………………………………………………………………...............................................................................................................
...................................................................................................................................................................................
...................................................................................................................................................................................
............................................................................................................................................................................. [2]
(d) Identify two causes of a software interrupt.
1 ..............................................................................................................................................................................
……………...................................................................................................................................................................
2 ..............................................................................................................................................................................
............................................................................................................................................................................ [2]

5(a) Instructions and data are stored in the same memory space / in main memory. 1
5(b)(i) 1 mark for each special purpose register: 3
Program Counter (PC):
• to store the address / location / memory location of the next instruction to be fetched
Index Register (IX):
• to store a value that is added to an address to give another address
Status Register (SR):
• to store flags which are set by events // from the results of arithmetic and logic
operations and interrupt flags
5(b)(ii) 1 mark for both rows: 1

CPU component Data bus Address bus Control bus

System clock

Memory Address Register (MAR)


5(b)(iii) 1 mark for each bullet point (max 2): 2

• to coordinate / synchronise the actions of other components in the CPU


• to send / receive control signals along the control bus
• to manage the execution of instructions (in sequence)
• to control the communication between the components of the CPU

5(c) 1 mark for each bullet point: 2

• to send a signal from a device or process


• ... seeking the attention of the processor

5(d) 1 mark for each bullet point (max 2). 2


For example:
• division by zero // runtime error in a program
• attempt to access an invalid memory location
• array index out of bounds
• stack overflow

4b 9618 W22 P12


7 (c) Write the register transfer notation for each of the stages in the fetch-execute cycle described in the
table. [3]
Description Register transfer notation

Copy the address of the next instruction into the


Memory Address Register.

Increment the Program Counter.

Copy the contents of the Memory Data


Register into the Current Instruction Register.

4c 9618 W22 P13


4 (a) A Central Processing Unit (CPU) contains several special purpose registers and other components.
(i) State the roles of the following registers.
Memory Address Register (MAR) ………………............................................................................................................
………………………………..................................................................................................................................................
...................................................................................................................................................................................
Memory Data Register (MDR) .................................................................................................................................
………………………………..................................................................................................................................................
............................................................................................................................................................................ [2]
(ii) State when interrupts are detected during the Fetch-Execute (F-E) cycle.
…………………………………................................................................................................................................................
........................................................................................................................................................................... [1]
(b) A computer system contains a system clock.
Describe the purpose of the system clock.
...................................................................................................................................................................................
...................................................................................................................................................................................
...................................................................................................................................................................................
.............................................................................................................................................................................. [2]
(c) Upgrading secondary storage to solid state typically improves the performance of computer systems.
Identify one other upgrade to the hardware and explain why it improves the performance of a computer
system.
Upgrade ...................................................................................................................................................................
Explanation ..............................................................................................................................................................
………………………………………………………..........................................................................................................................
............................................................................................................................................................................. [2]

4(a)(i) 1 mark for each register: 2


MAR:
• holds address in memory from which data will be read / to which data will
be written
MDR:
• holds the data/instructions which has been read from or is to be written to the
address in the MAR
4(a)(ii) after completion of the execute stage // before the cycle begins 1
4(b) 1 mark for each bullet point (max 2): 2
• synchronise operations
• ... by creating timing signals
• to keep track of the date and time / timestamp files
• to process operations in the correct order / sequence
4(c) 1 mark for identification of a correct upgrade: 1 2
mark for a corresponding explanation:
Examples:
• increase quantity of RAM
• ... so allowing more applications to reside in memory at the same time, saving
disk access times

• increase the size of cache memory


• ... so that the CPU can continue working without waiting for data

• increase clock speed


• ... so that more instructions are performed in a time period

• increase the number of processors / cores


• ... so that more instructions are performed in parallel

5a 9618 S23 q11


6 An interrupt is generated when a key is pressed on a computer keyboard.
Explain how the computer handles this interrupt.
...................................................................................................................................................................................
...................................................................................................................................................................................
...................................................................................................................................................................................
...................................................................................................................................................................................
...................................................................................................................................................................................
...................................................................................................................................................................................
...................................................................................................................................................................................
...................................................................................................................................................................................
...................................................................................................... [5]

6 1 mark each to max 5 5

• An interrupt flag is raised in the (interrupt) register


• At the end of the current FE cycle // at the start of the next FE cycle
• The system checks the interrupt register for higher priority interrupts than
current process
• If true, it stores the current contents of the registers on the stack
• The appropriate interrupt service routine (ISR) for the key press is called
• The input data from the keyboard is processed
• The contents of the registers are restored from the stack
• ... and control is passed back to previous process

5b 968 S23 p12


5 A student has purchased a new laptop.
(a) The laptop is designed using the Von Neumann model for a computer system.
Identify two types of signal that a control bus can transfer.
1 ………………………………..............................................................................................................................................
2 .......................................................................................................................................................................... [2]
(b) Describe two ways the hardware of a laptop can be upgraded to improve the performance and explain how
each upgrade improves the performance.
1 ………………………………………………………………………………………………………………………………………………………………………….
...................................................................................................................................................................................
...................................................................................................................................................................................
...................................................................................................................................................................................
...................................................................................................................................................................................
..................................................................................................................................................................................
2 …………………………………………………………………………………………………………………………………………………………………………
...................................................................................................................................................................................
...................................................................................................................................................................................
...................................................................................................................................................................................
...................................................................................................................................................................................
................................. .......................................................................................................................................... [4]
(c) Peripherals are connected to the laptop using ports.
(i) A printer is connected to a Universal Serial Bus (USB) port.
Describe how data is transmitted through a USB port.
...................................................................................................................................................................................
...................................................................................................................................................................................
...................................................................................................................................................................................
.............................................................................................................................................................................. [1]
(ii) A monitor is connected to the laptop using a different type of port.
Identify one other type of port that can be used to connect the monitor.
…………………..………………...................................................................................................................................... [1]

5(a) 1 mark each to max 2 2


Examples:
• Interrupt
• Timing
• Read
• Write
5(b) 1 mark for description; 1 mark for corresponding explanation 4
Examples
• Increase number of cores
• Each core can independently carry out a process at the same time // so that
more instructions are performed in parallel
• Increase RAM capacity
• ... allowing more applications to reside in memory at the same time, saving disk
access times
• Increase cache memory
• More data can be stored in fast access so less time is spent accessing from RAM
• Increase clock speed
• More Fetch-Decode-Execute (FDE) cycles can run each second / per unit time

5(c)(i) 1 mark for a correct answer 1


• 1 bit is transferred at a time
• Can be synchronous or asynchronous
• USB-3 is full duplex and earlier versions are half-duplex

5(c)(ii) 1 mark for identification of a suitable port 1


Examples
• HDMI
• DisplayPort

5c 9618 S23 P13


7 (b) The computer has a Control Unit (CU), system clock and control bus. Explain how the CU, system clock and
control bus operate to transfer data between the components of the computer system.
...................................................................................................................................................................................
...................................................................................................................................................................................
...................................................................................................................................................................................
...................................................................................................................................................................................
...................................................................................................................................................................................
............................................................................................................................................................................. [4]
(c) Complete the table by writing the register transfer notation for each stage of the Fetch-Execute (F-E) cycle
given in the table. [2]

Stage description Register transfer notation

The Program Counter (PC) is incremented .......................................................................

The data in the address stored in the Memory


Address Register (MAR) is copied to the Memory
Data Register (MDR) .......................................................................
7(b) 1 mark each to max 4 4
• The system clock gives out timing signals
• … which are sent on the control bus
• …to synchronise the other system components
• The Control Unit initiates data transfer
• …by generating signals that are sent on the control bus to other components

7(c) 1 mark for each Register transfer notation 2

Stage description Register transfer notation

The Program Counter (PC) is incremented PC  [PC] + 1

The data in the address stored in the MDR  [[MAR]]


Memory Address Register (MAR) is copied
to the Memory Data Register (MDR)

5a 9608/31 Jun 17 Q6c - SoW


6(c) An alternative method of reading and processing sensor data is to use interrupts. Each
sensor is connected so that it can send an interrupt signal to the processor if its value
changes. On receipt of an interrupt signal, the processor carries out a number of steps as
shown in the following diagram.

Interrupt 2. Disable more interrupts

2. Save contents of current FE


cycle in interrupt handler

3. Identify source of
interrupt

4. Jump to Interrupt Service


Routine and start its FE Cycle

5. Restore task from


interrupt handler

Return to task. 6. Enable more interrupts


(i) State the purpose of step 1.
.....................................................................................................................................................
.....................................................................................................................................................
................................................................................................................................................ [1]
(ii) State the purpose of step 6.
.....................................................................................................................................................
.....................................................................................................................................................
................................................................................................................................................ [1]
(iii) Explain how the current task is saved in step 2.
.....................................................................................................................................................
.....................................................................................................................................................
.............................................................................................................................................. [2]
(iv) State two benefits of using interrupts to read and process the sensor data.
Benefit 1 .....................................................................................................................................
....................................................................................................................................................
Benefit 2 .....................................................................................................................................
.............................................................................................................................................. [2]
(v) The interrupt handler in step 3 has to test each bit of a 16-bit register to discover the
source of the interrupt. The contents of the 16-bit register are loaded into the 16-bit
accumulator:

An instruction is required to achieve the following:


• If bit 9 is zero, set the accumulator to zero.
• If bit 9 is one, set the accumulator to a non-zero value.
Write this instruction using an appropriate bitwise operation.
....................................................................................................................................... [2]
5b 9608/32 Jun 17 Q6c - SoW
6 (c) An alternative method of reading and processing sensor data is to use interrupts. Each
sensor is connected so that it can send an interrupt signal to the processor if its value
changes.
On receipt of an interrupt signal, the processor carries out a number of steps as shown in the
following diagram.

(i) State the purpose of step 3.


.....................................................................................................................................................
................................................................................................................................................ [1]
(ii) Explain what happens at step 4.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
....................................................................................................................................................
6a 9608/11 Nov 17 Q4 - SoW
4 (a) The diagram shows the components and buses found inside a typical Personal Computer(PC).

Some components and buses only have labels A to F to identify them.


For each label, choose the appropriate title from the following list. The title for label D is
already given.
• Control bus • System clock • Data bus • Control unit • Main memory • Secondary storage
A ...........................................................................................................................................
B ...........................................................................................................................................
C ...........................................................................................................................................
D Address bus
E ...........................................................................................................................................
F ........................................................................................................................................... [5]
7c 9608/13 Jun 18 Q3a, b - SoW
3 A computer is designed using the Von Neumann model.
(a) Describe the role of the Arithmetic and Logic Unit (ALU) and Control Unit (CU) in the Von
Neumann model.
ALU ...........................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
......................................................................................................................................
CU ............................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................... [4]

(b) Describe the role of the Status Register and Program Counter (PC).
Status Register .........................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
.................................................................................................................................
PC .............................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................. [4]
6b 9608/12 Nov 17 Q4 - SoW
4 The following diagram shows the components and buses found inside a typical personal
computer (PC).

(a) Some components and buses only have labels A to F to identify them.
For each label, choose the appropriate title from the following list. The title for label D is
already given.
• Control bus • Address bus • Arithmetic Logic Unit (ALU)
• General purpose registers • Secondary storage • System clock
A ...........................................................................................................................................
B ...........................................................................................................................................
C ...........................................................................................................................................
D Data bus
E ...........................................................................................................................................
F........................................................................................................................................... [5]
(b) Clock speed is a factor that affects the performance of a PC. Explain this statement.
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[2]
4.2 Assembly language

Candidates should be able to: Notes and guidance


Show understanding of the relationship
between assembly language and machine
code
Describe the different stages of the Apply the two-pass assembler process to a
assembly process for a two-pass assembler given simple assembly language program
Trace a given simple assembly language
program
Show understanding that a set of Including the following groups:
instructions are grouped • Data movement
• Input and output of data
• Arithmetic operations
• Unconditional and conditional instructions
• Compare instructions

Modes of addressing Including Immediate, direct, indirect,


indexed, relative
Machine code – the programming language that the CPU uses.
Instruction – a single operation performed by a CPU.
Assembly language – a low-level chip/machine specific programming language that uses mnemonics.
Opcode – short for operation code, the part of a machine code instruction that identifies the action the
CPU will perform.
Operand – the part of a machine code instruction that identifies the data to be used by the CPU.
Source code – a computer program before translation into machine code.
Assembler – a computer program that translates programming code written in assembly language into
machine code. Assemblers can be one pass or two pass.
Instruction set – the complete set of machine code instructions used by a CPU.
Object code – a computer program after translation into machine code.
Addressing modes – different methods of using the operand part of a machine code instruction as a
memory address.
Absolute addressing – mode of addressing in which the contents of the memory location in the operand
are used.
Direct addressing – mode of addressing in which the contents of the memory location in the operand are
used, which is the same as absolute addressing.
Indirect addressing – mode of addressing in which the contents of the contents of the memory location in
the operand are used.
Indexed addressing – mode of addressing in which the contents of the memory location found by adding
the contents of the index register (IR) to the address of the memory location in the
operand are used.
Immediate addressing – mode of addressing in which the value of the operand only is used. Relative
addressing – mode of addressing in which the memory address used is the current memory address added
to the operand.
Symbolic addressing – mode of addressing used in assembly language programming, where a label is used
instead of a value.

Shift – moving the bits stored in a register a given number of places within the register; there are different
types of shift.
Logical shift – bits shifted out of the register are replaced with zeros.
Arithmetic shift – the sign of the number is preserved.
Cyclic shift – no bits are lost, bits shifted out of one end of the register are introduced at the other end of
the register.
Left shift – bits are shifted to the left.
Right shift – bits are shifted to the right.
Monitor – to automatically take readings from a device.
Control – to automatically take readings from a device, then use the data from those readings to adjust the
device.
Mask – a number that is used with the logical operators AND, OR or XOR to identify, remove or set a single
bit or group of bits in an address or register.
Instruction Set
An instruction set is a collection of instructions that the CPU uses to carry out its tasks. For example,
an instruction might look like: 'LDD 101'. This instruction tells the CPU to load data from location
101 into the accumulator.
Machine Code
Computer can understand machine code. Machine
code is a binary programming language and is the
form most easily processed by a CPU. Each line of
code contains an opcode (an instruction) and
an operand (the data to be operated on by the given
instruction).

For example, to load data items from memory address


101, the Load is an instruction means an opcode, while 101 is memory address used as data for
the instruction, i.e. operand.
Here is an example of machine code instruction set:
Description Machine Code Instruction
Load data from given address 1100 0010 <address>
To store data at given memory address 1100 0100 <address>
To decrement contents of Accumulator by 1 1100 0101
To output contents of accumulator 1100 0111
To compare contents of memory location with a value 1110 0100 <address or data>

And here is an example program written in machine language:


Purpose Opcode Operand
To load data from memory address 101 1100 0010 0110 0101
To decrement data in ACC by 1 1100 0101
To output ASC Character 1100 0111
To compare the contents of ACC with a number 1110 0100 0100 1010
Assembly Language Instructions

Assembly language is an intermediate stage between machine code and high-level


language and can usually be converted to machine code by a direct translation. Like machine
code, an assembly language instruction contains an opcode and one or more operands.

A programmer might wish to write a program where the actions taken by the processor are directly
controlled. It is argued that this can produce optimum efficiency in a program. However, writing a
program as a sequence of machine code instructions would be a very
time-consuming and error-prone process. The solution for this type of programming is to use
assembly language. As well as having a uniquely defined machine code language each processor
has its own assembly language.
Like to load data from location 101, following instructions are used in machine code and assembly
language:
Machine Code Assembly Language
1100 0010 0110 0101 LDD 101

The command LDD 101 tells the CPU to load data from memory location 101 into the
accumulator. This is clearly easier to understand compared to ‘1100 0010 0110 0101'.

The essence of assembly language is that for each machine code instruction there is an
equivalent assembly language instruction which comprises:
• a mnemonic (a symbolic abbreviation) for the opcode.
• a value or address representation for the operand.
If a program has been written in assembly language it has to be translated into machine code
before it can be executed by the processor. The translation program is called an 'assembler'. The
fact that an assembler is to be used allows a programmer to include some special features in an
assembly language program. Examples of these are:
• comments
• symbolic names for constants
• labels for addresses
• macros
• subroutines
• directives: an instruction to the assembler program
• system calls.
The first three items on this list are there to directly assist the programmer in writing the program
.Of these, comments are removed by the assembler and symbolic names and labels require a
conversion to binary code by the assembler.
A macro or a subroutine contains a sequence of instructions that is to be used more than once in
a program.
Directives and system calls are instructions to the assembler as to how it should construct the
final executable machine code. They can involve directing how memory should be used or defining
files or procedures that will be used. They do not have to be converted into binary code.
Each make of CPU will have its own unique instruction set which will contain hundreds of complex
instructions.
A single CPU instruction consists of a binary number, this is called machine code. The machine
code is denoted in Hexadecimal format, for example Hex '04D3'
The exact range of instructions available to a processor will vary for each processor. However,
there are different types of instructions available to any given processor.
1. Data Movement Instructions / Data Transfer Instructions
2. Arithmetic Operations Instruction Set
3. Logical Operations Instruction Set
4. Conditional and Unconditional Jump
5. Input & Output
6. Selection & Repetition
Data Transfer Instructions
Data transfer instructions are used to move data between registers and between registers
and main memory.
Instruction
Op code Op code Explanation
Operand
(mnemonic) (binary)
Immediate addressing. Load the denary number n
LDM #n 0000 0001
to ACC.
Direct addressing. Load the contents of the
LDD <address> 0000 0010
location at the given address to ACC.
Indirect addressing. At the given address is the
LDI <address> 0000 0101 address to be used. Load the contents of this
second address to ACC.
Indexed addressing. Form the address from
<address> + the contents of the Index
LDX <address> 0000 0110
Register(IX). Copy the contents of this calculated
address to ACC.
LDR #n 0000 0111 Immediate addressing. Load number n to IX.
Relative addressing. Move to the address n
locations from the address of the current
LDV #n 00001010
instruction. Load the contents of this address to
ACC.
STO <address> 0000 1111 Store the contents of ACC at the given address.
2b 9618 W21 P12 –
8b (iii) The opcode LDM uses immediate addressing. The opcode LDD uses direct addressing.
Identify and describe one additional mode of addressing.
Mode of addressing ...........................................................................................................
Description ........................................................................................................................
...........................................................................................................................................
........................................................................................................................................... [2]
3c 9618 S22 P13
3 (a) The table shows part of the instruction set for a processor. The processor has one general
purpose register, the Accumulator (ACC).
Instruction Explanation
Opcode Operand
LDM #n Immediate addressing. Load the number n to ACC
Direct addressing. Load the contents of the location at the
LDD <address>
given address to ACC
Indirect addressing. The address to be used is at the given
LDI <address>
address. Load the contents of this second address to ACC
<address> can be an absolute or symbolic address
# denotes a denary number, e.g. #123
The current contents of main memory are:
Address
100 101
101 67
102 104
103 100
104 68
Complete the table by writing the value stored in the accumulator after the execution of each
instruction. [3]
Instruction Accumulator
LDM #103
LDD 102
LDI 103

(b) The instructions in part (a) are examples of the data movement group.
Describe two other instruction groups.
1 ................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
2 ................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
................................................................................................................................................ [4]
Q 1) Summer 15 P11-12
3 Five modes of addressing and five descriptions are shown below.
Draw a line to connect each mode of addressing to its correct description.
Mode of
Description
addressing

the operand is the address of the


Direct
address of the value to be used

the operand is the address of the value


immediate
to be used

the operand is the offset from the


indexed current address where the value to be
used is stored

the operand plus the contents of the


indirect index register is the address of the
value to be used

relative the operand is the value to be used

Examiner’s Report Quest No 3


This was well answered. A few candidates confused immediate addressing and indirect
addressing.
Arithmetic Instructions Set
Arithmetic instructions can be used to perform arithmetic functions on the contents of the registers.
Some processors allow a range of arithmetic instructions such as addition, subtraction,
multiplication, division and incrementation. Some others only allow addition and subtraction.
Instruction
Explanation
Op code Operand
ADD <address> Add the contents of the given address to ACC.
INC <register> Add 1 to the contents of the register (ACC or IX).
DEC <register> Subtract 1 from the contents of the register (ACC or IX).
Logic Operations Instruction Set
Logic instructions can be used to perform logic functions on the contents of the registers. Some
examples of logic instructions are; AND, OR, XOR and NOT. These can be useful when masking
numbers, for instance converting from ASCII to binary representation of numbers or converting
from higher to lower case ASCII.
Conditional and unconditional Jump
JPE <address> - Following a compare instruction, jump to <address> if the compare was False.
JPN <address> - Following a compare instruction, jump to <address> if the compare was True.
JMP<address> - Jump to the given address unconditionally.
Input & Output
In assembly language ASCII Code is used for each digit and character.
• IN - input a denary number from the keyboard and store in accumulator
• OUTCH – output to the screen character corresponding to the ACII character code in
accumulator
• OUT – output to the screen character corresponding to the ACII character code in accumulator
Selection/Repetition
In assembly language COMPARE is used for selection and repetition both with JUMP.
At first CMP with a condition and then JPE (JUMP IF EQUALS) if condition is true or JPN (JUMP
IF NOT EQUALS) if condition is not true.
Instruction
Op Operand Explanation
code
<address
CMP Compare contents of ACC with contents of <address>.
>
<address Following a compare instruction, jump to <address> if the compare
JPE
> was True.
<address Following a compare instruction, jump to <address> if the compare
JPN
> was False.

Addressing Mode:
1. Direct Addressing: Direct addressing. Load the contents of the location at the given address to
ACC
2. Indirect Addressing: The address to be used is at the given address. Load the contents of this
second address to ACC
3. Immediate Addressing: Load the number n to ACC or IX
4. Relative Addressing: the operand is the offset from the current address where the value to be
used is stored
5. Indexed Addressing: Form the address from <address> + the contents of the Index Register.
Copy the contents of this calculated address to ACC.
0 address instruction (Opcode without Operand)
This type of instruction takes no parameters and involves Assembly code that doesn't need
variables. For example:

• IN - input a denary number from the keyboard and store in accumulator


• OUTCH – output to the screen character corresponding to the ACII character code in
accumulator
• OUT – output to the screen character corresponding to the ACII character code in accumulator
• INC - increment the accumulator by 1
• DEC - decrement the accumulator by 1
• END –Return control to the operating system
1 address instruction
This type of instruction is very useful when you are dealing with only one general purpose register
(the accumulator) and takes only one operand. For example

• LDI #34 - load the accumulator with the denary value of 34


• ADD 234 - add the value stored at memory location 234 to the accumulator
2 address instruction
This type of instruction can accept two operands and the complexity of operations increases. For
example, ADD R1, R2 - add R1 to R2 and store the result back into R1
Note
All questions will assume there is only one general purpose register available (Accumulator)
# ACC denotes Accumulator
IX denotes Index Register
# denotes a denary number
B denotes a binary number, e.g. B01001010
& denotes a hexadecimal number, e.g. &4A
Macro
Macro or sub-routine is a group of instructions given a name performing part of task.
It is required when a group of instructions needed to be executed several times within the same
program. Macro the statements are written once and called using the name whenever they need
to be executed
Directives
Directive is an instruction that directs the assembler to do something.
A directive is not a program instruction, it is information for the assembler
For example following program starts with a directive which tells the assembler to load the first
instruction of the program to address 100.
Absolute Address
Absolute address is a fixed address in memory. Absolute addresses are also called real
addresses and machine addresses.

Absolute address

Symbolic Address
Absolute addresses are numerical address; it is convenient to use names for memory locations.
These names are called symbolic addresses.

Relative Address
Relative address means an address specified by indicating its distance from another address, called
the base address. For example, a relative address might be B+15, B being the base address and 15 the
distance (called the offset).
Assembler
It is impossible for a computer to execute this assembly language code because it is not in
machine code. It is now necessary for the computer to use a translator program to turn the
original program into machine code. This translator program is called an assembler and programs
written in this way are said to be written in assembly language.
The assembly process is relatively simple because assembly language has a one-to-one
relationship with machine code. That is, every assembly language instruction translates into
exactly one machine code instruction.
Two-pass assemblers
An assembler is a translator that translates an assembler program into a conventional machine
language program. Basically, the assembler goes through the program one line at a time, and
generates machine code for that instruction. Then the assembler proceeds to the next instruction.
In this way, the entire machine code program is created. For most instructions this process works
fine, for example for instructions that only reference registers, the assembler can compute the
machine code easily, since the assembler knows where the registers are.

Consider an assembler instruction like the following

ADD Value
...
...
Value: 70

This is known as a forward reference. If the assembler is processing the file one line at a time,
then it doesn't know what Value is when it first encounters the ADD instruction.
So, what is to be done to allow the assembler to generate the correct instruction?
Answer: scan the code twice. The first time, just count how long the machine code instructions will
be, just to find out the addresses of all the labels. Also, create a table that has a list of all the
addresses and where they will be in the program. This table is known as the symbol table. On the
second scan, generate the machine code, and use the symbol table to determine what value to
add, Value labels are, and to generate the most efficient instruction.
This is known as a two-pass assembler. Each pass scans the program, the first pass generates
the symbol table and the second pass generates the machine code.
Basically, the assembler must translate the mnemonics into binary, which is done by having a
simple lookup table with the mnemonics in one column and the binary machine code equivalents
alongside. The labels are a bit more complicated. The assembler does the translation in the same
way, but the table contents are not known before translation starts. The list of labels and their
actual memory address values have to be created by the assembler. As the program is read, the
assembler recognises the first label, NUM1, and allocates an actual memory location for NUM1
relative to the address used to store the first instruction. In this way, the assembler builds its own
lookup table of labels used by the assembly language program.
Assemblers translate from assembly language to machine code. Some assemblers scan the
assembly language program twice; these are referred to as two-pass assemblers.
First Pass:
1. Directives are acted upon
2. The assembler scans the assembly language instructions in sequence.
3. Ignore comments
4. Checks opcode in instruction set
5. Check the operand, is it absolute address or symbolic
6. Creates symbol tables for symbolic address
7. When it meets a symbolic address add it in symbol table
8. Place address of labelled instruction in the symbol table.
Pass 2:
9. Read the assembly language program one line at a time.
10. Generate object code, including opcode and operand, from the symbol table generated in
Pass
11. Save or execute the program.
5a 9608/11 Jun 17 Q4a – SoW
4 The following table shows part of the instruction set for a processor. The processor has one
general purpose register, the Accumulator (ACC) and an Index Register (IX).
Instruction
Op Operand Op code Explanation
code (binary)
Immediate addressing. Load the denary number n to
LDM #n 0000 0001
ACC.
Direct addressing. Load the contents of the location at
LDD <address> 0000 0010
the given address to ACC.
Indirect addressing. At the given address is the address
LDI <address> 0000 0101 to be used. Load the contents of this second address to
ACC.
Indexed addressing. Form the address from <address>
LDX <address> 0000 0110 + the contents of the Index Register(IX). Copy the
contents of this calculated address to ACC.
LDR #n 0000 0111 Immediate addressing. Load number n to IX.
STO <address> 0000 1111 Store the contents of ACC at the given address.
The following diagram shows the contents of a section of main memory and the Index Register
(IX).
(a) Show the contents of the Accumulator (ACC) after each instruction is executed.
5b 9608/12 Jun 17 Q5 - SoW
5 The following table shows part of the instruction set for a processor. The processor has one
general purpose register, the Accumulator (ACC), and an Index Register (IX).
Instruction
Op code Operand Op code Explanation
(mnemonic) (binary)
Direct addressing. Load the contents of the location
LDD <address> 0001 0011
at the given address to the Accumulator (ACC).
Indirect addressing. The address to be used is at the
LDI <address> 0001 0100 given address. Load the contents of this second
address to ACC.
Indexed addressing. Form the address
LDX <address> 0001 0101 from<address>+ the contents of the Index Register.
Copy the contents of this calculated address to ACC.
Immediate addressing. Load the denary number n to
LDM #n 0001 0010
ACC.
Immediate addressing. Load denary number into the
LDR #n 0001 0110
Index Register (IX).
STO <address> 0000 0111 Store the contents of ACC at the given address.
The following diagram shows the contents of a section of main memory and the Index Register
(IX).
(a) Show the contents of the Accumulator (ACC) after each instruction is executed.

(b) Each machine code instruction is encoded as 16 bits (8-bit op code followed by an 8-
bitoperand).
Write the machine code for these instructions: [3]

(c) Computer scientists often write binary representations in hexadecimal.


(i) Write the hexadecimal representation for the following instruction.

.......................................................................................................................................[2]

(ii) A second instruction has been written in hexadecimal as:


16 4D
Write the assembly language for this instruction with the operand in denary.
.......................................................................................................................................[2]
1b 9618 S21 P12
4 The table shows part of the instruction set for a processor. The processor has one general
purpose register, the Accumulator (ACC), and an Index Register (IX).
Instruction
Explanation
Opcode Operand
LDM #n Immediate addressing. Load the number n to ACC
Direct addressing. Load the contents of the location at the given
LDD <address> address to
ACC
STO <address> Store contents of ACC at the given address
ADD <address> Add the contents of the given address to the ACC
INC <register> Add 1 to the contents of the register (ACC or IX)
DEC <register> Subtract 1 from the contents of the register (ACC or IX)
CMP <address> Compare the contents of ACC with the contents of <address>
Following a compare instruction, jump to <address> if the compare
JPE <address>
was True
Following a compare instruction, jump to <address> if the compare
JPN <address>
was False
JMP <address> Jump to the given address
IN Key in a character and store its ASCII value in ACC
Output to the screen the character whose ASCII value is stored in
OUT
ACC
END Return control to the operating system
# denotes a denary number, e.g. #123
The current contents of the main memory and selected values from the ASCII character set are:
(a) Complete the trace table for the program currently in main memory when the following
characters are input:
AD
Do not trace the program any further when the third input is required. [4]
Instruction Memory address
ACC
address 100 101 102
68 65 100
(b) Some bit manipulation instructions are shown in the table:
Instruction Explanation
Opcode Operand
AND #n Bitwise AND operation of the contents of ACC with the operand
Bitwise AND operation of the contents of ACC with the contents
AND <address>
of <address>
XOR #n Bitwise XOR operation of the contents of ACC with the operand
Bitwise XOR operation of the contents of ACC with the contents
XOR <address>
of <address>
OR #n Bitwise OR operation of the contents of ACC with the operand
Bitwise OR operation of the contents of ACC with the contents of
OR <address>
<address>
<address> can be an absolute address or a symbolic address
# denotes a denary number, e.g. #123
The contents of the memory address 300 are shown:
Bit Number 7 6 5 4 3 2 1 0
300 0 1 1 0 0 1 1 0
(i) The contents of memory address 300 represent an unsigned binary integer.
Write the denary value of the unsigned binary integer in memory address 300.
..................................................................................................................................... [1]
(ii) An assembly language program needs to test if bit number 2 in memory address 300 is a 1.
Complete the assembly language instruction to perform this test.
......................... #4 [1]
(iii) An assembly language program needs to set bit numbers 4, 5, 6 and 7 to 0, but keep bits 0 to
3 with their existing values. Write the assembly language instruction to perform this action.
............................................................................................................................................................
....................................................................................................................................... [2]
4b 9608/12 Nov 16 Q5 - SoW
5 The table shows assembly language instructions for a processor that has one general purpose register, the
Accumulator (ACC) and an index register (IX).

Instruction
Explanation
Op Code Operand
LDD <address> Direct addressing. Load the contents of the given address to ACC.
Index addressing. Form the address from <address> + the contents of the
LDX <address>
index register. Copy the contents of this calculated address to ACC.
Indirect addressing. The address to be used is at the given address. Load the
LDI <address>
contents of this second address to ACC.
STO <address> Store the contents of ACC at the given address.
INC <register> Add 1 to contents of the register (ACC or IX).
ADD <address> Add the contents of the given address to the ACC.
END Return control to the operating system.
The diagram shows the contents of a section of main memory:

Main memory

100 0000 0010


101 1001 0011
102
0111 0011
103
0110 1011
104
105 0111 1110
106 1011 0001
107
0110 1000

0100 1011
200

1001 1110
(a) (i) Show the contents of the Accumulator after the execution of the instruction:
LDD 102
ACC:
[1]

(ii) Show the contents of the Accumulator after the execution of the instruction:
LDX 101
IX: 0 0 0 0 0 1 0 0

ACC:

Explain how you arrived at your answer.

............................................................................................................................................................................................
............................................................................................................................................................................................
.........................................................................................................................................................[2]
(iii) Show the contents of the Accumulator after the execution of the instruction:
LDI 103
ACC:

Explain how you arrived at your answer.

............................................................................................................................................................................................
............................................................................................................................................................................................
............................................................................................................................................................................................
............................................................................................................................................................................................
..............................................................................[3]
(b) Complete the trace table below for the following assembly language program.

800 LDD 810

801 INC ACC


STO 812
802
LDD 811
803
ADD 812
804
STO 813
805
END
806


810

811 28
41
812
0
813
0
Trace table:

Memory address
ACC
810 811 812 813
28 41 0 0

[6]
6a 9608/11 Nov 17 Q4 - SoW
4 (b) The following table shows part of the instruction set for a processor. The processor has one
general purpose register, the Accumulator (ACC), and an Index Register (IX).
Op code Operand Op code
Explanation
mnemonic (binary)
LDM #n 1100 0001 Immediate addressing. Load number n to ACC.
Direct addressing. Load the contents of the given
LDD <address> 1100 0010
address to ACC.
Relative addressing. Move to the address n locations
LDV #n 1100 0011 from the address of the current instruction. Load the
contents of this address to ACC.
STO <address> 1100 0100 Store the contents of ACC at the given address.
DEC 1100 0101 Decrement the contents of ACC.
Output the character corresponding to the ASCII
OUTCH 1100 0111
character code in ACC.
Following a compare instruction, jump to <address> if
JNE <address> 1110 0110
the compare was False.
JMP <address> 1110 0011 (Unconditionally) jump to the given address.
CMP #n 1110 0100 Compare the contents of ACC with number n.
Complete the trace table for the following assembly language program.
Trace table: [5]
ACC CountDown OUTPUT
15
67 C
15

(c) The program given in part (b) is to be translated using a two-pass assembler. The program has been
copied here for you. The program now starts with a directive which tells the assembler to load the first
instruction of the program to address 100.

On the first pass of the two-pass process, the assembler adds entries to a symbol table.
The following symbol table shows the first eleven entries, part way through the first pass.
The circular labels show the order in which the assembler made the entries to the symbol table.
Explain how the assembler made these entries to the symbol table.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[3]
(d) The assembler software must then complete the second pass building up the executable file.
(i) Name the second table needed when the assembler software carries out the second pass.
.......................................................................................................................................[1]
The following shows two of the program instructions in machine code.
Instruction
Machine
Binary Hexadecimal
code
1100
OUTCH C7
0111
JNE
A B
CarryOn
Each of the numbers A and B represents the complete instruction in two bytes, one byte for
the op code and one byte for the operand.
(ii) Use the following instruction set to write the numbers for A and B.
A (binary) ........................................................................................................................
B (hexadecimal) .............................................................................................................[3]
6b 9608/12 Nov 17 Q4 - SoW
4 (c) An assembly language program can contain both macros and directives.
(i) Explain what is meant by these terms.
Macro .........................................................................................................................................
............................................................................................................................................................
..............................................................................................................................................
Directive ......................................................................................................................................
............................................................................................................................................................
........................................................................................................................................ [3]
(ii) Give an example of the use of a directive.
............................................................................................................................................................
........................................................................................................................................ [1]

(d) The following table shows part of the instruction set for a processor. The processor has one
general purpose register, the Accumulator (ACC), and an Index Register (IX).
Complete the trace table for the following assembly language program.

Trace table: [5]


ACC Offset OUTPUT
10
50 2
10

(e) The program given in part (d) is to be translated using a two-pass assembler. The program
has been copied here for you.
Label Instruction
StartProg: LDV #Offset
CMP Value
JPE EndProg
OUTCH
LDD Offset
INC
STO Offset
JMP StartProg
EndProg: END
Offset: 10
50
65
89
32
Value: 32
On the first pass, the assembly process adds entries to a symbol table.
The following symbol table shows the first five entries, part way through the first pass.
The circular labels show the order in which the assembler made the entries to the symbol table.
Complete the symbol table. Use circular labels to show the order in which the assembler makes
the entries.
7a 9608/11 Jun 18 Q8a, b - SoW
8 The Von Neumann model uses a series of registers.
(a) Explain what is meant by the term register.
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
.......................................................................................................................... [2]
(b) (i) Explain the purpose of the Memory Data Register (MDR).
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
.......................................................................................................................... [2]
(ii) Name two registers, other than the MDR, that are used in the fetch-execute cycle.
Register 1 ...................................................................................................................................
Register 2 ............................................................................................................................... [2]
8a 9608/11 Nov 18 Q4a, b, d - SoW
4 The table shows assembly language instructions for a processor which has one general purpose
register, the Accumulator (ACC) and an index register (IX).

(a) (i) State what is meant by direct addressing and indirect addressing.
Direct addressing ..............................................................................................................
...........................................................................................................................................
Indirect addressing ............................................................................................................
........................................................................................................................................... [2]
(ii) Explain how the instruction ADD 20 can be interpreted as either direct or indirect addressing.
Direct addressing ..............................................................................................................
...........................................................................................................................................
Indirect addressing ............................................................................................................
........................................................................................................................................... [2]
(b) The assembly language instructions in the following table use either symbolic addressing or
absolute addressing.
Tick ( ) one box in each row to indicate whether the instruction uses symbolic or absolute
addressing. [2]
Instruction Symbolic Absolute
ADD 90
CMP found
STO 20

(c) The current contents of a general purpose register (X) are:


X
1 0 1 1 1 0 1 0
(i) The contents of X represent an unsigned binary integer.
Convert the value in X into denary.
.......................................................................................................................................[1]
(ii) The contents of X represent an unsigned binary integer.
Convert the value in X into hexadecimal.
.......................................................................................................................................[1]
(iii) The contents of X represent a two’s complement binary integer.
Convert the value in X into denary.
.......................................................................................................................................[1]
(d) The current contents of the main memory, Index Register (IX) and selected values from the
ASCII character set are provided with a copy of the instruction set.

Complete the trace table for the given assembly language program. [8]
Instruction Memory Address
ACC IX OUTPUT
Address 200 201 202 203 204 205
70 130 130 133 130 0 0 2 0
4.3 Bit Manipulation
Candidates should be able to: Notes and guidance
Show understanding of and perform binary shifts logical, arithmetic and cyclic
Left shift, right shift
Show understanding of how bit manipulation can be Carry out bit manipulation operations
used to monitor / control a device Test and set a bit (using bit masking)

Bitwise operations are similar to Boolean logic operations except that they work on individual bits
in a byte rather than on whole codes or characters. In this section, we are going to look at the
commonest operators and how they are typically used.
Following are the bitwise operators
Label Instruction
Opcode Operand
Opcode Operand Bitwise AND operation of the contents of ACC with the
AND #n operand
Bitwise AND operation of the contents of ACC with the
AND <address>
contents of <address>
Bitwise XOR operation of the contents of ACC with the
XOR #n
operand
Bitwise XOR operation of the contents of ACC with the
XOR <address>
contents of <address>
Bitwise OR operation of the contents of ACC with the
OR #n
operand
Bitwise OR operation of the contents of ACC with the
contents of <address>
OR <address>
<address> can be an absolute address or a symbolic
address
Bits in ACC are shifted logically n places to the left. Zeros
LSL #n
are introduced on the right hand end
Bits in ACC are shifted logically n places to the right.
LSR #n
Zeros are introduced on the left hand end
<label>: <opcode> <operand> Labels an instruction
<label>: Gives a symbolic address <label> to the memory location
<data>
with contents <data>

Most of the time, data is handled in bytes and words. Sometimes, though, applications require
manipulating data at the bit level.
There are several types of bit manipulation you are required to know:
• Bitwise left shift
• Bitwise right shift signed and unsigned
• Circular shifts
• Masking (AND)
• Setting bits (OR)
• Toggling bits (XOR)
Logical left shift

With a single left shift, each bit is moved up one location with the leftmost bit discarded (the MSB)
and a zero pads out the right most bit (the LSB)

The left shift operation is shown below for the number 00110101

With logical shifts, the sign is not preserved. For example in the diagram below if the number is in
two's compliment, the 1 in the MSB means it is a negative number, but a logical shift results in the
sign being discarded.

Multiplication

Most of the time, when you shift a binary number left, the value is doubled. For example denary 53
is binary 0011 0101. Place this in a binary table and carry out a left shift. The resulting binary 0110
1010 is denary 106 which is double the original number.

This easy way of doubling works so long as the leftmost bit was a 0 before the shift. If it was a 1,
that value is lost and the number isn't doubled. So, for a byte, multiplying through left wise shifts
works for positive numbers up to 127.
Arithmetic shift – the sign of the number is preserved. For example, an 8-bit register containing
the binary value 10101111 shifted right arithmetically three places would become 11110101.
Arithmetic shifts can be used for multiplication or division by powers of two.
Cyclic shift – no bits are lost during a shift. Bits shifted out of one end of the register are
introduced at the other end of the register. For example, an 8-bit register containing the binary
value 1011 0101 shifted left cyclically one place would become 0110 1010.

Instruction
Explanation
Opcode Operand
Bits in ACC are shifted logically n places to the left. Zeros
LSL #n
are introduced on the right hand end
Bits in ACC are shifted logically n places to the right. Zeros
LSR #n
are introduced on the left hand end
Bit manipulation to control devices
In monitoring and control, each bit in a register or memory location can be used as a flag and
would need to be tested, set or cleared separately.
For example, a control system with eight different sensors would need to record when the data
from each sensor had been processed. This could be shown using 8 different bits in the same
memory location.
• AND is used to check if the bit has been set.
• OR is used to set the bit.
• XOR is used to clear a bit that has been set.

The controlling computer or microprocessor has to have a real-time program running continuously.
The program can set values for Boolean variables subject to what the sensors detect. For
instance, if a controlled environment had two properties to be monitored and controlled, four
Boolean variables could be used. Values could be set by assignment statements such as:
IF SensorDifference1 > 0 THEN Sensor1HighFlag ← TRUE
IF SensorDifference1 < 0 THEN Sensor1LowFlag ← TRUE
IF SensorDifference2 > 0 THEN Sensor2HighFlag ← TRUE
IF SensorDifference2 < 0 THEN Sensor2LowFlag ← TRUE
Another part of the monitoring and control program would then be checking whether any of the
four flags were set. The machine code for running such a program could use individual bits to
represent each flag. The way that flags could be set and read are illustrated by the following
assembly language code fragments. In these code fragments the three least significant bits
(positions 0, 1 and 2) of the byte are used as flags.
The following illustrates the setting of all bits to zero which might be used when the system is
switched on.
LDD 0034 Loads a byte into the accumulator from an address.
Uses a bitwise AND operation of the contents of the accumulator with
AND B00000000
the operand to convert each bit to 0.
STO 0034 Stores the altered byte in the original address.
The following illustrates the toggling of the value for one bit. This changes the value of the flag it
represents. It might be needed because a problem has been encountered or alternatively because
a problem has been solved.
LDD 0034 Loads a byte into the accumulator from an address.
Uses a bitwise XOR operation of the contents of the accumulator with the
XOR B00000001
operand to toggle the value of the bit stored in position 0.
STO 0034 Stores the altered byte in the original address.
The following illustrates the setting of a bit to have value 1 irrespective of its existing value. This
would be a simple way of just reporting a condition repetitively.
LDD 0034 Loads a byte into the accumulator from an address.
Uses a bitwise OR operation of the contents of the accumulator with the
OR B00000100 operand to set the flag represented by the bit in position 2. All other bit
positions remain unchanged.
STO 0034 Stores the altered byte in the original address.
The following illustrates setting all bits to zero except one bit which is of interest. Following this
operation, a comparison can be made with a binary value to check if the bit is set. In this example
the value would be compared to the binary equivalent of denary 2.
LDD 0034 Loads a byte into the accumulator from an address.
Uses a bitwise AND operation of the contents of the accumulator with the
AND B00000010 operand to leave the value in position 1 unchanged but to convert every
other bit to 0.
STO 0034 Stores the altered byte in the original address.
AND bitwise operator - both bits must be a 1 for the result to be a 1, otherwise the result is
a 0.
Example 1: 01011100 & 11001110
7 6 5 4 3 2 1 0 Bit position
0 1 0 1 1 1 0 0 Data 1
1 1 0 0 1 1 1 0 Data 2
0 1 0 0 1 1 0 0 AND result

Example 2: 00101010 & 11101100


7 6 5 4 3 2 1 0 Bit position
0 0 1 0 1 0 1 0 Data 1
1 1 1 0 1 1 0 0 Data 2
0 0 1 0 1 0 0 0 AND result

OR bitwise operator - Either bit must be a 1, or both bits must be a 1, for the result to be a
1, otherwise the result is a 0.
Example 3: 10001000 | 11000001
7 6 5 4 3 2 1 0 Bit position
1 0 0 0 1 0 0 0 Data 1
1 1 0 0 0 0 0 1 Data 2
1 1 0 0 1 0 0 1 OR result

Example 4: 00010011 | 00000001


7 6 5 4 3 2 1 0 Bit position
0 0 0 1 0 0 1 1 Operator 1
0 0 0 0 0 0 0 1 Operator 2
0 0 0 1 0 0 1 1 OR result

XOR bitwise operator - both bits must be different for the result to be a 1, otherwise the
result is a 0.
Example 5: 10011110 ^ 00010001
7 6 5 4 3 2 1 0 Bit position
1 0 0 1 1 1 1 0 Data 1
0 0 0 1 0 0 0 1 Data 2
1 0 0 0 1 1 1 1 XOR result
Example 6: 00001010 ^ 11001100
7 6 5 4 3 2 1 0 Bit position
0 0 0 0 1 0 1 0 Data 1
1 1 0 0 1 1 0 0 Data 2
1 1 0 0 0 1 1 0 XOR result

Complement bitwise operator - invert the bits!


Example 7: ~ 01111100
7 6 5 4 3 2 1 0 Bit position
0 1 1 1 1 1 0 0 Data
COMPLEMENT
1 0 0 0 0 0 1 1
result

Example 8: ~ 10100010
1 0 1 0 0 0 1 0 Data
COMPLEMENT
0 1 0 1 1 1 0 1
result

Using masks to change bits and test bits


A mask is a bit pattern that has been defined by a programmer, which allows specific bits in a
piece of data to be tested or altered.
Setting bits to 1
If you need to turn on a specific bit, you can do this using the OR bitwise operation and a suitable
mask. For example, if you need to turn on Bit 4 and Bit 7 of a byte (remember that the bit on the
right hand side is Bit 0), you can use the mask 1001 0000 and the OR bitwise operation.

7 6 5 4 3 2 1 0 Bit position
0 0 0 0 0 0 0 0 Data
1 0 0 1 0 0 0 0 Mask
1 0 0 1 0 0 0 0 OR Result
Resetting bits to 0
You can't force a bit to be 0 using the OR command. You can use the bitwise command AND
along with a suitable mask, however. For example, suppose you wanted to reset Bits 0, 1 and 2 in
a byte but leave all the other bits as they were. You would use the mask 1111 1000 along with the
AND bitwise operator.

7 6 5 4 3 2 1 0 Bit position
1 0 1 0 1 0 1 1 Data
1 1 1 1 1 0 0 0 Mask
1 0 1 0 1 0 0 0 AND Result

Checking a specific bit


You can easily test what a bit is using the AND bitwise operator and a suitable mask. For example,
suppose you wanted to test Bit 2 of a piece of data to see if it was a 0 or 1. You would turn off all
the other bits using the AND bitwise operator, but test Bit 2 by ANDing it with 1. The mask you
would use in this case is 0000 0100 and here is an example of how it works. In the first example,
Bit 2 of the data we want to test is a zero and ANDing it with 1 results in a 0.

7 6 5 4 3 2 1 0 Bit position
0 1 1 0 1 0 0 0 Data
0 0 0 0 0 1 0 0 Mask
0 0 0 0 0 0 0 0 AND Result

We can test the result now. If the result is a zero as it is in this case, then Bit 2 in our data was a
0.
Now see what happens if Bit 2 in the previous data was actually a 1 to start with. When you AND a
1 with a 1, the result is a 1.
7 6 5 4 3 2 1 0 Bit position
0 1 1 0 1 1 0 0 Data
0 0 0 0 0 1 0 0 Mask
0 0 0 0 0 1 0 0 AND Result

As you can see, the result is now not zero anymore. In this situation, it tells us that Bit 0 in the
original piece of data must have been a 1 to start with.
Testing bits like this is very important. Based on the result of the test, we can branch off and do
different things in a program.
Toggling bits (making a 1 bit into a 0 and making a 0 bit into a 1).
We have seen how to turn bits on, and how to turn them off but we haven't seen how to do this at
the same time. For this, we need the XOR bitwise operator. Suppose we want to toggle bits 4, 5, 6
and 7 but leave Bits 0, 1, 2 and 3 in whatever state they are in. The mask we would need is 1111
0000 along with the XOR operator.
7 6 5 4 3 2 1 0 Bit position
1 0 1 0 1 0 1 0 Data
1 1 1 1 0 0 0 0 Mask
0 1 0 1 1 0 1 0 XOR Result

As you can see, the bits that we didn't want to toggle stayed as they were. However the bits that
we did want to toggle were indeed flipped over to the opposite state.
The bit on the left has the biggest value and is worth 128. It is called the Most Significant Bit
(MSB) and its position in the byte is Bit 7 (because in computing, we start counting from 0). The bit
on the right is the Least Significant Bit (LSB) is Bit 0 and is worth 1. When you work with bits, you
need to be very clear the number of the bit you are talking about, its value and terms like MSB and
LSB.
Specimen Paper 9618/01
4 A cake factory uses machines to make cakes .
(d) The machines have a counter to record the number of cake tins filled. Each time a cake tin is
filled, the counter is increased by 1. The value is stored in an 8-bit register, the current value is
shown.

0 0 0 0 1 0 0 1
(i) Show the value of the binary number after another five cake tins have been filled.
[1]

(ii) The following table shows some assembly language instructions for a processor which has one
general purpose register, the Accumulator (ACC).
Instruction
Explanation
Op code Operand
AND #n Bitwise AND operation of the contents of ACC with the operand
Bitwise AND operation of the contents of ACC with the contents
AND <address>
of <address>
XOR #n Bitwise XOR operation of the contents of ACC with the operand
Bitwise XOR operation of the contents of ACC with the contents
XOR <address>
of <address>
OR #n Bitwise OR operation of the contents of ACC with the operand
Bitwise OR operation of the contents of ACC with the contents of
OR <address>
<address>
Bits in ACC are shifted logically n places to the left. Zeros are
LSL #n
introduced on the right hand end
Bits in ACC are shifted logically n places to the right. Zeros are
LSR #n
introduced on the left hand end.
At the end of each day, the register is reset to 0. Write the assembly language statement to reset
the register to 0.
............................................................................................................................................................
....................................................................................................................................... [2]
(iii) A two-place logical shift to the left is performed on the binary number shown in part (d).
Show the result of this logical shift. [1]
(iv) State the mathematical result of a one-place logical shift to the right on a binary number.
............................................................................................................................................................
........................................................................................................................................ [1]
1b 9618 S21 P12
4 (b) Some bit manipulation instructions are shown in the table:
Instruction Explanation
Opcode Operand
AND #n Bitwise AND operation of the contents of ACC with the operand
AND <address> Bitwise AND operation of the contents of ACC with the contents of <address>
XOR #n Bitwise XOR operation of the contents of ACC with the operand
XOR <address> Bitwise XOR operation of the contents of ACC with the contents of <address>
OR #n Bitwise OR operation of the contents of ACC with the operand
OR <address> Bitwise OR operation of the contents of ACC with the contents of <address>
<address> can be an absolute address or a symbolic address
# denotes a denary number, e.g. #123
The contents of the memory address 300 are shown:
Bit Number 7 6 5 4 3 2 1 0
300 0 1 1 0 0 1 1 0
(i) The contents of memory address 300 represent an unsigned binary integer.
Write the denary value of the unsigned binary integer in memory address 300.
..................................................................................................................................... [1]
(ii) An assembly language program needs to test if bit number 2 in memory address 300 is a 1.
Complete the assembly language instruction to perform this test.
......................... #4 [1]
(iii) An assembly language program needs to set bit numbers 4, 5, 6 and 7 to 0, but keep bits 0 to
3 with their existing values. Write the assembly language instruction to perform this action.
............................................................................................................................................................
.................................................................................................................... [2]

1ac 9618 S21 P12_13 –


3 A processor has one general purpose register, the Accumulator (ACC), and several special
purpose registers.
(c) (i) The Accumulator currently contains the binary number:
0 0 1 1 0 1 0 1
Write the contents of the Accumulator after the processor has executed the following instruction:[1]
LSL #2

(ii) The Accumulator currently contains the binary number:


0 0 1 1 0 1 0 1

Identify the mathematical operation that the following instruction will perform on the contents of the
accumulator.
LSR #3
............................................................................................................................................................
.................................................................................................................... [1]
3a 9618 S22 P11 –
6 (a) A computer system is designed using the basic Von Neumann model.
(c) The table shows part of the instruction set for a processor. The processor has one general
purpose register, the Accumulator (ACC).
Instruction
Explanation
Opcode Operand
AND #n Bitwise AND operation of the contents of ACC with the operand
XOR #n Bitwise XOR operation of the contents of ACC with the operand
OR #n Bitwise OR operation of the contents of ACC with the operand
Bits in ACC are shifted logically n places to the left. Zeros are
LSL #n
introduced on the right hand end
Bits in ACC are shifted logically n places to the right. Zeros are
LSR #n
introduced on the left hand end
# denotes a denary number, e.g. #123
(i) Complete the register to show the result after the instruction AND #2 is executed. [1]

Register before: 0 1 1 0 1 1 0 1

Register after:

(ii) Complete the register to show the result after the instruction OR #8 is executed. [1]

Register before: 0 1 1 0 1 1 0 1

Register after:

(iii) Complete the register to show the result after the operation LSL #4 is executed. [1]
Register before: 0 1 1 0 1 1 0 1

Register after:
3b 9618 S22 P12
3 The table shows part of the instruction set for a processor. The processor has one general purpose
register, the Accumulator (ACC).
Instruction
Explanation
Opcode Operand
AND #n Bitwise AND operation of the contents of ACC with the operand
AND <address> Bitwise AND operation of the contents of ACC with the contents of <address>
XOR #n Bitwise XOR operation of the contents of ACC with the operand
XOR <address> Bitwise XOR operation of the contents of ACC with the contents of <address>
OR #n Bitwise OR operation of the contents of ACC with the operand
OR <address> Bitwise OR operation of the contents of ACC with the contents of <address>
<address> can be an absolute or a symbolic address
# denotes a denary number, e.g. #123
(a) The ACC currently contains the following positive binary integer:
0 1 1 0 0 1 0 1
Write the bit manipulation instruction that would change the binary integer in ACC to:
1 1 1 1 1 1 1 1
Opcode ..................................................... Operand ..................................................... [2]
(b) The ACC currently contains the following positive binary integer:
0 1 1 0 0 1 0 1
Write the bit manipulation instruction that would change the binary integer in ACC to:
1 0 0 1 1 0 1 0
Opcode ..................................................... Operand ..................................................... [2]

(c) Convert the following positive binary integer into hexadecimal.


01111110

............................................................................................................................................. [1]
(d) A three-place logical shift to the left is performed on the following positive binary integer.
Show the result of this logical shift.

01111110

............................................................................................................................................. [1]
3c 9618 S22 P13
3 (c) The table shows part of the instruction set for a processor. The processor has one general
purpose register, the Accumulator (ACC).
The binary value 00111101 is stored in the memory address 200.
Each instruction in the diagram is performed on the data in memory address 200.
Draw one line from each instruction to its correct result. [3]

Instruction Result
01111101

XOR
00111101
B11110000

OR B01010101 11111111

AND
11000010
B11111111

11001101
MJ19 P31
6 Monitoring and control systems have many different applications.
(a) Explain the importance of feedback in a control system.
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................ [3]
(b) An indoor swimming pool is to be kept at a constant temperature of 28 degrees.
Describe the use of feedback in this control system.
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................ [4]
(c) Give one example of a monitoring system. Explain why this is a monitoring system.
Monitoring system ....................................................................................................................
...................................................................................................................................................
Explanation ...............................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
MJ18P32
6 (a) There are five scenarios on the left and two types of system on the right.
Draw a line to link each scenario to its correct type of system.[2]
Scenario System
Car speed display

Aero plane autopilot Control

Rollercoaster

Recording the rainfall at a Monitoring


weather station

Robot loading a part on to a


conveyor belt

(b) Mary has six fish tanks. The temperature of the water in each tank needs to be within a specific
range. Identify three items of hardware that Mary can add to her tanks to help maintain the
temperature. Describe the purpose of each item.
Item 1 .........................................................................................................................................
Purpose ....................................................................................................................................
....................................................................................................................................................
Item 2 .....................................................................................................................................
Purpose ....................................................................................................................................
...................................................................................................................................................
Item 3 ........................................................................................................................................
Purpose ....................................................................................................................................
...............................................................................................................................................[6]
(c) A temperature reading is taken from each tank once per minute. The temperature reading is
stored as two successive bytes. The format is shown:
Fish tank Temperature reading
7 6 5 4 3 2 1 0

Byte 1 Byte 2

The fish tank number is indicated by setting one of the bits in Byte 1 to 1. For example, fish tank
number 5 is indicated by setting bit 5 to 1.
Bit 7 of Byte 1 is a flag:
• the flag’s initial value is zero
• when the reading has been processed, the flag’s value is set to 1
Bit 0 of Byte 1 is unused.
Byte 2 contains the temperature reading as a two’s complement integer.
(i) After a temperature reading has been taken, the bytes contain the following data.
7 6 5 4 3 2 1 0
0 0 0 0 1 0 0 0 0 0 0 0 1 0 1 1
Byte 1 Byte 2
Analyse the data contained in the two bytes.
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
..........................[3]
(ii) The system receives a temperature reading of -2 from fish tank number 4.
Complete the bytes to show the values for this reading after it has been processed. [2]
7 6 5 4 3 2 1 0

Byte 1 Byte 2
(d) A hardware device to affect the temperature of each tank is on or off depending on the value of
a bit in memory location 6753.
If bit 4 is 1, then the hardware device in fish tank 4 is on.
Write assembly language instructions to set bit 4 of memory location 6753 to 1 without changing
any other bits. Use the instruction set provided.
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
..........................[3]
Instruction set
Instruction Explanation
Op code Operand
Direct addressing. Load the contents of the location at the given address
LDD <address>
to ACC.
STO <address> Store the contents of ACC at the given address.
AND #n Bitwise AND operation of the contents of ACC with the operand.
Bitwise AND operation of the contents of ACC with the contents of
AND <address>
<address>.
XOR #n Bitwise XOR operation of the contents of ACC with the operand.
OR #n Bitwise OR operation of the contents of ACC with the operand.
Bitwise OR operation of the contents of ACC with the contents of
OR <address> <address>.
<address> can be an absolute address or a symbolic address.
MJ18P32
7 A museum stores antique items that need to be kept at constant temperature.
The museum is not sure about the actual temperatures. The museum installs some equipment.
This records the temperatures every hour and ensures the temperature stays within a set range.
(a) Identify the type of system described.
...............................................................................................................................................[1]
(b) The system has a temperature sensor. Identify two other items of hardware that the museum
can use for the type of system identified. Describe the purpose of each item.
Item 1 ........................................................................................................................................
Purpose ....................................................................................................................................
...................................................................................................................................................
Item 2 ........................................................................................................................................
Purpose ....................................................................................................................................
.................................................................................................................................................[4]
(c) The equipment records the temperature in all seven rooms in the museum.
Each recording is stored as two successive bytes in memory. The format is as shown.
Temperature Room
7 6 5 4 3 2 1 0

Byte 1 Byte 2
The room is indicated by the setting of one of the bits in Byte 2 to 1. For example, room 7 is
indicated by setting bit 7 to 1.
Bit 0 of Byte 2 is a flag:
• The flag’s initial value is zero.
• When the reading has been processed, the flag’s value is set to 1.
Byte 1 contains the temperature reading as an unsigned integer.
One reading returns the following binary data.
Temperature Room
7 6 5 4 3 2 1 0
1 0 1 1 0 0 1 1 0 0 1 0 0 0 0 1
Byte 1 Byte 2
(i) Analyse the data contained in the two bytes.
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
...................[3]
(ii) The system receives a temperature reading of 238 from room number 4. [2]
Complete the bytes to show the two bytes for this recording. The reading has not yet been
processed.

7 6 5 4 3 2 1 0

Byte 1 Byte 2
Unit 5 System Software
Topic You should be able to R A G
• Describe an Operating System (OS), the tasks performed, why an OS is
needed, the role of utility programs and program libraries
System
• Understand the need for language translators, Integrated Development
Software
Environments (IDE), the role of compilers and interpreters and their
benefits and drawbacks
CMOS – complementary metal-oxide semiconductor.
Operating system – software that provides an environment in which applications can run and provides an
interface between hardware and human operators.
HCI – human–computer interface.
GUI – graphical user interface.
CLI – command line interface.
Icon – small picture or symbol used to represent, for example, an application on a screen. WIMP –
windows, icons, menu and pointing device.
Post-WIMP – interfaces that go beyond WIMP and use touch screen technology rather than a pointing
device.
Pinching and rotating – actions by fingers on a touch screen to carry out tasks such as move, enlarge,
reduce, and so on.
Memory management – part of the operating system that controls the main memory.
Memory optimisation – function of memory management that determines how memory is allocated and
deallocated.
Memory organisation – function of memory management that determines how much memory is allocated
to an application.
Security management – part of the operating system that ensures the integrity, confidentiality and
availability of data.
Contiguous – items next to each other.
Virtual memory systems – memory management (part of OS) that makes use of hardware and software to
enable a computer to compensate for shortage of actual physical memory.
Memory protection – function of memory management that ensures two competing applications cannot
use same memory locations at the same time.
Process management – part of the operating system that involves allocation of resources and permits the
sharing and exchange of data.
Hardware management – part of the operating system that controls all input/output devices connected to
a computer (made up of sub-management systems such as printer management, secondary storage
management, and so on).
Device driver – software that communicates with the operating system and translates data into a format
understood by the device.
Utility program – parts of the operating system which carry out certain functions, such as virus checking,
defragmentation or hard disk formatting.
Disk formatter – utility that prepares a disk to allow data/files to be stored and retrieved.
Bad sector – a faulty sector on an HDD which can be soft or hard.
Antivirus software – software that quarantines and deletes files or programs infected by a virus (or other
malware). It can be run in the background or initiated by the user.
Heuristic checking – checking of software for behaviour that could indicate a possible virus.
Quarantine – file or program identified as being infected by a virus which has been isolated by antivirus
software before it is deleted at a later stage.
False positive – a file or program identified by a virus checker as being infected but the user knows this
cannot be correct.
Disk defragmenter – utility that reorganises the sectors on a hard disk so that files can be stored in
contiguous data blocks.
Disk content analysis software – utility that checks disk drives for empty space and disk usage by
reviewing files and folders.
Disk compression – software that compresses data before storage on an HDD.
Back-up utility – software that makes copies of files on another portable storage device.
Program library – a library on a computer where programs and routines are stored which can be freely
accessed by other software developers for use in their own programs.
Library program – a program stored in a library for future use by other programmers.
Library routine – a tested and ready-to-use routine available in the development system of a programming
language that can be incorporated into a program.
Dynamic link file (DLL) – a library routine that can be linked to another program only at the run time stage.
Translator – the systems software used to translate a source program written in any language other than
machine code.
Compiler – a computer program that translates a source program written in a high-level language to
machine code or p-code, object code.
Interpreter – a computer program that analyses and executes a program written in a high-level language
line by line.
Integrated development environment (IDE) – a suite of programs used to write and test a computer
program written in a high-level programming language.
Pretty-printing – the practice of displaying or printing well set out and formatted source code, making it
easier to read and understand.
Syntax error – an error in the grammar of a source program.
Logic error – an error in the logic of a program.
Debugging – the process of finding logic errors in a computer program by running or tracing the program.
Single stepping – the practice of running a program one line/instruction at a time.
Breakpoint – a deliberate pause in the execution of a program during testing so that the contents of
variables, registers, and so on can be inspected to aid debugging.
Report window – a separate window in the run-time environment of the IDE that shows the contents of
variables during the execution of a program.
Context-sensitive prompt - Displays predictions of the code being entered
Dynamic syntax check - Underlines or highlights statements that do not meet the rules of the language
5.1 Operating System
Candidates should be able to: Notes and guidance
Explain why a computer system requires an
Operating System (OS)
Explain the key management tasks carried out Including memory management, file
by the Operating System management, security management, hardware
management (input / output / peripherals),
process management
Show understanding of the need for typical Including disk formatter, virus checker,
utility software provided with an Operating defragmentation software, disk contents
System analysis/disk repair software, file compression,
back-up software Including:
Show understanding of program libraries • software under development is often
constructed using existing code from program
libraries.
• the benefits to the developer of software
constructed using library files, including
Dynamic Link Library (DLL) files

Hardware is the physical parts of the computer and software is the programs that run on a
computer.
There is a close relationship between hardware and software. Without software, hardware is very
limited and without hardware, software would not be able to run. They need each other.
Software:
Data and programs of computer are known as software.
There are two main types of software: systems software and application software.
System Software
System software is a software that provides platform to other software.
Systems software includes the programs that are dedicated to managing the computer itself, such
as the operating system and utility software.
Operating System
An operating system (OS) is a type of system software that manages computer’s hardware and
software resources.
It provides common services for computer programs. An OS acts a link between the software and
the hardware. It controls and keeps a record of the execution of all other programs that are
present in the computer, including application programs and other system software.
Most operating systems comprise a large set of programs, only some of which are stored in the
computer’s memory all the time. Many of the routines available in the OS are stored on the hard
drive so that they can be accessed when required. This saves space in the computer’s main
memory.
When you are using applications software, you are not communicating directly with the computer
hardware. Your applications software communicates with OS program modules that communicate
with the computer hardware on its behalf. Without an operating system, a computer is useless no
matter how many programs you have.
Why an operating system is need?
An operating system is the most important software that runs on a computer. It manages
the computer's memory and processes, as well as all of its software and hardware. It also allows
user to communicate with the computer without knowing how to speak the computer's language.
The hardware is unusable without an OS. Operating system hides complexity of hardware from
user. It acts as an interface/ controls communication between user and hardware, hardware and
software. It provides software platform / environment on which other programs can be run.
The management tasks performed by the operating system are
1. Memory Management: The OS keeps track of every memory location and is responsible for
making memory available for different processes, such as allocating free space in memory to
programs. The OS also deals with virtual memory and swapping pages in and out of RAM.The OS
keeps track of the primary memory and allocates the memory when a process requests it.
a. Memory protection to ensure that two programs do not try to use the same space,
otherwise results of processing will be incorrect.
b. Memory optimisation: To optimise the use of memory
o operating system determines which processes need to be loaded in main memory at any
one time.
o and how memory is deallocated on termination of a process.
o It also keeps track of free memory locations.
o It also swaps data between memory and HDD or SSD
c. Memory organisation: to determine how much memory is allocated to an application, and
how the memory can be split up in the most appropriate or efficient manner.
o In embedded system, a single (contiguous) allocation, where all of the memory is made
available to a single application.
o partitioned allocation, where the memory is split up into contiguous partitions (or blocks)
and memory management then allocates a partition (which can vary in size) to an
application
o paged memory, which is similar to partitioned allocation, but each partition is of a fixed size.
This is used by virtual memory systems
o segmented memory, which is different because memory blocks are not contiguous – each
segment of memory will be a logical grouping of data (such as the data which may make up
an array).
2. File Management: Allocates and de-allocates the resources and decides who gets the
resources.
• Maintains directory structures,
• Provides file naming conventions
• Performing create, copy, rename, delete etc. tasks
• Controls access of files
• Specifying file storage format like FAT or NTFS
3. Security Management: To ensure privacy, integrity and availability of data. Prevents
unauthorized access to programs and data by means of passwords.
• Keeping operating system up-to-date
• Keeping anti-virus software up-to-date
• Investigating firewall, to prevent unauthorised access
• Makes provision for recovery when data is lost for example back-up
• Provides usernames and passwords /encryption / user accounts to ensure privacy of data
• offering the ability for the recovery of data (and system restore) when it has been lost or
corrupted using back-ups etc.
4. Hardware Management
Programmers write software and users run this software. The software uses the hardware. The
operating system has to ensure that the hardware does what the software wants it to do.
Hardware management involves all input and output peripheral devices.
The functions of hardware management include
• communicating with all input and output devices using device drivers
• translating data from a file (defined by the operating system) into a format that the input/output
device can understand using device drivers
• ensuring each hardware resource has a priority so that it can be used and released as required.
The management of input/output devices is essentially the control and management of queues
and buffers. For example, when printing out a document, the printer management
• locates and loads the printer driver into memory
• sends data to a printer buffer ready for printing
• sends data to a printer queue (if the printer is busy or the print job has a low priority) before
sending to the printer buffer
• sends various control commands to the printer throughout the printing process
• receives and handles error messages and interrupts from the printer.
5. Process /resource management
A program, during execution is referred as a process. Many process are running in computer at a
time and each process needs access to computer resources.
The OS must manage the physical resources of the computer. Some resources are limited and
must be managed to maximise the use of the computer system:
- A computer system has only a fixed number of processors.
- Secondary storage is of a fixed size.
- Some input/output devices (e.g. printers) are shared.
Following process management tasks are done by operating system:
• Scheduling of processes / multi-tasking / multi-programming etc.
• Resolution of conflicts when two or more processes require the same resource using queue
etc.
6. Provision of a software platform/ environment
• The OS provides a platform on which the applications software can run.
7. Interrupt handling
Interrupts are signals sent be a hardware or a software or a user to seek attention of operating
system. Interrupts are handled by operating system like:
• Identifies priorities of interrupts
• Save current memory / process values /saves data on power outage
• Loads appropriate Interrupt Service Routine (ISR)

8. User- system interface


The OS provides a means of communication (the user interface) between the human user, or the
outside world, and the computer. A user interface is needed to allow the user to get the software
and hardware to do something useful. An operating system should provide at least the following
for user input and output:
• a command-line interface
• a graphical user interface (GUI).
Utility software
Programs that carry out tasks necessary to the operation of the computer are known as utility
software.
Disk formatter
When a disk is first produced the surface is
blank. It cannot be used to store data until it
has been formatted by disk formatter
software. The formatting process divides
the disk into smaller areas, each of which
can be searched more easily.
The disk surface is divided into a number of
tracks and each track is divided into smaller
blocks called sectors.
The amount of information that can be stored is enormous. One of the tracks is used as an index,
to hold data about where the other data are stored. The formatting process removes all data from
the disk so you should save the contents of a disk elsewhere before re-formatting it.
Why to Format?
– To configure the disc for use / initialise tracks and sectors
– To partition the disc into logical drives
– To initialise a file system (e.g. FAT, NTFS) / create a file directory
– To install a boot sector (if creating a bootable disk)
– To prepare the disc for initial use
– To check all sectors and mark bad sectors

Disk Mirroring
Disk mirroring is a form of disk backup in which anything that is written to a disk is simultaneously
written to a second disk. This creates fault tolerance in the critical storage systems. If a physical
hardware failure occurs in a disk system, the data is not lost, as the other hard disk contains an
exact copy of that data.
Mirroring can be either hardware or software based.
Disc Defragmenter
Defragmentation is the process of reorganizing the
data stored on the hard drive so that related pieces of
data are put back together, all lined up in a continuous
fashion. Defragmentation picks up all of the pieces of
data that are spread across hard drive and puts them
back together again.
Defragmentation physically organises the contents of
the mass storage device used to store files into the
smallest number of contiguous regions (fragments, extents). It also attempts to create larger
regions of free space using compaction to impede the return of fragmentation.
Defragmentation:
– Re-organises the disk contents
– Moves split files to rearrange blocks that are used for each file to make blocks contiguous
(so that file reading is faster)
– Reduces head movements
– Creates a larger area of (contiguous) free space

Disc checker or Disc Repair Software


A disk checker is a utility program which can scan a hard disk to find files or areas that are corrupted in
some way, or were not correctly saved, and eliminate them for a more efficiently operating hard drive. N
It is used to identify bad sectors so that they can be marked as unusable. It also verifies file system
integrity and fixes logical file system errors (Disc).
Hardware drivers
Any piece of hardware needs to be controlled and set up for communication with the processor.
The hardware drivers are programs that control the communication between the device and the
operating system.
File Manager
Data stored on a computer system are organised as files. A set of utility programs is needed to
handle the storage and use of these files. There are programs to store and retrieve the files and
programs that allow files to be altered or deleted. Sometimes the contents of two files need to be
combined (merged) or the contents of a file may need to be put into a particular order (sorted).
A file handling utility normally does all these tasks.
File compression:
A file compression utility is a software program that is used to compress/decompress the contents
of the disc, thus increasing capacity.
A file compression utility is used in many other situations, for example where large sized files of
one particular format need to be compressed. Here it can be used when thousands of files of one
format are created on a daily basis and these need to be compressed. For instance when image
files are created as part of a scanning process, such a software program can be used to convert
these normally large sized files into much smaller ones. This can result in a large amount of disc
space being saved as such files can quickly overwhelm servers, especially when a scanning
process is continuous and files are created daily.

Anti-virus
A computer virus is a small program that can reproduce itself. If it “infects” a computer system, a
virus can cause a range of damage including deleting files.
Antivirus software is a type of utility software used for scanning and removing viruses from
your computer. While many types of antivirus (or "anti-virus") programs exist, their primary
purpose is to protect computers from viruses and remove any viruses that are found.
Anti-virus is a software that continuously checks for viruses and is running in the background. It
indicates when / if a virus is found.
It can remove or quarantine the virus.
It checks disks and downloads for viruses automatically and asks user if they want virus scan. It is
used to protect the computer from viruses / to detect viruses
Backup software
Data backup is a utility software used to create a duplicate copy of data to safeguard it and enable
recovery. It is used to store disk contents (somewhere else) in case of disk failure, theft, natural
disaster or accidentally loss.
Backup software will:
• establish a schedule for backups
• only create a new backup file when there has been a change.
Program library
A collection of standard programs and subroutines that are stored and available for immediate
use.
Library routines are very valuable to programmers because they have already been written and
tested so the programmer is saved a lot of work; the code exists in compiled form so it does not
need to be re-compiled when it is used. Library routine is a pre-existing, pre-compiled and pre-
written modules (code). They can be linked into other program (without amendment). They are
developed to perform common. Library routines are also written for complex tasks like math
functions.

Benefit of library routines:


Less code needs to be written.
Library routine saves programming time, as code does not have to be written/re-written from
scratch, means saves re-inventing the wheel.
Library routines are used by many people that’s why they are pre-tested and well tested so it is
more robust/likely to work. Programmers can be fairly sure that the function will likely to work as it
should so it reduces time in testing.
They can be written in a different programming language.
They make use of special features of that language. They are also used for complex algorithms
(e.g. mathematical/graphics functions). The collection of over 1600 procedures for mathematical
and statistics processing available from the Numerical Algorithms Group (NAG) library. This
organisation has been creating routines since 1971 and they are universally accepted as being as
reliable as software ever can be.
Programmer does not need to work out how to write it so that he may not know how to code.
If there is an improvement in the library routine, the program updates automatically.

Drawbacks:
When a library routine is linked in a program, its copy is added in the executable code (every
program using a routine has to have its own copy of the routine). This increases the storage space
requirement for the executable file. It also increases memory usage when more than one process
uses the routine.
Sometime there are compatibility issues, they may not work with the other code/may require
changing program for it to work. They may need editing.
They are not tested means not guaranteed thorough testing.
There may be unknown or unexpected bugs / virus in the library routines.
Library routine may not meet exact needs or may give unexpected results.
If library routine is changed, there may be unexpected results / errors.
Why library routines are used in writing programs?
• The code is already written so the programmer is not starting over again which saves time.
• The code will have been used by many people so it should be already thoroughly tested and
relatively error-free / won’t need re-testing.
• The programmer can use e.g. mathematical / graphics functions etc. that he may not know how
to code.
• Use of named library functions can simplify the program and make it easier to read.
• The library routine code should conform to industry standards and therefore contribute towards a
more robust program.
Dynamic Linked Library (DLL)
Dynamic Linked Library is a collection of library routines that requires only a small piece of code to
be included in the main program. This allows it to link to the routine, which is stored separately in
memory, when execution of the program needs it.
The use of library (DLL) files fits exactly with strategy for managing the memory. A commercial
program such as Microsoft Word has one main executable (EXE) file which is loaded initially. The
code for other features, such as the spelling checker, could be contained in a separate DLL file
which is only loaded into main memory when required.
Advantages of DLL
DLL files are only loaded into memory when required so the executable file is smaller as the
executable does not contain all the library routines. It also saves space in memory.
The changes, improvements and error correction to the DLL file code are done independently of
the main program and as they are linked with the main program so there is no need to recompile
the main program.
Many processes can be linked to the same routine. This has the advantage that the executable
files for all programs need less storage space. Memory requirement is also minimised.
Another advantage is that if a new version of the routine becomes available it can be loaded into
memory so that any program using it is automatically upgraded.

Disadvantages of DLL
The main disadvantage of using a DLL is that the program is relying on the routine being available
and performing the expected function. If for some reason the DLL becomes corrupted or a new
version has bugs not yet discovered the program will fail or produce an erroneous result. The user
running the program will find it difficult to establish what needs to be done to get the program to
run without error.
The DLL file(s) needed to be included at run time so the executable code is not self-contained.
Appropriate (linking) software must be available at run-time to link, include or import the DLL files.
The DLL file must be present at run time otherwise (unable to find X.dll) errors.
Unexpected changes to the DLL file /corrupted DLL file and could mean the program stops
working as expected.
Malicious changes to the DLL file, could install a virus on the user’s computer and related files
could be corrupted.
1b 9618 S21 P12
7 Jennifer is writing a computer program for her A Level homework.
(a) Jennifer uses a program library to help her write her computer program.
Describe how a program library can be used while writing a computer program.
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
.................................................................................................................. [2]
(b) Jennifer uses an Integrated Development Environment (IDE) to write her computer program.
(i) The IDE allows Jennifer to use both an interpreter and a compiler while creating her computer
program.
Describe the ways in which Jennifer can use both a compiler and an interpreter while developing
the program.
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
.............. [4]
(ii) Identify two debugging tools that a typical IDE can provide.
1 ........................................................................................................................................
...........................................................................................................................................
2 ........................................................................................................................................
........................................................................................................................................... [2]
1ac 9618 S21 P12_13 –
2 Bingwen’s computer comes with an Operating System and utility software.
(a) Draw one line from each utility software to its correct description. [4]
Utility software Description
Scans software for errors and repairs
the problems

Moves parts of files so that each file is


Disk formatter
contiguous in memory

Creates a copy of data that is no


Defragmentation
longer required

Sets up a disk so it is ready to store


Back-up
files

Creates a copy of data in case the


Disk repair
original is lost

Scans for errors in a disk and corrects


them

(b) Identify four key management tasks that the Operating System will perform.
1 ................................................................................................................................................
2 ................................................................................................................................................
3 ................................................................................................................................................
4 ............................................................................................................................................[4]
2b 9618 W21 P12 –
7 A computer has system software.
(a) The Operating System handles interrupts.
Tick (✓) one box in each row to identify whether each event is an example of a hardware interrupt
or a software interrupt. [3]
Event Hardware interrupt Software interrupt
Buffer full
Printer is out of paper
User has pressed a key on the keyboard
Division by zero
Power failure
Stack overflow

(b) Describe the file management tasks that an Operating System performs.
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
.............................................................................. [4]
(c) Identify two utility programs that can be used to improve the performance of a computer and
state how they improve the performance.
1 ................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
2 ................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................... [4]
2ac W21 P11 P13 –
4 Francis is starting his first job as a software developer for a multinational company.
(b) Francis is shown the software he will be working on. He is unfamiliar with the Integrated
Development Environment (IDE) he is required to use.
(ii) A typical IDE provides debugging tools to support the testing of a program.
Identify three other tools or features found in a typical IDE to support the writing of the program.
1 ........................................................................................................................................
2 ........................................................................................................................................
3 ........................................................................................................................................[3]
(d) Francis’s team use language translators.
Complete the descriptions of language translators by writing the missing words.
............................................... are usually used when a high-level language program is complete.
They translate all the code at the same time and then run the program.
They produce ............................................... files that can be run without the source code.
............................................... translate one line of a high-level language program at a time,
and then run that line of code. They are most useful while developing the programs because
errors can be corrected and then the program continues from that line.
Assemblers are used to translate assembly code into ............................................... . [4]

3a 9618 S22 P11 - 5 A programmer uses an Integrated Development Environment (IDE) to


develop a program.
(a) Draw one line from each IDE feature to its correct description. [4]
IDE feature Description
Executes one line of the program and then
Context-sensitive prompt
stops

Underlines or highlights statements that do


Dynamic syntax check
not meet the rules of the language

Outputs the contents of variables and data


Breakpoint
structures

Single stepping Stops the code executing at a set line

Displays predictions of the code being


Report window
entered

(b) The programmer wants to allow users to edit, improve and redistribute the program.
Identify two different types of software licence that the programmer could use.
1 ................................................................................................................................................
2 ............................................................................................................................................[2]
(c) Explain the benefits to the programmer of using program libraries.
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
.............................................................................. [3]
3b 9618 S22 P12
6 A programmer uses language translators when writing and testing a program.
(a) Describe the operation of a compiler.
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...................................................................................................................................... [2]
(b) Describe the operation of an interpreter.
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
..................................................................................................................................... [2]
(c) Explain how a programmer can make use of a typical Integrated Development Environment (IDE) when
writing and testing a program.
Writing .......................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
Testing ......................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
................................................................................................................................................... [4]
3c 9618 S22 P13
4 A computer has system software including an operating system.
(a) Describe the key management tasks of an operating system.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [4]
(b) Utility software is a type of system software.
(i) Describe the purpose of back-up software and defragmentation software.
Back-up software ..............................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
Defragmentation software .................................................................................................
...........................................................................................................................................
...........................................................................................................................................
........................................................................................................................................... [4]
(ii) Give one other example of utility software.
..................................................................................................................................... [1]
4a 9618 w22 P11
7 (a) State two benefits to a programmer of using Dynamic Link Library (DLL) files.
1 ................................................................................................................................................
...................................................................................................................................................
2 ................................................................................................................................................
................................................................................................................................................... [2]
(b) Memory management is one of the tasks performed by an Operating System (OS).
Describe the ways in which memory management organises and allocates Random Access Memory (RAM).
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [2]

9608 5ac S17 Paper 31-33


6 A computer system is used to manage some of the functions in a vehicle. The vehicle has a
number of sensors and actuators. One sensor is used to monitor the moisture on the screen. If the
moisture exceeds a pre-set value, the windscreen wiper motor turns on automatically.
The software used in the computer system is dedicated to the sensor management functions.
When the system starts, the software runs some initial tasks. It then loops continuously until the
system is switched off.
(a) (i) State the name given to the type of system described.
....................................................................................................................................... [1]
(ii) Explain your answer to part (i).
...........................................................................................................................................
....................................................................................................................................... [1]
(b) Within the software loop, the value of each sensor is read in turn. The value read from the
sensor is then processed.
State two drawbacks with this method of reading and processing sensor data.
Drawback 1 ...............................................................................................................................
...................................................................................................................................................
Drawback 2 ...............................................................................................................................
................................................................................................................................................ [2]
(c) An alternative method of reading and processing sensor data is to use interrupts. Each sensor
is connected so that it can send an interrupt signal to the processor if its value changes. On
receipt of an interrupt signal, the processor carries out a number of steps as shown in the following
diagram.

(i) State the purpose of step 1.


............................................................................................................................................................
............................................................................................................................................................
.................................................................................................................................. [1]
(ii) State the purpose of step 6.
............................................................................................................................................................
............................................................................................................................................................
................................................................................................................................ [1]
(iii) Explain how the current task is saved in step 2.
............................................................................................................................................................
............................................................................................................................................................
................................................................................................................................. [2]
(iv) State two benefits of using interrupts to read and process the sensor data.
Benefit 1 ..................................................................................................................................
.................................................................................................................................................
Benefit 2 .................................................................................................................................
.......................................................................................................................................... [2]
(v) The interrupt handler in step 3 has to test each bit of a 16-bit register to discover the source of
the interrupt.
The contents of the 16-bit register are loaded into the 16-bit accumulator:

An instruction is required to achieve the following:


• If bit 9 is zero, set the accumulator to zero.
• If bit 9 is one, set the accumulator to a non-zero value.
Write this instruction using an appropriate bitwise operation.
....................................................................................................................................... [2]
Q 4) Winter 15 P12
Before it is used, a hard disk is formatted using disk formatter software.
(a) Explain why formatting is needed.
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
........................................................................................................................... [2]
(b) Eventually, the performance of the hard disk deteriorates.
Name three other utility programs that might be required. State why each is needed.
1 ................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
....................................................................................................................................
2 ................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
.................................................................................................................................
3 ................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................ [6]
Q 7) Winter 2016 P12
8 A programmer is writing a program that includes code from a program library.
(a) Describe two benefits to the programmer of using one or more library routines.
1 ................................................................................................................................................
............................................................................................................................................................
........................................................................................................................................
2 ................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
........................................................................................................................... [4]
(b) The programmer decides to use a Dynamic Link Library (DLL) file.
(i) Describe two benefits of using DLL files.
1 ..................................................................................................................................................
………..................................................................................................................................................
............................................................................................................................................................
......................................................................................................................................
2 ..................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
.................................................................................................................................. [4]
(ii) State one drawback of using DLL files.
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
....................................................................................................................[2]
Q 8) 9608 Summer 2017 P11_13
6 (a) The operating system (OS) contains code for performing various management tasks.
The appropriate code is run when the user performs various actions.
Draw a line to link each OS management task to the appropriate user action. [3]
OS management task Action

Main memory The user moves the mouse on


management the desktop

Input/output The user closes the spread sheet


management program

Secondary storage The user selects the Save


management command to save their spread
sheet file

Human computer The user selects the Print


interface management command to output their spread
sheet document
(b) A user has the following issues with the use of his PC.
State the utility software which should provide a solution.
(i) The hard disk stores a large number of video files. The computer frequently runs out of storage
space.
Utility software solution .................................................................................................[1]
(ii) The user is unable to find an important document. He thinks it was deleted in error some
weeks ago. This must not happen again.
Utility software solution .................................................................................................[1]
(iii) The operating system reports ‘Bad sector’ errors.
Utility software solution .................................................................................................[1]
(iv) There have been some unexplained images and advertisements appearing on the screen. The
user suspects it is malware.
Utility software solution .................................................................................................[1]
Q 9) 9608 Summer 17 P12
4 (a) (i) Explain why a personal computer (PC) needs an operating system (OS).
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
................................................................................................................... [2]
(ii) One of the tasks carried out by the OS is the management of the use of the processor.
Name and describe two other management tasks that the OS performs.
1 ..................................................................................................................................................
............................................................................................................................................................
.............................................................................................................................................
2 .................................................................................................................................................
............................................................................................................................................................
......................................................................................................................................... [4]
(b) A user has the following issues with the use of their personal computer (PC).
For each case, state the utility software which should provide a solution.
(i) The user wants to send a large file as an attachment to an email. The user knows that the
recipient’s Internet Service Provider (ISP) has a limit of 2MB for file attachments.
Utility software solution: ................................................................................................[1]
(ii) The user is writing a book and is worried that the document files could get damaged or deleted.
Utility software solution: ................................................................................................[1]
(iii) The computer has recently been slow to load large files. The user has deleted a large number
of small files to try to solve the problem. A friend has advised that there is a procedure which
should be regularly carried out to reorganise file storage on the hard disk.
Utility software solution: ................................................................................................[1]
(iv) The user clicked on an attachment in an unsolicited email. Since then, the computer has
shown some unexplained behaviours.
Utility software solution: ................................................................................................[1]
Q 11) Winter 2017 P12
1 One of the tasks of the operating system (OS) is the management of the main memory of the
computer system.
State and describe three other operating system management tasks.
1 .................................................................................................................................................
............................................................................................................................................................
.............................................................................................................................................
2 .................................................................................................................................................
............................................................................................................................................................
.............................................................................................................................................
3 ..................................................................................................................................................
............................................................................................................................................................
....................................................................................................................................... [6]
Q 12) Summer2018 P11
3 An operating system (OS) is usually pre-installed on a new computer.
(a) The OS performs a number of different tasks such as memory management and security
management.
(i) State three memory management tasks the OS performs.
1 ........................................................................................................................................
...........................................................................................................................................
2 ........................................................................................................................................
...........................................................................................................................................
3 ........................................................................................................................................
...........................................................................................................................................[3]
(ii) State three security management tasks the OS performs.
1 ........................................................................................................................................
...........................................................................................................................................
2 ........................................................................................................................................
...........................................................................................................................................
3 ........................................................................................................................................
...........................................................................................................................................[3]
(iii) State two tasks, other than memory management and security management that are carried
out by an OS.
1 ........................................................................................................................................
...........................................................................................................................................
2 ........................................................................................................................................
...........................................................................................................................................[2]
(b) Utility software is usually pre-installed on a new computer.
The following table lists four programs. Put one tick (✓) in each row to indicate whether or not the
program is utility software. [4]
Program True False
Disk Defragmenter
Word Processor
Library Program
Compression Software

Q 13) Summer2018 P12


1 An operating system (OS) is usually pre-installed on a new computer.
(a) The OS performs a number of different tasks such as file management and peripheral
management.
(i) State three file management tasks the OS performs.
1 ........................................................................................................................................
...........................................................................................................................................
2 ........................................................................................................................................
...........................................................................................................................................
3 ........................................................................................................................................
...........................................................................................................................................[3]
(ii) State three printer management tasks the OS performs.
1 ........................................................................................................................................
...........................................................................................................................................
2 ........................................................................................................................................
...........................................................................................................................................
3 ........................................................................................................................................
...........................................................................................................................................[3]
(b) Utility software is usually pre-installed on a new computer.
(i) The following table lists four programs. Put one tick (✓) in each row to indicate whether or not
the program is utility software. [4]
Program True False
Database
Virus checker
Web browser
Backup software

(ii) Name two other utility programs.


Program 1 .........................................................................................................................
Program 2 .........................................................................................................................[2]
Q 16) Winter 2018 P11
6 Kim is using her laptop computer to write a program in a high-level language.
(a) Kim needs to make sure the program is secure against unauthorised access. She has already
set up a username and password on her laptop.
Identify two additional electronic measures that Kim can use to keep the program secure.
1 ..............................................................................................................................................
2 ..............................................................................................................................................[2]
(b) Kim will use library routines in her program.
(i) Describe what is meant by a library routine.
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
........................................................................................................................... [2]

(ii) Describe one benefit and one drawback of using library routines.
Benefit .........................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
................................................................................................................................
Drawback ...................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................[4]
(c) Kim develops her program and makes it ready for use. To do this, she uses first an interpreter
and then a compiler.
Explain why Kim needs to use both an interpreter and a compiler.
Interpreter .................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
.............................................................................................................................
Compiler .....................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
...........................................................................................................................[4]
Q 17) Summer 2019 P11
3 Kimmy has written a program in a high-level language.
(a) Kimmy has used library routines in the program.
(i) Describe two advantages of using library routines in the program.
1 ................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
.....................................................................................................................................
2 .................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
..........................................................................................................................[4]
(ii) Describe what is meant by a Dynamic Link Library (DLL).
……………………………………………………………………………....................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
.................................................................................................................... [2]
(b) Three translators are compilers, interpreters, and assemblers.
(i) State one benefit of Kimmy using an interpreter during the development of the program.
............................................................................................................................................................
...................................................................................................................................... [1]
(ii) State three benefits of Kimmy using a compiler when the program is complete.
1 .................................................................................................................................................
...................................................................................................................................................
3 ................................................................................................................................................
.................................................................................................................................................
2 ...............................................................................................................................................
............................................................................................................................................... [3]
Q 19) Summer 2019 P13
1 A computer has an operating system (OS) and utility software.
(a) The following table lists key management tasks performed by an operating system and their
descriptions.
Complete the table by writing the missing management task names and descriptions. [4]
Management task Description
Memory management
Provides user accounts and passwords
Handles the signals sent when the attention of the processor is
required elsewhere
Provision of a software
platform
(b) A hard disk formatter and a hard disk defragmenter are two examples of utility software.
(i) Describe the actions performed by a hard disk formatter and a hard disk defragmenter.
Hard disk formatter
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
................................................................................................................................
Hard disk defragmenter..............................................................................................................
............................................................................................................................................................
............................................................................................................................................................
.................................................................................................................................. [4]
(ii) Identify three other examples of utility software that can be installed on the computer.
1 ..................................................................................................................................................
....................................................................................................................................................
2 ..................................................................................................................................................
....................................................................................................................................................
3 ..................................................................................................................................................
………….................................................................................................................................[3]
Q 20) Winter 2019 P11
2 (b) Aaron’s computer has an operating system (OS). The OS manages the running processes
and provides a user interface. Describe these OS management tasks.
Process management ...............................................................................................................
...................................................................................................................................................
............................................................................................................................................................
..........................................................................................................................................
...................................................................................................................................................
Provision of a user interface .....................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
................................................................................................................................................ [6]
(c) Aaron’s computer has a virus checker and backup software.
Describe these utility programs.
Virus checker ..............................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
......................................................................................................................................
Backup software .......................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
................................................................................................................................. [4]
Q 21) Winter 2019 P12
1 (a) The diagram shows different types of software on the left, and descriptions on the right.
Draw a line from each type of software to its correct description. [4]
Register Description
Provides a ready-built routine that can be
imported into a program
Operating
system
Provides an interface between the user
and the hardware

Utility program

Converts source code into a low-level


language

Library program

Creates a new document for the user to


edit

Compiler

An additional program that helps to


maintain or configure the system
(b) Describe the purpose of disk repair software.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [3]
Q 22) Winter 2019 P13
2 (a) Describe the following key management tasks that the mobile phone operating system carries
out.
Process management ...............................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
Memory management ...............................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................... [6]
Q 23) Summer 20 P11
8 Bart plays computer games on his stand-alone games console. The games console has an
operating system.
(a) Describe the tasks performed by the operating system to manage the main memory in the
games console.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [4]
(b) The computer games are written in a high-level language. Bart does not need a compiler or an
interpreter to run the games he buys for his console.
Explain why the games run without the need for a compiler or an interpreter.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [2]
9 Utility programs are examples of system software.
(a) Complete the table by writing the name of the utility program for each description. [3]
Description Utility program
Reorganises files on a disk to improve efficiency
Scans a hard disk to identify bad sectors
Prepares a hard disk for first use

Q 24) Summer 2020 P12


2 (c) Amir’s computer has system software, including utility software and an operating system.
(i) Explain how the disk formatter, disk contents analysis and disk repair utilities work together.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
..................................................................................................................................... [3]
(ii) Amir’s computer has several peripheral devices connected to it.
State three peripheral management tasks performed by the operating system.
Task 1 ................................................................................................................................
...........................................................................................................................................
Task 2 ................................................................................................................................
...........................................................................................................................................
Task 3 ................................................................................................................................
........................................................................................................................................... [3]
Q 25) Summer 2020 P13
4 Annchi is writing a computer game with a group of friends.
(a) One of her friends has suggested using Dynamic Link Library (DLL) files to help them develop
the game.
(i) Give three reasons why Annchi and her friends should use DLL files when developing the
game.
1 ........................................................................................................................................
...........................................................................................................................................
2 ........................................................................................................................................
...........................................................................................................................................
3 ........................................................................................................................................
........................................................................................................................................... [3]
(ii) Give two reasons why Annchi and her friends should not use DLL files when developing the
game.
1 ........................................................................................................................................
...........................................................................................................................................
2 ........................................................................................................................................
........................................................................................................................................... [2]
Q 26 Winter 20 P13
1 Identify the most appropriate utility program to use for each of the following tasks. [4]

Task Utility program


Rearrange the data on a disk so that files are
contiguous, and all free space is collected together
Prepare a disk for initial use
Reduce the size of a file
Examine a disk to find any bad sectors
Marking Scheme
Q 4) Winter 15 P12
Q 7) Winter 2016 P12
Q 8) Summer 2017 P11_13
Q 9) Summer 17 P12
Q 11) Winter 2017 P12
Q 12) Summer2018 P11
Q 13) Summer2018 P12
Q 16) Winter 2018 P11
Q 17) Summer 2019 P11
Q 19) Summer 2019 P13
Q 20) Winter 2019 P11
Q 21) Winter 2019 P12
Q 22) Winter 2019 P13

Q 23) Summer 20 P11

Q 24) Summer 2020 P12


Q 25) Summer 2020 P13

Q 26) Winter 20 P13


4b 9608/12 Nov 16 Q8 - SoW

5a 9608/11 Jun 17 Q6 – SoW


5b 9608/12 Jun 17 Q4 - SoW

6b 9608/12 Nov 17 Q1 - SoW


6b 9608/12 Nov 17 Q2 - SoW

7a 9608/11 Jun 18 Q3 - SoW


7b 9608/12 Jun 18 Q1 - SoW

8b 9608/12 Nov 18 Q6b, c – SoW


5.2 Language translators
5.2 Language Translators
Candidates should be able to:
Show understanding of the need for:
• assembler software for the translation of an
assembly language program
• a compiler for the translation of a high-level
language program
• an interpreter for translation and execution of a
high-level language program
Notes and guidance
Explain the benefits and drawbacks of using
either a compiler or interpreter and justify the use
of each Show awareness that high-level
language programs may be partially compiled
and partially interpreted, such as Java
Describe features found in a typical Integrated Including:
Development Environment (IDE) • for coding, including context-sensitive prompts
• for initial error detection, including dynamic
syntax checks
• for presentation, including pretty print, expand
and collapse code blocks
• for debugging, including single stepping,
breakpoints, i.e. variables, expressions, report
window

When computers were first used programs had to be written in machine code. This code
comprised simple instructions, each of which was represented by a binary pattern in the
processor. To write programs, a programmer had to code every instruction in binary.
This not only took a long time but was prone to errors. The process of taking these programs and
setting up a computer in such a way that it would follow the instructions was so complex that only
mathematicians were capable of doing it. If this had not changed, then
we would probably not be able to use computers in the way we do today.
The problems were caused by the fact that people had to present the instructions in a form the
processor could understand, i.e. as machine operations. In order that computers could be used
anywhere other than research institutions, human beings needed a method
of communicating with the computer which was closer to human communication than to machine
operations.
As the processor cannot understand anything but binary, this implies the need for a language
which matches the computer’s instruction set. If the program written by the programmer is not in
machine code then it must be translated into machine code.
Turning assembly language into machine code
Machine code
Every processor has a set of basic machine operations which it can carry out. The complete set of
machine operations is called the instruction set for that processor. Table gives a flavour of what
machine operations are like. Each operation is represented by
a machine code (shown in binary). This is called the operation code or opcode.
Table Machine operations.
Opcode Operation
001 Add a number
010 Subtract a number
011 Input a value
100 Output a value
101 Store a value in a memory location
110 Get a value from a memory location
Some of the operations in Table need a second or third piece of data in order to carry out the
instruction. This “other” piece of data that makes up the program instruction is called the operand.
It may be a number or a memory address.
A machine instruction consists of an opcode and an operand.
Table 3.2.1 is a restricted set of operations but it serves to illustrate the workings of a processor.
Imagine that the processor stores every instruction as a byte. It would use:
● three bits for the opcode
● five bits for the operand.
This only allows 32 possible addresses but it serves as an illustration.
If the processor is given the program instruction 00100001, it splits the instruction into two parts:
001 and 00001. The opcode 001 means that something has to be added. The operand 00001 is
the address in memory of the value that has to be added. The value stored in location 00001 in
memory is added to the contents of the accumulator.
The program instruction 00100001 is therefore understandable by humans (as we have a list of
the opcodes) and the processor. However, imagine a program with thousands of instructions that
look like this. It really would be almost impossible for a human to follow. Human beings need a bit
of help. They need a language other than binary if they are going to be able to understand a large
program.

Assembly language
The first attempt at making programs more understandable was to use a mnemonic in place of the
binary opcodes, as shown in Table.
Assembly language mnemonics.
Opcode Operation Mnemonic
001 Add a number ADD
010 Subtract a number SUB
011 Input a value IN
100 Output a value OUT
101 Store a value in a memory location STO
110 Get a value from a memory location GET
Consider a program in binary and the equivalent program using mnemonics:
Machine code Assembly language Description
program program
011 0011 IN 1 Load the value 3 to the processor
001 0101 ADD 5 Add 5 to this value
100 0000 OUT Output the current value
101 1111 STO 15 Store the value at memory address 15

Note that some instructions, e.g. OUT, do not have an operand. The assembly language version
assumes we can code numbers as decimal values. Stop and think which program is easier for the
programmer to code and understand. Where exactly in the processor are these calculations taking
place? The answer is in a special register called the accumulator.
Using labels for addresses
There are still problems because the references to locations in memory are written as binary or
decimal numbers. The operand shows a particular memory address so we could give this location
a name, or label. The program in the activity above simply adds two values together. Instead of
referring to these values by their addresses (00100 and 00101), why not just call them NUM1 and
NUM2?

The program then becomes:


IN
STO NUM1
IN
STO NUM2
GET NUM1
ADD NUM2
OUT
Using mnemonics to represent opcodes and labels to represent the memory locations makes the
program code very much easier for the programmer to understand. The use of labels for memory
addresses is called symbolic addressing.
1 Assembler:-
''Assembler is a language translator that translates source program written in Assembly Language
into object code in machine language.''
Computer can understand only machine language. Assemblers translate programs written in
Assembly Language into Machine Language so as computer can understand execute them.

Assembly Assembler Machine Language


Language Object Code
Source Code

However, it is impossible for a computer to execute this assembly language code because it is not
in machine code. It is now necessary for the computer to use a translator program to turn the
original program into machine code. This translator program is called an assembler and programs
written in this way are said to be written in assembly language.
The assembly process is relatively simple because assembly language has a one-to-one
relationship with machine code. That is, every assembly language instruction translates into
exactly one machine code instruction.
Basically, the assembler must translate the mnemonics into binary, which is done by having a
simple lookup table with the mnemonics in one column and the binary machine code equivalents
alongside. The labels are a bit more complicated. The assembler does the translation in the same
way, but the table contents are not known before translation starts. The list of labels and their
actual memory address values have to be created by the assembler. As the program is read, the
assembler recognises the first label, NUM1, and allocates an actual memory location for NUM1
relative to the address used to store the first instruction. In this way, the assembler builds its own
lookup table of labels used by the assembly language program.
A 'two-pass' assembler is not an essential requirement but it does clearly differentiate between the
two stages that are required in translation. An assembly language program will contain features
that are used to help the programmer and others that are used to inform the assembler program.
In the first pass of a two-pass assembler all of these features are either removed or acted upon.
Typical actions are:
• removal of comments
• creation of a symbol table containing the binary codes for symbolic names and labels
• creation of a literal table if the programmer has used constants in the program
• expansion of macros
• Identification of system calls and subroutines used.
If errors are not found, the second pass of the assembler generates the object code. This involves
replacing symbolic addresses with absolute addresses.
How assembler works:
Assemblers translate from assembly language to machine code. Some assemblers scan the
assembly language program twice; these are referred to as two-pass assemblers.
12. The assembler scans the assembly language instructions in sequence.
13. When it meets a symbolic address checks to see if already in symbol table
14. If not, it adds it to the symbol table in the symbolic address column
15. If it is already in symbol table check if absolute address known
16. If the absolute address is known, it is entered in the appropriate cell
17. If the absolute address is not known mark / leave as unknown
Interpretation and compilation
We have discussed how assembly language was used to make program writing easier. Assembly
language allows the use of mnemonics and labels for memory addresses. Writing programs in
assembly language, although easier than using machine code, is still tedious and takes a long
time. Assembly languages are still “machine oriented”, i.e. their instruction set is very much in
terms
of the what the computer architecture can do.
After assembly languages, high-level languages were developed. They are closer to the language
that people use for communication. That is, the languages were designed to more closely
resemble the task or problem the computer program was attempting to solve. However, programs
written in these high-level languages also need to be translated into machine code. This is done
by a compiler or an interpreter.
2 Compiler software
''A compiler is a language translator that translates whole source program written in High Level
Language into object code in machine language before execution of program.''
Compilers translate all instructions before executions. The object code is saved as object file,
which is executable. Object files don't need compiler or language for execution.

High Level Machine Language


Compiler
Language Object Code
Source Code (Executable file)

As high-level languages are more complex and further away from machine code, so the
translators had to become more complicated. Each new programming language that was created
led to the need for a translator for that particular language called a compiler. Hence to write high-
level programs in language XYZ, the programmer must have compiler software for language XYZ.
A compiler takes a program written in a high-level language (called the source program, which is
made up of source code) and translates it into an equivalent program in machine code (called the
object program or object file, which is made up of object code). Once this is done, the machine
code version can be loaded into the machine and executed without any further involvement of the
compiler. The compilation process is shown in Figure.
The advantages of compilation are that:
● The final object (.exe) file can easily be distributed to many users.
● Once the .exe file is produced, users do not need the compiler software.
● Users have no sight of the original source code and so there is no risk that it could be changed.
The disadvantages of compilation are that:
● The final object file is only produced when all errors in the source code have been located and
fixed.
● The development process can be long-winded with several runs of the compiler before finally all
the errors are located and the object file produced.
● The compilation process uses a lot of computer resources.
During the compilation process, memory contains:
● the compiler software
● the programmer’s source code
● the resulting object code
● sufficient memory for working storage while the translation is taking place.
3 Interpreters:-
''An interpreter is a language translator that translates source program written in High Level
Language into object code in machine language during step by step execution of program.''
Computer can only understand instruction written in machine language. Interpreters translate one
by one instruction of High Level Language source code into object code of Machine Language.
Interpreter translates one instruction which is executed before translation of next instruction. The
object code is not saved so the source code is interpreted every time before the execution.
Each high level language has its own language translator.

High Level Interpreter Machine


Language Language Object
Source Code Code

Some programming languages are translated by an interpreter. In this process, the programmer
can attempt to run the program as soon as (some of) the source code is created. The interpreter
identifies each instruction in sequence and executes it until a statement
is found which contains an error. At this point the program terminates and the programmer is
shown the instruction in the program which generated the error.
Each instruction is executed before the next instruction is identified. This system was developed
because early personal computers lacked the power and memory needed for compilation. It is also
used in some programming for the web. Interpretation has the advantage of producing an error
message as soon as an error is encountered. This means that the instruction causing the problem
can be easily identified.
The advantages of interpretation are that:
● The programmer can attempt to run the program at any time, including before all the code has
been written.
● Debugging is generally easier and faster using an interpreter.
The disadvantages of interpretation are that:
● Execution of a program is slow compared to that of a compiled program:
- The original program has to be translated every time it is executed.
- Instructions inside a loop are translated each time the loop is entered.
● The interpreter software has to be present in memory every time an attempt is made to run the
program.
● No final .exe (object file) is produced:
- So all users of the program must have the interpreter software available.
- The code is not protected – other programmers could make unwanted changes to the code as
the source code is always present.
The best of both worlds!
Earlier version of Visual Basic – up to version 6 – provided a programming environment which
contained both an interpreter and a compiler. This enabled the programmer to use the interpreter
during program development, making the finding of errors much easier.
When the program was working, it could be translated by the compiler into machine code to speed
up program execution. The machine code version (the .exe file) could then be distributed to users
who would not have access to the original code.
Sadly the latest Visual Basic .NET versions carry out a “compilation” when the user attempts to
run the program. If errors are found and reported then they must be corrected.
Compiler Interpreter Assembler
Translates a high-level Executes a high-level language Translates a low-level
language program into program a statement at a time. language program into
machine code. machine code.
An executable file of machine No executable file of machine An executable file of
code is produced. code is produced. machine code is produced.
One high-level language One high-level language program One low-level language
statement can be translated statement may require several statement is usually
into several machine code machine code instructions to be translated into one machine
instructions. executed. code instruction.
Compiled programs are used Interpreted programs cannot be Assembled programs can be
without the compiler. used without the interpreter. used without the assembler.

A compiled program is An interpreter is often used when An assembled program is


usually distributed for general a program is being developed. usually distributed for
use. general use.

1b 9618 S21 P12


7 Jennifer is writing a computer program for her A Level homework.
(a) Jennifer uses a program library to help her write her computer program.
Describe how a program library can be used while writing a computer program.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................ [2]
(b) Jennifer uses an Integrated Development Environment (IDE) to write her computer program.
(i) The IDE allows Jennifer to use both an interpreter and a compiler while creating her computer
program.
Describe the ways in which Jennifer can use both a compiler and an interpreter while developing
the program.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
..................................................................................................................................... [4]
(ii) Identify two debugging tools that a typical IDE can provide.
1 ........................................................................................................................................
...........................................................................................................................................
2 ........................................................................................................................................
........................................................................................................................................... [2]
2ac W21 P11 P13 –
4 Francis is starting his first job as a software developer for a multinational company.
(b) Francis is shown the software he will be working on. He is unfamiliar with the Integrated
Development Environment (IDE) he is required to use.
(i) Describe the ways in which Francis can act ethically in this situation.
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
.......................................................................................................................... [2]
(ii) A typical IDE provides debugging tools to support the testing of a program.
Identify three other tools or features found in a typical IDE to support the writing of the program.
1 ........................................................................................................................................

2 ........................................................................................................................................
3 ................................................................................................................................... [3]
(d) Francis’s team use language translators.
Complete the descriptions of language translators by writing the missing words.
............................................... are usually used when a high-level language program is complete.
They translate all the code at the same time and then run the program.
They produce ............................................... files that can be run without the source code.
............................................... translate one line of a high-level language program at a time,
and then run that line of code. They are most useful while developing the programs because
errors can be corrected and then the program continues from that line.
Assemblers are used to translate assembly code into ............................................... . [4]
3a 9618 S22 P11 - 5 A programmer uses an Integrated Development Environment (IDE) to
develop a program.
(a) Draw one line from each IDE feature to its correct description. [4]
IDE feature Description
Executes one line of the program and then
Context-sensitive prompt
stops

Underlines or highlights statements that do


Dynamic syntax check
not meet the rules of the language

Outputs the contents of variables and data


Breakpoint
structures

Single stepping Stops the code executing at a set line

Displays predictions of the code being


Report window
entered
(b) The programmer wants to allow users to edit, improve and redistribute the program.
Identify two different types of software licence that the programmer could use.
1 ................................................................................................................................................
2 ............................................................................................................................................. [2]
(c) Explain the benefits to the programmer of using program libraries.
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................ [3]
3b 9618 S22 P12
6 A programmer uses language translators when writing and testing a program.
(a) Describe the operation of a compiler.
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
........................................................................................................................... [2]
(b) Describe the operation of an interpreter.
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
........................................................................................................................... [2]
(c) Explain how a programmer can make use of a typical Integrated Development Environment
(IDE) when writing and testing a program.
Writing .......................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
.................................................................................................................................
Testing ......................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.......................................................................................................................................... [4]
Q 2) Summer 15 P13
2 Assemblers translate from assembly language to machine code. Some assemblers scan the
assembly language program twice; these are referred to as two-pass assemblers.
The following table shows five activities performed by two-pass assemblers.
Write 1 or 2 to indicate whether the activity is carried out during the first pass or during the second
pass. [5]
Activity First pass or second
pass
any symbolic address is replaced by an absolute address
any directives are acted upon
any symbolic address is added to the symbolic address table
data items are converted into their binary equivalent
forward references are resolved

Q 3) Winter 15 P11, P13


11 A game program is written which can be either interpreted or compiled. The table below shows
five statements about the use of interpreters and compilers.
Tick (✓) to show whether the statement refers to an interpreter or to a compiler. [5]
Statement Interpreter Compiler
This translator creates an executable file
When this translator encounters a syntax error, game execution halts
The translator analyses and checks each line just before executing it
This translator will produce faster execution of the game program
Use of this translator makes it more difficult for the user to modify the
code of the game
Q 4) Winter 15 P12
Q 5) Summer 16 P11, 12
1 Three examples of language translators and four definitions are shown below.
Draw lines to link each language translator to the correct one or more definitions.
Q 6) Summer 16 P 13
1 Describe two differences between a compiler and interpreter.
1 .................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
...................................................................................................................................
2 ...........................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
.............................................................................................................................[4]

Q 7) Winter 2016 P12


Q 8) Summer 2017 P11_13
Q 9) Summer 17 P12
Q 10) Winter 2017 P11, P13
2 (a) The diagram shows three items of software that translate program code.
Draw one line from each context to the correct item of translation software. [4]
Context Item of translation software

A web page contains a client-side script.

Assembler
Each instruction in the source code
consists of an op code and an operand.
Interpreter

The source code is required at run-time.

Compiler
When the source code is translated, copies of
the executable program can be distributed
without the need for the source code.
(b) The Java programming language is said to be machine or platform independent.
(i) Describe what is meant by machine independent.
...........................................................................................................................................
.......................................................................................................................................[1]
(ii) Describe how a Java source code program is translated.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
.......................................................................................................................................[2]
Q 11) Winter 2017 P12
2 (a) The diagram shows three items of software that translate program code.
Draw one line from each context to the correct item of translation software. [4]
Context Item of translation
software
The source code is written in a high-level
language. An executable file is produced.
Assembler
The source code uses instructions from the
processor’s instruction set.
Interpreter
The source code and translation software
must both be in main memory at execution
time.
Compiler
A web page contains some JavaScript code.
(b) A programmer is developing software and has both a compiler and interpreter for the high-level
language used. Describe two benefits of using each form of translation software.
(i) Benefits of a compiler
1 ........................................................................................................................................
...........................................................................................................................................
2 ........................................................................................................................................
........................................................................................................................................... [2]
(ii) Benefits of an interpreter
1 ........................................................................................................................................
...........................................................................................................................................
2 ........................................................................................................................................
........................................................................................................................................... [2]
Q 16) Winter 2018 P11
6 Kim is using her laptop computer to write a program in a high-level language.
(c) Kim develops her program and makes it ready for use. To do this, she uses first an interpreter
and then a compiler.
Explain why Kim needs to use both an interpreter and a compiler.
Interpreter ..................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
...................................................................................................................................
Compiler .....................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
...............................................................................................................................[4]
Q 17) Summer 2019 P11
3 Kimmy has written a program in a high-level language.
(b) Three translators are compilers, interpreters, and assemblers.
(i) State one benefit of Kimmy using an interpreter during the development of the program.
............................................................................................................................................................
...................................................................................................................................... [1]
(ii) State three benefits of Kimmy using a compiler when the program is complete.
1 ................................................................................................................................................
..................................................................................................................................................
3 ..............................................................................................................................................
...................................................................................................................................................
2 ................................................................................................................................................
.................................................................................................................................................

5 A simple program written in assembly language is translated using a two-pass assembler.


(a) The table contains some of the tasks performed by a two-pass assembler.
Tick (✓) one box in each row to indicate whether the task is performed at the first or second pass.
The first row has been completed for you. [2]
Task First pass Second pass
Creation of symbol table ✓
Expansion of macros
Generation of object code
Removal of comments
Q 18) Summer 2019 P12
2 Biyu is writing a computer program in a high-level language.
(a) Biyu uses a language translator.
(i) State the purpose of a language translator.
............................................................................................................................................................
...................................................................................................................................... [1]
(ii) Biyu uses an interpreter.
State two benefits of Biyu using an interpreter instead of a compiler while writing the program.
1 ................................................................................................................................................
.................................................................................................................................................
2 ...............................................................................................................................................
............................................................................................................................................... [2]
(iii) Name a translator other than an interpreter and a compiler.
............................................................................................................................................ [1]
(b) Biyu uses library files in the program.
Explain why software is often developed using library files.
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
....................................................................................................................... [2]
Q 20) Winter 2019 P11
1 (c) The following statements describe features of a low-level language.
Complete the statements by writing the appropriate terms in the spaces.
A ........................................................... is a sequence of instructions that are given an identifier.
These instructions may need to be executed several times.
A ........................................................... is an instruction that tells the assembler to do something.
It is not a program instruction.
The processor’s instruction set can be put into several groups. One of these groups is........[3]

Q 22) Winter 2019 P13


Q 23) Summer 20 P11
Q 24) Summer 2020 P12
(a) The steps 1 to 6 describe the first pass of a two-pass assembler.
The following three statements are used to complete the sequence of steps.
If it is already in the symbol table, it checks to see if the absolute address is
A
known
When it meets a symbolic address, it checks to see if it is already in the
B
symbol table
C If it is known, it is entered
Write one of the letters A, B or C in the appropriate step to complete the sequence.
1. The assembler reads the assembly language instructions
2. .........................
3. If it is not, it adds it to the symbol table
4. .........................
5. .........................
6. If it is not known, it is marked as unknown. [2]

Q 25) Summer 2020 P13


4 Annchi is writing a computer game with a group of friends.
(b) Each member of the group is creating a different part of the game. Each person needs to test
their part of the game independently before they are combined.
Identify the most appropriate type of translator that should be used to test each part of the game
independently. Justify your choice.
Translator ..................................................................................................................................
Justification ...............................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................. [3]
Q 26) Winter 20 P11
Q 27) Winter 20 P12
Q 28) Winter 20 P13
3 Hannah is writing a computer program using a high-level language. She uses both a compiler
and an interpreter.
(a) Describe the ways in which Hannah will use an interpreter while writing the program.
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
.................................................................................................................. [2]
(b) Explain the reasons why Hannah uses a compiler when she has finished writing the program.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [2]
(c) Some high-level languages are partially compiled and partially interpreted.
Give one benefit and one drawback of using a language that is partially compiled and partially
interpreted.
Benefit ......................................................................................................................................
...................................................................................................................................................
Drawback ..................................................................................................................................
............................................................................................................................................. [2]
Unit 6 Security, Privacy and Data Integrity
Topic You should be able to R A G
• Understand the difference between security, privacy and integrity of
Security, data
privacy and • Describe security measures for stand-alone PCs and networks
data integrity • Describe and use methods of data validation (on entry) and data
verification (on entry and during transfer)

Key terms
Data privacy – the privacy of personal information, or other information stored on a computer, that should
not be accessed by unauthorised parties.
Data protection laws – laws which govern how data should be kept private and secure.
Data security – methods taken to prevent unauthorised access to data and to recover data if lost or
corrupted.
User account – an agreement that allows an individual to use a computer or network server, often
requiring a user name and password.
Authentication – a way of proving somebody or something is who or what they claim to be. Access rights
(data security) – use of access levels to ensure only authorised users can gain access to certain data.
Malware – malicious software that seeks to damage or gain unauthorised access to a computer system.
Firewall – software or hardware that sits between a computer and external network that monitors and
filters all incoming and outgoing activities.
Anti-spyware software – software that detects and removes spyware programs installed illegally on a
user’s computer system.
Encryption – the use of encryption keys to make data meaningless without the correct decryption key.
Biometrics – use of unique human characteristics to identify a user (such as fingerprints or face
recognition).
Hacking – illegal access to a computer system without the owner’s permission.
Malicious hacking – hacking done with the sole intent of causing harm to a computer system or user (for
example, deletion of files or use of private data to the hacker’s advantage).
Ethical hacking – hacking used to test the security and vulnerability of a computer system. The hacking is
carried out with the permission of the computer system owner, for example, to help a company identify
risks associated with malicious hacking of their computer systems.
Phishing – legitimate-looking emails designed to trick a recipient into giving their personal data to the
sender of the email.
Pharming – redirecting a user to a fake website in order to illegally obtain personal data about the user.
DNS cache poisoning – altering IP addresses on a DNS server by a ‘pharmer’ or hacker with the intention of
redirecting a user to their fake website.
Data integrity – the accuracy, completeness and consistency of data.
Validation – method used to ensure entered data is reasonable and meets certain input criteria.
Verification – method used to ensure data is correct by using double entry or visual checks.
Check digit – additional digit appended to a number to check if entered data is error free.
Modulo-11 – method used to calculate a check digit based on modulus division by 11.
Checksum – verification method used to check if data transferred has been altered or corrupted,
calculated from the block of data to be sent.
Parity check – method used to check if data has been transferred correctly that uses even or odd parity.
Parity bit – an extra bit found at the end of a byte that is set to 1 if the parity of the byte needs to change
to agree with sender/receiver parity protocol.
Odd parity – binary number with an odd number of 1-bits.
Even parity – binary number with an even number of 1-bits.
Parity block – horizontal and vertical parity check on a block of data being transferred.
6.1 Data Security

Candidates should be able to: Notes and guidance


Explain the difference between the terms security,
privacy and integrity of data
Show appreciation of the need for both the security
of data and the security of the computer system
Describe security measures designed to protect Including user accounts, passwords, authentication
computer systems, ranging from the stand-alone PC techniques such as digital signatures, firewall,
to a network of computers antivirus software, anti-spyware, encryption
Show understanding of the threats to computer and Including malware (virus, spyware), hackers,
data security posed by networks and the internet phishing, pharming
Describe methods that can be used to restrict the
risks posed by threats
Describe security methods designed to protect the Including encryption, access rights
security of data

Data Integrity and security


Data integrity refers to maintaining and assuring the accuracy and consistency of data over its entire life-
cycle, and is a critical aspect to the design, implementation and usage of any system which stores,
processes, or retrieves data.
Data security is about keeping data safe. Many individuals, small businesses and major
companies rely heavily on their computer systems.
If the data on these computer systems is damaged, lost, or stolen, it can lead to disaster.

Data privacy is about keeping data private rather than allowing it to be available for unauthorise
access.
The Data Protection Act
The Data Protection Act controls how your personal information is used by organisations,
businesses or the government.
Everyone responsible for using personal data has to follow strict rules called ‘data protection
principles’.
They must make sure the information is:
1. used fairly, lawfully and transparently
2. used for specified, stated purposes
3. used in a way that is adequate, relevant and limited to only what is necessary
4. accurate and, where necessary, kept up to date
5. kept for no longer than is necessary
6. Data must be processed in accordance with the data subject’s rights.
7. Data must be kept secure.
8. Data must not be transferred to another country unless that country also has adequate
protection
Loss of Data
Data loss is any process or event that results in data being corrupted, deleted and/or
made unreadable by a user and/or software or application. It occurs when one or
more data elements can no longer be utilized by the data owner or requesting
application. Data loss is also known as data leakage.
Reason Pre-caution/ Method of Recovery
Accidental deletion • Back-up
• Saving on regular basis
• Use of password so as unauthorised person can’t delete data.
Hardware failure • Back-up
• UPS (to prevent loss of data from power failure)
• Saving on regular basis
• Parallel back-up hardware
Software failure • Back-up
• Saving on regular basis
Incorrect computer • Back-up
operation • Shut down computer properly
• Remove external storage properly
Natural Disaster • Back-up

Malware
Malware (malicious software) is specifically designed to disrupt or damage a computer system, such as a
virus.
Malware, short for malicious software, is software used to disrupt computer operation, gather sensitive
information, or gain access to private computer systems. It can appear in the form of code, scripts, active
content, and other software. 'Malware' is a general term used to refer to a variety of forms of hostile or
intrusive software.
Computer virus is program or code that replicates itself and is designed to amend, delete or copy data
and files on a user’s computer without their consent.
Viruses are developed with intention to harm other computer data and programs.
Worms and Trojan horse are also types of virus.
A worm is a program that actively transmits itself over a network to infect other computers.
A Trojan horse is any program that invites the user to run it, concealing harmful or malicious code.

The Trojan Horse is a story from the Trojan War about the subterfuge that the Greeks used to enter the
independent city of Troy and win the war. In the canonical version, after a fruitless 10-year siege, the
Greeks constructed a huge wooden horse and hid a select force of men inside, including Odysseus. The
Greeks pretended to sail away, and the Trojans pulled the horse into their city as a victory trophy. That
night the Greek force crept out of the horse and opened the gates for the rest of the Greek army, which
had sailed back under cover of night. The Greeks entered and destroyed the city of Troy, ending the war.

Security Risk:
• Can delete or corrupt data and programs
• Can disrupt computer,
• Can cause computer stop working “hung”
Methods to remove risk
• Install antivirus
• Download data/programs only from authentic source
• Scan before opening email attachments or data from external source
• Install firewall
Spyware
Spyware/key-logging is software that monitors key presses on a user’s keyboard, and relays the
information back to the person who sent the software.
Spyware is a form of malware that hides on your device, monitors your activity, and steals sensitive
information like bank details and passwords.
Security Risk:
• Transmits all data typed by user to the originator of spyware e.g. email/bank id and passwords, debi
t/credit card number etc.
• Can read cookies.
• Can change default web browser
• Can install other spyware
Methods to remove risk
• Install anti-spyware software
• Install firewall
• Use on-screen keyboard to type user id and
passwords
War Driving
War driving is the act of searching for Wi-Fi wireless networks by a person usually in a moving vehicle,
using a laptop or Smartphone. It is also known as Access-Point Mapping.
Security Risk
• Uses user’s internet data/time
• May hack password and personal data
Methods to remove risk
• Use complex password
• Limit the number of users
• Firewall
• Use wired equivalent privacy (WEP) encryption
Phishing
Phishing is the act of attempting to acquire sensitive information like usernames, passwords and credit card
details by disguising as a trustworthy source. Phishing is carried out through emails or by luring the users to
enter personal information through fake websites. Criminals often use websites that have a look and feel of
some popular website, which makes the users feel safe to enter their details there.
Protection
1. The most powerful weapon against phishing is common sense and the following rules that every
user should oblige to.
2. If you are not a customer of the site delete the email immediately. Don´t click on the link or reply.
3. If you are a customer and you are not sure if the email is legit do one of the following:
a) Contact the institute by phone or contact at the official website (do not use the email link of course)
and ask if the mail is official.
b) Instead of using the link provided open the website by typing in the official link there. The site should
have news about the email on their starting page. (Most of the time). If not, use 3a to verify the
email.
Pharming:
Pharming in Simple Steps:
• Hacker creates a fake website which appears similar to the original website.
• Hacker poisons the DNS servers thus domain names are resolved into fake IP address.
• User types the URL of the original website in the browser.
• The DNS server directs User to the fake website designed by hacker.
• User not knowing that it is a fake website, shares his confidential information such as login, password
etc.
• Hacker gets the user confidential information from his fake web site and uses it to access the original
website.
• Hacker exploits user's confidential information to his liking.

Protection
• Check the URL of any site that asks you to provide personal information. Make sure your session
begins at the known authentic address of the site, with no additional characters appended to it.
• Use a trusted, legitimate Internet Service Provider. Rigorous security at the ISP level is your first line of
defense against pharming.
• Check the certificate. It takes just a few seconds to tell if a site you land on is legitimate.
• Block suspicious Websites automatically
Identify fake website
A B
Hacking
Hacking is unauthorized use of computer and network resources.
The activity of breaking into a computer system to gain an unauthorized access is known as hacking. The
act of defeating the security capabilities of a computer system in order to obtain an illegal access to the
information stored on the computer system is called hacking.
Protection:
➢ Make your passwords long and complicated, and with a good mix of letters and numbers, as well as
utilizing case-sensitive letters. Don't use anything familiar, such as your birthday, your children's names or
anything like that. If a hacker wants to attempt to break into your email accounts, at least make him work for
it.
➢ Don't ever allow your browser to remember your passwords. True, it may be a bit of an
inconvenience to enter your password every time you log in.
➢ Activate Firewall
Firewall
a firewall is a network security system that monitors and controls incoming and outgoing network traffic
based on predetermined security rules. A firewall typically establishes a barrier between a trusted internal
network and un-trusted external network, such as the Internet.
Firewalls can be implemented as
both hardware and software, or a
combination of both. Network firewalls
are frequently used to prevent
unauthorized Internet users from
accessing private networks connected
to the Internet, especially intranets. All
messages entering or leaving the
intranet pass through the firewall,
which examines each message and
blocks those that do not meet the specified security criteria.

Functions of firewall
• Monitors incoming and outgoing traffic
• checking whether incoming or outgoing data meets a given set of criteria
• if the data fails the criteria, the firewall will block the ‘traffic’ and give the user(or network manager) a
warning that there may be a security issue
• logging all incoming and outgoing ‘traffic’ to allow later interrogation by the user(or network manager)
• criteria can be set to prevent access to certain undesirable sites; the firewall can keep a list of all
undesirable IP addresses
• helping to prevent viruses or hackers entering the user’s computer (or internal network)
• warning the user if some software on their system is trying to access an external data source (e.g.
automatic software upgrade); the user is given the option of allowing it to go ahead or requesting that
such access is denied.

Limitations of firewall
• it cannot prevent individuals, on internal networks, using their own modems to bypass the firewall
• employee misconduct or carelessness cannot be controlled by firewalls (for
example, control of passwords or use of accounts)
• users on stand-alone computers can chose to disable the firewall, leaving their computer open to
harmful ‘traffic’ from the internet.
• All of these issues require management control or personal control (on a single computer) to ensure
that the firewall is allowed to do its job effectively.

Proxy server
A proxy server is a dedicated computer system running on a computer that acts as an intermediary
between a client application, such as a Web browser, and a real server.
how proxy servers work:
When a proxy server receives a
request for an Internet resource
(such as a Web page), it looks in its
local cache of previously pages. If it
finds the page, it returns it to the
user without needing to forward the
request to the Internet. If the page is
not in the cache, the proxy server,
acting as a client on behalf of the
user, uses one of its own IP
addresses to request the page from
the server out on the Internet. When
the page is returned, the proxy server relates it to the original request and forwards it on to the user.
Functions of proxy servers include:
• allowing the internet ‘traffic’ to be filtered; they can block access to a website if necessary (similar type
or reaction as a firewall)
• by using the feature known as a CACHE, they can speed up access to information from a website;
when the website is first visited, the home page is stored on the proxy server; when the user next visits
the website, it now goes through the proxy server cache instead, giving much faster access
• keeping the user’s IP address secret – this clearly improves security
• acting as a firewall.
Security Certificates

https://www.us-cert.gov/ncas/tips/ST04-014
If an organization wants to have a secure web site that uses encryption, it needs to obtain a site, or host,
certificate.
There are two elements:
➢ a closed padlock,
➢ URL that begins with "https:" rather than "http:"
If a web site has a valid certificate, it means that a certificate authority has taken
steps to verify that the web address actually belongs to that organization. When you
type a URL or follow a link to a secure web site, your browser will check the
certificate for the following characteristics:
1. The web site address matches the address on the certificate
2. The certificate is signed by a certificate authority that the browser recognizes as a "trusted" authority
If the browser senses a problem, it may present you with a dialog box that claims that there is an error with
the site certificate.
If you have chosen not to trust the company who issued the certificate, or if the certificate has expired. You
will usually be presented with the option to examine the certificate, after which you can accept the
certificate forever, accept it only for that particular visit, or choose not to accept it.

4
1 2

3
Data Encryption
Encryption is the conversion of electronic data into another form, called cipher text, which cannot be easily
understood by anyone except authorized parties.
The word encryption comes from the Greek word kryptos, meaning hidden or secret.

Caesar Cipher (Encryption)


The earliest known and simplest ciphers. The method is named after Julius Caesar.
It is a type of substitution cipher in which each letter in the plaintext is 'shifted' a certain number of places
down the alphabet.
For example, with a shift of -4, A would be replaced by X, D would become 4, and so on.

Encryption makes the data meaningless unless the recipient has the necessary decryption tools.
There are two types of encryption:
SYMMETRIC ENCRYPTION is a method of encryption in which one key is required to encrypt and decrypt
the data.
ASYMMETRIC ENCRYPTION (also known as Public Key Encryption)is a method of encryption in which
one key (public key) is required to encrypt and other key (private key) to decrypt the data.
Symmetric Encryption

KEY Distribution Problem:


In symmetric key encryption the sender has to supply the encryption key to the recipient. But this key could
be hacked, which puts the security of the encrypted message at risk. This problem is known as key
distribution problem.

Example Question The student is interested in how simple encryption could be applied to a text
message. One of the simplest forms of encryption is a method of ‘substitution’ where each
character has a unique substitute character.
The student uses this method with the following character substitutions:
Message character A B C D E F G H I J K L M
Substitute character P L F N O C Q U D Z V G I

Message character N O P Q R S T U V W X Y Z
Substitute character X M W J B K E A H S Y R T
Assume all messages are made up from the upper-case characters only.
Show the string after the message AT SEVEN is encrypted.
............................................................................................................................................................
............................................................................................................................................................
...................................................................................................................................................... [2]
Show the string after a cypher text “FMIWKCD IPKEOBK” is decoded.
............................................................................................................................................................
...................................................................................................................................................... [2]
Symmetric encryption uses a single key.
Explain how a message is encrypted and decrypted using symmetric encryption.
............................................................................................................................................................
............................................................................................................................................................
...................................................................................................................................................... [2]
Example Question:
In a simple symmetric encryption system, each letter of the alphabet is substituted with another.
The plain text message:
The Quick brown Fox jumps over a lazy dog.
becomes the cypher text message:
Zag towns jumpy Dmh coilv mwgu f bfke rmq

(a) (i) Convert these words to cypher text.


Computer Science
.......................................................................................................................................................
.................................................................................................................................................. [2]
(ii) Decode this cypher text message.
NV pwza WYTWBFJ
.......................................................................................................................................................
.................................................................................................................................................. [2]
(ii) Decode this cypher text message.
(b) Both the person who sends the message and the person who receives it need to know what
the substitution key is, and they need to keep this secret. A copy of the
substitution key has been sent using SSL transmission.
Explain why this keeps the copy of the key secret during transmission.
.......................................................................................................................................................
.................................................................................................................................................. [2]

ASYMMETRIC (PUBLIC KEY) ENCRYPTION


Public-key encryption is a cryptographic system that uses two keys
-- a public key known to everyone
-- and a private or secret key known only to the owner of the key.
If a message is encrypted by Public key it can only be decrypted by associated Private key.
If a message is encrypted by private key it can only be decrypted by associated public key.
Example 1: When Bob wants to send a secure message to Alice, he uses Alice’s public key to encrypt the
message. Alice then uses her private key to decrypt it.(To make not-understandable for others)

Example 2: When Alice wants to ensure that the message is sent by her (to verify the sender and message is
not altered, not to make message secure (not-understandable by others)),
she encrypts her message using her own private key.
Then the message is transmitted to Bob.
Bob decrypts the message using Alice’s public key.
The decryption of message by Alice’s public key confirms that this is Alice’s message, and is without any
alteration.

Example 3 (Exam style question): Bill, a manager of a company, sent an email with very sensitive
information to a work colleague, Alison. However, Bill also accidentally sent it to everybody in the company.
Describe the method used that ensured only Alison was able to read the original contents of the email.
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................[4]
Answer Key
Manager encrypts email using Alison’s public key
Alison decrypts email his own private key

Example 4 (Exam style question): Alexa sends an email to Beena.


Explain how Beena can be sure that she has received a message that is authentic (not corrupted or
tampered with) and that it came from Alexa.
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
.........................................................................................................[2]
Answer Key
Alexa will encrypts her message using her own private key.
Beena will decrypts the message using Alexa’s public key.
If message is decrypted by Alexa’s public key, it shows that message is authentic (sent by Alexa and not
tempered).
DENIAL OF SERVICE ATTACKS
A denial of service attack (DoS) is an attempt at preventing users from accessing part of a network, notably
an internet server.
The attacker may be able to prevent a user from:
❖ Accessing their emails
❖ Accessing websites/web pages
❖ Accessing online services (such as
banking).
One method of attack is to flood the
network with useless traffic.
When a user types in or clicks on a URL of
a website (using their web browser), a
request is sent to the internet server which
contains the website or web page.
Obviously, the server can only handle a
finite number of requests. So if it becomes overloaded by an attacker sending out thousands of requests, it
won’t be able to service the user’s legitimate request. This is effectively a denial of service.
Q 4 a) The table below gives descriptions of three types of malware.
Description Term
Malware that attaches itself to another program.
Malware that redirects the web browser to a fake website.
Email that encourages the receiver to access a website and give their banking
details.
Complete the table by adding the correct terms. [3]
(b) Ben wants to send a highly confidential email to Mariah so that only she can read it. Plain text and
cipher text will be used in this communication.
(i) Explain the terms plain text and cipher text.
Plain text ............................................................................................................................
...........................................................................................................................................
Cipher text .........................................................................................................................
...................................................................................................................................... [2]
(ii) Explain how the use of asymmetric key cryptography ensures that only Mariah can read the email.
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
...........................................................................................................................................................................
.......................................................... [4]
(a)
Description Term
Malware which attaches itself to another program. VIRUS
Malware designed to redirect the web browser to a fake website. PHARMING
Email that encourages the receiver to access a website and give their banking
PHISHING
details.
(b) (i) Plain text is the original text
Cipher text is the encrypted version of the plain text
(ii) Asymmetric keys means that the key used to encrypt (public key) is different from the key used to
decrypt (private key)
Ben acquires Mariah’s public key
Ben encrypts email …
using Mariah’s public key
Ben sends encrypted email to Mariah
Mariah decrypts email …
Using her private key
6.2 Data Integrity
Candidates should be able to: Notes and guidance
Describe how data validation and data verification
help protect the integrity of data
Describe and use methods of data validation Including range check, format check, length check,
presence check, existence check, limit check,
check digit
Describe and use methods of data verification During data entry including visual check, double
during data entry and data transfer entry During data transfer including parity check
(byte and block), checksum

Data integrity refers to maintaining and assuring the accuracy and consistency of data over its entire life-
cycle, and is a critical aspect to the design, implementation and usage of any system which stores,
processes, or retrieves data.
Integrity of data:
o Sensibility of data
o Correctness of data.
• at the time of entry
• at the time of transmission

Validation and Verification


Validation and verification are two ways to check that the data entered into a computer is correct. Data
entered incorrectly is of little use.

Validation is an automatic computer check to ensure that the data entered is sensible and reasonable. It
does not check the accuracy of data.
For example, a secondary school student is likely to be aged between 11 and 16. The computer can be
programmed only to accept numbers between 11 and 16. This is a range check.
However, this does not guarantee that the number typed in is correct. For example, a student's age might
be 14, but if 11 are entered it will be valid but incorrect.
A validation check is a rule that is built into a database to check that the data entered is:
• Sensible
• Reasonable
• Within acceptable boundaries
• Complete
Validation does NOT mean that the data is actually correct, that requires verification.
INPUT Marks
WHILE Marks<0 OR Marks>100 DO
PRINT “Error! Re-enter marks”
INPUT Marks
ENDWHILE
There are a number of different validation rules that can be used in a database:
Type Checks - Field data types provide a basic method of validation. Field data types are assigned to
fields during the creation of the database table and data types such as Numeric, Boolean, Date/Time and
Image restrict what can be entered. If a user tries to enter text in a date field or alphabetic characters in a
numeric field, their entry will be rejected.
Range checks - these are used to limit the range of data a user can enter. The 'day' part of a date must be
in the range 1 to 31. An exam grade should be in the range 'A'...'G' or 'U'.
Presence checks - these simply check that an entry has been made in a particular field i.e. a null value
(empty field) is not permitted. Usually, not every field in a record needs to be filled in, however there are
likely to be some that must have a value and the presence check means that the system will not allow the
record to be saved until an entry is made. An application for a passport must have the applicant's surname.
Length Checks - All alphanumeric data has a length. A single character has a length of 1 and a string of
text such as “Hello World” has a length of 11 (spaces are counted in text strings). A length check ensures
that such data is either an exact length or does not exceed a specified number of characters. Mobile phone
numbers are stored as text and should be 11 characters in length.
Lookup - A lookup check takes the value entered and compares it against a list of values in a separate
table. It can then return confirmation of the value entered or a second list based on the value. One use of
lookups restricts users to pre-defined input using drop-down lists. A user is forced to use a list box to select
from a predetermined list of valid values.
Check digits - this type of check is used with numbers. An extra 'check digit' is calculated from the
numbers to be entered and added to the end. The numbers can then be checked at any stage by
recalculating the check digit from the other numbers and seeing if it matches the one entered. One example
where a check digit is used is in the 10 digit ISBN number which uniquely identifies books.
Summary of validation

Validation
How it works Example usage
type
Checks that a value falls within the Number of hours worked must be less than 50
Range check
specified range and more than 0
Similar to Range Check but the rule >=0 means reject negative numbers. Date of
Limit Check
involves only one limit. birth must not be later than a date.
Length Checks the data isn't too short or too
A password which needs to be six letters long
check long. Values must be a specific length.
Presence Checks that data has been entered into a In most databases a key field cannot be left
check field blank
Checks that the data entered is of a given Number of brothers or sisters would be an
Type Check
data type, integer (whole number).
Checks that when a string of characters is A name would not contain characters such as %,
Character
entered it does not contain any invalid and a telephone number would only contain
Check
characters or symbols, digits or (,), and + .
Checks the data is in the right format. A candidate number, PK-500-1234 or National
Format Values must conform to a specific Insurance number is in the form LL 99 99 99 L
Check pattern, for example, two letters followed where L is any letter and 9 is any number. for
by six digits followed by a single letter Date dd/mm/yyyy or mm/dd/yyyy
The last one in a code are used to check Bar code readers in supermarkets use check
Check digit
the other digits are correct digits
Existence Checks data in a file, a file name actually
check exists
Uniqueness
Checks that a data entered is unique
check

length check – e.g. only 30 characters in name field


character check – e.g. name doesn’t contain numeric chars
range check – e.g. day of month in date is between 1 and 31
format check – e.g. date in the form dd/mm/yyyy
check digit – e.g. end digit on bar code to check if it is valid
type check – e.g. integer, real
Data verification
Verification is performed to ensure that the data entered or transmitted exactly matches the original source.
Verification means checking the input data with the original data to make sure that there have been no
transcription errors (transcription means copying the data). The standard way to do this is to input the data
twice to the computer system. The computer then checks the two data values (which should be the same)
and, if they are different, the computer knows that one of the inputs is wrong. E.g. entering password twice
during sig-up. Verification methods include:
At the time of entry At the time of transmission
Double entry Parity check
Screen/visual check Checksum.
ARQ
Echo Check

1. Parity check
A parity check is a single bit which is added to the end of the message, and indicates that the number of
ones in the message is even or odd. If a single error occurs, the receiver could detect it because parity bits
will no longer match.
A parity check involves checking that the number of 1 bits in a byte totals to an even number (called “even
parity”) or an odd number (called “odd parity”). If two devices that are communicating decide to use odd
parity, there must always be an odd number of 1s. If a byte is received with an even number of 1s, an error
must have occurred.
For example, the byte 01011000 is sent. It has three 1 bits so it passes the odd parity check.
When it is transmitted, the byte received is 11011000. This has four 1 bits, which is an even number, so
there must have been an error in transmission. The receiving device would ask for it to be sent again.
Although this example uses odd parity, even parity can equally well be used. The two devices have to
agree which type of parity to use.
Parity is used not only during data transfer between devices but also when data are transferred between
different components of the CPU. If two mistakes are made in the same byte, they cancel each other out
and the faulty data are accepted.
This problem can be overcome and a clever way of identifying mistakes can be implemented by using
parity blocks.
A byte can represent a character code in eight bits, giving potentially 256 different characters. However, an
ASCII character reserves one of the bits for a parity bit. This leaves seven bits for the character code,
reducing the number of different characters to 128.
Parity blocks
A further check can be made on the data bytes which are transmitted. An additional byte, called the parity
byte, is calculated and transmitted for each group of bytes. The data bytes and parity byte together are
called a parity block.
A parity block is like a rectangle made up of rows and columns. The last bit in each row, i.e. in each data
byte, is the parity bit, which checks if there is an error in the byte. One possible problem with a parity bit
check is that two errors in the same byte are not picked up by the parity bit check. They are however
detected by the check which the parity byte performs.
Think of the parity byte not as data but as a whole row of parity bits, each of which is there to check the
column of bits above it in the grid. Consider the following transmission in which four data bytes are followed
by the parity byte using odd parity. The correctly transmitted parity block (four data bytes followed by the
parity byte) is shown below:

Assume that there was an error in the transmission and the bytes shown below were received by the
device. The number of 1s are counted. In a column and in a byte, number of 1s are not in odd. So there
must be an error with it. The bit intersecting erroneous column and byte is the bit with error. It should be
inverted to correct the error.
1 1 0 0 1 1 0 1
0 0 1 0 0 0 0 0
1 0 0 1 1 1 0 0
1 1 0 0 0 0 1 0
0 1 1 0 1 1 0 0

But errors in multiple bits are sometime unable to be traced out. As the number of 1s may remain in odd in
odd parity and even in even parity, then it cannot be identified.

It is claimed that checking the parity bits and using a parity block check will identify 99% of all transmission
errors.
2. Checksum
Data are normally sent as blocks of bytes rather than as individual bytes. Whatever the data represent, they
are in binary form and hence could be treated as numbers that can be added together. Another checking
procedure is to add all the bytes that are being sent in the block of data. Any bits lost at the most-significant
end as a carry are ignored, so the answer is an eight-bit number. This “check byte” or checksum is
calculated before the data are sent and then calculated again when they are received. If there are no errors
in the transmission, the two answers match. If, however, the two bytes are different there must be at least
one checksum that has been corrupted and the whole block of data has to be re-sent.
The following algorithm is used to calculate check sum:
1. Calculate file size
2. If file size<256 then
3. Checksum=file size
4. Else
5. Checksum=file size MOD 256
6. Endif
Sort the steps for Check Sum into order. Write the correct number in the column Step No.

Steps of Check Sum Step No.

The block of data is sent along with check sum.

The check sum is calculated and added to the block of data.

The computer then compares its calculated check sum with the check sum received.

If the two don’t match, then the there is an error in data transmission

The receiving computer calculates check sum.


3. Echoing back
The simplest way of checking the transfer of the data is to send the data back again. If the data sent
back are the same as the data sent in the first place then the original data must have reached the
destination unaltered. If not, the data must be sent again. This is known as echoing back. Echoing
back is very effective, but suffers from having to send data twice. The transmission mode needs to be
either duplex or half duplex to allow data transfer in both directions.

4. AUTOMATIC REPEAT REQUEST (ARQ)


https://en.wikipedia.org/wiki/Automatic_repeat_request
Automatic Repeat reQuest (ARQ), also known as Automatic Repeat Query, is an error-
control method for data transmission that uses acknowledgements (messages sent by the receiver
indicating that it has correctly received a packet) and timeouts (specified periods of time allowed to
elapse before an acknowledgment is to be received) to achieve reliable data transmission over an
unreliable service. If the sender does not receive an acknowledgment before the timeout, it
usually transmits the packet until the sender receives an acknowledgment or exceeds a predefined
number of retransmissions.
Sort the steps for ARQ into order. Write the correct number in the column Step No.

Steps of ARQ Step No.

Sending computer transmits a block of data

After a set period of time, a timeout occurs which triggers the data to be automatically
resent by the sending computer.

The sending computer waits for a period of time to see if receiving computer
acknowledges receipt of the data.

This will continue until the receiving computer acknowledges the data has been
received.
START

SEND DATA

SET Timer RESEND Data

Yes
Has Timer
timed out?

No

Acknowledgement
Received?

Yes

Transmission Successful

STOP
Check digits - this type of check is used with numbers. An extra 'check digit' is calculated from the
numbers to be entered and added to the end. The numbers can then be checked at any stage by
recalculating the check digit from the other numbers and seeing if it matches the one entered. One
example where a check digit is used is in the 10 digit ISBN number which uniquely identifies books.
The last number of the ISBN is actually the check digit for the other numbers, for example - the ISBN
0192761501.
Following two Methods are used to calculate check digit
Modulo-11 Method:
Modulo-10 Method:
Modulo-10 method is used in check digit calculation in ISBN 13, where the 13th digit of the ISBN code
is calculated using the following algorithm.

Steps Example
1. Find sum of digits at odd position
2. Find sum of digits at even position and multiply result
by 3

Sum of digits at odd position


9+8+1+7+2+2=29
13 12 11 10 9 8 7 6 5 4 3 2 1
9 7 8 3 1 2 7 3 2 3 2 0 ?

Sum of digits at even position x 3


3 (7+3+2+3+3)=54

3. Add both sums 29+54=83


4. Find Mod10 83 MOD 10=3
5. If remainder=0 then
Check digit=0
Else
Check digit=10-Remainder Check digit 10-3=7
Unit 7 Ethics and Ownership
Candidates should be able to: Notes and guidance
Show understanding of the need for and Understand the importance of joining a
purpose of ethics as a computing professional professional ethical body including BCS (British
Computer Society), IEEE (Institute of Electrical
and Electronic Engineers)
Show understanding of the need to act ethically
and the impact of acting ethically or unethically
for a given situation
Show understanding of the need for copyright
legislation
Show understanding of the different types of Licences to include free Software Foundation, the
software licencing and justify the use of a Open Source Initiative, shareware and
licence for a given situation commercial software
Show understanding of Artificial Intelligence Understand the impact of AI including social,
(AI) economic and environmental issues Understand
the applications of AI

Legal – relating to, or permissible by, law.


Morality – an understanding of the difference between right and wrong, often founded in personal
beliefs.
Ethics – moral principles governing an individual’s or organisation’s behaviour, such as a code of
conduct.
Culture – the attitudes, values and practices shared by a group of people/society.
Intellectual property rights – rules governing an individual’s ownership of their own creations or
ideas, prohibiting the copying of, for example, software without the owner’s permission.
Privacy – the right to keep personal information and data secret and for it to not be unwillingly
accessed or shared through, for example, hacking.
Plagiarism – the act of taking another person’s work and claiming it as one’s own.
BCS – British Computer Society.
IEEE – Institute of Electrical and Electronics Engineers.
ACM – Association for Computing Machinery
Piracy – the practice of using or making illegal copies of, for example, software.
Product key – security method used in software to protect against illegal copies or use.
Digital rights management (DRM) – used to control the access to copyrighted material.
Free Software Foundation – organisation promoting the free distribution of software, giving users the
freedom to run, copy, change or adapt the coding as needed.
Open Source Initiative – organisation offering the same freedoms as the Free Software Foundation,
but with more of a focus on the practical consequences of the four shared rules, such as more
collaborative software development.
Freeware – software that can be downloaded free of charge; however, it is covered by the usual
copyright laws and cannot be modified; nor can the code be used for another purpose.
Shareware – software that is free of charge initially (free trial period). The full version of the software
can only be downloaded once the full fee for the software has been paid.

7.1 Ethics and Ownership


Ethics is a set of moral principles that govern the behaviour of a group or individual. Therefore,
computer ethics is set of moral principles that regulate the use of computers. Some common issues of
computer ethics include intellectual property rights (such as copyrighted electronic content), privacy
concerns, and how computers affect society.
For example, while it is easy to duplicate copyrighted electronic (or digital) content, computer ethics
would suggest that it is wrong to do so without the author's approval. And while it may be possible to
access someone's personal information on a computer system, computer ethics would advise that
such an action is unethical.
As technology advances, computers continue to have a greater impact on society. Therefore,
computer ethics promotes the discussion of how much influence computers should have in areas such
as artificial intelligence and human communication. As the world of computers evolves, computer
ethics continues to create ethical standards that address new issues raised by new technologies.
COMPUTER ETHICS is a set of principles set out to regulate the use of computers.
Three factors are considered:
• INTELLECTUAL PROPERTY RIGHTS – this covers, for example, copying of software without the
permission of the owner
• PRIVACY ISSUES – this covers, for example, hacking or any illegal access to another person’s
personal data
• Effect of computers on society – this covers factors such as job losses, social impacts and so on.
Use of the internet has led to an increase in plagiarism – this is when a person takes another person’s
idea/work and claims it as their own. Whilst it is perfectly fine to quote another person’s idea, it is
essential that some acknowledgement is made so that the originator of the idea is known to others.
This can be done by a series of references at the end of a document or footnotes on each page where
a reference needs to be made. Software exists that can scan text and then look for examples of
plagiarism by searching web pages on the internet.
ACM/IEEE Code of Ethics
1. PUBLIC – Software engineers shall act consistently with the public interest.
2. CLIENT AND EMPLOYER – Software engineers shall act in a manner that is in the best interests
of their client and employer, consistent with the public interest.
3. PRODUCT – Software engineers shall ensure that their products and related modifications meet th
e highest professional standards possible.
4. JUDGEMENT – Software engineers shall maintain integrity and independence in their professional
judgment.
5. MANAGEMENT – Software engineering managers and leaders shall subscribe to and promote an
ethical approach to the management of software development and maintenance.
6. PROFESSION – Software engineers shall advance the integrity and reputation of the profession c
onsistent with the public interest.
7. COLLEAGUES – Software engineers shall be fair to and supportive of their colleagues.
8. SELF – Software engineers shall participate in lifelong learning regarding the practice of their profe
ssion and shall promote an ethical approach to the practice of the profession.
Exam-style Questions
1 The ACM and IEEE set out eight principles for ethics and professional practice. The categories, with
a short explanation, are shown in this diagram.

Statement 1: Team leaders should subscribe to and promote an ethical approach to the management
of software development and maintenance.
Statement 2: Software engineers shall participate in lifelong learning regarding the practice of the
profession.
Statement 3: Software and related modifications meet the highest possible standards.
a) These three statements need to be added to the diagram. Circle the correct numbers on the
diagram to indicate the positions for Statement 1, Statement 2 and Statement 3. [2]
b For each of these three workplace scenarios, unethical behaviour is demonstrated. Explain the
principle(s) which are not being met.
I Workplace scenario 1
A large project is devolved to project teams, each led by a project leader. One project leader fails to
inform his manager that he has major concerns that:
• their team's software contribution is taking much longer to write and test than anticipated
• they are consequently at risk of spending over their allocated budget. [3]
...................................................................................................................................................................
.................................................................................................................................
Ii Workplace scenario 2
The software house is about to train a number of programmers in a new programming language. Two
employees are refusing to attend the training. [2]
...................................................................................................................................................................
.................................................................................................................................
Iii The company is developing some monitoring software which requires sensors placed in a nature
reserve.
One employee considers the sensors will be a danger to some of the wildlife, but is told by his
manager that the matter is none of his concern. [2]
...................................................................................................................................................................
.................................................................................................................................

2 A team of software engineers is developing a new e-commerce program for a client. State three of
the principles of the ACM/IEEE Software Engineering Code of Ethics. Illustrate each one, with an
example, describing how it will influence their working practices.
1 .......................................................................................................................................................
..........................................................................................................................................................
2 .......................................................................................................................................................
……………………………………………………………........................................................................
3 ............................................................................................................ ...........................................
…………………………………………………………..................................................................... [6]

Copyright is a legal concept, enacted by most governments, that grants the creator of an original
work exclusive rights to its use and distribution, usually for a limited time, with the intention of enabling
the creator of intellectual wealth (e.g. the photographer of a photograph or the author of a book) to
receive compensation for their work and be able to financially support themselves.
Copyright is a form of intellectual property (as patents, trademarks and trade secrets are), applicable
to any expressible form of an idea or information that is substantive and discrete.
Copyright Issues: Very briefly, copyright gives the author of a work the right...
• ...to reproduce the work.
• ...to permit copies to be made by others.
• ...to prepare derivative works.
• ...to display the copyrighted work publicly.
Plagiarism is the practice of taking someone else's work or ideas and passing them off as one's own.
“Plagiarism is the deliberate or reckless representation of another’s words, thoughts, or ideas as
one’s own without attribution in connection with submission of academic work, whether graded or
otherwise.”
Plagiarism is considered academic dishonesty and a breach of Computer ethics. It is subject to
sanctions like expulsion.
Plagiarism is not a crime per se but in academia and industry it is a serious ethical offense, and
cases of plagiarism can constitute copyright infringement.
Cracking
Software cracking is the modification of software to remove or disable features which are
considered undesirable by the person cracking the software, usually related to break license.

The Free software Foundation and the Open Source Initiative


The Free Software Foundation and the Open Source Initiative are non-profit organisations that
promote the benefits of giving users the freedom to run, copy, and change and adapt software.
Examples of software licensed in this way include: F-spot (photographic manager), Scribus (DTP/word
processor) and LibreOffice (Office Suite). Users are allowed to follow the four freedoms:
• Run the software for any legal purpose they wish.
• Study the program source code and modify it where necessary to meet their needs.
• Redistribute copies of the software to friends and family.
• Distribute code modified by the user to friends and family
Software Licence:
There are different types of software licence
Commercial software
Commercial software that are created and made available for sale aiming to make a profit.
The licence issued to buyer is the licence of using it, it is not giving the ownership of the software. The
ownership remains with the vendor.
There are a number of different options that might be available:
• A fee is paid for each individual copy of the software.
• A company might have the option of buying a site licence which allows a defined number of copies
to be running at any one time.
• Special rates might be available for educational use.
Freeware is copyrighted computer software which is made available for use free of charge, for an
unlimited time. Authors of freeware often want to "give something to the community", but also want to
retain control of any future development of the software.
The term shareware refers to commercial software that is copyrighted, but which may be copied for
others for the purpose of their trying it out with the understanding that they will pay for it if they
continue to use it.

Open or free licensing


Free software is computer software that is distributed along with its source code, and is released
under terms that guarantee users the freedom to study, adapt/modify, and distribute the software.

For open licensing there are two major operations under way. Both are global non-profit organisations.
They are very similar in what they provide but there is a difference in their underlying philosophies.
The Open Source Initiative makes open source software available. The philosophy here is that the
use of open source software will allow collaborative development of software to take place. The
software is normally made available free of charge. The source code is provided.
The user of the software is free to use it, modify it, copy it or distribute it in accordance with the terms
defined by the license.
The Free Software Foundation is so-named because the philosophy is that users should be free to
use software in any way they wish. The software is not provided entirely free of charge; there is a
small fee to cover distribution costs. The free software is still open source. However, there is a special
feature of the license which is called ‘copyleft’. This is the condition that if the software is modified the
source code for the modified version must be made available to other users under the same
conditions of usage.
Copyleft Licences
These licences contain one key restriction. Any software that you develop where you have modified
the licensed source code must be licensed using the same license as the original. This is designed to
prevent people taking the source code, improving it, and then releasing it under a propriety licence in
order to sell. It may also restrict the type of usage, for instance if software is released for personal use
only and you adapt the software, you can only release a derivative under the same personal use
licence.
If you improve the code you must allow others to use it (you can still sell a product based on the
license but you can’t stop from using the source code you created).
Artificial Intelligence

Artificial intelligence (AI) is intelligence demonstrated by machines, unlike the natural intelligence
displayed by humans and animals, which involves consciousness and emotionality.
Artificial intelligence (AI) makes it possible for machines to learn from experience, adjust to new inputs
and perform human-like tasks. Most AI examples that you hear about today – from chess-playing
computers to self-driving cars – rely heavily on deep learning and natural language processing. Using
these technologies, computers can be trained to accomplish specific tasks by processing large
amounts of data and recognizing patterns in the data.
The impact of AI
The possibility of creating thinking machines raises a host of ethical issues, related both to ensuring
that such machines do not harm humans and other morally relevant beings, and to the moral status of
the machines themselves.
People often associate AI with science fiction, fantasy and robots. Numerous films and books fuel this
association. The science fiction author, Isaac Asimov, went so far as to produce his own three laws of
robotics:
1 A robot may not injure a human through action or inaction.
2 A robot must obey orders given by humans without question.
3 A robot must protect itself unless it conflicts with the two laws above.
However, AI goes way beyond robotics. It covers an ever-increasing number of areas, such as
• autonomous (driverless) vehicles
• artificial limb technology
• drones, used to carry out dangerous or unpleasant tasks such as bomb disposal, welding, or
entering nuclear disaster areas
• climate change predictions
• medical procedures, such as eye operations where extreme precision is required.
Specimen Paper 9618/01
4 A cake factory uses machines to make cakes .
(e) The factory servers run software that makes use of Artificial Intelligence (AI).
Explain how the use of AI can help improve the safety and efficiency of the factory.
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
............................................................................................................................................................ [3]

1b 9618 S21 P12


2 Aisha manages a team of software developers.
(a) Explain the reasons why it is important that Aisha acts ethically in relation to her team
members.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
....................................................................................................................................... [2]
(b) The team are developing a computer game where the user plays a board game (such as
chess) against the computer.
Describe how the computer would use Artificial Intelligence (AI) to play the board game.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
................................................................................................................................... [3]
(c) The final game will be released under a licence. [4]
Tick one or more boxes in each row to identify the licence(s) each statement describes.
Free Open
Commercial
Statement Software Source Shareware
Software
Foundation Initiative
The user can edit the source code
The user must always pay before
being able to use the software
The user can redistribute the
software
The user always gets a trial period
1ac 9618 S21 P12_13 –
1 Anya scans an image into her computer for a school project.
(d) Anya made sure that the image was not subject to any copyright before scanning it.
Describe what is meant by copyright.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [2]
2ac W21 P11 P13 –
4 Francis is starting his first job as a software developer for a multinational company.
(a) Francis has been advised to join a professional ethical body.
Describe the benefits to Francis of joining a professional ethical body.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
................................................................................................................................... [3]
(b) Francis is shown the software he will be working on. He is unfamiliar with the Integrated
Development Environment (IDE) he is required to use.
(i) Describe the ways in which Francis can act ethically in this situation.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
....................................................................................................... [2]
(ii) A typical IDE provides debugging tools to support the testing of a program.
Identify three other tools or features found in a typical IDE to support the writing of the
program.
1 ........................................................................................................................................
2 ........................................................................................................................................
3 ........................................................................................................................................ [3]
(c) Francis is part of a team writing a program. He finds an error in part of the program that
has already been tested. He decides not to tell anyone because he is worried about the
consequences.
Explain the reasons why Francis acted unethically in this situation.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
....................................................................................................................................... [2]
3b 9618 S22 P12
8 Describe one application of Artificial Intelligence (AI).
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
....................................................................................................... [3]

3a 9618 S22 P11 - 5 A programmer uses an Integrated Development Environment (IDE) to


develop a program.
(b) The programmer wants to allow users to edit, improve and redistribute the program.
Identify two different types of software licence that the programmer could use.
1 ................................................................................................................................................
2 .............................................................................................................................................[2]
Answer : Open source initiative and free software foundation
6a 9608/11 Nov 17 Q6 – SoW
6 Raj has joined a software company as a trainee programmer. He was given the company’s
Code of Conduct document during his induction training. The handbook has a section headed
‘Ethical Behaviour’.
(a) Describe what is meant by ethics.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
..............................................................................................................................................[2]
(b) Raj is assigned to work as a new member of a development team.
In his first week, Raj feels uncomfortable working with one of his colleagues. He is unfamiliar
with the programming language used by the team. Next week, he will be working on the site
of one of the company’s clients with a colleague. Raj is very nervous about working in an
unfamiliar workplace.
Raj has a review with his manager after his first three weeks.
The Code of Conduct document was produced by the Human Resources section. It closely
follows the ACM/IEEE Software Engineering Code of Ethics that uses these eight key
principles:
Public Client and Employer Product Judgement
Management Profession Colleagues Self
There are issues Raj will want to
raise with his manager.
Describe two of these

issues.
• Circle the key ACM/IEEE principle this comes under.
• Suggest what action should be taken to demonstrate ethical behaviour.
Issue 1
Description ................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
ACM/IEEE principle (Circle one only)
Public Client and Employer Product Judgement
Management Profession Colleagues Self
Possible action .........................................................................................................................
.....................................................................................................................................................
.................................................................................................................................................
Issue 2
Description ................................................................................................................................
.....................................................................................................................................................
.................................................................................................................................................
ACM/IEEE principle (Circle one only)
Public Client and Employer Product Judgement
Management Profession Colleagues Self
Possible action .........................................................................................................................
.....................................................................................................................................................
.............................................................................................................................................. [6]
6b 9608/12 Nov 17 Q5 - SoW
5 The IEEE Software Engineering Code of Ethics uses eight key principles shown in the right-
hand column of the following diagram.
Tom is employed as a tester with a software company. He is keen to become a trainee
programmer. The middle column in the diagram labels six incidents which have happened to
Tom this week. The table that follows the diagram describes each incident.

Incident Description
Tom has received some phishing emails. He reported this to the bank they were
A
supposed to have come from.
B Tom has asked his manager if they will pay for him to attend a programming course.
Tom is testing beta versions of new games software at work. He copies the software
C
on to CD-Rs and sells them to his friends.
D Tom has completed the application forms to join the Chartered Institute for IT.
Tom finds it difficult to work with one of his colleagues. His way of dealing with this
E
has been to refuse to speak with the colleague.
Tom’s manager had considered the testing of a new game was completed. Tom
F reported to his manager that he thought there were still bugs which needed to be
rectified.
(a) Draw a line on the diagram to link each of the six incidents to either ethical behaviour or
unethical behaviour.
(b) Consider each incident you have identified as ethical behaviour. [2]
Draw a line from each incident to indicate the IEEE category it maps to. [4]
8b 9608/12 Nov 18 Q5 – SoW
5 This question presents three scenarios. For each scenario, tick (✓) one box to show
whether you think the person’s behaviour is ethical or unethical. Justify your choice.
(a) Wendy is a software engineer who is developing a program for her company. Her friend,
Noah, is developing a program for a different company. Wendy looks at the code that Noah is
writing to get ideas for her own program.
Ethical
Unethical
Justification ...............................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.............................................................................................................................................. [2]
(b) Amit is fixing some bugs in the computer system of a large multinational company. He is
asked to sign a confidentiality agreement. He sees some confidential information which
contains the names of other multinational companies that have broken the law. He copies this
information and releases it on the Internet.
Ethical
Unethical
Justification .................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
............................................................................................................................................. [2]
(c) Farah is providing a company with an estimate for the cost of writing a program. The
company she works for is in financial difficulty so she increases the estimate by 10%.
Ethical
Unethical
Justification ................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
............................................................................................................................................. [2]
8a 9608/11 Nov 18 Q3 - SoW
3 Hugo has produced a program (app) for mobile phones. He needs to decide whether to use
an Open Source licence or to distribute the app as shareware.
(a) Describe what is meant by Open Source licence and shareware.
Open Source ............................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
Shareware ................................................................................................................................
..................................................................................................................................................
...............................................................................................................................................[4]
(b) Tick ( ) one box to indicate the licence Hugo should use. Justify your choice.
Open Source
Shareware
Justification ...............................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[2]
8a 9608/11 Nov 18 Q5 - SoW
5 For each of the following scenarios, tick ( ) one box for each scenario to indicate whether
you think the person’s behaviour is ethical or unethical. Justify your choice.
(a) Kevin is a software engineer who has recently started a job with a new company. He is
using program code from his previous employer in his new employer’s programs.
Ethical
Unethical
Justification ...............................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
...........................................................................................................................................[2]
(b) Nadya is a software developer. She has accepted a new job. She has never worked with
the programming languages used by this new company. Nadya is planning to increase her
knowledge of these programming languages before she starts her new job.
Ethical
Unethical
Justification ...............................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[2]
(c) Maria finds that one of her team members has produced some inventive code. She
presents this to her manager, stating that it was produced by the team. She does not mention
the individual’s name.
Ethical
Unethical
Justification ...............................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[2]
1b 9618 S21 P12
8 A company has several security measures in place to prevent unauthorised access to the
data on its computers.
(a) Describe the difference between the security and privacy of data.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [2]
(b) Each employee has a username and password to allow them to log onto a computer. An
employee’s access rights to the data on the computers is set to either read-only, or read and
write. Identify one other software-based measure that could be used to restrict the access to
the data on the computers.
.....................................................................................................................................................
........................................................................................................................................... [1]
(c) The company is also concerned about threats posed by networks and the internet.
Identify two threats to the data that are posed by networks and the internet.
Threat 1 ....................................................................................................................................
...................................................................................................................................................
Threat 2 ....................................................................................................................................
..............................................................................................................................................[2]
1ac 9618 S21 P12_13 – 6 Each of the following algorithms performs data validation.
State the type of validation check that each of the algorithms performs.
(a)
INPUT x
IF x < 0 OR x > 10 THEN
OUTPUT "Invalid"
ENDIF
............................................................................................................................................. [1]
(b)
INPUT x
IF x = "" THEN
OUTPUT "Invalid"
ENDIF
.............................................................................................................................................. [1]
(c)
INPUT x
IF NOT(x = "Red" OR x = "Yellow" OR x = "Blue") THEN
OUTPUT "Invalid"
ENDIF
.............................................................................................................................................. [1]
2b 9618 W21 P12 - 1 When designing computer systems, it is important to consider the
security, integrity and privacy of the data.
Draw one line from each measure to indicate whether it keeps data secure or protects the
integrity of data. [2]
Measure
Firewall

Double entry Data Security

Presence check

Password Data Integrity

Access rights
2ac W21 P11 P13 –
2 Xanthe wants to maintain the integrity and security of data stored on her computer.
(a) Explain the difference between data security and data integrity.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [2]
(b) Xanthe uses both data validation and data verification when entering data on her computer.
(i) Describe how data validation helps to protect the integrity of the data. Give an example in your
answer.
Description ........................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
Example ............................................................................................................................ [2]
(ii) Describe how data verification helps to protect the integrity of the data. Give an example in your
answer.
Description ........................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
Example ............................................................................................................................ [2]
(c) Two malware threats are spyware and viruses.
Give two similarities and one difference between spyware and a virus.
Similarity 1 ................................................................................................................................
...................................................................................................................................................
Similarity 2 ................................................................................................................................
...................................................................................................................................................
Difference .................................................................................................................................
................................................................................................................................................... [3]
2ac W21 P11 P13 –
5 (b) Describe the ways in which access rights can be used to protect the data in Javier’s
database from unauthorised access.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
............................................................................................................................................. [3]
3a 9618 S22 P11 –
3 A teacher is writing examination papers on a laptop computer. The computer is connected to the
internet. The teacher is concerned about the security and privacy of the papers.
(a) State the difference between the security of data and the privacy of data.
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [1]
(b) Identify and describe two threats to the data. Identify one security measure to protect against
each threat. Each security measure must be different.
Threat 1 ....................................................................................................................................
Description ................................................................................................................................
...................................................................................................................................................
Security measure ......................................................................................................................
Threat 2 ....................................................................................................................................
Description ................................................................................................................................
...................................................................................................................................................
Security measure ...................................................................................................................... [6]
3b 9618 S22 P12
4 A school stores personal data about its staff and students on its computer system.
(a) Explain why the school needs to keep both its data and its computer system secure from
unauthorised access.
Data ..........................................................................................................................................
...................................................................................................................................................
Computer system .....................................................................................................................
...............................................................................................................................................[2]
(b) Complete the table by identifying two security threats to the data on a computer.
Describe each threat. Give a different prevention method for each threat. [6]
Prevention
Threat Description
method

.......................... .................................................................................. ..........................


.......................... .................................................................................. ..........................
..................................................................................

.......................... .................................................................................. ..........................


.......................... .................................................................................... ..........................
................................................................................
(c) Data is encrypted when it is transmitted within the school network, or externally such as
over the internet.
Describe what is meant by encryption and explain why it is used.
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
....................................................................................................................................... [2]
3b 9618 S22 P12
8 Describe one application of Artificial Intelligence (AI).
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
.....................................................................................................................................................
............................................................................................................................................ [3]

3c 9618 S22 P13


5 A company wants to store data about its employees in a computer system. The owner of
the company wants to ensure the security and integrity of the data.
(a) (i) State why data needs to be kept secure.
.....................................................................................................................................................
........................................................................................................................................... [1]
(ii) One way the data stored in a computer can be kept secure is by using back-up software.
Give two other ways the data stored in a computer can be kept secure.
1 ........................................................................................................................................
...........................................................................................................................................
2 ........................................................................................................................................
......................................................................................................................................... [2]
(b) The data about the employees is currently stored on paper. The data needs to be
transferred into the computer system.
Data validation and verification are used to help maintain the integrity of the data.
(i) Identify and describe one method of data verification that can be used when transferring
the data from paper to the computer.
Method ..............................................................................................................................
Description ........................................................................................................................
...........................................................................................................................................
........................................................................................................................................... [2]
(ii) The company needs to transfer the date of birth of each employee into the computer
system.
Give one example of how each of the following data validation rules can be used to validate
the date of birth when it is entered into the system.
Range check .....................................................................................................................
...........................................................................................................................................
Presence check .................................................................................................................
...........................................................................................................................................
Length check .....................................................................................................................
........................................................................................................................................... [3]
(iii) Explain why the data in the system may not be correct even after validating and verifying
the data.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
..................................................................................................................................... [2]
4ac 9618 W22 P11
2 Draw one line from each security feature to its most appropriate description. [4]
Security feature Description
converts data to an alternative
form
Firewall

redirects a user to a fake website

Pharming

verifies the authenticity of data

anti-virus software
scans files on the hard drive for
malicious software
Encryption
accepts or rejects incoming and
outgoing packets based on criteria

1abSummer 15 P11-12
6 (ii) Describe one way of ensuring the security of the data against malicious damage.
...................................................................................................................................................................
..............................................................................................................................................[1]

1cSummer 15 P13
3 (a) Give the definition of the terms firewall and authentication. Explain how they can help with the
security of data.
Firewall .............................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
..............................................................................................................................
Authentication ..................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
......................................................................................................................................[3]

(b) Describe two differences between data integrity and data security.
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
................................................................................................................ [2]
(c) Data integrity is required at the input stage and also during transfer of the data.
(i) State two ways of maintaining data integrity at the input stage. Use examples to help explain your
answer.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...................................................................................................................................... [3]
(ii) State two ways of maintaining data integrity during data transmission. Use examples to help
explain your answer.
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
..................................................................................................................[3]
2ac Winter 15 P11, P13
9 (a) Give a brief description of each of the following terms:
Validation ..................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
Verification ................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[2]
(b) Data are to be transferred between two devices. Parity checks are carried out on the data.
Explain what is meant by a parity check. Give an example to illustrate your answer.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[4]
10 (a) Explain the term computer virus.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[2]
(b) A virus checker has been installed on a PC.
Give two examples of when a virus checker should perform a check.
1 ................................................................................................................................................
...................................................................................................................................................
2 ................................................................................................................................................
...................................................................................................................................................[2]
2b Winter 15 P12
8 Verification and validation can be applied during data entry.
Describe what is meant by these terms. For each method, explain why it is needed.
Verification ........................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
Validation ..........................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
......................................................................................................................................................[4]
3abSummer 16 P11, 12
5 Three types of software licensing and four descriptions are shown in the table below. [4]
Put a tick (✓) in each row to match each description to the appropriate type of software licensing.
Type of software
Description Open source Shareware Commercial
Software is purchased before it can be used
Source code comes with the software
Software is provided free on a trial basis
The software can be modified by the user
6 A team of software engineers is developing a new e-commerce program for a client.
State three of the principles of the ACM/IEEE Software Engineering Code of Ethics. Illustrate each
one, with an example, describing how it will influence their working practices.
1 .......................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
2 .......................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
3 .......................................................................................................................................................
..........................................................................................................................................................

..........................................................................................................................................................
......................................................................................................................................................[6]
3c Summer 16 P 13
3 A company needs new software to manage its accounts. It is evaluating two different options. One
option is open source software and the other is commercial software.
(a) Explain what is meant by open source software.
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
................................................................................................................................[2]
(b) Explain what is meant by commercial software.
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
..................................................................................................................................[2]
(c) The company has decided to purchase commercial software.
Identify four benefits to the company in choosing the commercial software option.
1 ................................................................................................................................................
...................................................................................................................................................
2 ................................................................................................................................................
...................................................................................................................................................
3 ................................................................................................................................................
...................................................................................................................................................
4 ................................................................................................................................................
...............................................................................................................................................[4]
5 (a) A Database Management System (DBMS) provides the following features.
(b) The school needs to safeguard against any data loss.
Describe three factors to consider when planning a backup procedure for the data.
Justify your decisions.
1 ................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
2 ................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
3 ................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[6]
7 A bank holds personal data about its customers and their financial data.
(a) Describe the difference between security and integrity of data.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[4]
(b) Describe three security measures that the bank could implement to protect its electronic data.
Security measure 1 ...................................................................................................................
Description ................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
Security measure 2 ...................................................................................................................
Description ................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
Security measure 3 ...................................................................................................................
Description ................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[6]

5ac Summer 2017 P11_13


5 A computer receives data from a remote data logger. Each data block is a group of 8 bytes.
A block is made up of seven data bytes and a parity byte.
Each data byte has a parity bit using odd parity. The parity byte also uses odd parity.
The following table shows a data block before transmission. Bit position 0 is the parity bit.

(a) (i) Describe how the data logger calculates the parity bit for each of the bytes in the data block.
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
..................................................................................................................................[2]
(ii) State the two missing parity bits labelled A and B.
A = ..............................
B = .............................. [1]
(iii) Describe how the computer uses the parity byte to perform a further check on the received data
bytes.
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
.................................................................................................................................[2]
(b) (i) A second data block is received as shown in the following table. There are errors in this data
block. Identify and then circle two bits in the table which must be changed to remove the errors [2]

(ii) Explain how you arrived at your answers for part (b)(i).
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
.................................................................................................................................[3]
7 The design of a web-based application can require the use of client-side scripting.
(iv) Describe the purpose of the validation check that the code performs.
...........................................................................................................................................
.......................................................................................................................................[1]
(v) Name and describe two other types of validation check that could be appropriate for this data
capture form.
Validation check: ...............................................................................................................
Description ........................................................................................................................
...........................................................................................................................................
Validation check: ...............................................................................................................
Description ........................................................................................................................
...........................................................................................................................................[4]
5b Summer 17 P12
6 Downloading a file from a website is an example of a client-server application.
(iv) Describe the purpose of the validation check that the code performs.
...........................................................................................................................................
.......................................................................................................................................[1]
(v) Name and describe two other types of validation check which could be appropriate for this data
capture form.
Validation check: ...............................................................................................................
Description ........................................................................................................................
...........................................................................................................................................
Validation check: ...............................................................................................................
Description ........................................................................................................................
...........................................................................................................................................[4]
6ac Winter 2017 P11, P13
3 A Local Area Network is used by staff in a hospital to access data stored in a Database
Management System (DBMS).
(a) Name two security measures to protect computer systems.
1 ................................................................................................................................................
2 ................................................................................................................................................ [2]
(b) A frequent task for staff is to key in new patient data from a paper document. The document
includes the patient’s personal ID number.
(i) The Patient ID is a seven digit number. The database designer decides to use a check digit to verify
each foreign key value that a user keys in for a Patient ID.
When a user assigns a primary key value to a Patient ID, the DBMS adds a modulus-11 check digit as
an eighth digit. The DBMS uses the weightings 6, 5, 4, 3, 2 and 1 for calculating the check digit. It
uses 6 as the multiplier for the most significant (leftmost) digit.
Show the calculation of the check digit for the Patient ID with the first six digits 786531.

Complete Patient ID ......................................................................................................[4]


(ii) Name and describe two validation checks that the DBMS could carry out on each primary key
value that a user keys in for a Patient ID.
1 Validation check .........................................................................................................
Description .................................................................................................................
....................................................................................................................................
2 Validation check .........................................................................................................
Description .................................................................................................................
.................................................................................................................................... [4]
6 Raj has joined a software company as a trainee programmer. He was given the company’s Code
of Conduct document during his induction training. The handbook has a section headed ‘Ethical
Behaviour’.
(a) Describe what is meant by ethics.
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
...............................................................................................................................[2]
(b) Raj is assigned to work as a new member of a development team.
In his first week, Raj feels uncomfortable working with one of his colleagues. He is unfamiliar with the
programming language used by the team. Next week, he will be working on the site of one of the
company’s clients with a colleague. Raj is very nervous about working in an unfamiliar workplace.
Raj has a review with his manager after his first three weeks.
The Code of Conduct document was produced by the Human Resources section. It closely follows the
ACM/IEEE Software Engineering Code of Ethics that uses these eight key principles:
Public Client and Employer Product Judgement
Management Profession Colleagues Self
There are issues Raj will want to raise with
his manager.
• Describe two of these issues.
• Circle the key ACM/IEEE principle this comes under.
• Suggest what action should be taken to demonstrate ethical behaviour.
Issue 1
Description ................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
ACM/IEEE principle (Circle one only)
Public Client and Employer Product Judgement
Management Profession Colleagues Self
Possible action .........................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
Issue 2
Description ................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
ACM/IEEE principle (Circle one only)
Public Client and Employer Product Judgement
Management Profession Colleagues Self
Possible action .........................................................................................................................
...................................................................................................................................................
................................................................................................................................................... [6]
6b Winter 2017 P12
3 A Local Area Network is used by school staff who access data stored in a Database Management
System (DBMS).
(a) (i) Explain the difference between security and privacy of data.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
.......................................................................................................................................[3]
(ii) Give an example for this application where privacy of data is a key concern.
...........................................................................................................................................
.......................................................................................................................................[1]
(b) Name and describe two security measures the Network Manager has in place to protect the
security of the data held in the DBMS.
1 ................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
2 ................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................[4]

(c) A task for staff at the start of the school year is to key in new pupil data from a paper document.
The data is entered to a screen form and includes the data verification of some fields.
Describe what is meant by verification.
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
.............................................................................................................................[2]
5 The IEEE Software Engineering Code of Ethics uses eight key principles shown in the right-hand
column of the following diagram.
Tom is employed as a tester with a software company. He is keen to become a trainee programmer.
The middle column in the diagram labels six incidents which have happened to Tom this week. The
table that follows the diagram describes each incident.

Incident Description
Tom has received some phishing emails. He reported this to the bank they were supposed
A
to have come from.
B Tom has asked his manager if they will pay for him to attend a programming course.
Tom is testing beta versions of new games software at work. He copies the software on to
C
CD-Rs and sells them to his friends.
D Tom has completed the application forms to join the Chartered Institute for IT.
Tom finds it difficult to work with one of his colleagues. His way of dealing with this has
E
been to refuse to speak with the colleague.
Tom’s manager had considered the testing of a new game was completed. Tom reported to
F
his manager that he thought there were still bugs which needed to be rectified.
(a) Draw a line on the diagram to link each of the six incidents to either ethical behaviour or unethical
behaviour.
(b) Consider each incident you have identified as ethical behaviour. [2]
Draw a line from each incident to indicate the IEEE category it maps to. [4]
7a Summer2018 P11
6 Parity bits can be used to verify data.
(a) The following binary number is transmitted using even parity.
Add the missing parity bit. [1]

(b) In the following parity block, the first column contains the parity bits, and the last row contains the
parity byte. A device transmits the data using even parity.
(i) Circle the error in the data transmitted. [1]
Parity
Data
bit
1 1 0 1 0 1 1 1
1 0 0 0 1 1 1 0
0 1 0 0 1 0 1 1
1 1 1 0 1 1 1 1
Parity
1 1 1 1 1 0 0 1
byte
(ii) Explain how you identified the error.
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
...............................................................................................................................[2]
(c) The data received can contain errors that are not detected using parity bits.
Explain how this can happen.
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
................................................................................................................................[2]
(d) Parity is not the only method to verify the data has been sent correctly.
Name and describe one other method of data verification during data transfer.
Name ........................................................................................................................................
Description ................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[3]
7b Summer2018 P12
3 Parity bits can be used to verify data.
(a) The following binary number is transmitted using odd parity. Add the missing parity bit. [1]

(b) In the following data transmitted, the first column contains the parity bits, and the last row
contains the parity byte. A device transmits the data using even parity.
Circle the error in the data transmitted. [1]
Parity
Data
bit
1 0 1 0 1 1 1 1
0 1 1 0 0 1 1 0
1 1 0 0 0 0 0 0
0 1 0 0 0 0 0 0
Parity
0 0 0 0 1 0 0 1
byte
(c) The following table shows five error detection measures.
Put one tick (3) in each row to indicate whether the measure is validation or verification.[5]
Measure Validation Verification
Checksum
Format check
Range check
Double entry
Check digit
7c Summer 2018 P13
2 A company writes applications (apps) for smart phones. The company has a relational database,
PURPLEGAME, which stores the information for one of its online game apps.
(b) The database manager is concerned about data integrity.
State what is meant by data integrity. Give an example of how the manager can ensure data
integrity in the PURPLEGAME database.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[2]
4 Parity bits can be used to verify data.
(a) The following binary number is transmitted using odd parity.
Add the missing parity bit. [1]

(b) In the following parity block, the first column contains the parity bits, and the last row contains the
parity byte. A device transmits the data using even parity.
Circle the error in the data being transmitted. [1]

Parity Data
bit
0 0 1 1 0 1 0 1
1 1 1 1 1 0 0 1
1 0 1 0 1 0 0 0
0 0 0 1 1 0 1 1
Parity
0 1 1 1 1 1 0 1
byte
(c) Four error detection measures are shown.
Draw one line from each error detection measure to indicate whether it is verification or validation.[4]
Error detection measure
Type check
Verification
Proof reading

Check digit Validation

Checksum
8a Winter 2018 P11
3 Hugo has produced a program (app) for mobile phones. He needs to decide whether to use an
Open Source licence or to distribute the app as shareware.
(a) Describe what is meant by Open Source licence and shareware.
Open Source ............................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
Shareware ................................................................................................................................
..................................................................................................................................................
...................................................................................................................................................[4]
(b) Tick ( ) one box to indicate the licence Hugo should use. Justify your choice.
Open Source
Shareware
Justification ...............................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[2]

5 For each of the following scenarios, tick ( ) one box for each scenario to indicate whether you think
the person’s behaviour is ethical or unethical. Justify your choice.
(a) Kevin is a software engineer who has recently started a job with a new company. He is using
program code from his previous employer in his new employer’s programs.
Ethical
Unethical
Justification ...............................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[2]
(b) Nadya is a software developer. She has accepted a new job. She has never worked with the
programming languages used by this new company. Nadya is planning to increase her knowledge of
these programming languages before she starts her new job.
Ethical
Unethical
Justification ...............................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[2]
(c) Maria finds that one of her team members has produced some inventive code. She presents this to
her manager, stating that it was produced by the team. She does not mention the individual’s name.
Ethical
Unethical
Justification ...............................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[2]
8BWinter 2018 P11
5 This question presents three scenarios. For each scenario, tick (✓) one box to show whether you
think the person’s behaviour is ethical or unethical. Justify your choice.
(a) Wendy is a software engineer who is developing a program for her company. Her friend, Noah, is
developing a program for a different company. Wendy looks at the code that Noah is writing to get
ideas for her own program.
Ethical
Unethical
Justification ........................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
........................................................................................................................................ [2]
(b) Amit is fixing some bugs in the computer system of a large multinational company. He is asked to
sign a confidentiality agreement. He sees some confidential information which contains the names of
other multinational companies that have broken the law. He copies this information and releases it on
the Internet.
Ethical
Unethical
Justification ......................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
....................................................................................................................................... [2]
(c) Farah is providing a company with an estimate for the cost of writing a program. The company she
works for is in financial difficulty so she increases the estimate by 10%.
Ethical
Unethical
Justification .....................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................... [2]
9a Summer 2019 P11
2 A software company produces software and distributes it under different software licences.
(a) Four descriptions of software licences are given.
Write the type of software licence that best fits each description. Use a different type of licence for
each description.
1. The software can be legally used, only after a fee has been paid.
Licence type ...................................................................................................................................
2. The source code comes with the software. If the software is modified, the edited source code must
be released under the same conditions as the original software.
Licence type .....................................................................................................................................
3. The software is free for a trial period and then a fee is requested, or expected, if the user wants to
continue to use the software.
Licence type ................................................................................................................................
4. The source code comes with the software. The software is free to be downloaded, edited, and
distributed, possibly without restriction.
Licence type ................................................................................................................................[4]
4 A software developer works in a team for a large software development company.
(a) Two principles of the ACM/IEEE Software Engineering Code of Ethics are:
• developers must act consistently with the public interest
• developers must act in the best interest of their client and employer.
Name and describe three other principles in the ACM/IEEE Software Engineering Code of Ethics.
Principle 1 .........................................................................................................................................
Description ......................................................................................................................................
...................................................................................................................................................................
.................................................................................................................................................
Principle 2 ........................................................................................................................................
Description .......................................................................................................................................
...................................................................................................................................................................
....................................................................................................................................................
Principle 3 .......................................................................................................................................
Description .......................................................................................................................................
...................................................................................................................................................................
............................................................................................................................................. [6]
(b) The software development company uses data backup and disk-mirroring to keep their data
secure.
Explain how data backup and disk-mirroring allow the company to recover from data loss.
Data backup .....................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
............................................................................................................................................
Disk-mirroring ...................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
........................................................................................................................................[4]
9bSummer 2019 P12
4 Shazia is creating a computer program that will be released to the public. The program includes a
video.
(d) Shazia wants to make sure her computer program is copyrighted.
(i) Define the term copyright.
...................................................................................................................................................................
.............................................................................................................................................. [1]
(ii) Shazia does not want to release the software as open source.
Explain why Shazia does not want to use an open source licence.
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
................................................................................................................. [2]
(iii) Name and describe two software licenses, other than open source that Shazia could use.
License 1 .........................................................................................................................................
...................................................................................................................................................................
.................................................................................................................................................
License 2 .........................................................................................................................................
...................................................................................................................................................................
..............................................................................................................................................[2]
5 Moheem is creating a relational database to store data about his customers.
(b) Moheem uses a Database Management System (DBMS) to ensure the security and integrity of
the data.
(i) Explain the difference between security and integrity.
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
................................................................................................................... [2]
(ii) Name and describe two security features provided by a DBMS.
Feature 1 .........................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
...........................................................................................................................................
Feature 2 ........................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
..................................................................................................................................... [4]
9cSummer 2019 P13
2 Frankie is a software developer. He is developing a program to manage customer records for a
client with an online retail business. He must ensure that data stored about each customer are both
secure and private.
(a) State the difference between security and privacy.
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
.............................................................................................................................. [2]
(b) Computer systems can be protected by physical methods such as locks.
Describe two non-physical methods used to improve the security of computer systems.
1 .......................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
..................................................................................................................................
2 .....................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
........................................................................................................................[6]
(c) A computer uses parity blocks to check the data that has been received is the same as the data
that has been transmitted.
The following is an example of a parity block.
Parity
Data
bit
1 1 1 1 0 0 0 1
0 0 0 0 1 1 1 0
1 1 0 1 1 0 0 1
Parity
1 1 0 1 1 0 0 1
byte

(i) Describe how a parity block check can identify a bit that has been corrupted during transmission.
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
......................................................................................................... [4]
(ii) Give a situation where a parity block check cannot identify corrupted bits.
...................................................................................................................................................................
............................................................................................................................................. [1]
(d) One principle of the ACM/IEEE Software Engineering Code of Ethics is to always act in the best
interest of the client.
Explain how Frankie can ensure that he is acting in the best interest of his client.
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
.................................................................................................. [3]
(e) When the program is complete, Frankie uses a compiler to prepare the program for the client.
Explain why Frankie uses a compiler instead of an interpreter.
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
................................................................................................... [3]
10b Winter 2019 P12
5 Mica has created some software and has copyrighted it. She wants to stop other people from
copying and changing it illegally.
(a) Identify two ways Mica can prevent illegal copies of the software being installed.
1 ................................................................................................................................................
...................................................................................................................................................
2 ................................................................................................................................................
................................................................................................................................................... [2]
(b) Identify one way Mica can distribute the software without the source code.
...................................................................................................................................................
............................................................................................................................................. [1]
(c) Mica is releasing the software under a commercial licence.
(i) Give two benefits to Mica of using a commercial licence.
1 ........................................................................................................................................
...........................................................................................................................................
2 ........................................................................................................................................
........................................................................................................................................... [2]
(ii) Name two other types of software licence.
1 ........................................................................................................................................
...........................................................................................................................................
2 ........................................................................................................................................
........................................................................................................................................... [2]
10C Winter 2019 P13
1 In a supermarket, a self-checkout machine allows customers to scan the barcodes of products and
then pay for their shopping. These are an alternative to the traditional cashier-staffed checkout.
(c) The self-checkout machines connect to a server that stores all the data for the supermarket.
This is a client-server network.
(ii) The supermarket is concerned about the security and integrity of the data on the server.
Identify two methods that can be used to minimise the security risk to the data, and one
method to protect the integrity of the data.
Security 1 ..........................................................................................................................
...........................................................................................................................................
Security 2 ..........................................................................................................................
...........................................................................................................................................
Integrity .............................................................................................................................
........................................................................................................................................... [3]
11a Summer 20 P1
1 A computer program makes use of data validation routines and verification of data input.
(a) Complete these two sentences about data validation and verification.
1. ................................................. checks that the data entered is reasonable. One example is
.................................................... .
2. ................................................. checks that the data entered is the same as the original. One
example is .................................................... . [4]
(b) The program is installed on a computer system that has security measures in place to protect its
data. [3]
Complete the following table.
Security measure Description

Data are written on two or more disks simultaneously.


....................................

.............................................................................................
Encryption
.............................................................................................
.............................................................................................

A copy of the data is taken and stored in another location.


………………………...
11b Summer 2020 P12
4 Sophie is about to start a new job as a junior software developer.
(a) She is worried about joining a new team of people.
(i) State one ethical action that Sophie can take to help her to feel more confident about starting work.
...........................................................................................................................................
..................................................................................................................................... [1]
(ii) State two ethical actions that Sophie’s manager can take to help Sophie to feel more confident
about starting work.
1 ........................................................................................................................................
...........................................................................................................................................
2 ........................................................................................................................................
........................................................................................................................................... [2]
(iii) State one ethical action that Sophie’s new colleagues can take to help Sophie to feel more
confident about starting work.
...........................................................................................................................................
..................................................................................................................................... [1]
(b) Explain why Sophie is asked to sign a professional code of conduct before starting work.
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
.......................................................................................................................................................... [3]
11c Summer 2020 P13
4 Annchi is writing a computer game with a group of friends.
(c) Annchi needs to decide which type of software licence to use for the game.
(i) Give two benefits to Annchi of using a commercial licence.
1 ........................................................................................................................................
...........................................................................................................................................
2 ........................................................................................................................................
........................................................................................................................................... [2]
(ii) Give one benefit to the customers of the game being released using a commercial licence.
...........................................................................................................................................
..................................................................................................................................... [1]
(iii) Describe one benefit to the customers of the game being released using a shareware licence.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
..................................................................................................................................... [2]
5 Wei is developing a program.
(a) He wants to make sure the source code is secure on his laptop.
Explain how encrypting the source code can keep it secure.
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
............................................................................................................................................................ [3]
(b) Wei wants to compress the source code to transport it to another computer.
Identify the most appropriate compression technique he should use.
Justify your choice.
Compression technique ............................................................................................................
Justification ...............................................................................................................................
...................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
............................................................................................................................................................ [3]
12a Winter 20 Paper 11
2 A veterinary surgery cares for sick animals. The surgery has a file-based database that stores data
about the pets, their owners, and appointments made with the surgery.
(d) New pet owners complete a paper-based form to register their pets at the surgery.
(i) Describe two verification checks that can be carried out when the data from the paperbased form is
entered into the database.
1 ........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
2 ...............................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
........................................................................................................................................................... [4]
(ii) Appointments can be booked between 09:00 and 16:50 on Monday to Friday.
Describe the ways in which the appointment date and time can be validated to make sure they are
reasonable.
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................... [2]
(e) The surgery has five computers that can all access the database. A copy of the database is stored
centrally.
(i) Complete the description of this type of network model by filling in the missing terms.
The ......................................... model has one ......................................... that stores all the data for the
surgery. The other computers are ......................................... . When a user requests data, a request is
sent to the ......................................... . [4]
(ii) The surgery wants to keep all data secure. The surgery network is not connected to the Internet.
Identify two authentication techniques the surgery could use to restrict access to the data.
1 ........................................................................................................................................
2 ........................................................................................................................................ [2]
3 Ria manages a team of software developers. The team is creating a mobile application game for a
client.
Ria wants to ensure that her team works to the ACM/IEEE Software Engineering Code of Ethics.
(a) Explain the ways in which Ria and her team can ensure that they follow the Code of Ethics in
relation to the product and their colleagues.
(i) Product
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
.......................................................................................................................................................... [2]
(ii) Colleagues
...................................................................................................................................................................
...................................................................................................................................................................
.............................................................................................................................................................. [2]
(b) Ria’s client wants to sell the game for a profit. The client cannot decide which type of software
licence to use to distribute the game.
Identify two types of licence that Ria could recommend to her client and justify the use of each
licence.
Licence 1 ..................................................................................................................................
Justification ...............................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
Licence 2 ..................................................................................................................................
Justification ...............................................................................................................................
...................................................................................................................................................
................................................................................................................................................... [4]
12b Winter 20 P12
5 A teacher uses a relational database, RESULTS, to store data about her students and their test
results.
(iv) The teacher wants to implement validation to make sure that all data entered into the database
RESULTS are reasonable.
Name three different methods of data validation that can be used in the RESULTS
database. Describe how each method will limit the data that can be entered in this
database.
Method 1 ...........................................................................................................................
Description ........................................................................................................................
...........................................................................................................................................
Method 2 ...........................................................................................................................
Description ........................................................................................................................
...........................................................................................................................................
Method 3 ...........................................................................................................................
Description ........................................................................................................................
........................................................................................................................................... [6]
(d) The teacher stores the database on the desktop computer in her classroom.
(i) Explain why it is important to keep the database secure.
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
......................................................................................................................................................... [2]
(ii) Explain the ways in which the teacher can use data backup and disk mirroring to limit the amount
of data lost in the event of hardware failure.
Data backup
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
.............................................................................................................................................................
Disk mirroring
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
........................................................................................................................................................... [4]
6 Malika has started a new job as a trainee software engineer.
(a) Malika’s manager has asked her to work with a senior software engineer for the first week.
Explain the ways in which Malika’s manager has acted ethically.
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
.......................................................................................................................................................... [2]
(b) Malika researched the company and the programming languages used by the company
before she started the job.
Explain the ways in which Malika has acted ethically.
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
.............................................................................................................................................................. [2]
(c) Malika thinks that her colleagues do not like her, so she asks her manager for help.
Describe the actions the manager could take to support Malika in an ethical way.
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
........................................................................................................................................................... [2]
Specimen Paper 9618/01
4 A cake factory uses machines to make cakes .
(c) The cake factory has servers that store its confidential recipes and control the factory machines.
(i) Describe the implications of a hacker gaining access to the cake factory’s servers.
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
........................................................................................................................................................... [4]
(ii) Explain how the company could protect its data against hackers.
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
................................................................................................................................. [4]
1ac Summer 21 P12_13
1 (d) Anya made sure that the image was not subject to any copyright before scanning it.
Describe what is meant by copyright.
....................................................................................................................................................................
....................................................................................................................................................................
............................................................................................................................................................. [2]
2b Summer 21 P12
2 Aisha manages a team of software developers.
(a) Explain the reasons why it is important that Aisha acts ethically in relation to her team members.
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
............................................................................................................................................... [2]
(b) The team are developing a computer game where the user plays a board game (such as
chess) against the computer.
Describe how the computer would use Artificial Intelligence (AI) to play the board game.
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
........................................................ [3]
(c) The final game will be released under a licence.
Tick (3) one or more boxes in each row to identify the licence(s) each statement describes[4]
Free Open
Commercial
Statement Software Source Shareware
Software
Foundation Initiative
The user can edit the source code
The user must always pay before being
able to use the software
The user can redistribute the software
The user always gets a trial period
8 A company has several security measures in place to prevent unauthorised access to the data on its
computers.
(a) Describe the difference between the security and privacy of data.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [2]
(b) Each employee has a username and password to allow them to log onto a computer. An
employee’s access rights to the data on the computers is set to either read-only, or read and
write. Identify one other software-based measure that could be used to restrict the access to the data
on the computers.
...................................................................................................................................................
............................................................................................................................................. [1]
(c) The company is also concerned about threats posed by networks and the internet.
Identify two threats to the data that are posed by networks and the internet.
Threat 1 ....................................................................................................................................
...................................................................................................................................................
Threat 2 ....................................................................................................................................
.............................................................................................................................................[2]
2ac Winter 21 P11 P13
2 Xanthe wants to maintain the integrity and security of data stored on her computer.
(a) Explain the difference between data security and data integrity.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [2]
(b) Xanthe uses both data validation and data verification when entering data on her computer.
(i) Describe how data validation helps to protect the integrity of the data. Give an example
in your answer.
Description ........................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
Example ............................................................................................................................ [2]
(ii) Describe how data verification helps to protect the integrity of the data. Give an example
in your answer.
Description ........................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
Example ............................................................................................................................ [2]
(c) Two malware threats are spyware and viruses.
Give two similarities and one difference between spyware and a virus.
Similarity 1 ................................................................................................................................
...................................................................................................................................................
Similarity 2 ................................................................................................................................
...................................................................................................................................................
Difference .................................................................................................................................
................................................................................................................................................... [3]
4 Francis is starting his first job as a software developer for a multinational company.
(a) Francis has been advised to join a professional ethical body.
Describe the benefits to Francis of joining a professional ethical body.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [3]
(c) Francis is part of a team writing a program. He finds an error in part of the program that
has already been tested. He decides not to tell anyone because he is worried about the
consequences. Explain the reasons why Francis acted unethically in this situation.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [2]
5 Javier owns many shops that sell cars. He employs several managers who are each in charge of
one or more shops. He uses the relational database CARS to store the data about his business.
(b) Describe the ways in which access rights can be used to protect the data in Javier’s database
from unauthorised access.
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
............................................................................................................................................................ [3]
2b Winter 21 P12
1 When designing computer systems, it is important to consider the security, integrity and privacy of
the data.
Draw one line from each measure to indicate whether it keeps data secure or protects the integrity of
data. [2]
Measure
Firewall

Double entry Data Security

Presence check

Password Data Integrity

Access rights
Two different validation checks are described using each of the following flowcharts.
Name the types of validation check.
1abSummer 15 P11-12

1cSummer 15 P13
2ac Winter 15 P11, P13

2b Winter 15 P12
3abSummer 16 P11, 12
3c Summer 16 P 13
5ac Summer 2017 P11_13
5b Summer 17 P12
6ac Winter 2017 P11, P13
6b Winter 2017 P12
7a Summer2018 P11
7b Summer2018 P12
7c Summer 2018 P13
8a Winter 2018 P11
8BWinter 2018 P11
9a Summer 2019 P11
9bSummer 2019 P12
9cSummer 2019 P13
10b Winter 2019 P12
10C Winter 2019 P13

11a Summer 20 P1
11b Summer 2020 P12
11c Summer 2020 P13
12a Winter 20 Paper 11
Specimen Paper 9618/01

1ac Summer 21 P12_13


2b Summer 21 P12
2ac Winter 21 P11 P13
2b Winter 21 P12
5a 9608/11 Jun 17 Q5- SoW
5a 9608/11 Jun 17 Q7civ, cv- SoW
5c 9608/31 Jun 17 Q2a, b - SoW

6a 9608/11 Nov 17 Q3 - SoW

7a 9608/11 Jun 18 Q6- SoW


7b 9608/12 Jun 18 Q3- SoW
7b 9608/32 Jun 18 Q6a - SoW
7c 9608/13 Jun 18 Q4- SoW

8a 9608/31 Nov 16 Q6a – SoW


8b 9608/12 Nov 18 Q6a - SoW
Unit 8 Databases
Topic You should be able to R A G
Databases • Understand the limitations of a file-based approach
• Understand and use relational database terminology, entity-
relationship(E-R) diagrams, the normalisation process to 3NF and the
features of a Database Management System (DBMS)
• Understand and use simple Structured Query Language (SQL), Data
Definition Language (DDL) commands and Data Manipulation
Language(DML) commands
Key terms
Database – a structured collection of items of data that can be accessed by different applications
programs.
Relational database – a database where the data items are linked by internal pointers.
Table – a group of similar data, in a database, with rows for each instance of an entity and columns
for each attribute.
Record (database) – a row in a table in a database.
Field – a column in a table in a database.
Tuple – one instance of an entity, which is represented by a row in a table.
Entity – anything that can have data stored about it, for example, a person, place, event, thing.
Attribute (database) – an individual data item stored for an entity, for example, for a person,
attributes could include name, address, date of birth.
Candidate key – an attribute or smallest set of attributes in a table where no tuple has the same
value.
Primary key – a unique identifier for a table. It is a special case of a candidate key.
Secondary key – a candidate key that is an alternative to the primary key.
Foreign key – a set of attributes in one table that refer to the primary key in another table.
Relationship – situation in which one table in a database has a foreign key that refers to a primary key
in another table in the database.
Referential integrity – property of a database that does not contain any values of a foreign key that
are not matched to the corresponding primary key.
Index (database) – a data structure built from one or more columns in a database table to speed up
searching for data.
Entity-relationship (E-R) model or E-R diagram – a graphical representation of a database and the
relationships between the entities.
Normalisation (database) – the process of organising data to be stored in a database into two or
more tables and relationships between the tables, so that data redundancy is minimised.
First normal form (1NF) – the status of a relational database in which entities do not contain repeated
groups of attributes.
Second normal form (2NF) – the status of a relational database in which entities are in 1NF and any
non-key attributes depend upon the primary key.
Third normal form (3NF) – the status of a relational database in which entities are in 2NF and all non-
key attributes are independent.
Composite key – a set of attributes that form a primary key to provide a unique identifier for a table.

Database management system (DBMS) – systems software for the definition, creation and
manipulation of a database.
Data management – the organisation and maintenance of data in a database to provide the
information required.
Data dictionary – a set of data that contains metadata (data about other data) for a database.
Data modelling – the analysis and definition of the data structures required in a database and to
produce a data model.
Logical schema – a data model for a specific database that is independent of the DBMS used to build
that database.
Access rights (database) – the permissions given to database users to access, modify or delete data.
Developer interface – feature of a DBMS that provides developers with the commands required for
definition, creation and manipulation of a database.
Structured query language (SQL) – the standard query language used with relational databases for
data definition and data modification.
Query processor – feature of a DBMS that processes and executes queries written in structured query
language (SQL).

Data definition language (DDL) – a language used to create, modify and remove the data structures
that form a database.
Data manipulation language (DML) – a language used to add, modify, delete and retrieve the data
stored in a relational database.
SQL script – a list of SQL commands that perform a given task, often stored in a file for reuse.
Databases
A database is a stored collection of information arranged in a logical, structured manner.
Flat file or File-based database:
In File-based database text files are used to store data while is flat file data is stored in one table.
Problems in flat- file or file-based database
1. The data privacy issue with a single file
A different problem is a lack of data privacy. The file above was designed so that the finance section
could find banking details and the recruitment section could find contact details. The problem is that
there cannot be any control of access to part of a file, so for example, staff in the recruitment section
would be able to access the banking details of members. Data privacy would be properly handled by a
database system.
2. Potential duplication. As more and more records are added to the database it becomes difficult to
avoid duplicate records. This is because there is no mechanism built in to the system to prevent
duplication. Later you will see how 'primary keys' are used to prevent this.
3. Non-unique records. Flat-file database doesn’t have unique field (primary key).
4. Inherently inefficient. Consider a situation where the database now needs to hold an extra field to
hold their email address. If there are tens of thousands of records, there may be many people having
no email address, but each record in a flat file database has to have the same fields, whether they are
used or not. Other methods avoid this wasted storage.
5. Harder to change data format. Suppose the telephone numbers now have to have a dash between
the area code and the rest of the number, like this 0223-44033. Adding that extra dash over tens of
thousands of records would be a significant task in a flat file database.
6. Poor at complex queries. If we wanted to find all records with a specific telephone number, this is a
simple single-field criteria that a flat file can easily deal with. But now suppose we wanted all people
living in Hull who share the same surname and similar postcode? - the criteria can quickly become too
complex for a flat file to manage.
7. Poor at limiting access. Suppose this flat file database held a confidential field in each record that
only certain staff are allowed to see - perhaps salaries. This is difficult to achieve in a flat file database
- once a person has entered a valid password to gain access, that person is able to see everything.
Because of these limitations other types of database have been developed. The next few pages will
describe these and their features.
Relational database
A relational database holds its data over a number of tables instead of one. Records within the tables
are linked (related) to records held in other tables.
Advantages of a relational database
Splitting data into a number of related tables brings many advantages over a flat file database. These
include:
1. Data is only stored once. In the previous example, the city data was gathered into one table so now
there is only one record per city. The advantages of this are
• No multiple record changes needed
• More efficient storage
• Simple to delete or modify details.
• All records in other tables having a link to that entry will show the change.
2. Complex queries can be carried out. A language called SQL has been developed to allow
programmers to 'Insert', 'Update', 'Delete', 'Create', 'Drop' table records. These actions are further
refined by a 'Where' clause. For example
SELECT * FROM Customer WHERE ID = 2
This SQL statement will extract record number 2 from the Customer table. Far more complicated
queries can be written that can extract data from many tables at once.
3. Better security. By splitting data into tables, certain tables can be made confidential. When a
person logs on with their username and password, the system can then limit access only to those
tables whose records they are authorised to view. For example, a receptionist would be able to view
employee location and contact details but not their salary. A salesman may see his team's sales
performance but not competing teams.
4. Cater for future requirements. By having data held in separate tables, it is simple to add records
that are not yet needed but may be in the future. For example, the city table could be expanded to
include every city and town in the country, even though no other records are using them all as yet. A
flat file database cannot do this.
Security measures in RDBMS
Following steps are taken in Relational Database Management System to resolve security issues
related with File-Based and flat file database:
• Issue usernames and passwords...
• stops unauthorised access to the data
• any further expansion e.g. strong passwords / passwords should be changed regularly etc.
• Access rights / privileges...
• so that only relevant staff / certain usernames can read/edit certain parts of the data
• can be read only, or full access / read, write and delete
• any relevant example e.g. only class tutors can edit details of pupils in their tutor group
• Create (regular / scheduled) backups...
• in case of loss/damage to the live data a copy is available
• any relevant example e.g. backing up the attendance registers at the end of each day and
storing the data off-site/to a separate device
• Encryption of data...
• if there is unauthorised access to the data it cannot be understood // needs a decryption key
• any relevant example e.g. personal details of pupils are encrypted before being sent over the
Internet to examination boards
• Definition of different views...
• composed of one or more tables
• controls the scope of the data accessible to authorised users
• any relevant example e.g. teachers can only see their classes
• Usage monitoring / logging of activity...
• creation of an audit /activity log
• records the use of the data in the database / records operations performed by all users / all
access to the data
• any relevant example, e.g. Track who changed a student’s grade
Entity-Relationship model
An Entity–relationship model (ER model) describes the structure of a database with the help of a
diagram, which is known as Entity Relationship Diagram (ER Diagram). An ER model is a design or
blueprint of a database that can later be implemented as a database.
An ER model is typically implemented as a database. In a simple relational database implementation,
each row of a table represents one instance of an entity type, and each field in a table represents an
attribute type. In a relational database a relationship between entities is implemented by storing the
primary key of one entity as a pointer or "foreign key" in the table of another entity.
Candidate key: In some cases there may be more than one attribute for which unique values are
guaranteed. In this case, each one is a candidate key and one will be selected as the primary key.
A field that could be chosen as the primary key
Primary key: an attribute (field) or a combination of attributes for which there is a value in each tuple
(record) and that value is unique
Secondary key: A candidate key that is not selected as the primary key is then referred to as a
secondary key.
Foreign key: an attribute in one table that refers to the primary key in another table.
Referential integrity: the use of a foreign key to ensure that a value can only be entered in one table
when the same value already exists in the referenced table
One-to-One
One-to-Many
Many-to-One
Many-to-Many
One-to-one relationship
In a relational database, a one-to-one relationship exists when one row in a table may be linked with only one
row in another table and vice versa.
For Example: A country has only one capital city, and a capital city
is the capital of only one country.
One-to-many relationship
One book can have many pages. One page can only be in one book.

In a relational database, a one-to-many relationship exists when


one row in table A may be linked with many rows in table B, but
one row in table B is linked to only one row in table A.

The opposite of one-to-many is many-to-one.

Many-to-many relationship

An Author can write several Books, and a Book can be written by several Authors.
A many-to-many relationship is a type of cardinality that
refers to the relationship between two entities A and B in
which A may contain a parent instance for which there are
many children in B and vice versa.
Specimen Paper 21
3 Mehrdad has a holiday company database that includes:
• data about holidays, such as the location, date, duration (in days)
• data about the customers and the holidays they have booked.
(a) Mehrdad has normalised the database, which has three tables.
(i) Draw an entity–relationship (E–R) diagram for the normalised tables.
(ii) Complete the table to identify the primary key and foreign key(s) for each of the tables you
identified in part (a)(i). If the table has no foreign key(s), write ‘None’.

Table name Primary key Foreign key


3abSummer 16 P11, 12
8 (b) The database design has three tables to store the classes that students attend.
STUDENT(StudentID, FirstName, LastName, Year, TutorGroup)
CLASS(ClassID, Subject)
CLASS-GROUP(StudentID, ClassID)
Primary keys are not shown.
There is a one-to-many relationship between CLASS and CLASS–GROUP.
(i) Describe how this relationship is implemented.
...........................................................................................................................................
...........................................................................................................................................
.......................................................................................................................................[2]
(ii) Describe the relationship between CLASS-GROUP and STUDENT.

.......................................................................................................................................[1]
3c Summer 16 P 13
5 (c) The database design has three tables to store the qualifications and grades each student has
attained. The following is a sample of the data from each table.
STUDENT
StudentID FirstName LastName Tutor
001AT Ahmad Tan 11A
003JL Jane Li 11B
011HJ Heather Jones 10A
QUALIFICATION
QualCode Level Subject
CS1 IGCSE Computer Science
MT9 IGCSE Maths
SC12 IGCSE Science
STUDENT-QUALIFICATION
QualCode StudentID Grade DateOfAward
SC12 011HJ A 31/8/2014
SC12 003JL C 31/8/2014
CS1 003JL B 31/8/2014
(i) Draw an Entity-Relationship (E-R) diagram to show the relationships between these three tables.
[2]

(ii) State the type of relationship that exists between STUDENT and STUDENT-QUALIFICATION.

.......................................................................................................................................[1]
4b Winter 2016 P12
9 A health club offers classes to its members. A member needs to book into each class in advance.
(a) The health club employs a programmer to update the class booking system. The programmer
has to decide how to store the records. The choice is between using a relational database or
a file-based approach.
Give three reasons why the programmer should use a relational database.
1 .........................................................................................................................................
..........................................................................................................................................
..........................................................................................................................................
2 ........................................................................................................................................
...........................................................................................................................................
..........................................................................................................................................
3 .......................................................................................................................................
..........................................................................................................................................
..........................................................................................................................................
...................................................................................................................................[6]

(b) The programmer decides to use three tables: MEMBER, BOOKING and CLASS.
Complete the Entity-Relationship (E-R) diagram to show the relationships between these tables.[2]
5ac Summer 2017 P11_13
1 A hospital is divided into two areas, Area A and Area B. Each area has several wards. All the ward
names are different.
A number of nurses are based in Area A. These nurses always work on the same ward. Each nurse
has a unique Nurse ID of STRING data type.

(a) Describe the relationship shown above.


...................................................................................................................................................
...............................................................................................................................................[1]
(b) A relational database is created to store the ward and nurse data. The two table designs for Area A
are:
A-WARD(WardName, NumberOfBeds)
A-NURSE(NurseID, FirstName, FamilyName, ...........................................................)
(i) Complete the design for the A-NURSE table. [1]
(ii) Explain how the relationship in part (a) is implemented.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
.......................................................................................................................................[2]
(c) In Area B of the hospital, there are a number of wards and a number of nurses.
Each Area B ward has a specialism.
Each Area B nurse has a specialism.
A nurse can be asked to work in any of the Area B wards where their specialism matches with the
ward specialism.
The relationship for Area B of the hospital is:

(i) Explain what the degree of relationship is between the entities B-NURSE and B-WARD.
...........................................................................................................................................
.......................................................................................................................................[1]
(ii) The design for the Area B data is as follows:
B-NURSE(NurseID, FirstName, FamilyName, Specialism)
B-WARD(WardName, NumberOfBeds, Specialism)
B-WARD-NURSE( ............................................................................................................ )
Complete the attributes for the third table. Underline its primary key. [2]
(iii) Draw the relationships on the entity-relationship (E-R) diagram.[2]
5b Summer 17 P12
1 Some shops belong to the Rainbow Retail buying group. They buy their goods from one or more
suppliers. Each shop has:
• a unique shop ID
• a single retail specialism (for example, food, electrical, garden).
Each supplier has:
• a unique supplier ID
• a similar single specialism recorded.
Rainbow Retail creates a relational database to record data about the shops and their suppliers. The
entity-relationship (E-R) diagram for the relationship between the SHOP and SUPPLIER tables is
shown.

(a) Explain what the degree of relationship is between the entities SHOP and SUPPLIER.
...................................................................................................................................................
...............................................................................................................................................[1]

The database design is as follows:


SHOP(ShopID, ShopName, Location, RetailSpecialism)
SUPPLIER(SupplierID, SupplierName, ContactPerson, RetailSpecialism)
SHOP-SUPPLIER(ShopID, SupplierID)
The SHOP–SUPPLIER table stores the suppliers that each shop has previously used.
Primary keys are not shown.
(b) (i) Label the entities and draw the relationships to complete the revised E-R diagram. [3]
(ii) Complete the following table to show for each database table:
• the primary key
• the foreign key(s) (if any):
° Each table may contain none, one or more foreign key(s).
° For a table with no foreign key, write ‘None’.
• an explanation for the use of any foreign key. [5]

Foreign key(s)(if
Table Primary key Explanation
any)
SHOP
SUPPLIER
SHOP–
SUPPLIER
(iii) The database designer has implemented SUPPLIER.ContactPerson as a secondary key.
Describe the reason for this.
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
.................................................................................................................................... [2]
6ac Winter 2017 P11, P13
7 A clinic is staffed by several doctors. The clinic serves thousands of patients. Each day and at any
one time, there is only one doctor in the clinic available for appointments.
The clinic stores patient, doctor and appointment data in a relational database.
(a) (i) Underline the primary key for each table in the following suggested table designs.
PATIENT(PatientID, PatientName, Address, Gender)
DOCTOR(DoctorID, Gender, Qualification)
APPOINTMENT(AppointmentDate, AppointmentTime, DoctorID, PatientID) [2]

(ii) Complete the following entity-relationship (E-R) diagram for this design. [2]
Summer 20 P13
6 Sheila creates a relational database for her hotel using a Database Management System (DBMS).
(a) Draw one line from each database term to its most appropriate description.
[4]

Database Term Description

A field in one table that links to a primary key in


another table

Attribute

A collection of records and fields

Primary key

The type of data that is being stored

Foreign key

A unique identifier for each tuple

Entity

A data item, represented as a field within a table

The concept or object in the system that we want


to model and store information about

(b) Identify three tasks that Sheila can perform using the DBMS developer interface.
1 ................................................................................................................................................
2 ................................................................................................................................................
3 ................................................................................................................................................ [3]
Normalisation
“A technique for designing relational database tables to minimize duplication of information and, in so
doing, to safeguard the database against certain types of logical or structural problems”
Normalisation is the process of analysing how to make databases more efficient by using separate
tables to reduce redundant data. When a database is normalised, data is broken down into smaller
tables and relationships are used to link them.
Normalisation provides rules that help:
• organise the data efficiently.
• eliminate redundant data.
• ensure that only related data are stored in a table.

Unnormalised form (0NF)


• Data might be repeated
• Data might be non-atomic
• The table might not have a primary key
• There might be repeating fields i.e. each field does not have a unique name
First Normal Form - 1NF
For a database to be in first normal form (1NF), the following rules have to be met for each table in the
database
• There are no columns with repeated or similar data
• Each data item cannot be broken down any further (All fields are atomic).
• Each row is unique i.e. it has a primary key
• Each field has an unique name
'Atomic' is the word used to describe a data item that cannot be broken down any further.
Examples of atomic data
• An identity number
• National Insurance number NY344599
• ISBN book reference e.g.1-931841-62-4
• Stock code PN10B
• A first name, 'Abdullah'
• A surname, 'Patel'
• A telephone number
• A school name: 'Karachi Grammar School'
• A complete description 'A fountain pen is a writing instrument'.
The point of the two last examples indicates that 'atomic' does not mean 'single word'. It
simply means that it would make no sense to reduce the data item any further as it would lose
its meaning.
Examples of non-atomic data
• A full name: Abdullah Patel when a first name and surname is present in the database
• A full address: 72/3 Street 15, DHA, Karachi
• Data that are part of a larger dataset e.g. Oxford Book club and Coventry Health club
In the last example, the database in question is storing club details and there are many different kind
of clubs (Health, Book, Chess etc) being stored. So it would make sense to split this data into
{Location, Club type}. So the context of the database needs to be understood when deciding if data is
atomic or not.
Extracted from Summer 15 P11-12
A database has been designed to store data about salespersons and the products they have sold.
The table SHOPSALES was the first attempt at designing the database.
FirstName Shop ProductName NoOfProducts Manufacturer
Nick TX television set 3 SKC
Nick TX Refrigerator 2 WP
Nick TX digital camera 6 HKC
Sean BH hair dryer 1 WG
Sean BH electric shaver 8 BG
John TX television set 2 SKC
John TX mobile phone 8 ARC
John TX digital camera 4 HKC
John TX Toaster 3 GK
The above table is not in First Normal Form (1NF) due to following reasons
• SHOPSALES table has repeated group (of attributes)
• each sales person has a number of products
• FirstName, Shop would need to be repeated for each record.
The database design is changed and this table is broken down into two tables to bring it into
1NF (1st Normal Form):
SalesPerson (FirstName, Shop)
SalesProducts (FirstName, ProductName, NoOfProducts, Manufacturer)
Using the data given in the first attempt table (ShopSales), show how these data are now
stored in the revised table designs.
Table: SALESPERSON
FirstName Shop
Nick TX
Sean BH
John TX
Table SALESPERSON is in 1NF because both the fields are atomic, FirstName is the primary key,
and three is no repeated data items (no data redundancy).
Table: SALESPRODUCTS
FirstName ProductName NoOfProducts Manufacturer
Nick television set 3 SKC
Nick Refrigerator 2 WP
Nick digital camera 6 HKC
Sean hair dryer 1 WG
Sean electric shaver 8 BG
John television set 2 SKC
John mobile phone 8 ARC
John digital camera 4 HKC
John Toaster 3 GK

The tables are now in first normal form (1NF) as they obey the following rules
• Each table has a primary key
• Each field name is unique
• Data is atomic
• No repeating / redundant fields
Try Yourself A first attempt at the table design is:
MANAGER(ManagerName, Telephone, BandName, Genre, NumberInBand, SetFee)
ManagerName Telephone BandName Genre NumberInBand SetFee($)
Yi Ling Chen 908765 Rachael Daz Covers 1 200
Yi Ling Chen 908765 Jazz Tones Modern jazz 4 450
Lockwood Bros 674442 Midnight Blues Modern jazz 5 350
Lockwood Bros 674442 Loose Beats Dance 3 400
Lockwood Bros 674442 Asyraf Duo Covers 2 250
Lockwood Bros 674442 The Flying Fleas Hip hop 8 700
Rachael Wang 118976 Li Wei Chen Covers 1 250
Gig Associates 567575 Buster Beats Reggae 6 600
Gig Associates 567575 Hits Forever Covers 3 300
Gig Associates 567575 Rap Incorporated Hip hop 5 800

State why the table MANAGER is not in First Normal Form (1NF).

...................................................................................................................................................................
Redesign the database table to bring it into 1st Normal Form.
Try Yourself A first attempt at the database design produced the following single table CUSTOMER.
Table: CUSTOMER
CustomerID CustomerName City OrderDate ProductID
043 Wilber London 10-09-15 678
043 Wilber London 21-09-15 883
043 Wilber London 28-10-15 883
928 Said Manchester 09-05-15 241
928 Said Manchester 18-07-15 906
493 Tasha Glasgow 11-09-15 005
351 Ahmed Liverpool 10-10-15 187
351 Ahmed Liverpool 11-10-15 154

State why the table is not in First Normal Form (1NF).


...................................................................................................................................................
...............................................................................................................................................[1]
Redesign the database table to bring it into 1st Normal Form.
Second Normal Form 2NF
Sometimes a table has a primary key made up of more than one attribute i.e. it has a compound
primary key. In this situation that the extra rule for second normal form comes in handy. The rule
states
• Non-key attributes must depend on every part of the primary key
• The table must already be in first normal form
In the following SalesProducts table FirstName + ProductName are used as compound primary key.
Table: SALESPRODUCTS
FirstName ProductName NoOfProducts Manufacturer
Nick television set 3 SKC
Nick Refrigerator 2 WP
Nick digital camera 6 HKC
Sean hair dryer 1 WG
Sean electric shaver 8 BG
John television set 2 SKC
John mobile phone 8 ARC
John digital camera 4 HKC
John Toaster 3 GK
In this table NoOfProducts and Manufacturer are non-key attributes. Non-key attribute manufacture
is dependent on product name only. No need to know first name of salesperson to find out
manufacturer of any product. Means here is a partial dependency. If this partial dependency is
removed this table will be qualified for 2nd Normal Form. To bring this table in 2NF the
SALESPRODUCTS table is broken down in such a way that all non-key attributes are fully dependent
on primary key. PRODUCTMANUFACTURER Table:
ProductName Manufacturer
television set SKC
Refrigerator WP
digital camera HKC
hair dryer WG
electric shaver BG
mobile phone ARC
Toaster GK

Table: SALESPRODUCTS
FirstName ProductName NoOfProducts
Nick television set 3
Nick Refrigerator 2
Nick digital camera 6
Sean hair dryer 1
Sean electric shaver 8
John television set 2
John mobile phone 8
John digital camera 4
John Toaster 3
Now there is no partial dependency in SALESPRODUCTS table, so it is qualifying for 2NF. Because of
following reasons:
• Non-key attributes depend on every part of the primary key
• The table is already in first normal form

Test Yourself
BAND(BandName, NumberOfMusicians, Genre, ManagerID, ManagerName, ManagerPhoneNumber)
VENUE(VenueName, Capacity)
BOOKING(BandName, PerformanceDate, StartTime, VenueName, NumberOfMusicians)
(i) Name the table that is not in Second Normal Form (2NF) and explain why.
Table .................................................................
Explanation ................................................................................................................................................
....................................................................................................................................................................
...................................................................................................................................................................
Re-design this table to put it into 2NF.
..............................................................................................................................................................[4]
Test Yourself A sports centre has a gym and a swimming pool. The sports centre has members.
A member is given a unique membership number when they join.
Different types of membership are available:
• J – Junior
• SF – Senior full
• SG – Senior gym only
• SS – Senior swim only
Members who use the gym are assigned a personal trainer.
Sports centre employees are identified with a unique three-character code.
An employee can be a personal trainer to one or more members.
The sports centre organises classes. Each class has a unique class name.
Each class is taken by an employee who acts as the class leader. An employee may be a class
leader for zero, one or more classes.
Members can take classes. Each class has a class code. Some classes are assigned a level:
• B – beginners
• I – intermediate
• A – advanced
A relational database is to be created to store data about members, employees, classes and class
attendance. The following table design MEMBER was a first attempt at the database design.
Table: MEMBER
MemberNo MemberType Trainer ClassName ClassLevel ClassLeader
510 SF SAF Yoga B B OLO
510 SF SAF Box fit B DAV
510 SF SAF Zumba B ROG
808 SS OLO Swimathon A ROG
756 J DAV Circuits I VAR
756 J DAV Box fit I DAV
756 J DAV Yoga A A OLO
756 J DAV Body pump A CFD
(a) (i) State why the table is not in First Normal Form (1NF).
…………………………………………………………………………………………………..............................................................................
..............................................................................................................................................................................[1]
(ii) Comment on your answer by referring to the data in the table.
………………….................................................................................................................................................[1]

(b) The design is changed so that there are two tables:


MEMBER(MemberNo, MemberType, Trainer)
MEMBERCLASSES(MemberNo, ClassName, ClassLevel, ClassLeader)
The primary keys are not shown.
(i) Using the data given in the original table, show the data now stored in table MEMBER. [1]
Table: MEMBER
MemberNo MemberType Trainer

(ii) Using the data given in the original table, show three rows stored in table MEMBERCLASSES.
The MemberNo should be different for each row. [2]
Table: MEMBERCLASSES
MemberNo ClassName ClassLevel ClassLeader

(iii) Using the data given in the original table, state how many rows would be in table
MEMBERCLASSES.
.......................................................................................................................................[1]
(iv) State the relationship between MEMBER and MEMBERCLASSES.
.......................................................................................................................................[1]
(v) Explain how the relationship is implemented.
....................................................................................................................................................................
....................................................................................................................................................................
...........................................................................................................................................................[2]
(c) The following new design for MEMBERCLASSES was suggested in part (b):
MEMBERCLASSES(MemberNo, ClassName, ClassLevel, ClassLeader)
(i) State the primary key for this table.
.......................................................................................................................................[1]
(ii) Explain why the table is not in Second Normal Form (2NF).
...........................................................................................................................................
.......................................................................................................................................[2]
(iii) The solution is to create a new third table.
Show the revised design including the primary keys.
MEMBER(MemberNo, MemberType, Trainer)
MEMBERCLASSES(............................................................................................................)
............................(............................................................................................................) [3]

(d) Each type of membership has a fixed annual membership fee. The new table design for
member data is:
MEMBER(MemberNo, MemberType, MemberTypeFee, Trainer)
(i) The revised MEMBER table is not in Third Normal Form (3NF).
Explain this statement.
...................................................................................................................................................................................
...................................................................................................................................................................................
...................................................................................................................................................................................
...............[2]
(ii) The solution is to create a new fourth table.
Show the revised design including the primary keys.
MEMBER(...........................................................................................................................)
.............(...........................................................................................................................) [2]
Summary

The rules for second normal form are


• Non-key attributes must depend on every part of the primary key
• The table must already be in first normal form
Third Normal Form
For a database to be in third normal form, the following rules have to be met
• It is already in 2NF
• There are no non-key attributes that depend on another non-key attribute
What this is trying to do is to spot yet another source of redundant data. If the value of an attribute
can be obtained by simply making use of another attribute in the table, then it does not need to be
there. Loading that attribute into another table and linking to it will make the database smaller.
For example in following table details about courses attended by students are given, each course has
a fixed fee.
STUDENTCOURSE
StudentID Course Starting Date Fee (£)
A101 Learn Python Basics 12/10/2020 20
A102 Artificial Intelligence 10/05/2020 50
A109 Learn Python Basics 12/10/2020 20
A110 Machine Learning 10/07/2020 40
A120 Artificial Intelligence 02/06/2021 50
A105 Learn Python Basics 07/09/2020 20
In this table StudentID is primary key while Course, StartingDate and Fee (£) are non-key attributes.
The non-key attribute Fee (£) depends upon only on Course i.e. another non-key attribute.
To remove this non-key dependency, STUDENTCOURSE table is broken down into two smaller tables,
COURSE and STUDENTCOURSE tables.
COURSE table:
Course Fee (£)
Learn Python Basics 20
Artificial Intelligence 50
Machine Learning 40
STUDENTCOURSE table:
StudentID Course Starting Date
A101 Learn Python Basics 12/10/2020
A102 Artificial Intelligence 10/05/2020
A109 Learn Python Basics 12/10/2020
A110 Machine Learning 10/07/2020
A120 Artificial Intelligence 02/06/2021
A105 Learn Python Basics 07/09/2020

Now in these tables:

All fields are atomic


And There are primary keys 1NF 2NF
3NF
And There is no partial dependency
And There is no non-key dependency

Benefits of normalisation
1. The database does not have redundant data, it is smaller in size so less money needs to be spent on
storage
2. Because there is less data to search through, it is much faster to run a query on the data
3. Because there is no data duplication there is better data integrity and less risk of mistakes.
4. Because there is no data duplication there is less chance of storing two or more different copies of
the data
5. Once change can be made which can instantly be cascaded across any related records.
Problems with normalisation
1. You need to be careful with trying to make data atomic. Just because you can split some types of
data further, it isn't always necessarily the correct thing to do. For example, telephone number might
contain the code followed by the number 0213 567890. It wouldn't be sensible to separate out these
two items.
2. You can end up with more tables than an unnormalised database
3. The more tables and the more complex the database, the slower queries can be to run
4. It is necessary to assign more relationships to interact with larger numbers of tables
5. With more tables, setting up queries can become more complex
Summary
The purpose of normalisation is to avoid redundant data and to make it easier to maintain a database by only
having to update a record in one place only.
Unnormalised form (0NF)
• Data might be repeated
• Data might be non-atomic
• The table might not have a primary key
• There might be repeating fields i.e. each field does not have a unique name
First normal form (1NF)
• There are no columns with repeated or similar data
• Each data item cannot be broken down any further.
• Each row is unique i.e. it has a primary key
• Each field has an unique name
Second normal form (2NF)
• The table must already be in 1NF
• Non-key attributes must depend on every part of the primary key
Third Normal form (3NF)
• The table must already be in 2NF
• There are no non-key attributes that depend on another non-key attribute
Try Yourself
1 A monthly magazine reviews new music releases.
Each music release has a title and a genre. The genre codes are as follows:
• J – Jazz
• P – Pop
• C – Classical
The magazine employs a number of people as reviewers. Reviewers are located all over the world.
A reviewer is identified by a unique three-digit code.
A relational database is to store data for reviews which appear in the magazine.
The data stored for each review are:
• music title
• music genre
• release date
• month and year when the review appeared
The following table REVIEWER was a first attempt at the database design.
Table: REVIEWER
ReviewerID Location Title Genre ReleaseDate ReviewDate
510 London Hits 36 P 12/01/2015 01-15
510 London Cindy pop P 26/03/2015 03-15
510 London Way out P 11/06/2015 07-15
808 New York Popular Bach C 12/01/2015 02-15
808 New York Ultimate Cole J 31/01/2015 02-15
756 Dhaka The Messiah C 11/11/2014 11-14
756 Dhaka Hot Miles J 02/02/2015 03-15
756 Dhaka Pine points J 11/04/2015 05-15
756 Dhaka Kylie P 11/04/2015 05-15
(a) (i) State why the table is not in First Normal Form (1NF).
...........................................................................................................................................
.......................................................................................................................................[1]
(ii) Comment on your answer by referring to the data in the table.
...........................................................................................................................................
.......................................................................................................................................[1]
(b) The design is changed so that there are two tables:
REVIEWER(ReviewerID, Location)
REVIEW(Title, Genre, ReleaseDate, ReviewDate, ReviewerID)
The primary keys are not shown.
(i) Using the data given in the original table, show the data now stored in table REVIEWER. [1]
Table: REVIEWER
ReviewerID Location

(ii) Using the data given in the original table, show three rows now stored in table REVIEW.
The ReviewerID should be different for each row in the table. [2]
Table: REVIEW
Title Genre ReleaseDate ReviewDate ReviewerID

(iii) Using the data given in the original table, how many rows would be in table REVIEW?
........................................................ [1]
(iv) State the degree of relationship between REVIEW and REVIEWER.
.......................................................................................................................................[1]
(v) Explain how the relationship in part(b)(iv) is implemented.
...........................................................................................................................................
...........................................................................................................................................
.......................................................................................................................................[2]
(c) Each title is reviewed once only. The database designer decides to also store the reviewer’s
name. A reviewer is paid a set fee for each review completed. The fee paid is determined by the music genre:
Genre Fee($)
J 150
P 100
C 200
The following revised design for REVIEW is suggested:
REVIEW(Title, ReviewerID, ReviewerName, Genre, Fee, ReleaseDate, ReviewDate)
(i) State the primary key for this table.
.......................................................................................................................................[1]
(ii) Explain why the REVIEW table is not in Third Normal Form (3NF).
..................................................................................................................................................................................
..................................................................................................................................................................................
..................................................................................................................................................................................
.............................................................................................................................................................................[2]
(iii) Currently the design is as follows:
REVIEWER(ReviewerID, Location)
REVIEW(Title, ReviewerID, ReviewerName, Genre, Fee, ReleaseDate, ReviewDate)
Re-design the solution to solve the issue in part (c)(ii). Show all primary keys.
..................................................................................................................................................................................
..................................................................................................................................................................................
..................................................................................................................................................................................
...........................................................................................................................................................................[5]
8.2 Database Management System (DBMS)

Candidates should be able to: Notes and guidance


Show understanding of the features provided by a Including:
Database Management System (DBMS) that • data management, including maintaining a data
address the issues of a file based approach dictionary
• data modelling
• logical schema
• data integrity
• data security, including backup procedures and
the use of access rights to individuals / groups of
users
Show understanding of how software tools found Including the use and purpose of:
within a DBMS are used in practice • developer interface
• query processor

Database Management System:


Software that controls access to data in a database
Database administrator (DBA):
A person who uses the DBMS to customise the database to suit user and programmer requirements.

Problems in file based database


It is clear that there are problems with this data. It would appear that when the data for Mr. Sohaib
Ahmed was first entered, his names were inserted in the wrong order. A later correct entry was made
without deletion of the original incorrect data. This type of problem is not unique to a file-based
system. There is no validation technique that could detect the original error. By contrast, validation
should have led to the correction of the missing telephone of Jasmin and address of Abdullah Patel.
The Jasmin Joseph are examples of duplication of data and inconsistent data.
There is also possibly an error that is not evident from looking at the file contents. A telephone
number could be entered here when that telephone number doesn’t exist.
The above discussion shows how a file-based approach can lead to data integrity problems in an
individual file. The reason is the lack of in-built control when data is entered. The database approach
can prevent such problems or, at least, minimise the chances of them happening.
The data privacy issue with a single file
A different problem is a lack of data privacy. The file above was designed so that the finance section
could find banking details and the recruitment section could find contact details. The problem is that
there cannot be any control of access to part of a file, so for example, staff in the recruitment section
would be able to access the banking details of members. Data privacy would be properly handled by a
database system.
Data redundancy and possible inconsistency in multiple files
To overcome privacy issue, data may be stored in different files for different departments of the
organisation. But it will cause data redundancy as data will be entered again and again in each file. It
will also cause inconsistency of data because if there is a change in any data item, it must be updated
in all files otherwise it will become inconsistent.

Advantages of a relational database


Splitting data into a number of related tables brings many advantages over a flat file database. These
include:
1. Data is only stored once. In the previous example, the city data was gathered into one table so now
there is only one record per city. The advantages of this are
• No multiple record changes needed
• More efficient storage
• Simple to delete or modify details.
• All records in other tables having a link to that entry will show the change.

2. Complex queries can be carried out. A language called SQL has been developed to allow
programmers to 'Insert', 'Update', 'Delete', 'Create', 'Drop' table records. These actions are further
refined by a 'Where' clause. For example
SELECT * FROM Customer WHERE ID = 2
This SQL statement will extract record number 2 from the Customer table. Far more complicated
queries can be written that can extract data from many tables at once.
3. Better security. By splitting data into tables, certain tables can be made confidential. When a
person logs on with their username and password, the system can then limit access only to those
tables whose records they are authorised to view. For example, a receptionist would be able to view
employee location and contact details but not their salary. A salesman may see his team's sales
performance but not competing teams.
4. Cater for future requirements. By having data held in separate tables, it is simple to add records
that are not yet needed but may be in the future. For example, the city table could be expanded to
include every city and town in the country, even though no other records are using them all as yet. A
flat file database cannot do this.
Summary - advantages of a relational database over flat file
• Avoids data duplication
• Avoids inconsistent records
• Easier to change data
• Easier to change data format
• Data can be added and removed easily
• Easier to maintain security.

Following steps are taken in Relational Database Management System to resolve security issues
related with File-Based and flat file database:
• Issue usernames and passwords...
• stops unauthorised access to the data
• any further expansion e.g. strong passwords / passwords should be changed regularly etc.

• Access rights / privileges...


• so that only relevant staff / certain usernames can read/edit certain parts of the data
• can be read only, or full access / read, write and delete
• any relevant example e.g. only class tutors can edit details of pupils in their tutor group

• Create (regular / scheduled) backups...


• in case of loss/damage to the live data a copy is available
• any relevant example e.g. backing up the attendance registers at the end of each day and
storing the data off-site/to a separate device

• Encryption of data...
• if there is unauthorised access to the data it cannot be understood // needs a decryption key
• any relevant example e.g. personal details of pupils are encrypted before being sent over the
Internet to examination boards

• Definition of different views...


• composed of one or more tables
• controls the scope of the data accessible to authorised users
• any relevant example e.g. teachers can only see their classes

• Usage monitoring / logging of activity...


• creation of an audit /activity log
• records the use of the data in the database / records operations performed by all users / all
access to the data
• any relevant example, e.g. Track who changed a student’s grade
The DBMS approach
A DBMS uses a more structured approach to the management, organisation and maintenance of
data in a database. An already-defined data structure can be used to set up and create the database.
The entry of new data, the storage of data, the alteration and deletion of data are all
managed by the DBMS.
A DBMS uses a data dictionary to store the metadata, including the definition of tables, attributes,
relationships between tables and any indexing. The data dictionary can also define the validation rules
used for the entry of data and contain data about the physical storage of the data.
The use of a data dictionary improves the integrity of the data stored, helping to ensure that it is
accurate, complete and consistent.
Data modelling is an important tool used to show the data structure of a database. An E-R
diagram is an example of a data model.
A logical schema is a data model for a specific database that is independent of the DBMS used to
build the database.
A DBMS helps to provide data security to prevent the unwanted alteration, corruption, deletion or
sharing of data with others that have no right to access it.
Security measures taken by a DBMS can include:
• using usernames and passwords to prevent unauthorised access to the database.
• using access rights to manage the actions authorised users can take, for example, users could
read/write/delete, or read only, or append only.
• using access rights to manage the parts of the database they have access to, for example,
the provisions of different views of the data for different users to allow only certain users
access to some tables.
• automatic creation and scheduling of regular back-ups.
• encryption of the data stored.
• automatic creation of an audit trail or activity log to record the actions taken by users of the
database.
The use and purpose of DBMS software tools
Developer interface
The developer interface allows a developer to write queries in structured query language (SQL)
rather than using query-by-example. These queries are then processed and executed by the query
processor. This allows the construction of more complex queries to interrogate the database.
Query processor
The query processor takes a query written in SQL and processes it. The query processor includes a
DDL interpreter, a DML compiler and a query evaluation engine. Any DDL statements are interpreted
and recorded in the database’s data dictionary. DML statements are compiled into low level
instructions that are executed by the query evaluation engine. The DML compiler will also optimise
the query

• DLL files are only loaded into memory when required.


• Changes /improvements /error correction to the DLL file code are done independently of the
main program.
o So there is no need to recompile the main program
o All programs using it will benefit
• A single DLL file can be made available to several application programs...
o Saving space in memory / easing the pressure on memory
Drawback of DDL
• The executable code is not self-contained …
o The DLL file(s) needed to be included at run time.
• Appropriate (linking) software must be available at run-time …
o To link/include/import the DLL files.
• The DLL file must be present …
o otherwise (unable to find X.dll) errors
• Unexpected changes to the DLL file /corrupted DLL file …
o could mean the program stops working as expected
• Malicious changes to the DLL file …
o could install a virus on the user’s computer / related files could be corrupted
Summer 2019 P13
3 A company uses a relational database, EMPLOYEES, to store data about its employees and
departments.
(a) The company uses a Database Management System (DBMS).
(i) The DBMS has a data dictionary.
Describe what the data dictionary stores.
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
................................................................................................................................... [2]
(ii) The DBMS has a query processor.
Describe the purpose of a query processor.
...................................................................................................................................................................
...................................................................................................................................................................
...................................................................................................................................................................
.................................................................................................................................... [2]
Summer 16 P 13
5 (a) A Database Management System (DBMS) provides the following features.
Draw a line to match each feature with its description. [3]
Feature Description
A file or table containing all the details of the database design
Data dictionary
Data design features to ensure the validity of data in the database
Data security
A model of what the database will look like, although it may not be
stored in this way
Data integrity
Methods of protecting the data including the uses of passwords and
different access rights for different users of the database

A school stores a large amount of data that includes student attendance, qualification and contact
details. The school is setting up a relational database to store these data.
(b) The school needs to safeguard against any data loss.
Describe three factors to consider when planning a backup procedure for the data.
Justify your decisions.
1 ................................................................................................................................................................
...................................................................................................................................................................
..................................................................................................................................................................
2 ................................................................................................................................................................
...................................................................................................................................................................
..................................................................................................................................................................
3 ...............................................................................................................................................................
...................................................................................................................................................................
..............................................................................................................................................................[6]
8.3 Data Definition Language (DDL) and Data Manipulation Language (DML)

Candidates should be able to: Notes and guidance


Show understanding that DBMS carries out all
creation / modification of the database structure
using its Data Definition Language (DDL)
Show understanding that the DBMS carries out
all queries and maintenance of data using its
DML
Show understanding that the industry standard Understand a given SQL script
for both DDL and DML is Structured Query
Language (SQL)
Understand given SQL (DDL) commands and be Create a database (CREATE DATABASE)
able to write simple SQL (DDL) commands using Create a table definition (CREATE TABLE),
a sub-set of commands including the creation of attributes with
appropriate data types:
• CHARACTER
• VARCHAR(n)
• BOOLEAN
• INTEGER
• REAL
• DATE
• TIME
change a table definition (ALTER TABLE)
add a primary key to a table (PRIMARY KEY
(field))
add a foreign key to a table (FOREIGN KEY
(field) REFERENCES Table (Field))
Write an SQL script to query or modify data Queries including SELECT... FROM, WHERE,
(DML) which are stored in (at most two) ORDER BY, GROUP BY, INNER JOIN, SUM,
database tables COUNT, AVG
Data maintenance including. INSERT INTO,
DELETE FROM, UPDATE
Structured Query Language (SQL)

Structured Query Language (SQL) is a specialized language for updating, deleting, and requesting
information from databases. SQL is an ANSI and ISO standard, and is the de facto standard database
query language. A variety of established database products support SQL, including products from
Oracle and Microsoft SQL Server. It is widely used in both industry and academia, often for enormous,
complex databases.

In a distributed database system, a program often referred to as the database's "back end" runs
constantly on a server, interpreting data files on the server as a standard relational database.
Programs on client computers allow users to manipulate that data, using tables, columns, rows, and
fields. To do this, client programs send SQL statements to the server. The server then processes these
statements and returns result sets to the client program.

Database data types:

Data types for attributes Description


CHARACTER (n) Fixed length text
VARCHAR(n) Variable length text
BOOLEAN True or False; SQL uses the integers 1 and 0
INTEGER Whole number
REAL Number with decimal places
DATE A date usually formatted as YYYY-MM-DD
TIME A time usually formatted as HH:MM:SS

Indeed, proficiency with SQL is one of the most sought after computing skills. This is the language that
DBMS software or relational database software uses for:
• Basic database design
• inserting a record
• deleting records
• amending records.
Difference between CHARACTER and VARCHAR
CHARACTER
1. Used to store character string value of fixed length. It is used when a fixed length value is to be
stored in a filed. For example to store 5 character long employee code a field EmpCode of data type
CHARACTER(5) is used. If a data item of lesser characters like 3 characters are stored 2 spaces will be
added in the field. i.e. the field will occupy 5 characters.
2. The maximum no. of characters the data type can hold is 255 characters.
3. It's 50% faster than VARCHAR.
4. Uses static memory allocation.
VARCHAR
1. Used to store variable length alphanumeric data. For example in a field EmpName of type
VARCAHR(20), if a name “Abdullah” is entered, this field will occupy the 8 character size.
2. The maximum this data type can hold is up to
• Pre-MySQL 5.0.3: 255 characters.
• Post-MySQL 5.0.3: 65,535 characters shared for the row.
3. It's slower than CHARACTER.
4. Uses dynamic memory allocation.

Data Definition Language (DDL)


To create database and database tables, to edit table design and to delete table DDL is used.
SQL (DDL) command Description
CREATE DATABASE <database name> Creates a database
CREATE TABLE <Table name> Creates a table definition
ALTER TABLE Changes the definition of a table
PRIMARY KEY Adds a primary key to a table
FOREIGN KEY … REFERENCES … Adds a foreign key to a table
DROP <Database> To delete a database or a table
DROP <Table>
ALTER TABLE <Table> DROP <fieldname>; To delete a field
ALTER TABLE <table name>
To alter table to add a primary key
ADD PRIMARY KEY (<primary key name>)
SELECT <Fields,…>
FROM <Table1>
To create relationship
INNER JOIN <Other table>
ON <Table1.primary key> = <Table2.Foreign key>

CREATE
To create a database and a table:

CREATE DATABASE School;


CREATE TABLE Staff
(
ID: INTEGER PRIMARY KEY,
NAME: VARCHAR(20),
GENDER: VARCHAR(6),
DOB: DATE,
TOWN: VARCHAR(20),
Points: INTEGER
);
CREATE DATABASE Session2024;
CREATE TABLE Student
(
RollNo : INTEGER NOT NULL,
Name : VARCHAR(20),
Class: VARCAHR(4),
SECTION: VARCHAR(1),
PRIMARY KEY (RollNo)
);

CREATE TABLE Student2

(
RollNo : INTEGER NOT NULL,
Name : VARCHAR(20),
Class: VARCHAR(4),
SECTION: VARCHAR(2),
);

To create a database of teachers


CREATE DATABASE Teachers;
CREATE TABLE TData
(
TID : CHARACTER(4),
TName: VARCHAR(20),
TSubject : VARCHAR(5)
);
To add a field joining date

ALTER TABLE TDATA


ADD TJoiningDate : DATE;

Setting Primary Keys

ALTER TABLE TData


ADD PRIMARY KEY (TID);
Primary keys can also be set during table creation

CREATE TABLE users


(
user_id INTEGER NOT NULL,
username varchar(25),
password varchar(25),
Address varchar(255),
PRIMARY KEY (user_id)
);

Setting Composite/Compound Keys


To set a primary key made up of two columns during table creation you could do something such as
this

CREATE TABLE users


(
user_id : NUMBER NOT NULL,
username : varchar(25),
password : varchar(25),
Address : varchar(25),
PRIMARY KEY (user_id, username)
);This could also be done after table creation:
ALTER TABLE users
ADD PRIMARY KEY (user_id, username);

Setting Foreign Keys


To create two tables in relational database like:
StData
RollNo Name Class Section

StMarks
SNo RollNo Month Marks

RollNo is primary key in StData table and foreign key in StMarks table.
To create these tables and set primary and foreign keys following commands are used:
CREATE TABLE StData
(
RollNo: INTEGER PRIMARY KEY,
Name : VARCHAR(20),
Class: VARCHAR(5),
SECTION : VARCHAR(20)
);
CREATE TABLE StMarks
(
SNo : INTEGER PRIMARY KEY NOT NULL,
RollNo : INTEGER NOT NULL,
Month: varchar(6),
Marks : REAL,
FOREIGN KEY (RollNo) REFERENCE StData(RollNo) );
Where the primary key is "product_id" and all the other attributes are declared within the ( )
structure and are followed by a comma.
DROP
To delete a database or a table

DROP DATABASE BandBooking;


DROP TABLE Staff

To delete a field from table:

To delete a field convictions:


ALTER TABLE Staff DROP convictions;

To delete field result from Marks table:


ALTER TABLE Marks DROP Result;

ALTER TABLE Student


DROP Section;

ALTER
An ALTER statement in SQL changes the properties of a table in a relational database without the
need to access the table manually.
To add field Result in Marks table
ALTER TABLE Marks
ADD Result VARCHAR(4);

To add section in student table


ALTER TABLE Student
ADD Section : VARCHAR(1);
To add a field and set as primary key in a Student2 table
ALTER TABLE Student 2
ADD RollNo : INTEGER PRIMARY KEY;

To add a new field convictions in staff table:


ALTER TABLE Staff ADD convictions INTEGER;

To delete a field convictions:


ALTER TABLE Staff DROP convictions;
SQL - INNER JOINS
The most important and frequently used of the joins is the INNER JOIN. They are also referred to as
an EQUIJOIN.
The INNER JOIN creates a new result table by combining column values of two tables (table1 and
table2) based upon the join-predicate. The query compares each row of table1 with each row of table2
to find all pairs of rows which satisfy the join-predicate. When the join-predicate is satisfied, column
values for each matched pair of rows of A and B are combined into a result row.
Syntax
The basic syntax of the INNER JOIN is as follows.
SELECT table1.column1, table2.column2...
FROM table1
INNER JOIN table2
ON table1.common_field = table2.common_field;
Example
Consider the following two tables.
Table 1 − CUSTOMERS Table is as follows.

CustomerID NAME AGE ADDRESS LastPurchase


101 Joseph 32 Karachi 2000.00
102 Abdullah 25 Lahore 15000.00
103 Ahmed 23 Hyderabad 2000.00
104 Chaitali 25 Mumbai 6500.00
105 Rehan 27 Bhopal 8500.00
106 Shamim 22 Karachi 4500.00
107 Salahuddin 24 Lahore 10000.00
Table 2 − ORDERS Table is as follows.
OrderID DATE CustomerID AMOUNT
50102 2009-10-08 103 3000
50100 2009-10-08 103 1500
50101 2009-11-20 102 1560
50103 2008-05-20 104 2060
Now, let us join these two tables using the INNER JOIN as follows −
SELECT CustomerID, NAME, AMOUNT, DATE
FROM CUSTOMERS
INNER JOIN ORDERS
ON CUSTOMERS.CustomerID = ORDERS.CustomerID;

SELECT RollNo, Name, Class, Marks, Result


FROM Student
INNER JOIN StudentsMarks
ON Student.RollNo = StudentMarks.RollNo;
Data manipulation language (DML)
Part of SQL is a data manipulation language (DML). The database designer can use it to write SQL scripts that:
• insert, amend and delete data records
• retrieve data from database tables based on search criteria specified by the user.
Again, this is likely to be done by the user with simple point-and-click features. What the DBMS does is create a
SQL script that mirrors the actions of the user and then runs the script. In Microsoft Access, this is done using a
facility called “Query By Example”.
To add records in Student table, which has following fields:
RollNo: INTEGER PRIMARY KEY,
Name : VARCHAR(20),
Class: VARCHAR(5),
SECTION : VARCHAR(1)

To enter data in all fields:


INSERT INTO Student
VALUES
(101, “Mr. Bean”, “SY”, “A”);
To enter data into specific fields:
INDERT INTO Student (RollNo, Name, Class) VALUES (10, “Mr. Dean”, “SY”);

The following insert script creates 13 new WARD records:


INSERT INTO WARD (WardName, NoOfBeds, NurseInCharge) VALUES ('Ward 1',10, 'Atiq') ;
INSERT INTO WARD (WardName, NoOfBeds, NurseInCharge) VALUES ('Ward 2', 20, 'Jones') ;
INSERT INTO WARD (WardName, NoOfBeds, NurseInCharge) VALUES ('Ward 3',15, 'Papandreou') ;
INSERT INTO WARD (WardName, NoOfBeds, NurseInCharge) VALUES ('Ward 4',11, 'Moazam') ;
INSERT INTO WARD (WardName, NoOfBeds, NurseInCharge) VALUES ('Ward 5',32, 'Abdullah') ;
INSERT INTO WARD (WardName, NoOfBeds, NurseInCharge) VALUES ('Ward 6',11, 'Patel') ;
INSERT INTO WARD (WardName, NoOfBeds, NurseInCharge) VALUES ('Ward 7',12, 'Philippe') ;
INSERT INTO WARD (WardName, NoOfBeds, NurseInCharge) VALUES ('Ward 8',15, 'Bashir') ;
INSERT INTO WARD (WardName, NoOfBeds, NurseInCharge) VALUES ('Ward 9',16, 'Ahmed') ;
INSERT INTO WARD (WardName, NoOfBeds, NurseInCharge) VALUES ('Ward 10',4, 'Moazam') ;
INSERT INTO WARD (WardName, NoOfBeds, NurseInCharge) VALUES ('Ward 11',4, 'Ocampo') ;
INSERT INTO WARD (WardName, NoOfBeds, NurseInCharge) VALUES ('Ward 12',12, 'Sviridov') ;
INSERT INTO WARD (WardName, NoOfBeds, NurseInCharge) VALUES ('Ward 13',12, 'Sekhina') ;
SELECT Command
Structured Query Language (SQL) is used to perform function on a database. There are four main
functions that you should be familiar with: SELECT, INSERT, UPDATE, DELETE
Built in SQL commands are normally written in capital letters, making your statements easier to
read. However, you can get away without them.
To help us understand how these things work we are going to use a test data set. Databases are used in all
areas of the computer industry, but for the moment we are going to use a dataset that keeps track of staff in
England, noting, names, gender, date of birth, towns and numbers of scars. Take a look at the staff data table
below:
Student

RollNo Name Class Section


101 Ahmed AS K
102 Wajid A2 G
103 Rehan A2 S
104 Kamran AS T
105 Jamal OL K

To select all the items from this table we can use:


SELECT * FROM <Table>

SELECT * FROM Student;

This would display all the Name and class of students who are in section K and class is AS.

SELECT Name, Class FROM Student


WHERE Section = “K” AND CLASS=”AS”;

This would display all the Name and class of students who are in section K or in section T.

SELECT Name, Class FROM Student


WHERE Section = “K” OR Section=”T”;

To display name and roll of students who are in class AS:


SELECT ROllNo, Name FROM Student WHERE Class = “AS”
The SELECT statement allows you to ask the database a question (Query it), and specify what data it returns.
We might want to ask something like Tell me the name and ages of all the Staff. Of course this wouldn't work,
so we need to put this into a language that a computer can understand: Structured Query Language or SQL for
short:

SELECT name, DoB --what to return


FROM Staff; --where are you returning it from

This would return the following:


name DoB
Geoff 12/05/1982
Jane 05/08/1956
Keith 07/02/1999
Oliver 22/08/1976
Patel 11/11/1911
Marea 14/07/1940
But suppose we wanted to filter these results, for instance: Tell me the ID, name and ages of all the Staff who
are male and come from Snape. We need to use another statement, the WHERE clause, allowing us to give the
query some criteria (or options):

SELECT ID, name, DoB


FROM Staff
WHERE town = 'Snape' AND gender = 'male'; --Criteria

This would return the following:


ID name DoB
3 Keith 07/02/1999
UPDATE:
Database aren't always perfect and there may be times that we want to change the data inside our database.
For example in Facebook if someone is annoying you and you limit their access to your profile, you'd update
the access field from 'normal' to 'restricted'. Or if one of our staff gets an additional scar you'd have to update
the numScars field. Let's take a look at that example, where our staff Peter gains a scar on his right cheek. This
was his initial state:

name: Peter
numScars: 7
UPDATE staff
SET numScars = 8;

But we have a problem here, this statement updates all records to numScars = 8. This means that every staff
will now have 8 scars!
ID name gender DoB town Points
1 Geoff male 12/05/1982 Hull 8
2 Jane female 05/08/1956 York 8
3 Keith male 07/02/1999 Snape 8
4 Oliver male 22/08/1976 Blaxhall 8
5 Patel female 11/11/1911 East Ham 8
6 Marea female 14/07/1940 Wythenshawe 8
We need to specify which staff we want to update by using a WHERE clause, you saw it earlier in the SELECT
example.

UPDATE staff
SET Points = 10
WHERE name = "Patel"; --only updates those people who are called Peter

UPDATE Marks
SET Result=”Pass” --store “Pass” in all students’ result.

UPDATE StudentsMarks
SET Result=”Pass”
WHERE Marks>=50 --store “Pass” in students’ result if marks are 50 or above.
INSERT
We might also want to add new things to our database, for example when we are adding new Criminal records
or a new friendship link on Facebook. To add new records we use the INSERT command with values of the
fields we want to insert:

INSERT INTO staff


VALUES (1234,'Julie', 'female','12/12/1994','Little Maplestead', 67);

Sometimes we might not want to insert all the fields, some of them might not be compulsory:

INSERT INTO staff (ID, name, town) --specific fields to insert into
VALUES (999, 'Frederick', 'Shotley');

ID name Gender DoB town Points


1 Geoff Male 12/05/1982 Hull 0
2 Jane Female 05/08/1956 York 1
3 Keith Male 07/02/1999 Snape 6
4 Oliver Male 22/08/1976 Blaxhall 2
5 Patel Female 11/11/1911 East Ham 10
6 Marea Female 14/07/1940 Wythenshawe 6
1234 Julie Female 12/12/1994 Little Maplestead 67
999 Frederick Shotley

DELETE
You might also want to delete a staff record, then you need a DELETE command to do all of these
things, to permanently delete records from databases. Imagine that record of Geoff is to be deleted:

DELETE FROM staff


WHERE name = 'Geoff'
Functions in SQL (DML)
SQL has many built-in functions for performing calculations on data.

SQL Aggregate Functions


SQL aggregate functions return a single value, calculated from values in a column.
Useful aggregate functions:
AVG() - Returns the average value
COUNT() - Returns the number of rows
MAX() - Returns the largest value
MIN() - Returns the smallest value
SUM() - Returns the sum
Dummy Database Table: TMarks
RollNo Month Marks Result
101 Feb 89 Pass
101 Jan 78 Pass
102 Feb 75 Pass
102 Jan 34 Fail
103 Jan 78 Pass
104 Jan 87 Pass

COUNT()
The COUNT() function returns the number of rows that matches a specified criterion.
Syntax:
SELECT COUNT(column_name)
FROM table_name
WHERE condition;
Example:
To count number of records:
SELECT COUNT(RollNo)
FROM Marks;
Example
To Count number of Students who are pass:
SELECT COUNT(Result)
FROM Marks
WHERE Result=”Pass”;
To Count number of Students who are pass:
SELECT COUNT(Result)
FROM Marks
WHERE Result=”Pass”;

Average Function AVG()


The AVG() function returns the average value of a numeric column.
Syntax:
SELECT AVG(column_name)
FROM table_name
WHERE condition;
Example:
To calculate average marks
SELECT AVG(Marks)
FROM Marks;
SUM()
The SUM() function returns the total sum of a numeric column.
Syntax:
SELECT SUM(column_name)
FROM table_name
WHERE condition;
Example:
To calculate total marks
SELECT SUM(Marks)
FROM Marks;
MAX()
The MAX() function returns the maximum value in a column.
Syntax:
SELECT MAX(column_name)
FROM table_name;
Example:
To calculate highest marks
SELECT MAX(Marks)
FROM Marks;
MIN()
The MIN() function returns the minimum value in a column.
Syntax:
SELECT MIN(column_name)
FROM table_name;
Example:
To calculate lowest marks
SELECT MIN(Marks)
FROM Marks;
SQL GROUP BY Statement
The SQL GROUP BY Statement
The GROUP BY statement groups rows that have the same values into summary rows, like "find the number of
customers in each country".
The GROUP BY statement is often used with aggregate functions (COUNT(), MAX(), MIN(), SUM(), AVG()) to
group the result-set by one or more columns.

GROUP BY Syntax
SELECT column_name(s)
FROM table_name
WHERE condition
GROUP BY column_name(s)
ORDER BY column_name(s);
Demo Database
Below is a selection from the "Customers" table in the Northwind sample database:
SQL GROUP BY Examples
Example
To count pass and fail students
SELECT COUNT(RollNo)
FORM Marks
GROUP By Result;

The following SQL statement lists the number of customers in each country:
SELECT COUNT(CustomerID), Country
FROM Customers
GROUP BY Country;

Example
The following SQL statement lists the number of customers in each country, sorted high to low:
SELECT COUNT(CustomerID), Country
FROM Customers
GROUP BY Country
ORDER BY COUNT(CustomerID) DESC;
GROUP BY With JOIN Example
Example
The following SQL statement lists the number of orders sent by each shipper:

SELECT Shippers.ShipperName, COUNT(Orders.OrderID) AS NumberOfOrders FROM Orders


LEFT JOIN Shippers ON Orders.ShipperID = Shippers.ShipperID
GROUP BY ShipperName;
Test Yourself With Exercises

Exercise:
List the number of customers in each country.

SELECT
(CustomerID),
Country
FROM Customers ;
Test Yourself A sports centre has a gym and a swimming pool. The sports centre has members.
A member is given a unique membership number when they join.
Different types of membership are available:
• J – Junior
• SF – Senior full
• SG – Senior gym only
• SS – Senior swim only
Members who use the gym are assigned a personal trainer. Sports centre employees are identified with a
unique three-character code. An employee can be a personal trainer to one or more members.
The sports centre organises classes. Each class has a unique class name.
Each class is taken by an employee who acts as the class leader. An employee may be a class
leader for zero, one or more classes.
Members can take classes. Each class has a class code. Some classes are assigned a level:
• B – beginners
• I – intermediate
• A – advanced
A relational database is to be created to store data about members, employees, classes and class
attendance. The following table design MEMBER was a first attempt at the database design.
Table: MEMBER
MemberNo MemberType Trainer ClassName ClassLevel ClassLeader
510 SF SAF Yoga B B OLO
510 SF SAF Box fit B DAV
510 SF SAF Zumba B ROG
808 SS OLO Swimathon A ROG
756 J DAV Circuits I VAR
756 J DAV Box fit I DAV
756 J DAV Yoga A A OLO
756 J DAV Body pump A CFD
(a) (i) State why the table is not in First Normal Form (1NF).
...........................................................................................................................................
.......................................................................................................................................[1]
(ii) Comment on your answer by referring to the data in the table.
................................................................................................................................................ [1]

(b) The design is changed so that there are two tables:


MEMBER(MemberNo, MemberType, Trainer)
MEMBERCLASSES(MemberNo, ClassName, ClassLevel, ClassLeader)
The primary keys are not shown.
(i) Using the data given in the original table, show the data now stored in table MEMBER. [1]
Table: MEMBER
MemberNo MemberType Trainer

(ii) Using the data given in the original table, show three rows stored in table MEMBERCLASSES.
The MemberNo should be different for each row. [2]
Table: MEMBERCLASSES
MemberNo ClassName ClassLevel ClassLeader

(iii) Using the data given in the original table, state how many rows would be in table
MEMBERCLASSES.
.......................................................................................................................................[1]
(iv) State the relationship between MEMBER and MEMBERCLASSES.
.......................................................................................................................................[1]
(v) Explain how the relationship is implemented.
...........................................................................................................................................
...........................................................................................................................................
.......................................................................................................................................[2]
(c) The following new design for MEMBERCLASSES was suggested in part (b):
MEMBERCLASSES(MemberNo, ClassName, ClassLevel, ClassLeader)
(i) State the primary key for this table.
.......................................................................................................................................[1]

(ii) Explain why the table is not in Second Normal Form (2NF).
...........................................................................................................................................
.......................................................................................................................................[2]
(iii) The solution is to create a new third table.
Show the revised design including the primary keys.
MEMBER(MemberNo, MemberType, Trainer)
MEMBERCLASSES(............................................................................................................)
............................(............................................................................................................) [3]

(d) Each type of membership has a fixed annual membership fee. The new table design for
member data is:
MEMBER(MemberNo, MemberType, MemberTypeFee, Trainer)
(i) The revised MEMBER table is not in Third Normal Form (3NF).
Explain this statement.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
.......................................................................................................................................[2]
(ii) The solution is to create a new fourth table.
Show the revised design including the primary keys.
MEMBER(...........................................................................................................................)
.............(...........................................................................................................................) [2]
0 9618/1 Specimen paper Q3 - SoW
3 Mehrdad has a holiday company database that includes:
• data about holidays, such as the location, date, duration (in days)
• data about the customers and the holidays they have booked.
(a) Mehrdad has normalised the database, which has three tables.
(i) Draw an entity–relationship (E–R) diagram for the normalised tables.

(ii) Complete the table to identify the primary key and foreign key(s) for each of the tables you
identified in part (a)(i). If the table has no foreign key(s), write ‘None’.

Table name Primary key Foreign key

(iii) Explain why the holiday database is in Third Normal Form (3NF).
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
........................................................... [2]
(b) The holiday company has several members of staff. The database has two additional tables to
store data about the staff.
STAFF(StaffID, FirstName, SecondName, DateOfBirth, Role, Salary)
SCHEDULE(ScheduleID, StaffID, WorkDate, Morning, Afternoon)
The following table shows some sample data from the table SCHEDULE.
ScheduleID StaffID WorkDate Morning Afternoon
210520-1 BC 21/05/2020 TRUE TRUE
210520-2 JB 21/05/2020 TRUE FALSE
220520-1 BC 22/05/2020 FALSE TRUE
220520-2 LK 22/05/2020 TRUE FALSE
(i) Write an SQL script to display the first name and second name of all staff members working on
22/05/2020.
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
.......................................................................................................................................................... [4]
(ii) Write an SQL script to count the number of people working on the morning of 26/05/2020.
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
.............................................................................................................................................................. [3]
1b 9618 S21 P12
1 Raj owns houses that other people rent from him. He has a database that stores details about the
people who rent houses, and the houses they rent. The database, HOUSE_RENTALS, has the following
structure:
CUSTOMER(CustomerID, FirstName, LastName, DateOfBirth, Email)
HOUSE(HouseID, HouseNumber, Road, Town, Bedrooms, Bathrooms)
RENTAL(RentalID, CustomerID, HouseID, MonthlyCost, DepositPaid)
(a) Give the definition of the following database terms, using an example from the database
HOUSE_RENTALS for each definition. [6]
Term Definition and example

..............................................................................................................................
Field
..............................................................................................................................
..............................................................................................................................

..............................................................................................................................
Entity
..............................................................................................................................
..............................................................................................................................

..............................................................................................................................
Foreign key
..............................................................................................................................
..............................................................................................................................

Examiner Report Question 1


(a) Many of the candidates were able to give correct examples for each term taken from the database given in
the question. Defining the terms proved to be more challenging. There was considerable confusion between
the use of ‘table’ and ‘database’, with many responses using them interchangeably. Some candidates need to
improve their understanding of multi-table databases. A common incorrect definition of a foreign key did not
mention the linking of the tables. An entity and a table are two different things. Many candidates described
and gave an example of a table rather than an entity.
(b) Tick one box to identify whether the database HOUSE_RENTALS is in Third Normal Form (3NF) or
not in 3NF.
Justify your choice using one or more examples from the database HOUSE_RENTALS.
In 3NF
Not in 3NF
Justification ..............................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
.............................................................................................................................................................. [2]
Examiner Report Question 1
(b) This question also required application of knowledge to the given database. Many candidates correctly
identified that the database was in 3NF, though often the justification included generic statements about the
requirements of 3NF without any application to the given tables.

(c) Example data from the table RENTAL are given:


RentalID CustomerID HouseID MonthlyCost DepositPaid
1 22 15B5L 1000.00 Yes
2 13 3F 687.00 No
3 1 12AB 550.00 Yes
4 3 37 444.50 Yes
(i) Complete the following Data Definition Language (DDL) statement to define the table RENTAL.
CREATE ...................................... ...................................... (
RentalID INTEGER NOT NULL,
CustomerID INTEGER NOT NULL,
HouseID ...................................... (5) NOT NULL,
MonthlyCost ...................................... NOT NULL,
DepositPaid BOOLEAN NOT NULL,
.......................................................... (RentalID)
); [4]
(ii) Write a Data Manipulation Language (DML) script to return the first name and last name of all
customers who have not paid their deposit.
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
............................................................................................................................................................ [4]
Examiner Report Question 1
(c) (i) There were many correct answers to this question. Many candidates correctly completed the DDL
statement.
(ii) There were some excellent DML scripts written for this question. Some candidates need to improve their
understanding of using more than one table in an SQL query. A common error was the inclusion of quotation
marks around the No in the WHERE clause when the DepositPaid field had been set as Boolean in the DDL
script of the previous part question
1ac 9618 S21 P12_13 – 7 Bobby and Kim are discussing databases.
(a) Bobby tells Kim that a file-based approach is usually better than a relational database.
Explain why Bobby is incorrect.
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
........................................................................................................................................................ [3]
(b) Bobby has a shop that sells products to customers. His database will store data about his
customers, their payment details, orders and the products he sells. Customers will have login details
to access their accounts. The database will update customers’ payment and login details without
keeping any historical records.
(i) Give one example of each of the following relationships from Bobby’s database.
one-to-one .................................................................................................................................................
....................................................................................................................................................................
one-to-many ..............................................................................................................................................
...................................................................................................................................................................
many-to-many ...........................................................................................................................................
.............................................................................................................................................................. [3]
(ii) Tick one box to identify the relationship that cannot be directly implemented in a normalised
relational database. [1]
Relationship Tick
one-to-one
one-to-many
many-to-many
Write a Data Definition Language (DDL) statement to define a new database with the name
SHOPORDERS.
....................................................................................................................................................................
............................................................................................................................................................... [1]
(c) A database has a data dictionary.
Give three items that are stored in a data dictionary.
1 ……………..................................................................................................................................................
2 ................................................................................................................................................................
3 ............................................................................................................................................................[3]
2b 9618 W21 P12 - 6
A shop sells plants to customers. The shop manager has a relational database to keep track of the
sales.
The database, PLANTSALES, has the following structure:
PLANT(PlantName, QuantityInStock, Cost)
CUSTOMER(CustomerID, FirstName, LastName, Address, Email)
PURCHASE(PurchaseID, CustomerID)
PURCHASE_ITEM(PurchaseID, PlantName, Quantity)
(a) The database is normalised.
(i) The table lists the following three stages of normalisation:
• The first stage is from a database that is not normalised (0NF) to First Normal Form (1NF).
• The second stage is from 1NF to Second Normal Form (2NF).
• The third stage is from 2NF to Third Normal Form (3NF).
Tick (✓) one box in each row to identify the appropriate stage for each task. [2]
Normalisation stage
Task
0NF to 1NF 1NF to 2NF 2NF to 3NF
Remove any partial key dependencies
Remove any repeating groups of attributes
Remove any non-key dependencies

Draw an entity-relationship (E-R) diagram for the database PLANTSALES.


(b) The shop manager uses a Database Management System (DBMS).
Describe the purpose and contents of the data dictionary in the DBMS.
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
............................................................................................................................................................. [3]
(c) The shop manager uses both Data Definition Language (DDL) and Data Manipulation Language
(DML) statements to create and search the database.
(i) Complete the DML statements to return the total number of items purchased with the
purchase ID of 3011A.
SELECT SUM(..................................................)
FROM ..................................................
WHERE .................................................. = ..................................................; [4]
(ii) Write DDL statements to include a field in the table PURCHASE to store the date of the order.
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
............................................................................................................................................................. [3]
2ac W21 P11 P13 –
5 Javier owns many shops that sell cars. He employs several managers who are each in charge of one
or more shops. He uses the relational database CARS to store the data about his business.
Part of the database is shown:
SHOP(ShopID, ManagerID, Address, Town, TelephoneNumber)
MANAGER(ManagerID, FirstName, LastName, DateOfBirth, Wage)
CAR(RegistrationNumber, Make, Model, NumberOfMiles, ShopID)
(a) Tick one box in each row to identify whether each field is a primary key or a foreign key. [2]
Table Field name Primary key Foreign key
MANAGER ManagerID
SHOP ManagerID
CAR RegistrationNumber
CAR ShopID
(b) Describe the ways in which access rights can be used to protect the data in Javier’s database from
unauthorised access.
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
...........................................................................................................................................................[3]
(c) Javier uses Data Definition Language (DDL) and Data Manipulation Language (DML) statements in
his database.
(i) Complete the following DML statements to return the number of cars for sale in each shop.
SELECT COUNT(.........................................................)
FROM .........................................................
......................................................... ShopID [3]
(ii) Complete the DML statement to include the following car in the table CAR.
Field Data
RegistrationNumber 123AA
Make Tiger
Model Lioness
NumberOfMiles 10500
ShopID 12BSTREET
........................ ........................ CAR
............................ ("123AA","Tiger","Lioness",10500,"12BSTREET") [2]
3a 9618 S22 P11 –
4 A teacher uses a relational database, MARKS, to store data about students and their test marks.
The database has the following structure:
STUDENT(StudentID, FirstName, LastName)
TEST(TestID, Description, TotalMarks)
STUDENT_TEST(StudentID, TestID, Mark)
(a) Describe the advantages of using a relational database compared to a file-based approach.
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
........................................................................................................................................................ [4]

(b) Give the highest level of Normal Form (NF) the database MARKS is in and justify your choice.
Normal Form ............................................................................................................................................
Justification ...............................................................................................................................................
....................................................................................................................................................................
................................................................................................................................................................[3]
(c) (i) Sample data to be stored in the table STUDENT_TEST is shown.
StudentID TestID Mark
12 A1 50
12 P10 100
13 A1 75
14 P10 60
Write a Structured Query Language (SQL) script to create the table STUDENT_TEST.
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
............................................................................................... [5]
(ii) Write a Structured Query Language (SQL) script to find the average mark of students in test A7.
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
............................................................................................................................................................ [3]
(d) The mark a student is awarded in a test will be entered into the database. This mark needs to be a
whole number between 0 and the maximum number of marks for that test (inclusive).
Explain how data validation and data verification can be used when a mark is entered.
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
............................................................................................................................................................ [4]
3b 9618 S22 P12
5 A database, FILMS, stores information about films and actors.
Part of the database is shown:
ACTOR(ActorID, FirstName, LastName, DateOfBirth)
FILM_FACT(FilmID, FilmTitle, ReleaseDate, Category)
FILM_ACTOR(ActorID, FilmID)
(a) Complete the entity-relationship (E-R) diagram. [2]

(b) A composite primary key consists of two or more attributes that together form the primary key.
Explain why the table FILM_ACTOR has a composite primary key.
...................................................................................................................................................................................
...................................................................................................................................................................................
...................................................................................................................................................................................
............................................................................................................................................................................. [2]
(c) Complete the SQL script to return the IDs of all the actors in the film with the title Cinderella.
SELECT .......................................................................................
FROM FILM_ACTOR
INNER JOIN ........................................................................................
ON FILM_FACT.FilmID = ..............................................................................
WHERE FILM_FACT.FilmTitle = .............................................................................. ; [4]
(d) Write an SQL script to count the number of films that were released in January 2022.
...................................................................................................................................................................................
...................................................................................................................................................................................
...................................................................................................................................................................................
...................................................................................................................................................................................
................................................................................................................................................................ [3]

(e) A Database Management System (DBMS) is used to create and manipulate the database.
Complete the descriptions of the features and tools found in a DBMS using the given terms.
Not all terms will be used.
Boolean data dictionary data redundancy field names
input Interface logical schema Normalisation
operating system Output primary keys Query
Structure
A DBMS provides data management. This includes the development of a .......................................................
that stores information about the data stored, such as ................................... and ......................................... .
The ....................................................... uses methods, such as an E-R diagram, to show the structure of the
database and its relationships.
The ....................................................... processor allows a user to perform searches to find specific data. The
DBMS also provides a developer ....................................................... that allows the user to create tables, forms
and reports. [6]
3c 9618 S22 P13
6 A relational database, TECHNOLOGY, stores data about the staff in a company and the computer
devices used by the staff.
The database has the following tables:
STAFF(StaffID, FirstName, LastName, DateOfBirth, JobTitle)
DEVICE(DeviceID, Type, DatePurchased, StaffID)
(a) Describe the relationship between the two tables. Refer to the primary and foreign keys in your
answer.
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
....................................................................................................................................................................
.......................................................................................................................................................... [4]
(b) The database uses a Data Definition Language (DDL) and Data Manipulation Language (DML).
(i) Complete the SQL script to return the number of devices stored in the database for the staff
member with the first name ‘Ali’ and last name ‘Khan’.
SELECT .............................................................. (STAFF.StaffID)
FROM ..............................................................
INNER JOIN DEVICE
.............................................................. STAFF.StaffID = DEVICE.StaffID
WHERE STAFF.FirstName = 'Ali'
.............................................................. STAFF.LastName = 'Khan'; [4]
(ii) The table DEVICE needs a new attribute to store whether the device has been returned by the
staff member, or not.
Write a Structured Query Language (SQL) script to insert the new attribute into the table DEVICE.
....................................................................................................................................................................
....................................................................................................................................................................
........................................................................................................................................................... [2]
(c) The database is in Third Normal Form (3NF).
Complete the table by describing the three normal forms. [3]
Normal Form Description

...............................................................................................
First Normal Form (1NF) ...............................................................................................
...............................................................................................
...............................................................................................

...............................................................................................
Second Normal Form (2NF) ...............................................................................................
...............................................................................................
...............................................................................................

...............................................................................................
Third Normal Form (3NF) ...............................................................................................
...............................................................................................
...............................................................................................
5a 9618 S23 q11
2 An organisation uses a database to store data about the types of bird that people have seen.
(a) The database is managed using a Database Management System (DBMS).
(i) State what is meant by a data dictionary and give one example of an item typically found in a data
dictionary.
Definition ...........................................................................................................................
...........................................................................................................................................
Example ............................................................................................................................
........................................................................................................................................... [2]
(ii) State what is meant by data integrity and give one example of how this is implemented in a database.
Definition ...........................................................................................................................
...........................................................................................................................................
Example ............................................................................................................................
........................................................................................................................................... [2]
(b) The database, Birds, stores information about the types of bird and the people who have seen them.
Data about each bird seen is stored with its location and data about the person who saw the bird.
Database Birds has the following tables:
BIRD_TYPE(BirdID, Name, Size)
BIRD_SEEN(SeenID, BirdID, Date, Location, PersonID)
PERSON(PersonID, FirstName, LastName, EmailAddress)

(i) Complete the table by identifying two foreign keys and the database table where each is found.[2]

Foreign key Database table


(ii) The database Birds has been normalised.
Draw one line from each Normal Form to the most appropriate definition. [1]
Normal Form Definition

First Normal Form (1NF) All fields are fully dependent on the primary key.

Second Normal Form (2NF) There are no repeating groups of attributes.

Third Normal Form (3NF) There are no partial dependencies.

(iii) Part of the database table BIRD_TYPE is shown:

BirdID Name Size

0123 Blackbird Medium

0035 Jay Large

0004 Raven Large

0085 Robin Small


The database only supports these data types:
• character varchar Boolean integer real date time
Write a Structured Query Language (SQL) script to define the table Bird_Type.
...................................................................................................................................................................................
...................................................................................................................................................................................
...................................................................................................................................................................................
...................................................................................................................................................................................
...................................................................................................................................................................................
............................................................................................................................................................................ [4]
(iv) The database tables are repeated here for reference:
BIRD_TYPE(BirdID, Name, Size)
BIRD_SEEN(SeenID, BirdID, Date, Location, PersonID)
PERSON(PersonID, FirstName, LastName, EmailAddress)
Complete the SQL script to return the number of birds of each size seen by the person with the ID of J_123.
SELECT BIRD_TYPE.Size, ............................................ (BIRD_TYPE.BirdID)
AS NumberOfBirds
FROM BIRD_TYPE, ............................................
HERE ...................................................... = "J_123"
ND BIRD_TYPE.BirdID = ......................................................
............................................ BIRD_TYPE.Size; [5]

2(a)(i) 2
1 mark for definition:

Data about the data in the database // data about the structure of the
database // metadata for a database

1 mark for a suitable example Examples:


• table names
• data types
• field names

2(a)(ii) 1 mark for definition 2

Methods of making sure the data is consistent

1 mark for example Examples:


• Enforcing referential integrity
• If data in one table is deleted/edited all tables are updated // cascading
update/delete
• Validation/verification rules
2(b)(i) 1 mark for each field name and table 2

Foreign key Database table

BirdID BIRD_SEEN

PersonID BIRD_SEEN

2(b)(ii) 1 mark for all 3 correct lines 1

Normal Form Definition

First Normal Form All fields are fully


(1 NF) dependent on the primary
key.

Second Normal There are no repeating


Form (2NF) groups of attributes.

Third Normal Form There are no partial


(3 NF) dependencies.

2(b)(iii) 1 mark each 4

• CREATE TABLE start and end bracket


• Bird ID as CHAR/VARCHAR
• Name and size as VARCHAR/CHAR
• Bird ID as primary key

Example answer:
CREATE TABLE BIRD_TYPE(
BirdID CHAR(4) NOT NULL,
Name VARCHAR(9),
Size VARCHAR(6),
PRIMARY KEY (BirdID)
);

2(b)(iv) 1 mark for each correctly completed space 5

SELECT BIRD_TYPE.Size, COUNT(BIRD_TYPE.BirdID) AS


NumberOfBirds
FROM BIRD_TYPE, BIRD_SEEN

WHERE BIRD_SEEN.PersonID = "J_123"


AND BIRD_TYPE.BirdID = BIRD_SEEN.BirdID
GROUP BY BIRD_TYPE.Size;

5b 9618 S23 q12


2 A horse riding school uses a database, Lessons, to store data about lesson bookings.
This database is created and managed using a Database Management System (DBMS).
(a) The table contains names and descriptions of DBMS features and tools.
Complete the table by writing down the missing names and descriptions. [4]

Name Description

Data dictionary
..................................................................................................
..................................................................................................
..................................................................................................

Query processor
..................................................................................................
..................................................................................................
..................................................................................................

.........................................
A model of a database that is not specific to one DBMS.
.........................................

.........................................
A software tool that allows the user to create items such as tables,
......................................... forms and reports.

[4]
(b) Explain the reasons why referential integrity is important in a database.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [3]
(c) The database Lessons has the following tables:
HORSE(HorseID, Name, Height, Age, HorseLevel)
STUDENT(StudentID, FirstName, LastName, RiderLevel, PreferredHorseID)
LESSON(LessonID, Date, Time, StudentID, HorseID, LessonContent)
Dates in this database are stored in the format #DD/MM/YYYY#.
The fields RiderLevel and HorseLevel can only have the values: Beginner, Intermediate or
Advanced.
(i) Describe two methods of validating the field RiderLevel.
1 ........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
2 ........................................................................................................................................
...........................................................................................................................................
........................................................................................................................................... [2]
(ii) Write a Structured Query Language (SQL) script to return the names of all the horses that have the horse
level intermediate or beginner.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
..................................................................................................................................... [4]
(iii) The following SQL script should return the number of riders that have the rider level beginner and have a
lesson booked on 09/09/2023.
SELECT SUM(STUDENT.RiderLevel) AS NumberOfRiders
FROM STUDENT, LESSON
WHERE StudentID = StudentID
OR Date = #09/09/2023#
AND STUDENT.RiderLevel = Beginner;
There are four errors in the script. Identify and correct each error.
1 ........................................................................................................................................
...........................................................................................................................................
2 ........................................................................................................................................
...........................................................................................................................................
3 ........................................................................................................................................
...........................................................................................................................................
4 ........................................................................................................................................
........................................................................................................................................... [4]
Question Answer Marks

2(a) 1 mark for each correct feature or description 4

Feature Description

Data dictionary Data about the data in the database // data


about the structure of the database // metadata
for a database

Query processor Software that allows the user to enter criteria,


then finds and returns the appropriate result //
software that
processes and executes queries written in SQL

Logical schema A model of a database that is not specific to one


DBMS

Developer interface A software tool that allows the user to create


items such as tables, forms and reports

2(b) 1 mark each to max 3 3


• Referential Integrity makes sure data is consistent
• Referential Integrity makes sure all data is up-to-date
• Referential integrity ensures that every foreign key has a corresponding
primary key
• Referential Integrity prevents records from being added / deleted / modified
incorrectly
• Referential Integrity makes sure that if data is changed in one place the change is
reflected in all related records
• Referential Integrity makes sure any queries return accurate and complete results

2(c)(i) 1 mark each to max 2 2


• Presence check to make sure that the (rider level) is entered
• Look-up / Existence check to make sure the rider level is only Beginner,
Intermediate or Advanced
• Length check to make sure the rider level entered is either 8 or 12 characters
• Type check to make sure the rider level is alphanumeric

Question Answer Marks


2(c)(ii) 1 mark each 4

• SELECT field Name


• FROM table HORSE
• WHERE with Intermediate / Beginner
• OR with Beginner / Intermediate

Example answer: SELECT


Name
FROM HORSE
WHERE HorseLevel = "Intermediate"
OR HorseLevel = "Beginner";

2(c)(iii) 4
1 mark each

• SUM should be COUNT // SELECT COUNT(STUDENT.RiderLevel)


• The WHERE statement needs the table names before each field name
// WHERE STUDENT.StudentID = LESSON.StudentID
• The OR should be AND // AND Date = #09/09/2023#
• Beginner is missing the speech marks // STUDENT.RiderLevel = "Beginner";

5c 9618 S23 P13


4 A shop rents cars to customers. The shop uses a relational database to store information about the rentals.
(a) Describe two ways in which a relational database addresses the limitations of a file-based approach.
1 ...............................................................................................................................................................................
...................................................................................................................................................................................
...................................................................................................................................................................................
..................................................................................................................................................................................
2 ................................................................................................................................................................................
...................................................................................................................................................................................
...................................................................................................................................................................................
............................................................................................................................................................................. [4]
(b) Complete the table by writing the missing term or description for each database feature. [4]

Term Description

........................................
An object that data is stored about.
........................................

..................................................................................................
Tuple ..................................................................................................
..................................................................................................

..................................................................................................
Secondary key ..................................................................................................
..................................................................................................

........................................
A field in one table that is linked to a primary key in another table.
........................................

(c) The car rental database is not normalised. The current database design is:
BOOKING(CarRegistration, StartDate, EndDate,
CarModel, CarColour, CustomerFirstName)
CUSTOMER(CustomerFirstName, CustomerLastName, EmailAddress,
TelephoneNumber)
Write a normalised database design for this database.
All tables must be in Third Normal Form (3NF).
Use the field names given and underline the primary key fields.

...................................................................................................................................................................................
...................................................................................................................................................................................
...................................................................................................................................................................................
...................................................................................................................................................................................
...................................................................................................................................................................................
...................................................................................................................................................................................
...................................................................................................................................................................................
............................................................................................................................................................................. [4]
(d) The data is validated and verified when it is entered into the database.
(i) The car registration number must be: 1 letter, followed by 3 numbers, followed by 2 letters.
For example, A123AA is valid but A12AA is invalid.
One way that a registration number can be validated is by using a presence check to make sure the
registration number has been entered.
Describe two other ways that the car registration number can be validated.
1 ................................................................................................................................................................................
...................................................................................................................................................................................
2 ................................................................................................................................................................................
.............................................................................................................................................................................. [2]
(ii) Describe two ways that the car registration number can be verified when it is entered into the database.
1 ................................................................................................................................................................................
...................................................................................................................................................................................
2 ................................................................................................................................................................................
.............................................................................................................................................................................. [2]
(iii) State why the car registration number might be incorrect even after it has been validated and verified.
………………………………………..........................................................................................................................................
............................................................................................................................................................................. [1]

4(a) 1 mark for each bullet point. Mark in pairs. Max 2 for each description. 4

• Reduces data redundancy


• ... because linked tables mean that each data item is stored only once
• Reduces program-data dependency
• ... because the data is separate from the software so changes to the data do
not require programs to be re-written
• Reduces data inconsistency // improves data integrity
• ... because by only storing data once it only needs to be updated once //
changes in one table will automatically update in another // linked data cannot
be entered differently in two tables
• Complex queries are easier to run
• Can provide different views
• ….so users can only see specific aspects of the database
4(b) 1 mark each 4

Term Description

Entity An object that data is stored about.

Tuple A row of data in a table about one instance of


an object.

Secondary key An additional/alternative key used as well as


the primary key to locate specific data // a
candidate key that has not been chosen as a
primary key.

Foreign key A field in one table that is linked to a primary key


in another table.

4(c) 1 mark each 4

• Only 3 tables with appropriate identifiers (i.e. one table for customer, one for
booking and one for car)
• Appropriate Primary key in each table underlined
• Booking table includes Primary key from car and Primary key from customer as
Foreign keys
• All original fields are in correct tables

Example answer:
BOOKING(BookingID, CarRegistration, CustomerID,
StartDate, EndDate)
CAR(CarRegistration, CarModel, CarColour)
CUSTOMER(CustomerID, CustomerFirstName,
CustomerLastName, EmailAddress, TelephoneNumber)
4(d)(i) 1 mark each to max 2 2

• Length check: the registration number must be 6 characters long


• Format check: the registration number must be in the format letterdigit-digit-
digit-letter-letter
• Type check: the registration number must be alphanumeric
4(d)(ii) 1 mark each 2

• Visual check: Manually compare the registration number entered with the
source document
• Double entry: Enter the registration number twice and the computer compares
to check they are the same
4(d)(iii) The registration number on the original document might be in the correct format but 1
may be the incorrect registration number for that car.
Summer 2019 P13
3 A company uses a relational database, EMPLOYEES, to store data about its employees and departments.
(a) The company uses a Database Management System (DBMS).
(i) The DBMS has a data dictionary.
Describe what the data dictionary stores.
...................................................................................................................................................................................
...................................................................................................................................................................................
...................................................................................................................................................................................
............................................................................................................................................ [2]
(ii) The DBMS has a query processor.
Describe the purpose of a query processor.
...................................................................................................................................................................................
...................................................................................................................................................................................
...................................................................................................................................................................................
.................................................................................... [2]

Summer 16 P 13
5 (a) A Database Management System (DBMS) provides the following features.
Draw a line to match each feature with its description. [3]
Feature Description
A file or table containing all the details of the database design
Data dictionary
Data design features to ensure the validity of data in the database
Data security
A model of what the database will look like, although it may not be stored
in this way
Data integrity
Methods of protecting the data including the uses of passwords and
different access rights for different users of the database
A school stores a large amount of data that includes student attendance, qualification and contact
details. The school is setting up a relational database to store these data.
(b) The school needs to safeguard against any data loss.
Describe three factors to consider when planning a backup procedure for the data.
Justify your decisions.
1 ................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
2 ................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
3 ................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[6]
4b 9608/12 Nov 16 Q9 - SoW

5a 9608/11 Jun 17 Q1-SoW


5b 9608/12 Jun 17 Q1 - SoW

6a 9608/11 Nov 17 Q7 -SoW


6b 9608/12 Nov 17 Q7 -SoW

7a 9608/12 Jun 18 Q7 - SoW


7b 9608/13 Jun 18 Q2 - SoW

8a 9608/11 Nov 18 Q7 -SoW

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy