Letts Revision
Letts Revision
Computer
<
en /
t\
Masts ‘
Supports the
new national
curriculum
This complete revision and practice book is divided into two parts: the revision guide and the exam practice workbook.
it will reinforce all the skills on the main GCSE courses.
Whether you like to learn by seeing, hearing or doing (or a mix of all three), the revision guide uses three different approaches
to help you engage with each topic and revise in a way that suits you. The exam practice workbook is packed with GCSE-style
questions, including a complete set of practice papers, to ensure you are thoroughly prepared for your exams.
Key features
The revision guide neatly packages the GCSE course into short revision modules to make planning easy.
The workbook provides exam-style questions matched to each module, followed by a complete set of
practice papers.
<> Striking page design, images and diagrams to help you engage with the topics.
4
5
Pt
ce
4
Be
[<3
°
‘zo
BBN meas
fra
\
Science
—
Comp a
Revision Guide
Fundamentals of Algorithms
Module 1: Representing algorithms
Module 2: Searching algorithms
Module 3: Sorting algorithms
Mind map
Exam practice questions
Programming 1
Module 4: Data types
Module 5: Pseudocode
Module 6: Arithmetic, relational and Boolean operators in programming languages
Module 7: Flowcharts
Mind map
Exam practice questions
Programming 2
Module 8: Data structures
Module 9: Input/output and file handling
Module 10: = String handling
Module 11: |§Random number generation in a programming language
Module 12: Databases
Mind map
Exam practice questions
Programming 3
Module 13:
Module 14:
Module 15:
Computer Systems
Module 20: Hardware, software and Boolean logic
Module 21: Software classification
Module 22: Systems architecture.
Module 23: Secondary storage
Mind map
Exam practice questions
ASCII table
Answers
Index
Algorithms
An algorithm is a process used to solve a problem or achieve a task. In computer science, sometimes a
program is used. Be careful not to confuse the two! A program is a type of algorithm, but then so is a recipe.
An algorithm:
» is aset of steps, or instructions, to complete a task. We use them all the time — we just
don't realise we are.
» is away to solve problems, or complete tasks. There are a lot of different ways in which to
complete each task, just like there are a lot of different Victoria soonge cake recipes or there
is more than one way to go to school.
is judged by whether it completes the task, or solves the problem, in the most efficient
way. An efficient algorithm only uses the resources it absolutely needs in order to
complete the task — no more, no less
» is generally made up of INPUT —- PROCESS — OUTPUT.
:JS
» is tracked using what are called trace tables, which trace the
Wi
progress of the computer through the code.
=
Y
Wi
Y
aa Process and function
oe.
Yy Algorithms are generally made up of INPUT — PROCESS — OUTPUT. Keeping track of what
Ce the code is doing at any one time can be challenging, so we use trace tables, which trace the
progress of the computer through the code.
When you use a trace table, you go through your code as if you are the computer, writing
down the inputs, the processes and the outputs. This is an essential part of testing and can
help you see where the computer code would go wrong before you even enter it, which
saves time in class — and money in business.
Efficiency » The extent to which a task is completed in the shortest possible amount of
Module
1 code. This also relates to the amount of memory used and speed of execution of the code.
Trace tables » A template to help you follow each instruction in your program
|
Output_|
Set alarm code
, Sheekte|
Consider the following ace! |
short counting algorithm: ole |
ont ; ce
OUTPUT x =
WHILE x <=3
it
a= =|
a at ee 20
PRINTy 2
ee
OUTPUT “Complete” ts
2
BSS
eae
code been Set off alarm!
entered?
Deactivate alarm
Decomposition
When you decompose a task, you break it into smaller tasks.
Decomposition: | ROOM
~ » helps you write your code because it is usually easier to write | TIDYING MY
- code for each section at a time, rather than trying to write the . 1) Clear the floor a9
whole thing in one go. So, an alarm system for your home will | 2) Move what's un
have a ‘set/unset’ program and a ‘live’ program. | the bed
> makes life a lot easier when you are testing your code | 3) Put cloth es in the
because you can test each section before you run it all 4 drawer
together. Think about the code needed to run a driverless
Car — you can see why it is a good idea to test the bits of
code (like stopping when something is in the way) before
you put the car on the road.
Abstraction eehatislan
Abstraction is the way we remove unneeded information from / algorithm?
a task so a computer can complete it. In the exam, you will ad Explain using two
need to be able to read code, or a brief, and identify the ‘real. different examples:
problem’. For example, if you are programming a driverless one in human terms, and one
car, does it matter if the car is pink or yellow? What is more referring to computers.
important is whether speed or direction is set accurately. . What do we mean by an
‘efficient algorithm’?
Make a model of a computer showing INPUT — . What are the main
PROCESS — OUTPUT, or be more ambitious components of algorithms?
and include storage! Show how data travels . How does a trace table help
through the system. with efficient code design?
Binary search
A binary search chooses the middle value in a sorted array, and works out whether the value
sought is higher or lower than the middle value. Then it splits the array again to check again
— is the value higher or lower than the middle value? The list is repeatedly split in half and half
and half until the item is located.
This means that the computer only ever searches half of the data, because it is either on the
correct number, or pointed at the correct half of the data that is in the array.
We use this method in our own lives, too. If you’re looking for a student in a class whose
Surname begins with H, you would not start at A.
7)
In pseudocode, the binary search algorithm is short. Follow the code through step by step:
EG. ClassList= [5,6,8,9,15] The content of the array is
so 3 INPUT A #number you're looking for inside the [] brackets
ASes :
IF (first > last) return -1; # number not found represented by -1
ELSE # identifies a comment
6fe)) Bl:-
== means “is equal to”.
IF (value = = A[mid])
RETURN mid:
ELSE IF (value < A[mid])
BinarySearch(A, first, mid-1, value);
a Et ELSE
rr BinarySearch(A, mid+1, last, value);
B&B
Module
2 Module 2 Searching algorithms
Linear search
A linear search:
» is used when you can't sort the data into any useful order, or when there are very few items
to search.
» is also known as ‘brute force’ searching. The computer searches from the first item until either the
end of the data or until the item sought is located, one by one.
» is best used when the data to be searched is very small, or is so frequently amended that sorting
is a waste of time.
> can take a really, really long time because it checks every single item, which is why it is used only
when a binary search isn’t possible or appropriate.
The pseudocode for this type of search is much more straightforward. Follow it through in the
graphic below.
The content of the array is
ClassList=[“Alex”, “Riley”, “Chris”, “Bailey”, “Jamie”] inside the [ ] brackets
INPUT A #name you're looking for
FOREACH [item in list]: The arogrami within the
eeee#ee
IF [item] = =A, FOREACH command, which
END
Binary vs linear
When selecting the most suitable search algorithm, consider these summary points:
» Data must be already sorted before a binary search can be carried out.
» A linear search can be slower as it checks every piece of data.
» With very small data sets neither method would have a particular speed advantage.
» A linear search can be completed with a shorter pseudocode sequence.
In pairs: use a suit of playing cards é{ 1. Imagine you are looking for a telephone number
— so just the spades or hearts for ie for K. Lombard in London, which of the two search
~ example — and while one of you techniques would be the best? Explain your
thinks of a card in the suit, the other answer.
one uses binary search to locate it. 2. Show how you would use binary search to find
Compare that with wild guessing to | the person with 17 marks from this group: 22, 19,
_ see the effectiveness of a systematic is glow eesp
BS search. 3. Which search technique requires data to be sorted?
neg
Merge sort
Merge sort is also known as ‘divide and conquer’ because, like the binary search, the merge
sort splits the data in half and works on each half in turn. The computer then sorts the smaller
groups before merging the two together again. This is rather like when we shuffle cards, only
we mess up the sort while the computer code resets it.
MergeSort (Array(First..Last))
BEGIN
IF Array contains only one element THEN
wi RETURN Array #already sorted
e ELSE
=ars
LeftSide = MergeSort(Array(First..Middle))
RightSide = MergeSort(Array(Middle+1..Last))
=)
Result = Merge(LeftSide, RightSide)
RETURN Result
“h ENDIF
END MergeSort
fy
ee
eoeees8segeeseses#seees2#e28e8e @
eeeeveeeeeseesvpmenerpeeeeeeee
D Bubble sort
=
aed
Bubble sort comes from the way that stones settle in a tank of bubbling water: the larger
thes stones sink to the bottom of the tank while the small ones appear to rise to the top. That is
° why a bubble sort is called a sinking sort. This is very rarely used, but it illustrates important
Vv) principles so is included in all computer science study. Its slow methodical nature means it is
normally only used for very small volumes of data. :
} A bubble sort compares the first two items, checks which one is
larger, and swaps them if necessary so that the larger is first.
} Then it checks the next pair, and so on.
» If there have been any position changes, the whole process is begun
again until the computer can go from start to finish and there are no
changes to be made. At this point the data is in descending order.
Descending » Decreasing
in number to 1 downwards,
or in value from A
Module3
E EYE Sorting algorithms
A practical example of this is worked through below.
I have a list of grades [5,6,8,9,15] and need to sort them from highest to lowest.
The computer looks at the first two: [5,6]
The second (right hand) is larger, so they are swapped [6,5]. Then the next two are checked [5,8].
Again, these need to be swapped [8,5].
The next two are [5,9] which, again, have to be changed (see how the 5 is being pushed down to the bottom) [9,5]
Finally [5,15] have to be swapped to [15,5].
In one pass, the list has been changed from [5,6,8,9,15] to [6,8,9,15,5]. The computer will have to do this
sequence again, from the start, to change the list and slowly, pass by pass, move this to [15,9,8,6,5]. The
numbers would change like this, in ELEVEN steps:
[5,6,8,9,15] [8,9,15,6,5]
/ (6:5,8,9; to] (9.8; 19iG,9] Values that are
cs [6,8,5,9,15] [9,15,8,6,5] already in the
q [6,8,9,5,15] [15,9,8,6,5] ‘right place’ don't
[6,8,9,15,5] move again.
[8,6,9,15,5]
[8,9,6,15,5]
FOR j from 0 to N - 1
: IF alj)
>alj +1]
For the exam, you need to be able to compare and contrast these two types of sorting algorithms.
Bubbie (itt ae
Eficiontly handle big data sets?
Space used in memory
-
EE
Stable (never changes since _| Variable (splits the data in two)
items are just swapped)
In a box, mix up small 1. You need to work out the oldest person in a class
and large stones or of 20. Which would be the most appropriate of
marbles. If you shake the two sort techniques? Explain your answer. 3
them (gently) you will 2. Show how you would use bubble sort to E#
see bubble sort in create a descending list from this group: 22, 19, ht
process, as the larger 17 lS geno, rs
stones or marbles 3. Which sort technique is appropriate for large
come to the top. amounts of data?
ae , §
5
a,
ey
a
he
Son 5 * )
ae ie BE
B. Sorting algorithms MCE ce: 9
ahs a Tee ee x
Answer the following questions on a separate piece of paper.
wh
1. Complete the trace table for the algorithm below. =
number = 5
OUTPUT number
~
what
Vi
rf
FOR ifrom 1 to 3
5
number = number +3
OUTPUT number
END o
Y
aoa
eee
Wd
tSea
2.
=
6
><
ui
(8 marks)
2: ‘Decompose the task: an automatic car wash program that will wash
all vehicles from a small car to a minibus. (5 marks)
_ 3. Decompose the task: make your bedroom neat enough for an inspection. (2 marks)
e 4. Explain how decomposition helps programmers code efficiently. (3 marks)
_ 5. Explain how abstraction helps programmers to plan a coding solution to
- aproblem. (3 marks)
«6. Describe what this algorithm does.
: counter = 1
: WHILE counter < 11
-_ PRINT counter
counter = counter + 1
PRINT “All done”
2 END (2 marks)
ez Explain how the efficiency of algorithms is judged. (3 marks)
8. Compare and contrast linear and binary search algorithms. (5 marks)
. Compare and contrast merge sort and bubble sort algorithms. (3 marks)
of
Fun
alg
Exam practice questions Batre le ies EY
Main sais types Programming concepts
a Data types allow us to categorise the range There are three main constructs within
of data that is used in programs. Computer coding: sequence, iteration (or repetition)
programs treat different types of data in and selection (or choice).
different ways.
Constructs
Here are the main data types:
Sequence is the simplest form, or
Integer is a whole number, no decimal point structure, of computer code. The computer
or fraction, no letters. It might be used to moves from one statement to the next
define a count for a loop — you can only in sequence. There are no loops, no
perform an instruction a whole number of branches, and no instructions can be
i =
times, not 2% times, for example. (It’s a skipped.
term you might have met in maths.)
Boolean data is digital: yes/no; on/off; true/
false. This is essential for loops — for example,
is the temperature over a set point? Has the Sequence structure follows one path from
loop been run x number of times? (You should start to finish.
have met this as part of your work learning
Iteration (or repetition) refers to the
how to search the Internet effectively.)
number of times a computer passes
Real data tries to reflect ‘real’ numbers, so
through a set of instructions. One iteration
this includes decimals: these are sometimes
is once through, and would be shown
described as ‘float’ numbers because
in a sequence-based code. We tend to
the number of decimal places can vary
use this term when referring to loops in
depending on the level of detail needed. It
code — for example, how many times (or
might be used to show the weight of an item
iterations) will the computer complete this
in kilos, or fractions of distance measurement.
section of a code? There are two forms
/ Being specific about 4.75 kilos, not 5, for
of iteration: definite (also called count
example, could make a difference for dosage
control) sets the specific number of times
of medication or fertiliser.
an instruction must be performed and
Character is any one of the letters and indefinite (also called condition control)
symbols on a keyboard. You can also define allows for a variable number of times to
a number as a character when you don't perform the instruction, dependent on
want to use it for a mathematical operation. another factor, such as temperature, or
String can hold any number of © ; weight or time.
Data
types~ symbol. This can include name, address
alphanumeric characters: text, number,
Selection (or choice) is best
demonstrated using the ‘IF, THEN, ELSE’
and telephone number entries, for
%. description. If the temperature is 14
~ example. Although a telephone number iis
degrees Celsius, then turn on the boiler,
constructed of numbers, we don't use it for =
else leave the boiler off. Most computer
mathematical operations: itiseffectively an
code involves some element of selection.
adidiess, Xe)
& :isstored asa string. ae
pee | Sex=
Selection allows for a decision to change
the flow of the program.
Bs
ee
Saal
ie
Module4
Ee
() 0) ee en as Se —
, cet
By 3
’
-_
er
a: PS _
Fae
a.
HO sae whee NS ep snd reer Rh EPR MRR SMP, eater renee Nips. a wT Repsaicc e0
we Pea mas. les? 2h we a hie a Ncod Paes ae aot . 4
oo «=
Sequence oo « ae
axa ®
aos =
Name <- USERINPUT FOR i —1T0 10 IF age < 15 THEN What To Wear
OUTPUT “Hi,”Name OUTPUT i age <— myVar + 1 Main Decision — is it a school
OUTPUT “Press x to exit.” |ENDFOR ELSE OUTPUT age dau?
ENDIF Ais.ita ‘non-uniform’
Examples of codes that reflect the three main principles
day?
Both iteration and selection can be used in nested forms, which
ki
i4 b. Is the weather ¢ old?
3
;
e
mean that more than one loop or decision is ‘inside’ a larger part Is the weather wet? aes
of the code.
CG
d. Dol have games/ pe/s
science today?
In computer terms, the nested versions look neater than the DE
A
—— Ca E : ei , oe
Indefinite » Variable and defined by another factor, such as ‘while temperature above
20°C, hold the window open’
Nested » When you put one element ‘inside’ another, such as ‘putting on your blazer’ is
‘inside’ ‘getting ready for school’
Declaration » When you ‘declare’ something you define it, such as ‘AgelnDays = AGE x 365’
Identifier » The way an element of the code (variable, constant or subroutine) is labelled
modules [EE
Seni PeDE aSS eae
E OSS © * 3 Ee
Using pseudocode
=; Pseudocode is the name we give to a shared language that
coders understand and use for planning programs before
beginning the coding. Computers cannot understand it, but it is not
simple English either: it is a formalised way of writing that means
‘*, coders from all over the world will be able to make sense of it.
= Characteristics of pseudocode
» Always starts with the name of the program
» Made up of a sequence of statements or steps
» Each statement is written on a separate line
> Statements are written in simple English
> Keywords and indentation are used to identify separate
sections of the code
> No fixed syntax (so you don’t have to worry about semi-colons
FE or brackets)
Examples of pseudocode
1. Calculate the area of a rectangle. INPUT HeightOfRectangle
Module
5
>.
: EB
te:ss
=
2 Module
-_
~
pid eZ
_—
OE. a ‘ mf a ' . ha “e gt a ee ; rs
Relational
The most common relational operators are ones - INPUT TotalScore
you will remember from maths. * INPUT NumberOfStudents
The symbols we use vary from language to > AVERAGE int(TotalScore/NumberOfStudents)
language, but in pseudocode they are: : IF AVERAGE > = 50
OUTPUT “We did it!”
Action
| Symbol +f
. OUTPUT “We need to try again.”
ENDIF
programming
in
Arithmetic,
Boolean
and
relational
operators - END @
ee
e@eee
El
Module6é
Module 6 Arithmetic, relational and Boolean operators in programming languages
eat ed * uy ae
MMI“2 RIE
—— EI a
Ogee ' A: caus rede
itcentll Dios
Combinations
Natural English en
If it’s raining AND a school _| IF Raining AND SchoolDay OR WorkDay Raining is the main component,
day OR | have to go to work TakeTheBus then the decision is whether you
I'll take the bus, otherwise | ELSE are going to work or school.
I'll walk. Walk
ENDIF
If it’s NOT raining AND a IF NOT Raining AND SchoolDay OR WorkDay This time, if it is not raining or you
school day OR | have to go Walk have to go to work or school, you'll
to work I'll walk, otherwise ELSE take the bus, else you'll walk.
Pll take the bus. TakeTheBus
ENDIF
How would the results differ when using the MOD and DIV operators to calculate 11/2?
What is the computer output from the calculation (5+2) * (12/3)?
Write the pseudocode structure for a decision to have a cold drink if the temperature
outside is hot, and a hot drink if not.
The code development process usually includes creation of a flowchart since it enables the
coder to ‘see’ how the code should operate, which bits should go first, which bits can be
looped and so on.
E
Module
7
mt YOUN" | Veena: esnaecine? —Wadiiptndanattp
pease ceroUNE re wm, 66 RT a aie NED,
y
{
LEAVE SUNGLASSES
BEHIND
WEAR
SUNGLASSES
SNISUAapPWIVYD
weaicon
0} Juriba 40 UVY) sd
Java
UV
SSAT
i
jwuba
wWvsbod
1vu0iyy)a¥ UVa]O0g
ON
/SU011V1 34
0}
(Sapuiwusad
amvu
Shumy
JNYIWYIUY
avi
SUVs
fo
uo1simg
YIM
aYi
UONIWAIGNS
IPOIOPVISd
An-3yUM
u01qwonEEa1ynW
aunjonsys
pean
aofaq
Yy1M) 4aHayu1 10 WWINPOW
SMOYS
uoMIppyv
ayoo
fo
SaqquOUud
ssaoud buiuuyyd
fo ywd sv yfeasn
MOT
siayyo
burpyad
€ aUd}san|W
SMOT]V
L buawiwvabodd
apoo fo yuys ayy w sy}
hq
fisva
wimnba sabunbuy) huvw SatquoUd WiW
ubis = asn uayfo Saiquoud dol
puvysiapun 03 hsvy
I]AVUVA AO YUVISUOD
aU0ISITIW
Peer |
sjwyuawvpun4
Bi Vv Sumy fo poyjawm ay : ys buq uo pasyg
buiwwvs
oe
“Z
i
Z
2 AdAdU
Whi = abunbuvy pavys
&
quawayw4s
onwiupap
bod
quvjsuoD
JO
IUVU
J]GVUVA
. JUVvy}suo) ay} saurfad sadhy
fo
. y *=
U
abuvy) uvd sajqv SHE'Z'L ‘Ba —aouanbas
G8 it-G @ 2.2 SS
4 I]AVUVA ayy saUrfad UOIWIVIIAP 3]GVUVA
xa]V ‘B'a — Buys
(Ee 8 6 es
1 Woawaya suo buiqNd
01903125
919904
Buin10g
arya]
4$14
Way
{fo
319304
NAHL
U0
WAN
“B'a
=
4]
U017VJ9}|
SUOI}IPUOD A3YO UO
ywada
‘b £
—sabaqul
asuu
‘b'a
puy
—burpuadap
=
sabuvy
31009
ayiutfad
sabuvyp)
ayutfapu]
—
Jahau
ar
ZS+
G:a
pu
jas
ey
—
ae
L6urwmwesboig
ia
If you need more space to answer the following questions, please use a separate piece
of paper.
1. Look at the code below, and answer the questions that follow:
Counter = 0
WHILE counter < 11:
Counter +=1
PRINT counter
PRINT “All done”.
a) What data type is ‘counter’? (1 mark)
que
pra
Exa
4. Describe what the difference is between definite and indefinite iteration. (2 marks) .
\
f°)
s
5. Give a pseudocode example of nested selection. (3 marks)
:
:
©
bs]
6. What is the difference between AND and NOT Boolean operators? (1 mark) ©)
©
an
A.
pees of arrays
A simple array could be the names of students in a group: ¥
ClassGroup = [Alex, Bailey, Krishna, Jamie, Riley] ee
And now you could change things on this group as one group, rather than having to operate
on each individual separately, such as moving them from Year 10 to Year 11, or from Ms Smith’s
at
class to Mr Hussain’s class.
A two-dimensional array could be your class timetable or book reviews by different students,
so that each row is a different book, and each column is the review by a different student.
Now you can see how each book is reviewed by a lot of reviewers, or the type of book a
particular reviewer liked.
:We could work out from this that Jamie maybe doesn’t like reading at all and that the most
popular book is Flowers for Algernon. You can also see the record structure, the template for
data storage that will most effectively do whatever you need. In this case, entries cover what
the readers have read and the names of the readers: the table structure above does that.
Often this form of structure will include key fields which are uniquely attached to each
Data
structures
record, so that if there were two students named Alex who read Of Mice and Men, we would
know that this Alex was the one we were looking for, because the key field is different.
In your school records, you will have a UPN, a Unique Pupil Number. This is your key field,
or primary key. Even if someone was born on the same day as you, with the same name and
address, they couldn't be mixed up with you.
EH
Modules
tye: Data structures
i tte te eae ve eee i : z 5 ee
‘4 by . ' Le ae i 4 e = hd - * : ree 4)
ti : ; * Ber poe eg Dy dak geie ot dane
bine ew ok Ie
WY 4 PONS Remmi Caemest Rentiet ereacin ae «al
Poet DS wae.
You can use a loop to update simple arrays, and cover each of
item in turn:
fe HIGH=0
Lo
ene
A FOR EACH SCORE
S IF SCORE >HIGH
: HIGH = SCORE
END
Or you can use a specific index point (/in this example) to
access specific items within the array:
O is the first position, but you could start further into the array as | have
HIGH = 0 here, by saying that you only want to work from position 5.
FOR | IN RANGE 5: (LENGTH OF SCORE) —
IF HIGH < SCORE [I]: Make your fridge into a two-
HIGH = SCORE [I] dimensional array. Sort your
END fridge shelves into ‘dairy’ on
one shelf, ‘fruit/vegetables’
= Two-dimensional array on another shelf, and so on.
> Inatwo-dimensional array you can also access items specifically,
» or traverse the entire array. On a chess board, the array would
be defined as BOARD [8,8] because there are 8 spaces in each
> row, and 8 rows. Now you can identify where each piece would
be by identifying its row and column. Computers use this form of
reference to create the images you see on your computer, phone
and television screen: each pixel is defined separately. 41. What would be an
example of a record
Now to update the data for the reading scores table at the start of
in a doctors’ surgery
this section (Krishna now rated Jane Eyre 5, as well as the other
database?
books) you would identify the row and column:
2. What would be in an array
BookScore [0] [2] = 5 of pet names?
3. How could you make a
Sia one-dimensional array
aa of pet names into a
0 |a
Jane Eyre ee ee two-dimensional array
ae1|OfMiceandMen | 6| 4 | 5 that would identify the
[2|Flowers forAlgernon|
9_ pet type?
Your code needs to be able to handle this sort of task. You need to be able to gain input from
the user when you need it — from a keyboard for example — process it, and output a result of the
processing. Usually, as part of your coursework, you need to be able to handle a text file. Often
these will be in .csv or .txt format.
One way of handling files is to create one from your first entries:
PROGRAM ‘CLASSGROUP’
ClassList = [“Alex”, “Riley”, “Chris”, “Bailey”, “Jamie”]
PRINT “Enter new name”
INPUT NewName
APPEND NewName TO ClassList
SAVE ClassList
3 This adds names to a
PRINT ClassList class list — a safer way
END of doing this would be to
use a copy of the class list.
oeees#eeeeeeese#eeegreeeveeee e
eee
eeees+#eesereersessereeeteree#e#setkset
Often files already exist, and need updating rather than creating. In this case, the code
above wouldn't work because it could repeatedly overwrite existing names.
PROGRAM ‘CLASSGROUP’
ClassList = [“Alex”, “Riley”, “Chris”, “Bailey”, “Jamie”]
PRINT “Enter new name or x to exit”
INPUT NewName
file
and
handling
Input/output
IF NewName = = ClassList
PRINT “Name already exists”
ELSE
IF NewName NOT x
APPEND NewName TO ClassList
SAVEAS ClassList2
PRINT ClassList2
END
WORK = OPEN(CLASSLIST.csy, a) Opening the class list just to append data to it:
there is a new student who must be added.
Considering the example of a class list shown above, the reason for accessing the data will decide on
whether to open the file in read, write, append or read and write mode.
Simply reading from a file can be done by displaying each line number from the first to the last in a
FOR loop.
OPEN (ClassList.csv,r)
FOR Eachline IN ClassList.csv
OUTPUT Eachline o
END
ib.cSv » Comma separated values: files in this format often are arrays that will easily import into
a spreadsheet or database program
.txt » ‘Text’ files that have no formatting and are easily opened in a word processing program
String handling
Handling strings refers to ‘groups’ of characters. There are a range of operations that you
might need to perform on strings: i,
Ces
e length » the number of characters.
e position » the location of a specified substring.
e substring » any contiguous sequence of characters within a string.
| © concatenation » the joining of strings end-to-end.
| (| e convert character to character code » conversion to ASCII code and back again for
yet example.
| e string conversion operations » changing letters from uppercase to lowercase for example.
if
eo A string is a sequence of characters in memory, just like a piece of string.
An important characteristic of each string is its length, which is the number of characters in it.
The length can be any whole number or integer.
A particularly useful string for some programming applications is the empty string, which is a
string containing no characters and thus having a length of 0. Programmers can set up this
string for error conditions, for example, and set a test of looking for whenever that string is
greater in length than O.
In Python version 3 and above, you can see we have two strings below, and | am asking it to
| identify a specific location in each one — position [0] in string 1 (i.e. the first character) and
positions [1:5] in the second (characters 2 through 6).
/
handlprint(“var2[1:5], ”, var2[1:5])
print(“var1 [0]: ”, var1[0])
vart[0]: H
var2[1:5]: ytho
BS
Module10
BiG‘Module 10 String handling
“e vem Le Pp i - ay we @ a =? of (veers
~ i7t a ee dy ¢ £0 + at ba kioy dl t= i }
fe yat : Od bbs AO ROS ak | a oe
Bie." . eh ot a ee 2 | ee PF ack ey <a
Pseudocode
examples
ay
a Stringname.length OR How long is the string? For example, how many students in a
*
LEN(stringname) class? (Remember strings start at position 0.)
someText="Computer Science” print(someText.length) (OCR)
| Return the position String.indexOf(n) Looks at the nth entry in a file (indexing starts at position 1)
in a string if contents of file fruit.txt is: L1 orange L2 banana L3 grape
line2 — READLINE(fruit.txt, 2) # line2 is “L2 banana”
Return the substring | Stringname. Substrings start with the Oth character, and will ‘chop’ strings
data within the SubString(startingPosition, into smaller groups:
) string numberOfCharacters) CutText=”"Computer Science” print(CutText.substring(3,3)
will display ‘put’
Concatenation of String.Join OR NewString = Appends one string to another to make a longer string.
two strings String1 + String2 if contents of file fruit.txt is: L1 apple L2 banana L3 clementine
and contents of file veg.txt is: S1 potatoes S2 celery S3 pepper
Can also sometimes
include: , and & Then shopping.txt = fruit.txt + veg.txt to create a shopping
list that includes both entries. note + does not work as a
mathematical function
Convert string to Int(string) Changes the string into an integer. You might need this if you
integer are working out ages or scores.
Convert integer to Str(integer) Turns the integer into a string — such as a telephone number.
string
Convert string to Float(string) You may remember about ‘floating’ decimal places — ‘float’ is |
real also a Python command you might recognise. 1% Bi
Convert real to Str(variable) You can also change the decimal number into a string, such ce .
string as an IP address. a:
Convert content of | String.toUpper(inString) |Changes to content of the string to all upper case letters. .%
string to upper case re y?
Convert content of | String.toLower(inString) |Changes the content of the string to all lower case letters. ag
string to lower case 7 a
4 x
e &
a F ¢ - » 4
i M4
| String handling BCE
y ph ote ee rem x [,. 4 ia :. i
%
»|
Truly random numbers are hard to come by for humans: we
tend to stick to patterns. When we talk about random numbers
we are often really referring to chance — that there is a uniform
distribution of, say, flowers in a meadow. Of course, this isn’t
really the case, because the flowers will go where the conditions
are best, rather than spacing themselves out evenly.
c r= aM
* & Selecting random numbers
In pseudocode, random numbers are selected using the term
RANDOM
a res, % ra *
i programming language
andom enld tlgeneration ina Module 11 [> fi
Introduction to databases |
Relational databases hold data in a structured format that allows it to be readily searched hee:
and processed by the computer using algorithms. A good example of structured data is data
held on a spreadsheet where every cell is addressable and identifiable and data can be
sorted by multiple criteria. In databases, however, the structures are clear: called records and
fields, they manage the data in a fashion that allows the program to search, update and edit,
delete and report back on the contents in a speedy and effective way.
SQL (Structured Query Language) is a language designed to work with relational databases.
In simple terms, unstructured data is the opposite. Computers are not as effective at dealing
with unstructured data: this is something humans do better. An example of unstructured data
is the content of an email message, which is difficult to categorise into a table.
Components of databases
Databases have two main elements: the part that actually holds the data and ke
l
it the DBMS (database management system) that is used by applications to 12
sie
ie
t
access that data. It is the DBMS that enforces the structure, ensuring that:
» all relationships between data are maintained (so everyone who started the day in class
7W ends the day in class 7W unless there’s a deliberate action to move them)
» all data is stored correctly and rules are not violated (So no one in class 7W is 64-years-old)
» all data is recoverable to a safe point in the case of a disaster (keeping backups). &,
Although there are a number of different ways to organise data, over time relational databases
have proved to be one of the most powerful. In relational databases, data is held in tables which
represent a set of items such as employees. Each table is constructed in columns and rows:
Each of the titles here refers to a field within the table.
Fr
eae
33 [Sexy gy" ee oF a eee
|FormGroup”
3) eae Eu om cla ea
You can see a UniquePupilNumber is allocated to every student. This means that no matter how
® many Alex Hussains there are in the school, or in the country, this one is the only one with that
4 number, so we can use that number to check we are using the correct data.
a —
a
+ :*
~
2
‘Module 12
eae” an
47 :.,
a
em
_
ee
The technical name for the field that we guarantee is unique to each record is primary key. Often
when designing database tables, we will include an ID field automatically, and relational database
programs such as Microsoft Access® automatically include this field whenever you create a table.
So far this table has very little detail. The rest of Alex’s class could be added without a common link but
these would be contained in unrelated tables. A new table called FormGroups could be set up with the
FormGroup (EH) field used as a link between them. Links between tables using common fields are the
power of relational databases.
When more than one table is used then foreign keys can appear: this is a field in one table but also
a primary key in another. In the case of Alex, her UPN is a primary key in this table, but might be also
included in a class table for each of her subject classes, so would be a foreign key in those tables.
< ae <9) ea
One-to-one — This is when each entry in our student table has only one relationship in another table.
Generally, we don’t use one-to-one relationships much because if there is only one link, that data could
often be held on the single table.
One-to-many - This is the most common type of relationship: each record in one table links to one or
more records in another table, but each record in the second table links to only one record in the first
table. Looking at Alex's table, while she has only one form group, that form group will have more than
one student. is
Many-to-many -— This is when each record in one table links to one or more in the second, and vice
versa. An example here would be Alex’s teachers: each teacher may teach more than one subject
and each subject may be taught by more than one teacher.
Setting up these tables is an art in itself of decomposition: breaking down a task into smaller tasks
so that a computer can process more effectively. This also applies to databases — in this context you
decompose your data into multiple tables, to limit duplication of data entry and storage as far as possible.
Module12[El
+
‘
If you need more space to answer the following questions, please use a separate piece
of paper.
2. Read and answer the questions about the following table in a relational database.
que
prac
el
Exa
yas
=
——
5
fe 3
into Little ones (Aecom-
position) makes it more
achievable.
Updating the code is made
easier as subroutines can
be edited individually.
"J
3
th
ad
WV
a ©]
=
G
Wi
4
~
< Using code modules or subroutines (one for
each part of the task) makes it easy to see which
5 part of the code does a specific task.
°ma
2 Advantages of subroutines
~.
Wi
/
Iteration: the code can be written once, then used again. An example of this is the drain
oe
) or spin cycle on a washing machine: only written once, but used a number of times. In the
controller code, there will be one set of instructions to control the action, often either at the
< start or end of the main code, and within the main code there will be the instruction ‘spin’ or
ho
Ld
‘drain’ and this will call that subroutine into play. ee
ww
3
matter how many times you need it, your code can be considerably shorter.
"So
Fi
Module
13 Wty. ITT ci. Introduction to subroutines and structured programming
Translators — usually included within programming software — convert high-level language into low-level
language (machine code). There are three types of translator: assemblers, interpreters or compilers.
Advantages Disadvantages
Assembler An assembler translates This is far closer to Very device specific with
assembly language into the machine code, so __| limited instructions available.
machine code (also there are fewer errors in |More difficult to code and
Known as source code). translation. complex tasks require long
programs.
Compiler A compiler translates the | This is much faster than | It can be difficult to test
whole program that the running interpreted individual lines of compiled
programmer has written code, since once it code compared to interpreted
into machine code in one | has been compiled it is |languages because you only
sweep before the program | done. get to know the errors after
is run. the whole program has been
compiled.
Interpreter An interpreter translates Interpreted code will Running this can take a
code written by show an error as soon | lot longer than compiled
programmers into as it hits a problem, so |code, and since the code is
machine code, it is easier to debug interpreted one line at a time,
instruction by instruction | than compiled code. each time you run it you have
as the computer operates to interpret it again.
it, not all at once.
In pSeudocode, the general practice is that subroutines are kept at the end of the code. The
syntax for subroutines is straightforward: programs always begin with ‘program name’ and
subroutines start with either <sub> or <proc> (or <procedure>) followed by its name and
parameters.
Wi
Y The parameter defines how the rest of the subroutine operates.
=
~
Example:
lf a tree grows 20 cm per year, then the subroutine
2
=Oy)
A more mathematical example could be to draw a graph
showing the grades achieved by a class of students:
SUB Graph(x,y)
"Oo Where the x and y values are set or calculated elsewhere
= in the program.
Y
Le A more complicated example can be seen if we go back to the washing machine code:
=
6oa
PROGRAM “WashingMachine”; SUB WashCycle
Check WaterLevel WHILE Timer <10
a.
WashCycle machine with water Turn drum left 30 secs
ELSE without overfilling! ENDWHILE
Fill ENDSUB ae
ENDIF and back aga
Ls SUB SpinCycle (SpinSpeed)
\
WashCycle Rt ahs Turn pump ON
SpinSpeed = 800 W iis Int (SpinSpeed)
5
"oO
RinseCycle
SpinSpeed = 1200
se
jira
at IF pump dry
Stop spin
°
SpinCycle ELSE
END SpinCycle
= ENDIF
ENDSUB
36| toys
(Tl Parameters and subroutines
SUB RinseCycle
Check WaterLevel
IF WaterLevel = Top
WHILE Timer <10 Rinse Cycle, in this case, is just a"
Turn drum right 30 secs ONE rinse, but modern machines
have a different final rinse that
Turn drum left 30 secs often includes fabric softener F *
ENDWHILE a LTT aed
ye euuueaee
ELSE ana.
Fill
ENDIF
ENDSUB
END
It can sometimes. be problematic to use a variable from outside the subroutine (or global variable) so
sometimes a subroutine will use its own variables, such as the timer in the washing machine example.
This is called a local variable and is sometimes more reliable since it is only used and defined inside |
that subroutine and not affected by anything from the rest of the code.
Local variables are just used in the function where they have been declared, and once the program a
comes to an end, the local variable is erased from computer memory.
Global variables are usually defined at the start of a program, outside of any function. They can be
called or accessed from any function or subroutine at any point of the program.
Global » When referring to a variable, this identifies one that operates in and is referenced
by anumber of elements of code across the program, such as TIME
Local » When referring to a variable, this identifies one which is only referenced within its
own subroutine or function
_ Use parameters to define how a friend 1. In the washing machine code, is the
~ moves or performs a task — tidying their room WaterLevel variable global or local?
f angrily or brushing their hair twenty times, for 2. Why are global variables sometimes
ex problematic?
=
workload, and costs more too. OUTPUT “WELCOME, FRED!”
6
Proofreading data — this method involves END
someone checking the data entered
ye against the original document. This is
) also time consuming and costly.
5
2
° Testing
ec Testing takes place after creating any program to see if it meets its original specification and
is fully functional. This is done through using test data from across the expected range as
well as invalid data.
You must use a clear range of test data, and be able to justify your choices.
Lf)
evaa_|pemen sedi [
Type of Example (checking age | Reasoning
\
° feeiael
Erroneous
ae
FRED
you've used => rather than just >.
Checks that the code is strong enough to withstand ;
= (or invalid) input that results if the user is malicious or is not
paying attention.
Language classification
There are a range of programming languages, all of which fit into two categories:
High-level languages are closest to human language, and are the most recently developed. They
need a compiler because the computer doesn’t understand them.
Low-level languages are closest to the way the computer operates, with direct commands the
computer understands.
High-level languages Low-level languages
Easier to read because they are close to human language. Hard to read because they are closer to computer code than human
language.
Most code is written in these because they can be designed | Only specific tasks are written in these because they are complex to
for a specific purpose and are easier to use. operate.
Easier to learn because they are closer to the way we speak. | Harder to learn because they are not in a familiar structure.
Used to control software more than hardware: you can control |Used to control hardware rather than software: you need to know the .
many computers using the same language. computer for which you are coding.
__ | Examples: Java, Visual Basic, BASIC, the C family, Pascal, Examples: machine code is the lowest level language, and the only
Python. : one that the computer can handle without any intervention. The next
is assembly language, which is a little closer to human language. True
machine code is binary!
Each processor (or chip) has its own machine code instruction set, which is why if you want to use
machine code you have to know the machine! The few people who still use assembly language are
those who work in designing software for embedded systems (such as a sat nav in a car) or for
controlling specific hardware, such as writing device drivers.
Validation » Checks that data is reasonable, within any set limits. It does not check that
something is ‘true’
Authentication » The process of identifying a user accessing a system or program,
normally through a username and password
Verification » Checks that something is true. This is hard for a computer to do, since as yet
we do not have reliable ways to tell if someone is being honest
Embedded systems » A computer system with a dedicated function within a larger system,
typically an electrical or mechanical system
1. The code below checks for an age entry of greater than 13.
abvunbuv
“pasn MyUOWWMOI JON
ee
Ayquiassyv
Sianup
aniirap
yuoourng
|oe
1903-07
4SaMO]
yova sjaaw apod ayifo ywud wym sabuquvapy
PUT
—
ysodubis sauzqnoignis 10 SajvipOW
S1
SaUO W191 49 juuss ybonosyy Ls a GY havuig — apod
Sv} b1q ay} 2321 AWAOD 0} J91SVF IUIYIVUA JS9MOT
hyjaywivdas 4sv} wus uorvorfissv9
yava DUIPOI PUY SaUo JayJWWS 07U1 abunbuv)
sysvy abiv} Buisodwmosap suvaw
nsug oud
WwISd 'Sa}awWvxI
Sayvsado IUINIOAGNS VY MOY 10AJUOD
pasn sabunbuv}
JOMOA AdNAWAOD BAOU SPUuVvwWdd SIQ}OWIVAVA asN ‘ yana1-Y BH UOWMAOD SOW
aye : ‘ > y aqu]suwy 0} sBY
apo ajdus
JaIndwoo asnvoaq
UvY1 BUIPOD aOW S$ay4V1 SAW19W10S
U01}VJaA0 U1 AIMO]S
PVIA 01 ABPIVY SIW1}IW0S
burwiwysbold
papaau aurdrvsip-fjas wow YInW\ sabvyuvapysid SaUTNOIGUS UNIS PUY ISNGOY abunbuv}
UVWNY, 0} 3S0]D
IYO IY U1 AIYMasja Jas SA]FVUVA as
ing 3
SUIS JUNPIMPU1 3$9} 0} A91SVF sabvyuvapy c
syybu ssaoov shyiquep
YuorYInAwISUA abuvs WIYNIM S1 YIP avq s1 vy ayy Wuyfuod 0} VIP
syayo — UO1UPI]!VA sysayo — uO1IwIYfUaA Gu ayy siaqua sasn VY
syvaya — UOTWWITUIaYyINnNYy
U01}V49}]|
dew puiy Bac
If you need more space to answer the following questions, please use a separate piece
of paper.
5. What is the difference between data validation and data verification? (4 marks)
6. What rules should test data follow? Give reasons for your answer. (6 marks)
7% Explain the main differences between low-level and high-level languages. (6 marks)
eT EE Eee EEO
que
pra
dex
Exa
Exam practice questions Borie Titi: pe at |
Be 10101010 1010
7
a ee |
a a .
which can be either ‘on’ or ‘off’, represented § Predicting the sequence is easier if you look
by 0 for ‘off’ and 1 for ‘on’. Counting in at each one in detail. Base 10 would look like:
binary is easy once you see the pattern.
Most exam boards focus on 8-bit
Each time the numbers move to the left,
structures, so we'll use that here. This
the value increases by a power of 10, so
Each hexadecimal digit represents 4 bits |128 |64] 32] 16] 8[4] 2[1
(or a nibble), so this is more human-friendly Each time the numbers move to the left, the
<a:
LS than binary. value increases by a power of 2, so 2 is two
times 1, 4 is two times 2, 8 is two times 4.
/
Base 16 looks like:
Js oes.” and
Binary arithmetic yT
Using the following rules, it is also possible to add 8-bit binary numbers together without converting to 0
another format. a)
Consider the following addition: 0001 0101 + 0010 1001
Work from the right and follow these basic rules:
(0+0=0), (1+0=1), (0+1=1), (1+1=0 and carry 1) and (1+1+1=1 and carry 1)
OAD TT Ost
0 7 31'0.0°4 16
ant he
carry line: ibat 1
We use leading zeros to show where the other digits are, to indicate that this is 8-bit binary.
Units of informer
ing
waa YOU need to remember the basics:
4- bitbas3-
bit
You will remember that a bit is the smallest unit of storage: just one element — a 1 or a0. We
use these bits in bundles, or clusters, since one on its own isn’t really all that useful. 4 bits are
a nibble, 8 bits are a byte.
Using these combinations the computer stores all the data and presents for us on screen
what we require. Graphics, sound, text and numbers must all be converted into binary for the
computer to process them. They can be represented in 4- and 8-bit formats, and the basics
can be shown with graphics for example:
7
If we code 0 as white and 1 as black, we can make this image easily with 1 bit per pixel (or
square).
But black and white is limited — most graphics use more colours than this — so if we try for 2
bits per pixel we can add to this, in binary form:
1 bit per pixel: 2 possible colours So, for example:
2 bits per pixel: 4 possible colours OO stays for white
3 bits per pixel: 8 possible colours 01 becomes blue
4 bits per pixel: 16 possible colours 10 becomes green
11 becomes red
oOo [cc\an om racrmleyase Cark yellow 128,0128,0 | yellow 255,255,0 white 255,255,255
But this is still limited. 4-bit graphics use 4 bits per pixel, and 8 use 8 bits per pixel, to allow
us to show more complex colours.
LN
information
of
Units
Greta
and
character
encod
ere ctarencoding
Since we know that computers only work in binary, we need a way of translating the character set
(letters, numbers, and symbols) typed on the keyboard into something the computer can process.
The two main methods you need to know are:
Se > R emember
ber to
t count fromfromthe
the rightrightand and the
th
ASCII
ASCII stands for American Standard Code for Information Interchange. The first 32 codes (0-31) are set
aside for controlling devices like printers. 32 is a space, 33 an exclamation mark, and the codes then
follow the sequence along the top of a keyboard layout. There are a total of 128 characters represented
by ASCII.
Unicode
Unicode is an industry standard for texts encountered in most of the world’s writing systems. Unicode
uses the same codes as ASCII as far as it goes — and then extends to cover a wider range of
alphabets and special symbols, using between 1 and 4 bytes per character. You might have seen
character coding called UTF-32, which stands for Unicode Text Formatting 32, the simplest encoding.
Over 100000 code are assigned in Unicode 6.0.
ee kes
Peas Make coded messages with 1s and Os
that must be decoded with some squared
ah Saki paper. Use the ASCII table at the end of
Harel the book (or a Unicode table online) to
Rares
F
help you design a message using the
Once you know one code codes rather than the letters.
you can often work out the rest.
ad
ae ee
J ty
Both of these code the character sets in a logical Led
pattern (such as all capital letters together, all
. What size (in MB or GB) is the hard
lowercase letters together, and all letters in
drive of a computer at school?
alphabetical order, all numbers in ascending order)
Convert that number into the number
so that in ASCIl, ‘A’ is 65, and ‘B’ is 66, and so on.
of bytes. For example, a 32 MB hard
drive would be 32*1024*1024 bytes —
Character set » The letters, numbers and 33554432 bytes.
symbols used on a keyboard. Different . How is Unicode an improvement on
languages, and even subjects, often have ASCII?
different character sets . lf the ASCII code for ‘A’ is 65, what is
the code for Q?
-_ Te
WS— ~
fo"
The resolution of a typical computer screen is 1920 pixels horizontally, and 1080 pixels
vertically, making the number of pixels shown on the screen equal to 2073600 pixels.
A common graphics file type is a bitmap. Despite being a rather large file type because it
defines every single dot in a graphic, this remains popular.
sound
d File name and
extension
Comments
The Microsoft BMP format is barely used outside Windows: it is large and unwieldy in file
size, not advised for use in web or print designs.
GIF (Graphic This was an original format and is best used for solid colours. It is a lossless format, so
Image File) even after the file has been compressed the quality remains unchanged.
JPEG (Joint Possibly the most well-known format, especially on the web, also used by mobile phone
Photographic and digital cameras, for example. A JPEG allows compression of graphics in a lossy
Experts Group) format, meaning that quality is lost as the file is increasingly compressed, but JPEGs can
also be saved in full uncompressed detail.
PNG (Portable Often used instead of one of the other two above, this can handle transparency better
Network Graphics) | than a GIF format, although the files tend to come out larger. —
TIFF Another popular graphic file format, this can also be compressed to different levels. Like
JPEG files they can be used uncompressed.
The size of a bitmap graphic uses pixels the same as a screen: in bits it is width (pixels) x
height (pixels) x depth (bits) or in bytes (width (pixels) x height (pixels) x depth (bits))/8.
The colour depth of the graphic is then expressed by the number of bits used, e.g. ‘64-bit
graphics’.
A simple 4 x 5 square shows how bitmaps Converting the black and white image into
are constructed:
itere(ti(-mE:g
Represent
byte is called ‘alpha’ and you might have seen that
in graphics work of your own. Alpha refers to the
|Green |0,2550 =
/Pink =|255,170,170
|0,FRO
Metadata can include details such as the purpose of the file, its time and date of creation, the author
or owner of the software, the location on a computer where it was stored, the standards applied to the
data in the file and the file size.
Representing sound
Sound can be recorded either using digital or analogue EN ff A
equipment with analogue recording the sound waves directly
onto a magnetic tape or physical record and digital taking the
analogue signal and sampling it to a digital file. Many argue the
quality of one is better than the other but there are many variables
involved in both, from the quality of equipment used and the
sampling settings used. Standard sound is 44.1 KHz — or about
44000 samples per second.
Sound file sizes are calculated based on sampling rate and sample resolution:
Fe a
SS eae oe
fiea)(_2 j[wea) [wea](2|[r=8](2 |(naa ee)
Character |p|x|1|rlulo/i|s|h|n|t|m|f|e|a|SPACE|
compression
itere(ti(-mwiea
Data Frequency |1/1/1]1/1/1/2]2}2]2/2/2/3}4}4{ 7 _|
Table offrequency |
EE todsie
A tree is built by working out the frequencies — in the table — and making the two lowest elements
into ‘leaves’ creating a parent with a frequency that is the sum of the two leaves. Pulling in the other
frequencies as you go, you build the tree until only one number remains.
This number is the root of your binary Huffman tree. To generate a Huffman code you go through the
tree to the value you want, outputting a O every time you take a left-hand branch, and a1 every time
you take a right-hand branch.
Decoding a Huffman encoding is straightforward: as you read bits in from your input data you pass
through the tree beginning at the root, taking the left-hand path if you read a O and the right-hand path
if you read a 1. When you hit a leaf, you have found the code.
While ASCII is a set length (7 bits), Huffman coding is a variable length system. Calculating the size of
the file depends on knowing the length of the code.
Coding the word FOOTBALL in the example below: L at 0; 0 at 1 (only because 0 at 0 looks odd: either
way round would work) then the other letters at F = 10; T = 11; B = 100; A = 101
aeae
Toe dae
module19EI
yb Jsowjybu ayy qyybu ayrys
aso} ‘1f2] ay} 0} asu| 1vn1b07
yfiys
yor
abv103s fo yun
i7wiquassa JOU wyyawvpurs — 11g
SIN10]09
Ng ‘Sdaquinu Jano hsv
moqu Buimouy YUOM
wow
1axX1A
aoW
NIOSV SpuUeqxX"
=
Syiq
Jad
—PyoM
avy
U01}V}WUasadaa (sri
ui sabuuburyy
JSOW SIBAOD
vywyp fo
— aponun
sadhy
uww
buipoouy
({fo puv uo) sjvJusawmvpun4
JaVIDYD
|
smoys 0
puy hjUo
SABPIVIVY)I
syas
SHAOM AaINAWOD 944
NVM ay} 0} 4Saso]D
abunbuv)
ys buy
asodund saw1jawos — IIDSV
pivoghiax
(219q1U) 119-4 V SU puyv abunbuvy
Sasvg SA1AWIO9
U01Sae v UO Shay IV
huvuig burquasaidas fo uo Burpuaday saffia
hm hypuarssasn sow yownNrsapyxaH JaQWMNn
J-V UaVyi 6-0 WOAL S205) 99/1 VU
buipod
4 nH WUOS 03 satuanbass
UyUsI
dV} INO AAOM
wwned
iSv OJ Av1}vs JsoW saiuanbadf 4134}
(Su1podua
puy anyon ponquay
yybuay uny) ITe f0 SUM, ay} SapooVy
dew pull uol}e}UaSa/d~a, e}ep jo sjeyJUaWIepUN
If you need more space to answer the following questions, please use a separate piece
of paper.
10. How many possible colours may be coded with 4 bits per pixel? (1 mark)
a
11. Explain how sound is encoded so that#t can be transferred from natural
analogue to digital files. (5 marks)
repr
of
Fun
data
ists = lial Ae ‘
NtAe RR we csFRRLo a, B#91010104010101010
Hardware and software
In essence, a computer is the product of hardware and software. It is no use having
the newest and fastest computer if it has no programs, and the best software in the world
cannot operate without hardware of some sort.
Hardware refers to the parts of the computer that can be touched or seen: they are the physical
components — they’re ‘hard’. Software is the coding, from the machine code to the top level
language, which makes the computer perform the operations required.
Hardware Software
Grats, Ti ius
software
Hardware,
and
Witere(ti
logic
Boolean
t-te
ert iM Hardware, software and Boolean logic
yo. %
er aewd
A %A eaie ve we 1. exer oad
A m UA
f K “ Q
B im 8 .
The truth table for an OR gate looks like this: yo :
i = To work this out you would need to follow the bot:
data, so start with the AND gate: -
9
Design an interactive poster with 1. If a gate has two inputs and operates when either input
pockets that you can fill with is on, which type of gate is it?
counters to show each of the gates 2._If a gate has four inputs and only operates when all
in action. ~ four are on, which type of gate is it?
Rs \ —— _
“a | ‘ 2 ,
WS ee
Hardware, software and Boolean logic Bu Cy(. psu 53 |§
: a i)pe if =
) ri Y
ES
~ "2 > ' ' of
Classification
There are two main types of software that you need to be able to
distinguish:
1. System software, including operating systems and utility
programs
2. Application software
System software
System software is the software that operates the computer
hardware itself — not anything that you interact with, except
possibly to log in, or respond to messages. Within this definition
are operating systems, device drivers, virus protection HARDWARE
programs and computer maintenance programs such as disk
defragmenters.
seo
=* including
purposes
receive
management 2
12 ¢ 5
outside aos
‘ = sS O° ¢=
&3
9 ace > 30 3
$2 8%5 SQM”
= foot = (also
ad t il § ssoldest
sCetAallS? yg
a ( einer conmputerks
x
®
e
Software
classification
Nay tose SS
= 32 ° oO eC.
ae
cma
te
oe
° T} easier
my 2 a
o® Za: Q.
Aa a
iQo Cy ains
= 4
®
yc s 33
3‘applicaations
G
dishwashers
ing contention
3
20:
)
awe
uoTeS
number aao 5s¢
commands— ~ of
runs© compact & =
Lidementia @
Operating systems
Operating systems (OS) are key to the function of any computer.
» The OS controls the operation of the processor and memory, by managing the resources so that
each application is allocated enough processor time and power, memory and hard drive space to
complete its job. In this, the OS is like a referee, making sure everyone plays a fair game.
» The OS controls any peripherals, like printers, scanners, barcode readers that are attached to the
computer. It will use specialised drivers to ensure that the right instructions are passed in a way
that the device can operate.
» The OS controls security — logins and sometimes basic firewalls and anti-virus facilities are run
through the OS.
» The OS provides a foundation for all application software to run, allowing software developers to
write for an operating system rather than for a computer design, as was the case in the early years
of computer development. This is because each OS has a standardised API (application program
interface).
There are many different types of OS — Android, Windows X and Mac OSX are probably familiar to
you, but there are others such as UNIX and different types of LINUX like Debian and Mint. Some are
proprietary, which usually means you pay for them, while the LINUX types are all ‘free’.
a : Se = a
Utility programs
Utility programs perform specialised tasks, rather than juggle lots of demands like the OS. Some
utility programs are included in the OS, such as disk defragmenting and file compression. Anti-virus
(AV) and firewall programs may be utility programs with which you are already familiar. Regularly
updated security software is essential for safe function online.
Rs ge
oesDSS Sans
LF
Pi
a *
Se a a aD
Application software
Application software is the software that you as the user install, and it is the software with which you
work most frequently. Word processing or presentation or spreadsheet software is application software,
as are your email client and Internet browser. Again, as with utility software, application software tends
to be installed for a specific purpose, such as managing emails or browsing the Internet.
You need to remember that this really only applies to the stored-program computers, in
which an ‘instruction fetch’ and ‘data operation’ cannot occur at the same time because they
use the same bus. This is called the ‘Von Neumann bottleneck’.
Traffic along a bus in the model shown can only go one way at a time — it is a serial
connection — and therefore the performance of the computer was significantly slowed.
Modern architecture overcomes this because the same memory is used for both program
instructions and data.
/
The fetch-execute cycle is the process by which the CPU reads (fetches) instructions from
the memory cache, decodes them, and then operates — or executes — the instruction.
Components
Memory
the CPU rather than in separate places on the circuit board, where the main mer
connectors are located. |
The computer uses cache ‘memory as a form of buffer because the CPU worksesfas
instructions so the processor can access them faster than from RAM each ti
tr
Cyt
architecture
Systems
(yee A register is a small amount of storage not accessed by main memory and
to get data to the CPU. Data used most frequently can be stored in registers
fastest access time.
EE odie 2
' Processor
| The speed of a computer processor is often referred to as clock speed. This refers to the internal
clock in the CPU that keeps everything working to time, like a conductor keeps an orchestra
; synchronised. The faster the clock, the more instructions a CPU can execute per second.
Clock speeds are measured in MHz (megahertz) or GHz (gigahertz). One megahertz equals one
million cycles per second — but remember that a 2 GHz CPU is not necessarily double the speed of a
1GHz CPU because the memory, the task and the number of cores will all make a difference. Clock-
digital circuits use a clock signal to ensure all parts of the circuit remain synchronised. On a modern
processor chip, this is essential due to the high speed of processing.
Buses
Buses are pathways around the motherboard that connect the components that are attached. There
are two main types of ‘buses’ in a computer: the internal bus carries data within the motherboard, and
the external bus communicates data with peripherals and devices attached to the motherboard.
Each bus has pins or lines — there are three types:
» Control — used to send out messages to co-ordinate the activities on the motherboard
» Address — used to pass memory addresses from one component to another
» Data - transfers the data between all components.
The processor bus you may have already heard of, called the FSB or Front-Side Bus, carried data
between the CPU and the memory controller, called northbridge by IBM, in the 1990s. b .
ALU
The ALU (Arithmetic-Logic Unit) performs the mathematical and logical operations required by the code,
and then passes the result to the memory. Therefore, it does the mathematics (1 + 2 = 3) and the logic
(Is this string longer than that?).
. =.
Control unit » The component in the CPU that directs the operation of the processor. It %
controls the data movements around the processor
Stored-program » A program that holds all of its instructions in RAM rather than on another
storage device
Bus » A communication system (often through wires) within a computer that transfers data
between components, such as between the main processor and memory
Volatile » Memory that is wiped when the power is switched off
Main memory » A general term used to refer to any memory other than registers and cache,
that the CPU accesses. In most situations main memory refers to on-board or added RAM —
Clock speed » One way in which the speed of the processor is measured — in Hertz
Cores » An independent processing unit within a CPU so that the processor can run more
than one instruction at a time
Clock-digital circuits » These use a clock signal to ensure all parts of the circuit remain
synchronised oe
ALU » The Arithmetic-Logic Unit is a circuit that performs the mathematical and logical
operations within the Central Processing Unit (CPU) and Graphics Processing Unit (GPU)
c oaLies
across the world can access the same files. | your files safe.
Disaster recovery is easier — assuming that | Moving from one provider to another can be
your storage provider wasn't affected by difficult.
whatever hit your system.
Costs are generally lower per mB and There can be data ownership issues if your
storage Capacity is more flexible than local provider is sold to another company — when
storage. Facebook bought Instagram, all Instagram
content transferred a ‘license to use’ that
content to Facebook — without the users’
express consent.
The other option is to store your files locally. This can be either truly local — attached to your
computer through an internal or external port — or networked. Network Attached Storage is a
term that refers to hard drives attached to a network of computers solely for the purposes of
storage. You access them usually through mapping a drive letter, like N:\ or S:\ for example,
and the array of disks is treated as if it is one large hard drive.
Advantages of local storage Disadvantages of local storage
ir
You have control of your data The capacity is limited by the
External drives are cheap and have considerable capacity |Data recovery in event of a
for the non-specialist to use to extend their data storage. | disaster is down to the user.
Computer architecture is also found in embedded systems, such as digital watches, MP3
players, MRI scanners and traffic lights. An embedded system is one in which the computer
system plays a part in a much bigger device. The computer element is often nearly invisible,
Wty
Secondary
wee
storagebut essential. Unlike non-embedded systems, embedded systems are generally designed to ;
perform a single task rather than be general purpose computers.
<S
‘pages' and these pages are where than hard drives
Limited write cycles —
the data is stored. Pages are clumped (magnetic).
these wear out much
together to form “blocks”.
Start up faster faster than anything
SSDs can only write to blank pages in since there are no else.
the blocks, and only delete pages when moving parts.
Write speeds can be
there isn't enough space left to store
Some are slow.
the data required. As a result SSDs
waterproof.
perform less and less well over time.
Ideal for portable
USB devices.
A CD/DVD/Blu-ray has a single track Portable. Require special drives
of data spiralling from the centre to the to write to them.
On some formats,
edge of the disk. These are made up of
data can be Relatively small
bumps on one side, which show up as
archived because capacity.
microscopic pits on the other. The drive
it cannot be over-
motor moves a laser and lens system Easily damaged.
written (DVD-R/
to exactly focus on the area to be read/
CD-R). Some compatibility
written. The bumps (or pits) reflect the
laser differently from the flat ‘lands’ in iSSUeS ACross drives.
Inexpensive.
between, and the electronics in the
drive interpret this to read the data.
Magnetic Hard drives contain spinning platters One of the The disks eventually
(hard disk which are accessed by a read/write cheapest methods fail.
drive-HDD) head on an arm. This can move from to store data.
Surface can become
the centre to the edge of the platter up
Fast access to damaged leading to
to 50 times per second.
data. data corruption.
Data is stored in sectors and tracks —
Direct access to Cannot easily transfer
a track is one circle around the disk,
any part of the between computers.
a sector is a section of the arc. The
drive.
operating system often organises
sectors into clusters.
Computer systems
puyv
Aaqsibal
MdD
M1
dew pul BOC CEE tp
la
If you need more space to answer the following questions, please use a separate piece
of paper.
1. A modern smartphone allows the user to input data through the use of
a touch screen. State three other ways in which data can be input to
a smartphone. (3 marks)
Wi
2. Smartphones use solid state media rather than magnetic storage. Identify Co
2
two differences between these types of storage media and suggest why
smartphones use solid state storage. (3 marks)
ee
Vi
Y
3
rey
3. The output of an AND gate with three inputs (A,B,C) is ON when any one
input is ON. State whether this is true or false. (1 mark) uy
an
ded
4. What would be the output of this combination of logic gates if A is ON VW
and B is OFF? (2 marks) ie
a
A
2.
Q
B =
a)
5. Describe the Von Neumann model of computer architecture. (5 marks) as
Ra
cf. Why is it important for computers to have adequate capacity of RAM? (2 marks)
}
8. A lot of companies are now using ‘the cloud’ for data storage. What is
‘the cloud’ and why are companies moving their data into this form of
- storage? Nin (3 marks)
Com
sys
: NN a a re
There are a variety of different types of network within that definition that you need to know:
Local Area Network (LAN): A network in Wide Area Network (WAN): A network ifs
which all connected devices are relatively in which the connected devices are too
close together, in a single building or thinly spread to make a physical
premises, like a school or office complex. connection. These tend to be connected ft :
Because the distances involved are fairly through telephone lines, undersea
short, cables can be used to establish cables and, in extreme cases, satellite
physical links between each device and links. In a multinational organisation,
the servers and resources, usually through there may be LANs within cities, and a hi I
switches. Wireless and fibre optic connections WAN linking all the LANs into one large ! ne
also suit this type of network. LANs usually web. At the most extreme, the Internet
operate within single organisations. could be seen as a WAN. Sometimes, as in the
case of the Net, elements of a WAN are owned
by different people or organisations.
es of networksIm
Personal Area Network (PAN): A network often Wired or wireless: wired networks can use
based on Bluetooth connection between devices copper ‘Cat5’ ethernet cable for short distance
such as keyboards, pointing devices, phones, connectivity (up to about 100m from device to
audio headsets and printers. These cover very switch), with fibre optic cable used for longer
short distances (up to about 10 metres) but have distances. Wireless networks remove the need
the advantage that they can move with the user. for cables but all devices on the network require
connectivity.
Advantages
Reliable connection. Not portable — you're tied to the workspace.
Wired
Usually faster than wireless connections. |Generally more expensive to set up because
network
More secure. every device needs a separate cable.
Portable. Can lose signal under less than ideal conditions.
Can easily add and remove devices. Security can be an issue if passwords and other
Wireless
settings aren't strong.
network
Can be slow — especially if the access point
(WAP) is shared between devices.
LAN > Local Area Network. A network for one organisation, usually on one site, or sites which
are geographically close
WAN » Wide Area Network. A network usually for one organisation, covering a much wider
area, often countries or continents
4
Investigate the most common wireless security 1. When designing a new network for
protocols-WEP, WPA and WPA2-and produce a school, which structure would you
a factsheet on why they are important. recommend, and why?
2. Would a travelling DJ be better off
investing in wired or wireless kit? Why?
=
transports the signals. network. Bus cables are limited in
°2.
length and must be terminated
Best used in small or
properly to avoid reflection of
temporary networks — can
signal, which can crash the
be a useful home network
©
system.
solution.
Data has to ‘queue’ sometimes
because the bus is busy with
x
ted other demands.
A ring network has Data can be transmitted Expensive to cable.
©
all of the computers from different devices
High levels of redundancy
connected to each other simultaneously, making
question the cost effectiveness
ina circle. communication more reliable
=
in this model.
and faster.
Setup and maintenance is
@
This can handle high levels of
gai traffic because each device
difficult.
shares the load. Administration of all nodes can
installed.
Ideal for wireless connections.
Ly A mesh network
interconnects each
Fast data flow when it is
working well — all data flows in
Each packet of data has
to travel through all of the
N device with all of the one direction. devices between its origin and
a
others, sharing the load its destination.
Even when the load is the
for data communication,
same, this performs better If one device malfunctions
and generally producing
=
s6
than a bus setup. the whole network is
a much more reliable
compromised.
function. Each device can access the
resources on the network Setting this up is more
equally. expensive than a bus network.
Encryption: Makes data appear meaningless and provides security for the content both when stored
electronically and when transmitted using an encryption key. Decryption uses the decryption key to
convert the data back to an intelligible form.
MAC address filtering: Using a MAC address, a whitelist of authorised devices can be maintained
and any unknown devices questioned or blocked.
Whitelist: Identifies authorised sites if on an Internet filter, or users or machines if on a firewall. Only
those on the whitelist are allowed through.
Most networks will run all of these systems to help ensure that only authorised users and devices
access network resources.
3 Communication protocols
TCP/IP |
ah hah See
rw!
The Internet Layer is second from bottom. It packs data into packets
INTERNET LAYER | that include the source and destination addresses and the order in
: ; which the higher layers should reassemble the packets on arrival.
SL SE a ea |
S| NETWORK ACCESS The Network Access Layer defines how data is physically sent through
the network, controlling the hardware along the route. Protocols in operation
(or DATA LINK) LAYER here include IP and Ethernet. You can see evidence of the layer when you
view the NIC (Network Interface Card) in your computer.
a _
a F ; p ae.) an
oh
: 5
Communi cols Module 26 |67|
_-_ ’ ‘
n 7 Lan
‘ *
hen. ”
lf you need more space to answer the following questions, please use a separate piece
of paper.
1. A friend is setting up their home network and Internet access with two
computers, three tablets and their phone. Would you recommend that
they use wired or wireless? Give two reasons in your answer. (3 marks)
2. When would bus topology be a useful structure for network design? (2 marks)
ques
prac
Exa
5. What is the client-server model? (2 marks)
A]
6. What type of network is the Internet? (1 mark)
a,name
eS)
Identify each of the layers of the TCP/IP model of the Internet. (4 marks)
=
Y
da
=
d
ed
=
wx?
2.
=
°Ww
2)
Gis
one
&
e
ad
7
(1 mark)
S
&
"oO
=
3
bbe
Py a ae
_ Definition and purpose
Cyber security refers to the range of strategies we use to protect computers, programs and
data from malicious attack or damage.
There are an increasing number of styles and types of attack, and it is worth reading technology
we and business news headlines to be aware of up to date information.
-: -
5 Types of threat
>) The main cyber security threats that you need to Know about are:
Description
Malicious code Any element of code in a software system
that is designed to breach security or damage
the system, including viruses, worms, logic
bombs, Trojan horses (backdoor and
trapdoor) and other malware. Spyware is the
generic term for programs like keyloggers that
hunt out and transmit to a third party details
held on computer systems.
Your best defence here is common sense and caution, supported by up-to-
date anti-virus and firewall provision.
Poor password practice Many hackers rely on users failing to recognise the important of strong
passwords and exploiting the following examples of poor practice:
Leaving any device, website or software password at its default
admin setting.
Using the same password for many services: a social network and bank
account for example.
Using one of the many commonly-held passwords: p@55wOrd, for example.
and
threat
purpose Poor access rights
configuration/Network
Keeping track of who can access what is essential for any computer system,
including deleting the user privileges of those who leave the organisation. A
policy weaknesses good network policy includes the ways in which this can be done — allowing
no other, so that standardised approaches are used across the organisation.
It also specifies the computer systems themselves, so that software and
hardware are all to the same minimum specification, and sets up a regular
audit of all procedures, to ensure the rules are being followed.
Unpatched and/or outdated Browser and operating system, driver and application software, are regularly
software updated to ensure robustness and security — and malware writers are
inNMION, constantly benefitting from those who delay their updating.
Removable media The growing availability and capacity of removable media
such as USB storage devices and Bluetooth connected
devices means that your computer can be infected without
ever connecting to the Internet.
#73);
Module
27
Virus » A program which has been written to replicate itself on the host computer and
across to other unprotected computers where it has access
Worm » A program that spreads itself through network connections to other systems
Trojan horse » A program that appears to be benign but is actually causing damage that
the user often cannot see until it is too late
Backdoor Trojan » Also known as Trapdoor Trojan, is a program left by a hacker allowing
free unauthorised access to otherwise secured elements of a computer system
Malware » Generic term for software that users may unwittingly download onto their
computers, ranging from viruses to keyloggers and spyware
Spyware » Spyware is the generic term for programs like keyloggers that hunt out and
transmit to a third party details held on computer systems
Keylogger » Records all typing on the keyboard, and transmit this to its owner. This can
clearly include passwords and other identity information
1VCore
(t
Detecting
and
threats
preventing
(-t:3 address the message
goes astray.
~—
72 Buty (et:
El
3
Detecting and preventing threats
wr
Automatic Local installation Avoids the ‘user problem’ Some feel this is an invasion
software of online copies altogether. of privacy.
updates — drivers, Keeps software up to date selecting Requires that the computer
operating the right elements each time. system is operating at pre-
systems, arranged times.
application
Can slow Internet access
programs
speeds.
Others include:
Access levels
An option often overlooked, this can limit the opportunity for someone to wittingly or unwittingly cause
damage across a network. Network users are assigned a level of control over resources on the
network that match their role and no more. In a school, only the network manager and possibly the
head teacher will have ‘total’ control: others will have progressively less control since they don’t need
it. On the odd occasion when someone needs a task completed they would need to ask someone
who has the level of access necessary. This adds a level of checking as well as a trail of action.
Firewall
A firewall is a system — hardware- or software-based — which scrutinises network traffic and applies
a set of rules to limit the possibility of illegitimate traffic passing through. This is a barrier between
‘trusted’ devices on the same network and less trusted devices or networks — such as the Internet.
Some organisations take this further by including a proxy server, which is an additional intermediary
between the trusted and the not-trusted devices.
Anti-virus software
This now often includes protection against a range of malware, and adds a layer of
protection against malicious software. The simplest kinds rely on scans to check
Antivirus
through your hard drive, while others are constantly actively scanning for changes
in your data that could be caused by malicious software. It must be said that all
AV/firewall software is only as good as the operator, and nothing can override your
' choosing ‘yes’ to install something nasty.
- Encryption
4This iis the conversion of an original message (plaintext) into a code (ciphertext) using a key. Encryption is
now essential to much communication over the Internet: secure e-commerce, banking and other personal ,
‘ data transmission would be impossible without cryptography. As with passwords, it is accepted that ne is
nO ‘unbreakable’ code — just ones that take too long to be worth the effort.
é
Biometrics » Physical attributes unique to
each individual
Ethics
Is anonymity a ‘good’ The EU ‘right to be forgotten’ rules are said to be helping people putAgptentee
thing? What about the was incorrect— but is it also helping criminals? Whose rights should Be
ho aaa
‘trolls’ on social media? .
Privacy
Identity theft is agrowing business. With GPS in so many items — is it impossible to
How should this be dealt with? be ‘away from everyone’? Is this a bad thing?
Wearable tech
pe URS decisions
Vi : Are we slowly expecting
i
more of computers, and
=
less of ourselves?
uu
ie)
=
the people to do the work if we don’t buy the access to
the product?
"oO
°
=
7a Module 29 |Ethics:
..
.BP. law
You MUST know the main provisions of:
» Data Protection Act (1998)
Only applies to data about /iving people, known as
personal data.
Eight data protection principles:
Data should be fairly and lawfully processed
Data should only be used or disclosed for the
specified notified purposes
Data should be adequate, relevant and not
excessive
Data should be accurate and kept up to date
Data should not be kept any longer than necessary
Access must be provided for individuals to check
and correct their data, with a right of explanation
when a computer takes automated decisions
based on the data
Data should not be transferred outside the
European Union except to countries with adequate
data protection legislation
Freedom of Information Act (2000); (Scotland
2002)
This Act allows the public a right to information
held by public authorities such as central and local i!
Introduction to encryption
This has already been mentioned in a number of chapters so here is where
all of the information is pulled together. 30
Encryption is the process of converting plaintext (original, unencrypted) into ciphertext
(encrypted) so that the message is as close to impossible to work out as makes no
difference. It is accepted that no cipher is unbreakable — but if the cipher key is only used for
a set number of hours, and it will take longer than that to break it, then it is secure enough.
Encryption isn’t encoding — if you encode something you are changing it into another format,
such as Male = M, Female = F: hardly a top secret action. ASCI| encodes the letters you type
into numbers that the computer can process. So encoding helps the transfer of data.
Encryption is designed to focus the transfer of data to only those who have the key. Anyone
else just sees a garbled transmission, such as ‘95’ and doesn't know what this means.
Hashing is used to check whether anyone has tried to break the code before sending it on.
Any changes to anything in the content will produce a garbled or changed message when
the legitimate key is used.
A simple cipher
One of the simplest encryption systems is known as the Caesar cipher — used by Julius
Caesar to communicate with his armies. This is a simple ‘shift’ cipher, whereby each letter
represents another in a logical sequence.
A\B/C/D/E|F/G/H/1|J/K/L/M|N|O/P/Q/R/S/T|U|V
|W X|Y¥ |Z)
/
wix|y¥|z/a[Bic|Dje|F/G/H]
1|J|KiL|M/N/O/P QiRis|T/UlV
The top row are the letters we will use for our plaintext message: the bottom row still contains
the same letters, but they have been ‘shifted’ five places to the right. Using this simple cipher,
the word ‘computing’ becomes:
C|O|M/P/U|T|IIN|G|
LYIKI I {L/Q/PlE}y|C|
Clearly this is fairly easy to break, and you can make it more complex by changing the letters
in the encryption to numbers:
For the exam, knowing how to use a simple cipher is enough — you don’t need to be able to
translate the more complex work.
In addition to the moral and ethical need to maintain security of data, you will remember that —_
Encryption
WUCyretiCeeliae the Data Protection Act requires all organisations to take reasonable measures to prevent
loss of data.
Uses of encryption
Organisations will usually have data protection policies S
which will include encryption: schools will usually encrypt i
Plaintert Dp Encrypted 74) Plainterxt
data held on portable devices that staff use, emails that —> [ Text g eo Ts
S00 oe
identify students personally, for example. Encryption ——-_—Decrypttow
Sender Recipient
The most familiar method of encryption for most users will
be SSL — Secure Sockets Layer, a protocol that uses a publioKey pritatn Key
key to encrypt data across the Internet using two keys:
A public key accessible to all
:
2. A private key known only to the recipient of the message.
This combination is the only way in which secure communication is possible: pick a global brand like
.
Amazon— how could they have secret keys with every one of their customers?
c
<5 SD ORR AEE 2923a ere oe ead WEES S: Das. gon od 5
ag PSE Se
Reka a j) Poca ee 7 4
a aae tS a a a Te ror hi asa Rey> ake : ae
Huy SSL ee
Your browser connects to the website and requests an identity check from the server, to make sure
that the server sends a recognised SSL certificate. If this is part of a list the browser holds, then all is
DE
FORRES?
vere mer
well. If not, the browser will ask the user ‘Are you sure you want to deal with these folks? | don't know
5
them!’ At this point it is a good idea to pause and check you have typed the correct URL, because
this is a hint that something isn’t necessarily right. If the certificate is recognised, the URL changes
from HTTP to HTTPS and you can continue your session in an encrypted mode.
a Te RET ae “Dor ogre
Se 2s eee ac;
saree sae
—
syuqaW01g suvos vuijal/any
ynvfop ww Yq
UOWMWOI 1SOW SJUUAAabU14
ayqupipasd
anqovsd
piomssvd
400d
REE.
Sd1Y4}2 puv
hyundsas saqnd soya
myuanbasf pabuvy) ON
3
wow Buryjou — papaau
sybu ayy hyo bu1q4a$ =
| sMaiA ANON $301 VI U0) DUIP1Ad 1V
:i away Viayy vayM Main fo Sonat we bib besti
'‘ ae ———
Meet
—4 "
vajajap jou ayfoud uasn ‘byfuoo yy bu 10d INO, “eMatn anon suoddns aUapina WwYM
= cai Ssa00V 400d Wwalyt
papaau ; UayMJOU eae fo
sadn éxUIYI NON op wYyM
' \\ u1b0] WiMipy asr)
mae
UM
SWAAOM ae apoo
ee Sno1nvyW pV U01}90} Old VIVA
e
uoinuryed AVI SSAUIAU
Y100}0V11g
wpa shui fo
ph bettas ssa00v JOUsaqU |
( sonaap gsn
\\\
pasuoynvun
Ye yovyy words vywyp yay a1qusvaM eee fe
Wods vIvp puv puy swuia}shis 39940/d
ae
one
swiayshis 3991 0dd
dew pull
y4
If you need more space to answer the following questions, please use a separate piece
of paper.
a)
=
—
om
Vv
Oo
(3 marks)
How do updates help you protect your computer against security threats? i
re
ot
ued
.=
8. Consider three technical reasons why social networking sites may have =
been used by large groups of people Around the world to organise protests. (6 marks)
i
Vv
Wi
hea
7)
>.
ee
67 101
102
103
ri0 104
1
is 1 OS
1
if2 06
73 107
74 108
75 109
‘ic = 110
77 ase
78 ie
ih9 113
114
81 115
82 116
83 TW,
84 118
8 5) 118
120
87 121
88 122
Me ASCII Table
Fundamentals of Algorithms 1. Removing non-essential detail allows focus on the core
Quick test questions problem. (1)
Pages 4-5 2. Aplan could go down the wrong path, solving the wrong
1. An algorithm is a set of steps, or instructions, to complete a problem. (1)
task, such as a recipe or a washing machine program. 3. Identifying common elements that can be combined to
2. An efficient algorithm only uses the resources it absolutely help design a simpler solution. (1)
needs to complete the task — no more, no less. It prints the numbers 1-10. (2)
3. The main components of algorithms are INPUTS — PROCESS
¢ Effectively using the computer resources available at
— OUTPUTS.
the time.
4. When you use a trace table you go through your code as if
e Using the minimum amount of steps or code.
you are the computer, writing down the inputs, the processing
e The least possible time for the program to run.
and the outputs. This is an essential part of testing, and can
(3 marks: 1 mark for each point made)
help you see where the computer code would go wrong
The binary search approach chooses the middle value in a
before you even enter it, which saves time in class — and
sorted array (1), and works out whether the value sought is
money in business.
higher or lower — moving up or down the list (1) to locate what
Pages 6-7 it seeks. This means that the computer only ever searches
1. Binary search, because the book will be huge and it will be in half of the data, because it is either on the right number, or
a sorted order (alphabetical). Splitting the range searched is pointed at the right half of the data that is in the array. A linear
more effective. search is used when you can't sort the data into any useful
2. Start with all numbers 22, 19, 17, 15, 2, 9. Sort so that the last order (1), or when there are very few items to search. This is
two numbers are in order and check the middle number. The because it is also Known as ‘brute force’ searching (1). The
middle one is 17. computer searches from the first item until either the end of
3. Binary the data (1), or until the item sought is located, one by one.
Pages 8-9 This can take a really, really long time, which is why it is used
1. Both will produce the answer, but bubble sort may take a lot only when a binary search isn’t possible or appropriate.
longer. Merge sort is also known as ‘divide and conquer’ (1) because
2. Compare 22 and 19, OK, compare 19 and 17, OK, compare like the binary search the merge sort splits the data in half,
15 and 2, OK, compare 2 and 9, swap 9 before 2 and start sorts the smaller groups, and then merges the two together
again. When comparing 9 and 2, OK, sort complete. 22, again. Bubble sort comes from the way that stones settle in
19, 17, 15, 9, 2. The list is fully checked again before the a tank of bubbling water (1): the smaller ones ‘sink’ to the
computer declares it is sorted. bottom of the tank while the large ones appear to rise to the
3. Merge top. That is why sometimes a bubble sort is called a sinking
sort (1). Bubble sort is horrendously long-winded, which is
Exam practice questions
why it is only useful for very small volumes of data.
Page 11
if Programming 1
Quick test questions
Pages 12-13
1. A digital data = on/off, true/false
2. Any WHOLE number.
3. Iteration is repetition of a process or sequence of instructions.
This will help a programmer because, for example, they can
write the code to check for the temperature value once and
set the computer up to test for a set value continually.
Pages 14-15
1. Organise everything together
Plug in a kettle
Put teabag in cup
Put water into kettle
Switch on kettle
Wait for kettle to boil
Add water to cup
(8 marks: 1 mark per correct answer) Remove teabag with spoon
Answers such as: Add milk and/or sugar
establish size of vehicle. , Serve
e Set spray for soap. 2. Pseudocode is closest to natural English of all the languages
e Set brush height based on sensor settings. used in Computer Science. We use it to structure our
e Set water jet bar height based on sensor settings. planning before writing the code for real. It is not written in
¢ Set fan bar height based on sensor settings. full sentences, like natural English, but in code structure.
(5 marks: 1 mark for each point made) Computers do not understand pseudocode.
Answers such as: 3. FOR is count controlled, WHILE is context controlled. FOR is
¢ Clear out all hiding places (e.g. under bed) and place set to the limits designed by the programmer, FOR temp>20;
items in their correct storage locations, but WHILE depends on the conditions.
¢ Clear out all horizontal spaces (including bottom of wardrobe)
and place items in their correct storage locations.
e Return all iterns not belonging in the room to their rightful locations.
¢ Dust and vacuum. (2 marks for four points made)
Decomposition helps programmers because once a task
has been decomposed it can be tackled one element at a
time (1), and the code can be produced one module at a
time (1), so they can test each section more effectively (1).
Answers 8
Pages 16-17 Exam practice questions
1. 11/2 Mod operation = 1 Page 21
11/2 Div operation = 5 1. (a) Counter is an integer. (1)
2. 84+2=7,92/3 =4 (b) (i) Variable is a storage location in memory which
7*4=28 can hold data and is given a unique name by
3. IF temp =hot the programmer. In the code above, counter is a
Cold drink variable. (1)
ELSE (ii) Iteration is the repeated operation of a sequence
Hot drink of statements in a code. In this example the code
iterates 11 times and on the final time, when the
Pages 18-19
counter value equals 11, it falls to the ‘all done’
if
START output. (1)
(iii) An algorithm is a sequence of instructions to
Y complete a task in a set number of steps. In the code
above the algorithm counts from 1 to 10, then prints
BOIL KETTLE
‘all done’. (1)
!
the same thing for as long as the temperature is greater than
NO PUT COFFEE 20 degrees, regardless of how long that is.
IN MUG IF GameOver THEN
SCORE = PlayerSCORE
IF SCORE > TOPSCORE THEN
Yes TOPSCORE = SCORE
PRINT “Genius”
IN MUG ENDIF
PRINT “Game Over: See you next time!”
Y ENDIF
= ADD MILK/SUGAR (1 mark for variables; 1 mark for completed code that
shows the nested IF; 1 mark for clear ends to IF loops)
Within a program, using the AND function means two
conditions must be met to achieve a certain output but the
STOP
NOT function means the opposite of any condition is returned. (1)
2. Programming 2
Quick test questions
Pages 22-23
Any individual detail such as first name, surname, address,
phone number, date of birth.
2. Just the names [Fred; Alfie; Oscar]
LEAVE UMBRELLA TAKE AN 3. Using a key, value combination in a two-dimensional array:
AT HOME UMBRELLA Pets(0,0) = “Fred”, Pets(0,1) = “Dachshund”, Pets(1,0) =
“Alfie”, Pets(1,1) = “Labradoodle”,
Pets(2,0) = “Oscar”, Pets(2,1) = “Terrier”
Pages 24-25
1. Write means you want to write new data or overwrite existing
data, read means just look at it.
2. Because it takes more memory, more time to load, and allows
3.
more possibility of error through accidental edit or delete.
Pages 26-27
1. For example:
[Convert atingtointeger —[inieving)
id
ISITA
STAY INBED! |< SCHOOL —>| GO TO SCHOOL
DAY?
fnaex [0[3[2[9[«[5]e]7[a1 Usually parameters are included in parentheses () (1) after the
|84|Answers /
6. The CPU reads (fetches) instructions (1) from the memory cache, or 7.
RAM (1), decodes them, and then operates — or executes (1) — the
instruction. APPLICATION LAYER
7 A large amount of RAM enables more instructions/programs to
be loaded from secondary storage into RAM (1) so they can be
executed by the processor more efficiently rather than the CPU
needing to wait for the instruction to be located and loaded. As
TRANSPORT LAYER
a result more programs may be run simultaneously, Additionally,
some programs simply need a lot of RAM to run properly (1), such
as games programs.
8. The cloud is a colloquial term for ‘the Internet’ and is often also a = ca
defined as ‘other people's computers’. The advantages for many | INTERNET LAYER |
businesses include that: |
Storage is flexible and cheaper than purchasing and managing the Sh celine ag a tts bod
hardware onsite.
Offices across the world can access the same files.
NETWORK ACCESS
Local disaster recovery is easier — as long as your storage provider
(or DATA LINK) LAYER
wasn't the one hit. (3 marks: 1 mark for each point made)
Answers 85
Arguably, there is a fine line between these two. Blagging Te Thousands of security threats are discovered in a year (1),
tends to be more personal (1) while phishing tends to be and the software companies are always writing code to
pretending to be an organisation (1), but both seek to fool ensure that their product is resilient (1) against the attacks
you into giving your personal or confidential details away. from the threats they discover. If you do not update your
No (1). The USA is regarded as having sufficient data security computer, then the threat remains (1).
measures in place (1), though this is now a grey area as a Any three from: social networking fast to transfer so harder
result of the revelations about the NSA and GCHQ monitoring to censor; has a global reach so can reach more people
Internet transactions. more quickly than other media; lack of central control by a
It is hard to read and the ‘sound’ option often isn’t clear government because the data is stored in another country;
enough. (1) allows incorporation of text with images/video/sound. (6
Biometrics such as retinal scans are the most secure but marks: 1 mark for each comment, 1 mark for explanation
are also expensive to add to existing hardware and can be of impact)
difficult to reprogram if and when the teacher leaves the
school. A password is the cheapest system, but it can often
be the weakest as well if the password is easy to break.
Usually the data on a teacher's laptop is encrypted and the
teachers are required to change their passwords frequently,
so that there is less of a chance that the laptop data will be
compromised using this system. (5 marks: 1 mark for each
point made)
}86|Answers
4-bit structure 42-44 databases 28-31
8-bit structure 42-44 data compression 48-49
Data Protection Act (1998) 65, 75-77, 79
abstraction 5 data representation 42-51
access levels 73 data structures 22
algorithms 4-11, 74 data types 12-13
ALU (Arithmetic-Logic Units) 56-57 DBMS (Database Management Systems) 30-31
analogue 47 decimal base 42
anti-virus software 73 declaration 13
application software 54-55, 70 decomposition 5, 31, 34
arguments/parameters 36-37 decryption 65
arithmetic 16, 42-43 defending cyber threats 72-74
arrays 6, 22-23 definite iterations 13
ASCII code 26-27, 45, 77, 80 descending 8-9
assignment statements 13 disk drives 59
attacks 70-73 DNS (Domain Name Systems) 67
authentication 38-39, 65
efficiency 4
backdoor Trojans 70-71 embedded systems 39, 58
binary arithmetic 8, 43 encryption 29, 65, 73, 76-77
binary searches 6-7 ethics 74-75
biometrics 72-73
bitmap files 46-47 fetch-execute cycles 56
bitrate 47 fields 30-31
bits 42-44 file handling 24
blacklist 65 firewalls 55, 65, 70-71, 73
Boolean data 12-13 flowcharts 5, 18-19
Boolean logic 52-53 foreign keys 31
Boolean operators 16-17 Freedom of Information Act (2000);
bubble sort 8-9 (Scotland 2002) 75
buses 56-57 functions 13, 34-37
bytes 43-44, 46, 49
global subroutines 37
Caesar ciphers 76-77 graphic files 46
characters 12, 26-27, 45, 48-49
ciphertext 76-77 hard drives 45, 55, 58-59, 73
classifying software 54-55 hardware 64-65, 67, 70, 72-73, 75
client-server architecture 66-67 hashing 76-77
clock-digital circuits 57 hexadecimal bases 42-43
clock speed 57 high-level language 35, 39
cloud computing 58-59, 74 Huffman coding/trees 48-49
colour depth 46-47
compression 47-49 identifiers 6, 13
Computer Misuse Act (1990) 75 image representation 46-47
computer networks 62-69 indefinite iterations 13
computer systems 39, 58, 70-74 information, units of 44
concatenation 26-27 input/output 18, 24-25
constructs 12 integers 12-14, 27
control unit 56-57 IP (Internet Protocol) 66-67
copyright 74-75 iteration 12-13
Copyright, Designs & Patents Act (1988) 75
cores 57 JPEG (Joint Photographic Experts Group) 46-47
CPU (Central Processing Units) 56-58 .,
.csv (comma separated values) 24-25 keyloggers 70-71
cyber security 70-73, 76-78
language classification 35, 39 sample resolution 47
LAN (Local Area Networks) 62-63 sampling rates 47
law and ethics 75 searching algorithms 6-7
leading zeros 43 secondary storage 58-59
linear searches 7 security 29, 38-39, 65, 70-73, 76-78
local subroutines 37 selection/choice 12-13
logic gates 52-53 sequence 12-13
low-level language 35, 39 shifts 43
software 52-55
MAC (Media Access Control) addresses 65 sorting algorithms 8-9
malicious attacks 70-73 sound representation 47
malware 70-71 spyware 70-71
memory 56-59 SQL (Structured Query Language) 30-31, 71
merge sort 8-9 SSH (Secure Shells) 67
metadata 46-47 SSL (Secure Sockets Layer) 77
storage 56-59
nested constructs 13 stored-programs 56-57
networks 62-69 strings 12, 26-27
nibble/4 bits 42-44 structured programming 34-35
number bases 42-43 subroutines 13, 34-37
substrings 26-27
one-dimensional arrays 22-23 systems architecture 56-57
operating systems 54-55 system software 54-55
optical drives 59
TCP (Transmission Control Protocol) 66-67
packets 66-67 testing 38-39
PAN (Personal Area Networks) 63 threats 70-73
parameters/subroutines 36-37 topology of networks 64-65
personal data 75 trace tables 4-5
pixels 46-47 Trojan horses 70-71
plain text 76-77 truth tables 52-53
ports 65 two-dimensional arrays 22-23
primary keys 22, 31 txt (text files) 24-25
procedures 13, 34-37
processors 56-57 Unicode 45
protocols 66-67 utility programs 54-55
pseudocode 6-7, 14-17, 22, 27-28, 36
pseudorandom numbers 28-29 validation 38-39
viruses 70-71, 73
RAM (Random Access Memory) 56-57 volatile memory 56-57
random numbers 28-29: Von Neumann architecture 56-57
real data 12
records 22-23 WAN (Wide Area Networks) 62-63
register 43, 56-57 whitelist 65
relational databases 30-31 wired networks 63
relational operators 16 wireless networks 63, 66
repetition/iteration 12-13 worms 70-71
resolution 46-47
RLE (Run Length Encoding) 48
ROM (Read Only Memory) 56
Ad}NdwWIO,
BDUDIDS
ai)¥
(ae
Programming 1
Module 5: Pseudocode
Module 7: Flowcharts 14
Programming 2
Programming 3
Contents
Module 19: Data compression
Computer systems
Module 20: Hardware, software and Boolean logic 30
Paper 2 57
ASCII table 64
Answers 65
4 Define the term ‘algorithm’. [2 marks]
es Explain the purpose of the algorithm set out in this flowchart. [3 marks]
START
CURE UT:
“COUNTING...”
— eety
a
@
=
i)
5°)
‘
wed
=
Y 3 | Draw a flowchart to describe an algorithm to print all numbers divisible by 3 up to 100. [5 marks]
wi
aw
hea
em
w
aa
For more help on this topic, see Letts GCSE Computer Science Revision Guide pages 4-5. SK.
4 |ty:
(tl (a Representing algorithms
4 | State two properties of an algorithm that could be considered when describing
it as ‘efficient’. [2 marks]
Edit Data
Enter Password Wi
=
Select Program
=
Select File and Open
a
pa
6 | Define ‘iteration’ in the context of designing a program structure. [1 mark]
°
=
[2 marks] 6
D
=
=
aed
[2 marks]
gdWi
Ydees
2.
9 | Explain how a trace table is used to test a computer program to check
Y
for early errors. [2 marks]
ce
For more help on this topic, see Letts GCSE Computer Science Revision Guide pages 4-5.
£non
Wi ben Identify what type of search this is. [1 mark]
=
INPUT A #name you’re looking for
FOREACH [item in list]:
Bes TE teem) ==A-
©
Df
OUTPUT result stop search
ELSE
RETURN
f°))
f=nfo 4 | Linear search is often also known as ‘brute force’ searching.
ud [1 mark]
am Why is this?
©
v
Vi
[3 marks]
r
For more help on this topic, see Letts GCSE Computer Science Revision Guide pages 6-7.
At first glance, which type of search would be the most appropriate for the
following data?
i 2,0,4,0,0,7,8,9,10,11,12
vi
=
8 |Which would be the most appropriate type of search for the following data? a
=
Give a reason for your answer. [2 marks]
tn
©
| want to find if there are any Hussains in the class:
—
“Adams”, “Banks”, “Kelly”, “Madsen”, “Lisson”, “Hepworth” ©
Gi
i=
rcs
Ww
red
fe
i)
V)
For more help on this topic, see Letts GCSE Computer Science Revision Guide pages 6-7.
A Repeatedly splits the data in half until each ‘list’ contains only a single
data item. Then, having broken it into smaller parts, it repeatedly
combines these ‘lists’ back together, this time putting them in
their required order (ascending or descending in value). [a
2 | Use a bubble sort to sort the dataset (6,2,4,1,8) in ascending order. Show your
working and state the number of steps required. [4 marks]
Wi
=
a
=
a
2)
ty [3 marks]
ce
Got
=
we
a
=]
V)
For more help on this topic, see Letts GCSE Computer Science Revision Guide pages 8-9.
[3 marks]
[1 mark]
5 |What does the phrase ‘constant declaration’ mean, and how is it different from
declaring a variable? [4 marks]
6 | ‘Repeat’ instructions like the one below are an example of which technique? [1 mark] Data
typ
(NB fd = ‘forward’, ‘rt’ = ‘right’ followed by the degrees to turn)
+
co
[4 marks]
5
"oO
°
=
For more help on this topic, see Letts GCSE Computer Science Revision Guide pages 12-13.
ae Give a definition of ‘pseudocode’. [2 marks]
ey Write the pseudocode for a simple algorithm that is used to process data entered
by aclass teacher. It prints ‘passed’ if a student's mark is above 30, and
‘did not pass’ if it isn't. [2 marks]
wy
"©
n=0
while n<=100
©
display n
i
n=n+1
endwhile
Q
"©
rs
qs
ue
he
For more help on this topic, see Letts GCSE Computer Science Revision Guide page 5 1 :
4 | Explain what the following code does.
G Write the pseudocode to take three numbers as input and print the sum
and product of those numbers.
a
"oO
@
es
©
"Oo
=
wy
vi
ib.
:
For more help on this topic, see Letts GCSE Computer Science Revision Guide pages 14-15.
modules
ate Write a simple program to multiply two user input numbers together, and
print the result. [1 mark]
languages
re Explain why the following two codes would display and produce different results. [3 marks]
programming
in
wi
as a:=13 a= 13
° b=2 Die
ctha
ee
c = INT(a/b) c = FLOAT(a/b)
7)
2. print Cc print c
°
S
©
=
°
0
ca
c
=
6
G
= 3 | Explain why the calculation in this program would cause a problem. [1 mark]
S
6
ales!
7
the
input
input
Name
Age
= Score =
7
ae! Name*Age
Print Score
=
>
=
Sos
x
Module
6
For more help on this topic, see Letts GCSE Computer Science Revision Guide pages 16-17.
4 |The following code aims to work out overtime pay.
prog
in
[2 marks]
a a5
Da 23
Teecw< 1.0 AND =b) < 50
print “Class Dismissed”
ELSE
print “Extra Homework!”
ENDIF
©
=
5
"oO
°
=
For more help on this topic, see Letts GCSE Computer Science Revision Guide pages 16-17.
[4 marks]
Wi
oss
then
ge
en
as
>
=
oo
Output “Acceptable
range”
(EERIE Fowchor
oa Put the flowchart elements below in the correct order to monitor the
temperature in a greenhouse. [2 marks]
wi
de?
was
©
——
WJ
=
2
Babi:
For more help on this topic, see Letts GCSE Computer Science Revision Guide pages 18-19.
eA Black and white bitmap images can be encoded using 1 to represent white
and 0 to represent black in a two-dimensional array. Show the two dimensional
array for the capital letter C where the array is 4 pixels by 4 pixels. [2 marks]
ey If a list contains the following elements, what would be output by the command
print (text[2]) if the array count starts at [0]? Give a reason for your answer. [2 marks]
yt ym, ny,
text = [“apples”; “oranges”; “pears”; “bananas” ]
a Is this acceptable data for an array? Give a reason for your answer. [2 marks]
names = [“Max”,“Khali”,22,“Sam”)
Data
structures
myArray(6,6)
6 | In the list below, identify the item at index point [5] if the index starts at [0]. [1 mark]
00
~
(1,2,3,4,5,6;7,5,9)
=
"Oo
° [1 mark]
=
For more help on this topic, see Letts GCSE Computer Science Revision Guide pages 22-23.
[2 marks]
open("classlist.csv", "a")
°
=
For more help on this topic, see Letts GCSE Computer Science Revision Guide pages 24-25.
ea Complete the following table to show which data you would store as an integer
and which you would store as a string.
15 fe
(CS
2010
01501 2987659
3 If the following variables are given string values, what would be the result when
they were concatenated in the same order in which they were entered?
one =) SElsh?
two = “chips”
three = “mushy peas”
handling
String one = me of Se Ans |
lf a function returns the numeric character code, and the character code for
one[1] is 105 and the character code for one[3] is 104, what is the character
°
|
code for one[0]? | [1 mark]
=
= Po) Explain why a character encoding system uses a different
[1 mark]
o
code for upper- and lowercase letters.
°
=
For more help on this topic, see Letts GCSE Computer Science Revision Guide pages 26-27. RA
KR Explain what the following code does. How does it use the random feature
within the language? [4 marks]
import random
My _ number = random.randint(1, 100)
guess = int(input("Take a guess: ")) prog
a
in
ion
©he
Ld
tries
7
# guessing loop
<
while guess != Mynumber:
7
if guess > Mynumber: =
print("Too high!")
7
ts
else:
print("Too low!") 2
endif =
=
<
guess = int(input("What is your guess: "))
cre se =i
endwhile 3
print("You got it! The number was", Mynumber) °
print("And it only took you", guesses, "tries!\n") o
<
G
oc
For more help on this topic, see Letts GCSE Computer Science Revision Guide pages 28-29.
3 |Giving examples, what is the difference between ‘structured’ and ‘unstructured’ data? [4 marks]
V~i
wy see75 | T-shirt 7 [Blue |S Bs
Wi Trainers [Black [6_—s*d £29.99
© [333548 [Hoodie [Red |M_ £29.99
ms) Shirt £12.99
©
gad
£6.99
©
C
SELECT * FROM StockList
WHERE Size=’M’
AND Colour='White’
sibeasalb ails cen asus sores nicipwavsisbunsacu het eae [1 mark]
For more help on this topic, see Letts GCSE Computer Science Revision Guide pages 30-31. a
yim Module 12
ay Give three reasons why using a structured approach to their code will benefit
a programmer. {3 marks] =)
i
be
(°)]
>)
Es Within structured programming, good programmers plan what they intend to Shoe
a.
do, then comment the code as it is constructed. In this context, what is a
x?)
comment? Give an example. [2 marks] 7]
fea
=
ees
ed)
=
ba
Lory
Wi
mo)
La
©
Wi
3 | Describe the three types of translation programming software and provide a Y
brief description of each. [6 marks] =
Esc)
=
=)
be
me]
=)
Wn
Oo
RS
c
2
ae
Ww
=)
TS
&
4 |Describe the steps a programmer can take to make the code they write -
easier for another programmer to follow. [4 marks] =
For more help on this topic, see Letts GCSE Computer Science Revision Guide pages 34-35.
3 |A school is developing a part of its website to allow parents and students to upload
images. They need a subroutine that would check that the image is within the maximum
size allowed (1 MB) before uploading only those that are the right size.
subroutines
and
Parameters
+
\
=
5
"So
FD (x) moves the robot x squares forwards
LT (x) turns the robot x degrees left
°
RT (x) turns the robot x degrees right
Obstacle() is a Boolean response to the status of the robot
=
For more help on this topic, see Letts GCSE Computer Science Revision Guide pages 36-37. '
A
START
(b) What would be the path of the robot through the grid below if the
following code was executed? [1 mark]
(c) Write the code for the path of the robot through the grid below from
START to END. [1 mark]
sub
and
Par
Y
=
=
=
oS
0
=
For more help on this topic, see Letts GCSE Computer Science Revision Guide pages 36-37.
=)
f=
=
=
A)
os
D ra Describe one method of validation used by online surveys to help them manage
2.
Y
=iw
ase 3 |Validation is required for the data in the parameters for the function below:
=
i
nee
Wi
5 [2 marks]
2
°
oc
5 |A program requires a date of birth from the 20" century to be entered. Provide normal,
extreme and erroneous test data examples in the format DD/MM/YYYY. [3 marks]
For more help on this topic, see Letts GCSE Computer Science Revision Guide pages 38-39.
ic
2 |What is the decimal representation of the hexadecimal number A2?
b
and
bas
Num
0
\ oe
=
5
"Oo
°
=
For more help on this topic, see Letts GCSE Computer Science Revision Guide pages 42-43.
&.
cs]
¢
2
Pera
:
© [1 mark]
a
\e)]
£
Sefaes ZF If a kilobyte is 1024 bytes and a megabyte (MB) is 1024 kilobytes,
fill in the gaps for the following sizes. [2 marks]
Seger:
A gigabyte (GB) iS 0 24c eee ee eee
0
Wi A terabyte (TB) is 1024 oo. PR ie OPE ae cor!
So 5 | If a robot has a 4-bit instruction set, how many individual different instructions
= can it operate?
=
Give a reason for your answer. [2 marks]
For more help on this topic, see Letts GCSE Computer Science Revision Guide pages 44-45.
Define ‘colour depth’ and state how it affects file size. [2 marks] \e)
Lo
ve)
tee
eT)
ae?
adi
8 | Give a significant disadvantage of ASCII code that led to the development of ©
ka
Unicode. [2 marks]
f
hens
td
"So
¢
©
f
2
wit
-
G
Sue
‘e)
£
ele
has
Le)
Wi
pe
¢
|
For more help on this topic, see Letts GCSE Computer Science Revision Guide pages 44-45.
Ea) Define what ‘bit depth’ is and what impact it has on the quality of the sound. [2 marks]
3) Two versions of the same tune, with the same sample rate, have very different file sizes.
Explain why tune.wav is 50.4 MB and tune.mp3 is 3.43 MB. [2 marks]
a State what is meant by ‘resolution’ of a monitor. Explain what impact resolution has
on the quality of graphics displayed. [4 marks]
sound
and
images
RepresentingGi A JPEG file format uses lossy compression. Explain what this means for both the
quality of the image and the size of the file. [3 marks]
00
\ me
[2 marks]
=
S
s
°
=
For more help on this topic, see Letts GCSE Computer Science Revision Guide pages 46-47.
28 ty.
(1 (ME. Representing images and sound
ah Describe what a ‘Huffman tree’ is and what purpose it serves. [2 marks]
IY 4 Huffman tree for the text 2012 LONDON OLYMPICS is shown below.
Complete the missing sections. [5 marks]
com
Dat
O
\ me
=
5
"Oo
°
=
For more help on this topic, see Letts GCSE Computer Science Revision Guide pages 48-49.
ee A client complains that their laptop computer is running very slowly, even though
their anti-virus software is up to date.
Give two examples of how utility software could help free up some space on
the hard drive. [2 marks]
Port
Firewire
Network
Bus
A client complains
that their laptop is
running very slowly, even
though their
anti-virus software is up
to date, and they do not
have a lot of data on their
hard disk.
software
logic
Boolean
and
Hardware, How could adding to the
memory in the laptop help 7 . a
to solve this? rip . 3 [2 marks]
°
N
=
5
"oO
°
=
For more help on this topic, see Letts GCSE Computer Science Revision Guide page
sind
D
2
=
6
6 |The image below is a black and white image of 25 pixels. fe
Explain why 25 bits would be needed to represent this image. [2 marks]
=)
-)
ee
"oO
=
6
Ythers
6
by
sd
>
So:
GS
Vi
a
6
thee
>
"oO
6
abe
ke
Mod
20
For more help on this topic, see Letts GCSE Computer Science Revision Guide pages 52-53.
Spreadsheet [|
Internet browser [|
=
3 What is ‘open source software’? [1 mark]
2
©ed
he 4 | Explain the main difference between a Command Line Interface (CLI) anda
Graphical User Interface (GUI). [4 marks]
=Vi
Lh
da
ag
Y [5 marks]
©
whe
>
wien!
°
Shes
v)
[2 marks]
For more help on this topic, see Letts GCSE Computer Science Revision Guide pages 54-55.
w
Bo
ae
[2 marks] spd
es
@
=
5 | Below are three different types of memory.
woheas
ed
doz
Tick the fastest from these types of memory. [1 mark]
mS
f
Level 1 cache [aia]
RAM ee
a)
Level 2 cache [| ed
Ww
a
Vv)
For more help on this topic, see Letts GCSE Computer Science Revision Guide pages 56-57.
9 | In addition to the CPU clock speed, name two factors that can affect the CPU's
performance. [2 marks]
YShas
5
ipa!
te
Y
—_
=i
Some
6
Wi
=
Y
wet
>
Wi
For more help on this topic, see Letts GCSE Computer Science Revision Guide pages 56-57.
ee What is the difference between a ‘-R’ and ‘-RW’ in relation to an optional disc? (2 marks]
cy A small organisation wants to transfer all its data onto a cloud storage plan.
Discuss the advantages and disadvantages of this option. [8 marks]
a
ed
We)
bes
@
og
Vi
om
be
®
"oO
4 | Explain, using an example, what is an ‘embedded system’ is. [2 marks]
See
@
VW
@
Vv)
5 |Tablet computers and mobile phones tend to use solid state media for storage rather
than hard drives. Describe two reasons, other than cost and capacity, why solid state
is used. [4 marks]
For more help on this topic, see Letts GCSE Computer Science Revision Guide pages 58-59.
va Explain the difference between a local area network (LAN) and a wide area network
(WAN). Give an example of a situation where each might be used. [4 marks]
3 |Which type of networking (wired or wireless) would you recommend for a small office
with four people who use laptops and share a printer? Explain your answer. [5 marks]
networks
of
and
ions
types
os “Schools should ban all onsite wireless connectivity for students.”
Discuss this statement. [8 marks]
Def
+
N
=
"Oo
°
=
For more help on this topic, see Letts GCSE Computer Science Revision Guide pages 62-63. a
ey Draw an example of a ring network topology, showing clearly each of the components:
printer, storage/server, three workstations. [5 marks]
a
D
=
°
2.
°
Pag
wees
°
4 | Identify the difference between whitelist and blacklist filtering. Explain which is the
>
Y
more secure. Explain which is more flexible. [4 marks] ae
For more help on this topic, see Letts GCSE Computer Science Revision Guide pages 64-65.
[2 marks]
na Client-server communication:
Tick one option in each case, showing whether the action would take place at the
client end, server end or both. [3 marks]
[Action
——~S*dYSCSLIENT |SERVER [GOTH _|
Starting arltieke | |aen n
[Displaying
protocols
Communication
HTMLpages|) |
Incr a
5 | Describe what the ‘client-server model’ is. [2 marks]
©
N
= 6 |What elements may be found on the ‘application layer’ of the 4-layer Internet model?
5
"©
What purpose does the application layer serve? [2 marks]
°
=
For more help on this topic, see Letts GCSE Computer Science Revision Guide pages 66-67. e
tye
(11 (-X-3 Communication protocols
ae In the context of cyber security, what is a ‘Trojan horse’? [2 marks]
2 | What is ‘good password practice’ in terms of security? Give four examples. [4 marks]
iE Explain why, when you forget your password, the company holding your account
should send you a link to reset your password, not a copy of your password. [4 marks]
[2 marks]
thre
ion,
and
pur
[3 marks]
fj
os
O
[4 marks]
For more help on this topic, see Letts GCSE Computer Science Revision Guide pages 70-71.
d
threat To control the access different users have to information. Ei
To let the network manager know who is doing what on the network. i
[2 marks]
purpose
inition,
an
‘ce
os
O
11] Why is it important to keep all software up to date, especially on a device that is
attached to the Internet? [4 marks]
—!
For more help on this topic, see Letts GCSE Computer Science Revision Guide pages 70-71. "8d
pa
ra What is the difference between encryption and encoding? Explain with examples. [4 marks]
[4 marks]
[1 mark]
[4 marks]
thre
pre
and
Det
6 | Modern organisations are spending increasing amounts of money on cyber security.
This includes penetration testing, which is an attack by an organisation on its own
computer system to identify weak points. What is the difference between black and
00
white box penetration testing? [4 marks]
al
=
=
"oO
°
=
For more help on this topic, see Letts GCSE Computer Science Revision Guide pages 72-73.
Vi
wee
te
a
thes [2 marks]
sus
ie
G)
{=
dhe
[2 marks]
c
a
a
@
des
&. [3 marks]
"oS
es
#3
Sy
=
ew
ed
@
aha
@:
O
Module
28 ~
For more help on this topic, see Letts GCSE Computer Science Revision Guide pages 72-73. xa
st
[6 marks]
Ethi
ns
oo
a THINGS |
ce
fi
O71
N
~
©
=
"Oo
4
=,
For more help on this topic, see Letts GCSE Computer Science Revision Guide pages 74-75.
ing Module 29
> -
3 | What are the security considerations for data storage in the ‘cloud’?
Do you think these are outweighed by the convenience of this sort of storage?
4 | Explain how a social network, based in the UK, must comply with the Data
Protection Act. [6 marks]
Ethics
O7
S*Wiekcore to
Fick- Proto’Shaing 7
@| flickr
N REST G
se -
us
0
.
he
5
"oO +
©
=
For more help on this topic, see Letts GCSE Computer Science Revision Guide pages 74-75.
Module 29 Ethics
ia What is a simple ‘Caesar cipher’? [1 mark]
A\B/C/D/E/F/GH/1/J/K/L/m|N/O|P/QiR|/s|T|U x viwix|y¥
ELFIG/H} 1]y[k]L|M|Njo[Pjajals|tiulv|w]xly]z]a]B|
Using the Caesar cipher above, decode this message. [1 mark]
CYOA YKILQPAN OYEJYA
(1 mark]
[2 marks]
A familiar method of encryption is SSL. Explain what SSL is and how it works. [4 marks]
Enc
oS
en
=
5
"oO
=)
=
For more help on this topic, see Letts GCSE Computer Science Revision Guide pages 76-77.
Module 30
a“a97 7
thls
GCSE
Computer Science
e mathematical instruments
Instructions
e Use black ink or black ball-point pen. Use pencil only for drawing.
e Answer all the questions.
e Answer the questions in the spaces provided.
e Answer questions that require a coded solution in whichever format you prefer, as long as your
meaning is clear and unambiguous.
e You must not use a calculator.
Information
3 Below are three types of memory. Tick the name of the type of memory used to make up
for the difference of speed in function of two internal components of a computer. [1]
EC A a EG
a) Explain how the Caesar cipher works. [2]
b) Explain how it aids effective data transfer across the Internet. [2]
58,34,2,4,39,54,1
Cangetbecres0
lisieie cect |Ppse yelp sist
found <- false
ib acaoy ul
WHILE i<6
IF list[i] = target THEN
found<- true
ENDIF
i. i en |
ENDWHILE
a) Complete the trace table for this algorithm. The number of rows does not relate to the
number of steps. [4]
b) The algorithm is currently inefficient. One of the following lines should replace the WHILE
statement above. Identify (tick) the correct replacement. [1]
START
A
START
41. A Huffman tree for EVERYONE HAD FUN AT THE PARTY is shown below. Complete the
missing elements in the table below. [3]
Huffman coding
Stock:
Styles
Warehouse:
SpaceUsed
Saa a
aa ee
a) State one field in the Warehouse table which will be the primary key. [1]
b) State how many records there are in the Stock table. [1]
c) Explain how the relationship between the two tables has been created. [2]
b) State how many bits would be needed if the image had four colours not two. [1]
16 In binary addition, show the result of 100101 + 10101. Show your working. [2]
Character
While
Length
Boolean
Sp
al
pid
Ke
18 Show the process in bubble sorting in the dataset below. [3]
shapen a re
19 Inabubble sort, tick the maximum number of swaps, if there are five numbers in
the dataset to be sorted. [1]
30 [|
20 What is the worst-case scenario for bubble sort? Explain why. [4]
22 State the index of the value 9 in the dataset below. For the purposes of this exercise,
the index starts at [1]. [1]
23,12,4,9,1,30,3
25 [2]
28 Tick the type of error that will allow the program to run, but will produce an incorrect answer. [1]
Run time error [|
GCSE
Computer Science
e mathematical instruments
Instructions
e Use black ink or black ball-point pen. Use pencil only for drawing.
e Answer all the questions.
e Answer the questions in the spaces provided.
e Answer questions that require a coded solution in whichever format you prefer, as long as your
meaning is clear and unambiguous.
e You must not use a calculator.
Information
2 Explain the difference between a LAN and a WAN. Give examples of both types of network. [4 marks]
“A wireless network is more convenient, but less secure, than a wired network.”
APPLICATION LAYER
LAYER
LAYER
5 Below there are three network protocols. Tick one which is solely used by email communication. [1 mark]
TCP/IP a
IMAP [|
HTML i
6 Communication across a network is expressed in Mbps. Calculate how many bits are
being transmitted per second for a network with a 5 Mbps connection. [3 marks]
7 Complete the truth table for the following logic circuit: [6 marks]
A
D
K
Zz
B
9 Complete the truth table for the AND logic gate. [1 mark]
Ee oe A AND B
aS |aR
FRc Ee
opin] Seer
10 A logic circuit is being developed for a lift door. The door has a sensor each side (A) and (B).
The door opens when one is triggered, and can also be opened or closed using an override
switch (O). The output is shown in Z. Complete the following logic circuit diagram. [3 marks]
B
Zz
O
11. Asmall business wants to explore storing their data in the ‘cloud’. One of their team is worried
about this. Explain the benefits and potential disadvantages of storing data in the cloud.
Your answer should include a clear definition of the ‘cloud’. [6 marks]
13 Tick the following statement that is true about run length encoding. [1 mark]
It is most effective on images with many continuous pixels of the same colour [nt]
14 One method of data compression is Huffman coding. Here are three types of data.
Tick the type that is compressed using Huffman coding. [1 mark]
Graphical data [|
Sound data [|
15 Operating systems are an example of which type of software? Tick one. [1 mark]
Application software BB
16 Describe what a ‘high-level’ programming language is. Explain why this is preferred by programmers
for some tasks. [3 marks]
17 “Subroutines make the process of algorithm writing easier”. Discuss this statement. [6 marks]
20 Computer systems now manage critical data across our lives. Discuss two ways in which we can
help ensure the safety and security of this data, whether at home, in school or at work. [6 marks]
|64|ASClltable |
Answers
Module 1: Representing algorithms It starts its search at the middle value (1), then splits the dataset (1)
1. An algorithm is a sequence of steps (1) that can be followed to according to whether the data sought is above or below the middle
complete a task (1). value (1).
This flowchart outputs ‘counting’ (1), then counts sequentially by If the data is unsorted (1) or the value is near the start of the file (1)
1s up to 5 (1) and outputs ‘done’ (1). Binary search (1) because the dataset is sorted (1)
START Linear search (1) because the list is fairly small and not sorted (1).
Output LoopCounter
Yes
ls LoopCounter
<100?
Answers 65 |
2. Input student mark Module 8: Data structures
If student mark > 30
print ‘passed’
Else (1)
print ‘did not pass’
End (1)
3. Counts (1) and prints (1) numbers up to 100 (1). 2. Data structures define how data is formatted and stored (1) to
4. Prints all numbers between a user-set start and finish point allow for efficient search, retrieval and processing (1).
(1), printing an error message (1) if the start number is larger Output would be “pears” (1) because all lists are indexed
»
than the finish number (1). starting at O (1).
5. Input Numberl No (1) because arrays do not accept mixed data types (1).
Input Number2 The array has 6x6 elements (1) — 36 in total (1).
Input Number3 (1) 6 is the 5th item (1) because all indexes start at 0.
Sum = Number1+Number2+Number3 NOS
An array is static in that its size is fixed and cannot be
print “The sum of the numbers is: “ + “Sum (1) updated (1).
Product = Number1*Number2*Number3”
print “The product of the numbers is: “ + Module 9: Input/output and file handling
“Product” (1) 1. It would open a csv file (1) called contacts (1). It then asks
the user to input their name and phone number (1) and then
Module 6: Arithmetic, relational and Boolean operators in saves the new data to the file (1).
programming languages 2. External sensors (1), e.g. temperature, movement or sound.
1. Inputa User input (1), e.g. keyboard, mouse, touchscreen.
input b 3. An index allows the computer to search the database more
crab effectively (1), because it is possible to search the index (1)
print c (1) rather than the whole database to locate the element sought.
2. Code 1 would show the integer value of 13/2, which is 7 (1). 4. Because the computer cannot check if you are telling the
Code 2 would show the ‘real’ or ‘float’ value, which is 6.5 (1). truth (1) — only that the data you enter is within the limits that
The integer value is the rounded up whole number result of have been set (1).
the calculation (1). 5. file = open(“classlist.csv”, “a”)
3. Because you cannot use mathematical operators on strings like name (1) = input (“Please enter name.”)
‘Name’: you can only use mathematical operators on numbers (1). file.write (1) (name + °,”+ ™\n”)
4. The coder used division (/) on the calculation of pay based 6. The file would be overwritten everyday, meaning older
on hours worked and pay rate (1). This should have been a * versions could not be accessed (1). A solution would be to
for multiplication (1). create a daily backup with an alternative filename (1).
5. Although b has a value lower than 50, a is greater than 10 (1),
so the printout would be ‘Extra Homework!” (1). Module 10: String handling
6. bstill has the lower value, but now the code is looking for 1. Astring data type can contain any alphanumeric character
a being equal to or greater than 10 (1). So now the display (1), including punctuation (1).
shows “Class Dismissed!” (1).
Store as an Store as
integer a _
Module 7: Flowcharts
1. a= decision (1)
b = terminator (START/STOP) (1)
c = input/output (1)
d = process (1)
2. When an input value is entered, the flowchart checks if it
is greater than or equal to 10 (1). If it is not, the “Outside
acceptable range” statement is given and resets (1). If it is,
the flowchart checks if it is also equal to or less than 20 (1).
If not, it resets again and if it is, the final “Acceptable range” [4 marks if fully correct, 3 marks if four correct, 2 marks
message is given and the flowchart stops (1). if three correct, 1 mark if one correct]
3. “fishchipsmushy peas” (1) because there is no clear space
set up between the strings (1).
4. 102 (1)
5. So that the computer can distinguish between the two
READ TEMPERATURE
possible data entries, as in passwords, for example (1).
Answers
created using statistical patierns that can be repeated and
PRINT “CLOSE
therefore it is not truly random (1).
WINDOWS!"
(2)
|66|Answers
ra Any two from: user ID generation; online gambling; computer Module 14: Parameters and subroutines
games; online password generators; cryptography services. 1. Any one from: name; value (1).
[2 marks: 1 mark for each use] 2. Any two from: the code can be written once, then used more than
It chooses a random integer (1) of value between 1 and 100 once, as needed, such as a greenhouse temperature monitoring
(1), and encourages the users to guess the number. It counts system; keeps code shorter because you are only writing the code
the number of guesses and outputs that number as part of the once for the subroutine, no matter how many times you need it,
message (1) when the user gets the number right. The random your code overall can be considerably shorter; easier to test even
function in this code ensures that truly no one knows in advance the large tasks, if decomposed into smaller subtasks, can be easy to
value of the number to be guessed (1). test one module — or subroutine — at a time; you can access and
use any variable from your main code without having to redefine it.
Module 12: Databases [2 marks: 1 mark for each example]
1 A flat-file database has only one table (1), such as an Excel 3. Accept an answer such as:
worksheet which shows the prices of products in a store (1). Sub ImageCheck (1)
A relational database has several different tables linked together maxFileSize = 1 (1)
(1), such as a school database that contains details of students, input “file to be uploaded” (1)
staff, classes (1). Check file properties (1)
A primary key is a data entry uniquely identified to each record IF filesize <= max
within the database (1). UPLOAD file
Structured data is data organised into a specific format (1), such ELSE
as your contacts on your phone (1). Unstructured data is like a list output “file too large” (1)
of your IMs or the contents of your social media photo account (1): ENDIF
there is no coherent organisation (1). EndSub (1)
To output the data in a way that is easy for humans to read (1). 4. (a)
ere ()
®p mana: mar
©
D
: 4mare:
correct row]
Answers }67|
————
Module 15: Robust and secure programming the non-Western languages that ASCII doesn’t recognise or
1. Validation ensures that the data is within reasonable limits accommodate (1). Unicode has separate character sets for
(1), such as a date of birth, or a postcode (1). It does not test the majority of written languages across the globe.
whether the data is actually true (1).
Verification checks whether the data is true (1), and this is Module 18: Representing images and sound
generally a human task (1) rather than a computer one. Date ile The program takes a number of samples of the sound at
of birth, for example, can be confirmed with a birth certificate regular set intervals (1), and works out the ‘top’ and ‘bottom’
or driver's licence or passport (1). values of the analogue sound within each sample (1). If the
Accept answers such as: sound being processed is ‘above’ the halfway point, the
Make some answers ‘required’ so that they can rank against program checks again if the sound would still be above
them. halfway if the first half was cut into half again, and so on.
Ask for the same information in different ways so that if the ‘Above’ is recorded as a ‘1’, ‘below’ it is recorded as a ‘0’ (1).
answers differ then something isn't right. The more samples per second that are taken, the higher the
[2 marks: 1 mark for method, 1 mark for description] quality of sound — and the larger the file (1).
Accept answers such as: Bit depth is the number of bits available for each sample
Timeln >= 0700 AND Timeln < 1200. ‘nine o'clock’ would be taken from the sound (1). The greater the bit depth, the better
invalid. the quality of sound (1).
[2 marks if fully correct, 1 mark for valid time control] MP3 is a lossy compression format so a lot of data is lost in
Any two from: making sure the program runs without errors; the compression, thus reducing the size.
testing confirms that the product that has been created to meet or
the original specification criteria or problem; mimicking user WAV is a lossless compression format so very little data is lost
input with different data to make sure all possible values are in compression, meaning that the file size isn’t reduced as
dealt with appropriately; eliminating the need to withdraw and substantially.
re-release a program. [2 marks: 1 mark for description, 1 mark for explanation]
[2 marks: 1 mark for each point made] Resolution refers to how many pixels are used per square (1).
Normal: e.g. 01/10/1974 (1) Low-resolution graphics are coarser (1) and may seem ‘furry’;
Extreme: 01/01/2000 or 31/12/1999 (1) high resolution graphics have more pixels per square (1) and
Erroneous: e.g. 5" June 1969 (1) therefore are clearer and sharper (1).
JPEGs allow compression of graphics in a lossy format,
Module 16: Number bases and binary arithmetic meaning that data quality is lost (1) as the file is increasingly
ut It is easier to translate into decimal (1), easier to understand compressed (1), but JPEGs can also be saved in full
(1). Each hexadecimal digit represents 4 bits, or a nibble, so uncompressed detail (1).
two hexadecimal digits represent a byte (1). A pixel is short for Picture Element, and is a single ‘dot’ on
A= OG weeee your screen or printout (1). It is a square of one colour used to
160 + 2=162 [2 marks: 1 mark for correct working, 1 mark make a bitmap image (1).
for correct answer]
00000111 Module 19: Data compression
+ 00000111 if A Huffman tree shows the frequency of elements in a file, coding
00001110 the most frequent ones with the smallest number (1), to limit
[2 marks: 1 mark for correct working, 1 mark for correct the file size overall in a lossless compression strategy (1).
answer] RLE is a very simple form of lossless data compression (1)
Ge ae alee which converts consecutive identical elements by storing the
= 200mlOmmal number of identical elements as a code (1).
= 4 ORO When it is used on images that have many continuous
= (018, identical colour pixels black and white image, for example (1).
[2 marks: 1 mark for correct working, 1 mark for correct
answer]
Answers
and the larger the file size (1).
space so that the files may be loaded more quickly; some :
The original 128 characters within ASCII are not sufficient
type of backup software could be used to move files to a
to represent all of the possible characters, numbers and
secure place, then the user could delete the less often used ~
a
symbols in languages across the world (1). Unicode includes ~' %
~
files on the hard disc to free up space; which would improve the Module 23: Secondary storage
speed of the disc. [2 marks: 1 mark for each correct example] if Optical (1). CD/DVD/Blu-ray (1)
2. Busv (1) 2 A ‘-R' disc can only be written to once (1) whereas a ‘RW’ disc can
3. Hardware is the collective name given to the physical (or electrical) be erased and re-written multiple times (1).
components (or parts) of a computer system (1). <F You can come to either conclusion — that cloud storage is a good
4. RAM memory is the workspace of the computer. If there isn't enough or not-so-good option for the organisation. Your comments should
capacity in memory for the CPU needs, the computer has to set up include elements such as:
what's known as a virtual memory file (1). To do this the CPU reserves
Advantages of cloud Disadvantages of cloud
space on the hard disk to simulate (or pretend to be) additional RAM.
storage storage
This process, referred to as ‘swapping’, slows the system down (1).
Access from anywhere with You need a reliable Internet
AORB | Internet connection. connection — especially if
So if they have travelling you are handling large files.
oe
access files and update representatives they might
1 diaries, for example. be trying to access diaries
or online files and find that
they cannot.
[2 marks if fully correct, 1 mark for the first two lines]
6. Two colours are needed so only two possible bit patterns — For businesses, this means You are relying on someone
that offices across the world else to keep your files safe.
which can be represented with one bit showing either
can access the same files.
O or 1 (1): therefore 25 pixels will need 25 bits (1).
Disaster recovery is easier — Moving from one provider to
Module 21: Software classification assuming that your storage another can be difficult.
1. Any one from: word processing; spreadsheet; desktop publishing (1). provider wasn't affected by So you need to be sure that
whatever hit your system. they meet the standards
It is not enough to simply name a product like ‘Keynote’ or ‘Word’,
So if the organisation is you need as a small
2. Anti-virus checker v (1) holding staff and customer organisation.
3. Open source software is provided with a licence that means it data it is easier to recover
can be downloaded, along with its source code, used, edited or without imposing on the
redistributed for any purpose (1). people.
4. ACommand Line Interface is the text based way of communicating
Costs are generally lower There can be data
with the computer (1). It is not particularly efficient nor is it user
per MB and storage capacity ownership issues if your
friendly (1). A Graphical User Interface is the basis of most systems is more flexible than local provider is sold to another
today, like iOS, WindowsX and MacOSx, where icons replace the storage. company — when Facebook
words (1) and a mouse is used more than a keyboard (1). So this can be a better idea bought Instagram,
5. The OS is needed to provide an interface between application for a small organisation that is all Instagram content
software/user and hardware (1) and to handle input/output devices balancing costs carefully. transferred a ‘licence to use’
that content to Facebook
(1). It is responsible for memory management (1) and for allocating
— without users’ express
processor time (1). It also provides security (1). consent.
6. A device driver is a small program or software interface (1) that So the data they hold might
enables an operating system to communicate with a hardware well be given away to a
device (1) such as a printer or graphics card. bigger company, breaking
the law. They need to be
sure that this is not going to
Module 22: Systems architecture
happen.
1. Volatile memory (such as Read Access Memory) (1) will only hold
data in memory as long as there is a power source, whereas non- [8 marks: 0-2 marks — A poor response containing little
volatile memory (such as USB storage) (1) will Keep contents when explanation of advantages and disadvantages. No use of
power is disconnected (1). technical language and poor use of spelling and grammar;
2. A Von Neumann bottleneck occurs when an ‘instruction fetch’ and 3-5 marks — A response is given that relates to the scenario.
‘data operation’ cannot occur at the same time because they use Some advantages and disadvantages are given with some
the same bus (1). explanation. Some examples are provided and there is some
3. The fetch-execute cycle is the process by which the CPU reads use of technical language. Only minor errors in spelling and
(fetches) instructions from the memory cache, decodes them, and grammar; 6-8 marks — A detailed response is given that is
then operates — or executes — the instruction (1). related to the scenario. Advantages and disadvantages are
4. RAM loses its content when the power is switched off (1) and ROM given and explained fully. There is a balanced discussion and
is read-only so cannot be edited (1). all examples are relevant and appropriate. There are few, if any,
5. Level 1 cache Vv (1) errors in spelling and grammar.]
6. Virtual memory is a section of the hard drive that is used when the 4. An embedded system is one in which the computer system plays a
computer does not have access to enough RAM to complete the part ina much bigger device. The computer element is often nearly
tasks in the program (1). invisible, but essential (1). Examples include digital watches/MP3
7. The computer uses cache memory as a form of buffer because players/traffic lights (1).
the CPU works faster than RAM (1). The data is pushed into cache
memory before the CPU needs it to stop the slower memory
inhibiting the function of the CPU (1).
8. Buses are wires around the motherboard that connect the
components that are attached (1).
9. The number of cores (1) and the cache memory (1).
Answers |69|
5. Any two from: solid state media can be more compact than Module 25: Network topology
magnetic media: the smaller size enables better portability; iti A star network topology has one connection to each of the
the battery will last longer because solid state media uses resources or devices on it (1), while a mesh network connects
less power; speed of access is higher in solid state drives so every device to every other device (1). While the mesh network
you can more quickly access your data; solid state is silent, is more robust (1), it is also a lot more expensive. (1)
so it can be used in a wider variety of settings. Example answer:
[4 marks: 2 marks for each reason]
S$ @
it A network often based on Bluetooth connection between
devices such as keyboards, pointing devices, phones, audio
headsets and printers (1). These cover very short distances
(up to about 10 metres) but have the advantage that they can
move with the user (1).
A LAN is a network in which all connected devices are
s
relatively close together, in a single building or premises
(1) like a school or office complex (1). A WAN is a network
in which the connected devices are too thinly spread to S-
Answers
Detailed justification for the argument. There is a balanced
discussion and all examples are relevant and appropriate.
There are few, if any, errors in spelling and grammar.]
Answers .
11. Browser and operating system, driver and application software, are
Starting handshake
Displaying HTML pages v
rata regularly updated (1) to ensure robustness and security (1) —and
malware writers are constantly benefitting from those who delay
their updating (1). A loophole/error/back entrance may have been
found that puts the computer at risk (1).
Answers
[6 marks: 0-2 marks — A poor response containing can continue your session in an encrypted mode (1).
little justification for the argument. No use of technical
language and poor use of spelling and grammar; 3-4
marks — A response is given that relates to the scenario.
Some justification for the argument. Some examples are
Answers ?
Paper 1 b) FD (3)
A (1) LT (90)
2. 1111101 (1) FD (2)
3. cache v (1) RT (90)
4. a) A Caesar cipher is a set of alphabetical letters set against a FD (2)
second set, but ‘shifted’ a set number of places so that each LT (90)
letter is paired against a different one in the opposing set FD (2) (2)
(1). When a message is encoded, the coded letters (not the iA Character | Huffman coding
original message) are sent to the recipient, who can decode the SPACE 111
message only if they know the ‘shift’ (1). N 00011
retolmtrlulrterats|
b) [P{[B[z[clH]{G|
tutste
001
[3 marks: 1 mark for each correct row]
Perera EM Lents a Pipe pest [ee 12. a) WarehouseLocation (1)
[BI IIN/ATR{[Y{ | ae pica 5 (1)
[3 marks: 1 mark for each correct word decoded] c) The primary key (1) from Warehouse is a field in the Stock table (1).
5. a) Aclient-server model spreads the workload between the main 13. Each bit can hold two colours (1) — 36 pixels in a two-colour
server and the user's device (1). image need 36 bits (1).
b) Aclient device may share resources with the more powerful b) 2 per pixel (1)
server (1), which enables faster communication because the 14 . Resolution is the number of pixels per set size, e.g. per inch, not in
server does the work before transmission (1). the overall image (1).
6. Hexadecimal is easier for humans to read Vv (1) . An operating system manages the computer resources and is
7. 58,34,2,4,39,54,1 = starting the interface between the user and the computer (1). It controls
34,58 24 5439 1 memory and processing time, manages access rights of users and
2,4 34,58 39,54,1 handles errors (1).
1,2,4,34,39,54,58 = finishing 100101
[2 marks: 1 mark for correct steps, 1 mark for correct outcome] + 10101
8. a) 111010
[2 marks: 1 mark for correct working and 1 mark for correct answer]
Character ¥ (1)
pats =| Boolean Vv (1)
greta2) - 16,21,11,19 -> 16,11,19,21 -> 11,16,19,21 [3 marks: 1 mark for
each stage. Mark for last stage will only be awarded when the
ae other stages are correct]
et . 10v (1)
[4 marks: 1 mark for each correct column] . The worst situation for bubble sort is when the list is effectively in
b) WHILE i<=6 AND found = false Vv (1) reversed order, so that every element (1) is in the ‘wrong’ position (1)
9. Example answer: and must be moved on each pass so that the sort will need to make
IF hour = 0 THEN the maximum number of passes (1) through the list.
OUTPUT 12 21. Example answers:
OUTPUT ‘am’ Set total to zero
ELSE IF hour < 12 THEN Set SCOre™ counter Co one
OUTPUT hour While score counter is less than or equal to ten
OUTPUT ‘am’ Input the next score
ELSE IF hour = 12 THEN Add the score into the total
OUTPUT 12 Set the class average to the total divided by ten
OUTPUT ‘pm’ Print the class average.
ELSE hour < hour - 12
OUTPUT hour
OUTPUT ‘pm’
ENDIF
Total = 0
ENDIF
ENDIF (4)
10. a) FD (3)
LT (90)
FD (3)
RT (90)
FD (1) AVERAGE =
TOTAL 10
Yes
OUTPUT
INPUT NEXT AVERAGE
SCORE
START (2)
ADD SCORE TO
TOTAL
[4 marks: 1 mark for right sequence, 1 mark for loop, 1 mark for
accurate calculation, 1 mark for output]
Answers
22. Position (or index) 4 (1) Paper 2
23. Arrays are of fixed size, so they cannot be edited without 1. Answers to include:
rewriting the code. 4 A bus network has a central spine of network cabling
Arrays can only store data of one type. Y [1 mark: both (called a bus) while a ring network has all of the computers
correct for 1 mark] connected to each other in a circle.
24. Array (1) A bus network is simple and cheapest to install and is good
Boolean (1) for a temporary network. It is flexible because elements can
25. Any two from: to make code easier to read; to allow for code be removed or added without messing with the rest of the
reuse/sharing; to improve code maintenance/make the code network. It is best used in small or temporary networks and
easier to update; to reduce programmer error. [2 marks: can be a useful home network solution. A ring network can
1 mark for each answer] offer fast data flow when it is working well — all data flows in
26. The data sent to a function by the subroutine that called it ¥ (1) one direction. Even when the load is the same, this performs
27. Logic error ¥ (1) better than a bus setup. Each device can access the
28. Answers to include: resources on the network equally.
High-level languages are human readable, but must be Both have disadvantages, however. In a bus network, if the
compiled or interpreted to be processed by the computer. bus (spine) fails the whole network crashes. Performance is
Low-level languages are closer to machine code, but are affected by load so the more devices attached, the slower
hard for humans to read. it functions. Bus cables are limited in length, so the network
If you write in a low-level language you have much more is limited in size, and must be terminated properly to avoid
control over the performance of the code and processor, reflection of signal, which can crash the system. Data has
while in a high-level language you are dependent on the to ‘queue’ sometimes because the bus is busy with other
compiler. If you write in a high-level language you can more demands. |n a ring network, each packet of data has to
easily debug an error track it, since it is easier for humans travel through all of the devices between its origin and its
to read. destination. If one device malfunctions the whole network is
Low-level languages take longer to write and check compromised. Setting this up is more expensive than a bus
than high-level languages, but writing code in high-level network. [5 marks: 1 mark for each correct point made]
languages loses some of the time benefit because the code A LAN is a network in which all connected devices are
must be compiled. relatively close together (1), in a single building or premises,
Low-level languages are harder for humans to learn than like a school or office complex (1). A WAN, on the other hand,
high-level languages. is a network in which the connected devices are too thinly
[6 marks: 1-2 marks: There are a few simple or vague spread to make a physical connection (1). These tend to be
statements relating to the question.The form and style of connected through telephone lines, undersea cables and, in
writing has many deficiencies. Ideas are not often clearly extreme cases, satellite links (1).
expressed. Sentences and paragraphs are often not well- Answers to include:
connected or at times bullet points may have been used. A wired network offers a more reliable connection because
Specialist vocabulary has been used inappropriately or not the link is physical. This means that it is also usually faster
at all. Much of the text is legible and some of the meaning than wireless connections. It is less convenient because it ties
is clear. There are many errors of spelling, punctuation the device to one place, but because the data is transferred
and grammar but it should still be possible to understand through a physical link it is more secure.
much of the response. 3—4 marks: There is evidence A wireless network allows more freedom of movement,
of some evaluation shown through the use of mostly although you can lose signal under less than ideal conditions.
correct technical explanation linked with advantages in Sharing a wireless access point with other users can also
the situation given. The answer covers a few of the ideas slow the speed of any data transfer. Security can be an issue
above or includes other correct answers. The form and since data is broadcast rather than contained within a cable.
style of writing is appropriate to the purpose and some [6 marks: 1-2 marks: There are a few simple or vague
complex ideas are expressed reasonably clearly and statements relating to the question. The form and style
fluently. Well linked sentences and paragraphs are usually of writing has many deficiencies. Ideas are not often
used. Specialist vocabulary has been used on a number clearly expressed. Sentences and paragraphs are
of occasions but not always appropriately. Text is legible often not well-connected or at times bullet points may
and most of the meaning is clear. There are occasional have been used. Specialist vocabulary has been used
errors of spelling, punctuation and grammar. 5-6 marks: inappropriately or not at all. Much of the text is legible and
There is evidence of a clear evaluation shown by a correct some of the meaning is clear. There are many errors of
explanation and three well justified comments. The answer spelling, punctuation and grammar but it should still be
covers most of the ideas above or includes other correct possible to understand much of the response. 3-4 marks:
answers. The form and style of writing is appropriate to There is evidence of some evaluation shown through the
the purpose and complex ideas are expressed clearly and use of mostly correct technical explanation linked with
fluently. Sentences and paragraphs follow on from one advantages in the situation given. The answer covers a
another clearly and coherently. Specialist vocabulary has few of the ideas above or includes other correct answers.
been used appropriately throughout. Text is legible and the The form and style of writing is appropriate to the purpose
meaning is clear. There are few, if any, errors of spelling, and some complex ideas are expressed reasonably
punctuation and grammar.] clearly and fluently. Well linked sentences and paragraphs
are usually used. Specialist vocabulary has been used
on a number of occasions but not always appropriately.
Answers
Answers -
Text is legible and most of the meaning is clear. There are anf Cloud storage is the term for storing your data on computer
occasional errors of spelling, punctuation and grammar. 5-6 systems belonging to someone else, and accessing them through
marks: There is evidence of a clear evaluation shown by a the Internet (1). Advantages of cloud storage include that you may
correct explanation and three well justified comments. The access them from anywhere with an Internet connection (1), and
answer covers most of the ideas above or includes other can therefore collaborate with people regardless of distance or
correct answers. The form and style of writing is appropriate time. Local disaster recovery is easier too, since you can restore
to the purpose and complex ideas are expressed clearly and from an online backup (1). Costs are generally lower per MB than
fluently. Sentences and paragraphs follow on from one another local storage (1). On the other hand, however, your data is stored
clearly and coherently. Specialist vocabulary has been used on someone else's computer, so you need to be sure of their
appropriately throughout. Text is legible and the meaning is security measures (1), and of ownership of your data should that
clear. There are few, if any, errors of spelling, punctuation and company be bought or go into bankruptcy. Moving what can be
grammar.] considerable amounts of data from one provider to another can
APPLICATION LAYER also cause problems (1).
ive Both file types use compression to reduce file size (1) and therefore
people may be concerned about the loss of quality as both remove
either image elements or certain audio frequencies (1).
TRANSPORT LAYER 13. It is most effective on images with many continuous pixels of the
same colour ¥ (1)
14. Text data ¥ (1)
15. System software ¥ (1)
INTERNET LAYER 16. Instructions are close to English/easier for humans to read and
write than a low-level language, which means a programmer is
less likely to make errors (1). It's quicker to develop code and
easier to maintain high level code (1). High-level languages are
NETWORK ACCESS (or DATA LINK) LAYER usually available across many platforms or chipsets or operating
systems (1).
ie You can come to either stance but you need to use evidence to
[3 marks: 1 mark for each correct layer] support your response. Answers to include:
IMAP ¥ (1) The advantages of using subroutines over writing the code
Oa 5 megabits per second = 5 000 000 bits per second (3) repeatedly as needed include clearly breaking a big task into little
ones makes the big task more achievable. Using code modules
or subroutines (one for each part of the task) makes it easy to see
which part of the code does which part of the overall task. Updates
are a lot easier — you just change the bit that needs to be updated.
A subroutine may work perfectly one time that it is called, but the
main code may then change the variable used by the subroutine
[6 marks: 2 marks for each correct column] — and the subroutine may fail. Finally, testing through the entire
a) An embedded system is part of a larger system, such as traffic code checking, each iteration of each subroutine, can feel like an
lights, and is designed to work without human intervention. endless task. [6 marks: 1 mark for each point made]
Usually the ‘computer’ part is invisible to the user (1). 18. A patch will fix any known security issues (1) so the machine
b) Any one from: senses cloth quality and density to identify running the application is less vulnerable to cyberattack (1).
quantity of water needed; detect water temperature; manage 19. A way of organising data so that it can be used efficiently ¥ (1)
wash cycle (1). 20. Answers to include: Backup (ideally off-site) to help make
sure that if data is corrupted in some way the copy may be
See used; Passwords to ensure only authorised people gain
sO | access to the data; Access levels to help ensure that only
OF =| the right people gain access to editing or creation options;
ae Redundancy — keeping a parallel system (or resources)
running ready to take over if anything happens to the main
system (or resources).
[6 marks: 1-2 marks: There are a few simple or vague
statements relating to the question. The form and style
of writing used has many deficiencies. Ideas are not
often clearly expressed. Sentences and paragraphs
are often not well-connected or at times bullet points
may have been used. Specialist vocabulary has been
used inappropriately or not at all. Much of the text is
legible and some of the meaning is clear. There are
[3 marks: 1 mark for A and B into an OR gate, 1 mark for O and
many errors of spelling, punctuation and grammar
the output of A and B into an AND gate, 1 mark for the output of
but it should still be possible to understand much of
the gate with O as an input with its output connected to Z]
the response. 3-4 marks: There is evidence of some
evaluation shown through the use of mostly correct
technical explanation linked with advantages in the
situation given. The answer covers a few of the ideas
above or includes other correct answers. The form and
Answers
style of writing used is appropriate to purpose and
expresses some complex ideas reasonably clearly
and fluently. Well linked sentences and paragraphs
are usually used. Specialist vocabulary has been
used on a number of occasions but not always
appropriately. Text is legible and most of the
meaning is clear. There are occasional errors of
spelling, punctuation and grammar. 5-6 marks:
There is evidence of a clear evaluation shown
by a correct explanation and three well justified
comments. The answer covers most of the ideas
above or includes other correct answers. A form
and style of writing appropriate to purpose is
used and complex ideas are expressed clearly
and fluently. Sentences and paragraphs follow
on from one another clearly and coherently.
Specialist vocabulary has been used appropriately
throughout. Text is legible and the meaning is
clear. There are few if any errors of spelling,
punctuation and grammar.]
21. a) Validation is an automatic computer check to
ensure that the data entered is sensible and
reasonable (1).
b) Any two from: check digit; format check; length check;
lookup limit; presence check; range check
[2 marks: 1 mark for each correct answer]
22. A variable is data stored in memory that can be
changed. 4
23. Normal (or typical) (1): e.g. 07625738925 (1)
Extreme (or boundary) (1): 07000000000 or 07999999999 (1)
Erroneous (1): e.g. Sheffield71155 (1)
Answers
Answers .
ACKNOWLEDGEMENTS
MIX | fo ee
al
Paper from &:) es
responsible sources _ou
wa
Ja5
FSC FSC C007454 Es Science Science
; on Combined Combined
U
l
of present and future generations,
and other controlled sources.
1. Available from:
www.collins.co.uk Q O uwm
www.lettsrevision.com
:g 39 Be
2. Fax your order to 01484 665736
3. Phone us on 0844 576 8126 pa £8 SSS 8s
4. Email us at [email protected] [im Bao" | : ons & 3” & 2
’ :so a ot
5. Post your order to: Collins Education,
seeercst RIKB-SGZT-ZYJL, 9780008162 9780008162054 9780008162061
Honley HD9 6QZ
ee
ek 5
Whether
J MCLiitcl vou
yvuearn by seeing, hearing or doing (or a mix of all
| like
Ac to
ao
three), this complete revision and practice book uses three different
approaches to help you engage with each topic and is packed with
exam-style practice @ opportunities for all-round revision success.
ee
networks
of
and
Definitions
itr
wl
types
yorworenao
ite
x ~
Find us at www.lettsrevision.cc
¥ Ei facebook.com/ettsrevision
7 -- @lettsrevision
ISBN 978-0-00-816206-
_www.collins.co.uk/lettsGCSErevision Mis
£10.99
* >