Aqa 8525 PG Sample
Aqa 8525 PG Sample
Computer
Science
AQA 8525
S Robson and
PM Heathcote
Contents
Section 1
Fundamentals of algorithms 1
Section 2A
Programming basics 24
Section 2B
Programming techniques 44
iv
Section 3
Fundamentals of data representation 62
Section 4
Computer systems 80
Section 5
Fundamentals of computer networks 110
v
Section 6
Cyber security 125
Section 7
Relational databases and SQL 135
Section 8
Ethical, legal and environmental impacts of digital technology 145
vi
SECTION 1 FUNDAMENTALS OF ALGORITHMS Abstraction allows us to separate the ‘logical’ from the ‘physical’. A good example of this is the
map of the London Underground – all we need to know is what stations are on which line, and
the best route to get from A to B. There is no need to get bogged down in details of the exact
distance between stations or even in which direction the route actually takes us at any given
moment.
Similarly, we are all quite happy to use a computer or drive a car without having much idea of how
it works. A driver, a child in the back seat and a mechanic all have a very different view of a car.
We abstract away everything we don’t need to know about and concentrate on the essentials.
No This is a decision box that can only accept “yes” or “no” answers, for
example: "Is number less than 0?"
Yes
42 31 12 3 37 18 29 47
42 31 12 3 37 18 29 47
42 31 12 3 37 18 29 47
42 31 12 3 37 18 29 47
This is the end of stage 1 where all the elements have been separated out.
In the second stage, each pair of sublists is repeatedly merged to produce new sorted sublists
until there is only one sublist remaining. As each pair of lists is merged, they are merged in order.
Merging the final two sublists results in the sorted list.
Stage 2
42 31 12 3 37 18 29 47
1
31 42 3 12 18 37 29 47
3 12 31 42 18 29 37 47
3 12 18 29 31 37 42 47
This is the end of stage 2, with all the items recombined in sorted order.
Carry out a merge sort on the following set of numbers. The numbers are to be sorted
Q22 in ascending order.
6 8 1 17 27 11 15 3
(a) Write out the four sorted sublists after the first phase of Stage 2 (the merge
process).
(b) Write out the two sorted sublists after the second phase of the merge process.
(c) Write out the complete list after the third phase of the merge process.
SECTION 1 EXERCISES
1. Abstraction and decomposition are two aspects of computational thinking.
(a) Sienna is designing a program to control a cat-flap which will open only when a cat
belonging to the owner approaches.
Describe two ways in which she may use abstraction in reaching a solution to this
problem. [2]
(b) A program is required to enter a set of students’ examination marks, count the number
of students who obtained each mark and output the counts for each mark. Examination
marks entered must be in the range 0 to 100.
Explain how decomposition might be used in designing a solution to this problem. [3]
2. (a) (i) A bubble sort is used to sort the following numbers in ascending order:
34, 56, 89, 23, 12, 77, 49, 44
Write the order that the numbers be in after the first pass. [2]
(ii) State the number of passesrequired to sort the items? (No flag is used to
indicate a sorted list.) [1]
(b) A merge sort is to be used to sort the same numbers. During the merge phase, the
following four pairs of numbers need to be merged into two groups of four.
(34, 56), (23, 89), (12, 77), (44, 49)
Write the contents of each group of four numbers after the next phase
of the merge? [2]
1
3. A list of surnames is held in sorted order. The names are:
Beck, Coe, Ford, Grey, Hill, Kerr, Lunn, Pugh, Ross, Shaw, Taft, Ward
(a) State which names would be examined when searching for the name Grey using
(i) a linear search [1]
(ii) a binary search [1]
(b) State which names would be examined when searching for the name James using
(i) a linear search [1]
(ii) a binary search [1]
(c) In a list of 1000 items, state the maximum number of names that would have to be
searched to find a particular name using
(i) a linear search [1]
(ii) a binary search [1]
Section 1 Exercises 21
Binary shifts
0 0 0 0 1 1 1 1
0 0 1 1 1 1 0 0
(NOTE: Fill empty binary positions with 0s as you shift to the left.)
The original binary number has a value of 15 (i.e. 8+4+2+1 = 15); the number after shifting two
places to the left has the value 60 (i.e. 32+16+8+4 = 60). It is multiplied by 4, or 22.
Shifting binary numbers to the right has the opposite effect i.e. each shift to the right has the
effect of dividing by 2. Thus if we shift:
0 1 1 1 0 0 0 0
0 0 0 0 1 1 1 0 3
The original binary value was 112 (i.e. 64 + 32 + 16 = 112) and the value after shifting three
places to the right is 14 (i.e. 8 + 4 + 2 = 14). The number was divided by 8, and becomes 23.
(NOTE: Fill empty binary positions with 0s as you shift to the right.)
Multiplication/division by powers of 2
This gives an easy way to multiply and divide binary numbers by powers of 2, but can come
at the expense of accuracy. For example 00000110 shifted right twice to divide by 4 would be
00000001. This is the equivalent of decimal 1, but 6 / 4 = 1.5.
• Shifting right one place divides the number by 2
• Shifting left one place multiplies the number by 2
This is equivalent to shifting a decimal number right or left – for example shifting 12300 right
gives 1230, i.e. it divides the number by 10. Shifting left multiplies a decimal number by 10.
Write down the results after the following shift operations and write down the decimal
Q7 values before and after the shifts:
(a) The number 11001100 is shifted TWO places to the right
(b) The number 00011001 is shifted TWO places to the left
(c) The number 11001000 is shifted THREE places to the right
(d) The number 00000111 is shifted FOUR places to the left
(e) The number 10000000 is shifted FIVE places to the right
Huffman coding
Huffman coding is a compression technique used to reduce the number of bits used to represent
each letter. The more frequently a letter appears in the text, the fewer bits are used to represent it
in a text file.
Example 3
Consider the sentence PIPPA ATE A PEPPER. A table showing the frequency of each character,
including spaces is created as the first step in building the Huffman tree. For example, there is
one "I", one "R", and six "P"s in the sentence.
Character I R T A E SPACE P
Frequency 1 1 1 3 3 3 6
You will only be required to interpret the tree, not build it. A Huffman tree for this sentence is
shown below. It is a binary tree in which characters that occur most frequently are nearer the top
and therefore require fewer characters to encode them, as described below.
0 1
3
0 1 0 1
Space P
0 1 0 1
T A E
0 1
I R
Using this Huffman tree, the coding for each character is derived from the path taken from the
root node to the character. Branching left at a node is coded as 0, branching right is coded as 1.
Thus the character ‘A’ would be represented by the bit pattern 110 because from the top of the
tree, you go right, right, left to reach A. The encoding for ‘T’ would be 001 and for ‘E’, 111.
The total number of bits needed to represent the word “ATE” would be 3 + 3 + 3 = 9. In 7-bit
ASCII, the number of bits required would be 3 x 7 = 21, representing a saving of 12 bits in the
compressed format, with a 57% reduction in size.
3.6 Compression 77
The Boolean expression for AND is written: Q = A • B where • represents AND.
Example 1
The logic circuit below represents the Boolean condition (NOT A AND B) OR (A AND C). The
outputs at D and E have been labelled so that they can be referred to in the truth table overleaf.
A
D
B
P
E
C
Biometric methods
Employees of an organisation or members of the public passing through airport security, for
example, may be asked to identify themselves by using a biometric method to prove to the system
that they are who they claim to be. Biometric methods include a fingerprint scan, voice pattern
sample or retinal scan. The probability of two people having identical biological characteristics is
infinitesimally small, and so these methods can be used to positively identify a person.
Biometric methods are often used on mobile devices. The advantage of these methods over
password entry are that it is not possible to steal or forget a biometric characteristic.
CAPTCHA
6
CAPTCHA is an acronym for “Completely Automated Public Turing test to tell Computers and
Humans Apart", and is a type of test to determine whether or not the user is human.
A piece of text is displayed on screen in a format indecipherable by text recognition software.
Context is critical; a t might look like an l or i, and it is only in context that a human can identify it
as a t.
Even perfectly sighted individuals sometimes find CAPTCHA text very difficult or
Q6 impossible to read. Does the use of CAPTCHA images discriminate against any
computer users?
located in
Capital city Country One-to-one
holds
Hospital ward Patient One-to-many
take
Student Course Many-to-many
The ‘many’ end of a relationship is shown by the “crow’s feet” in the relationship diagram.
Q4 What type of relationship is there between the Owner and Animal tables?
8 Large-scale cloud providers allow organisations to use fewer servers and therefore, less energy.
Specially designed cloud data centres are more efficient than in-house hardware, using optimised
equipment and sophisticated cooling equipment. This can result in very significant energy
savings.
In addition, cloud storage enables many employees to work from home for at least part of the
week, saving on the carbon emissions arising from commuting daily to work.
Many cloud providers are committed to reducing the environmental impact of using their
technology. Data centres may be powered by wind and solar power alongside non-renewable
energy sources. Google and Amazon purchase almost 100% renewable energy. Microsoft has
reduced the huge amount of water used in cooling systems by designing air-cooling systems.
Unit 2A
Unit 2B
Unit 4
Unit 8
Unit 6
Unit 3
Unit 5
Unit 7
Unit 1
3.1 Fundamentals of algorithms
3.1.1 Representing algorithms
3.1.2 Efficiency of algorithms
3.1.3 Searching algorithms
3.1.4 Sorting algorithms
3.2 Programming
3.2.1 Data types
3.2.2 Programming concepts
3.2.3 Arithmetic operations in a programming language
3.2.4 Relational operations in a programming language
3.2.5 Boolean operations in a programming language
3.2.6 Data structures
3.2.7 Input / output
3.2.8 String handling operations in a programming language
3.2.9 Random number generation in a programming language
3.2.10 Structured programming and subroutines
3.2.11 Robust and secure programming
3.3 Fundamentals of data representation
3.3.1 Number bases
3.3.2 Converting between number bases
3.3.3 Units of information
3.3.4 Binary arithmetic
3.3.5 Character encoding
3.3.6 Representing images
3.3.7 Representing sound
3.3.8 Data compression
www.pgonline.co.uk/resources/gcse/gcse-aqa
Unit 2A
Unit 2B
Unit 4
Unit 3
Unit 5
Unit 7
Unit 1
Unit6
3.4 Computer systems
3.4.1 Hardware and software
3.4.2 Boolean logic
3.4.3 Software classification
3.4.4 Classification of programming languages and translators
3.4.5 Systems architecture
3.5 Fundamentals of computer networks
3.5 Computer networks
3.5 Network topologies
3.5 Network security
3.5 Protocols and layers