Grade8 - DL&C Textbook
Grade8 - DL&C Textbook
Computing
9
Ben Barnes
Margaret Debbadi
Pam Jones
Tristan Kirkpatrick
SERIES EDITOR:
Lorne Pearcey
369825_FM_Cam_LSC_SB_001-007.indd Page 2 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
Endorsement indicates that a resource has passed Cambridge International’s rigorous quality-assurance
process and is suitable to support the delivery of a Cambridge International curriculum framework. However,
endorsed resources are not the only suitable materials available to support teaching and learning, and are not
essential to be used to achieve the qualification. Resource lists found on the Cambridge International website
will include this resource and other endorsed resources.
Any example answers to questions taken from past question papers, practice questions, accompanying marks
and mark schemes included in this resource have been written by the authors and are for guidance only.
They do not replicate examination papers. In examinations the way marks are awarded may be different.
Any references to assessment and/or assessment preparation are the publisher’s interpretation of the
curriculum framework requirements. Examiners will not use endorsed resources as a source of material for any
assessment set by Cambridge International.
While the publishers have made every attempt to ensure that advice on the qualification and its assessment is
accurate, the official curriculum framework, specimen assessment materials and any associated assessment
guidance materials produced by the awarding body are the only authoritative source of information and should
always be referred to for definitive guidance. Cambridge International recommends that teachers consider using
a range of teaching and learning resources based on their own professional judgement of their students’ needs.
Cambridge International has not paid for the production of this resource, nor does Cambridge International
receive any royalties from its sale. For more information about the endorsement process, please visit
www.cambridgeinternational.org/endorsed-resources
Cambridge International copyright material in this publication is reproduced under licence and remains the
intellectual property of Cambridge Assessment International Education.
Third-party websites and resources referred to in this publication have not been endorsed by Cambridge
Assessment International Education.
Hachette UK’s policy is to use papers that are natural, renewable and recyclable products and made from
wood grown in well-managed forests and other controlled sources. The logging and manufacturing processes
are expected to conform to the environmental regulations of the country of origin.
Orders: please contact Hachette UK Distribution, Hely Hutchinson Centre, Milton Road, Didcot, Oxfordshire,
OX11 7HH. Telephone: +44 (0)1235 827827. Email [email protected] Lines are open from 9 a.m. to
5 p.m., Monday to Friday. You can also order through our website: www.hoddereducation.com
ISBN: 978 1 3983 6982 5
© Margaret Debbadi and Pam Jones 2023
First published in 2023 by
Hodder Education,
An Hachette UK Company
Carmelite House
50 Victoria Embankment
London EC4Y 0DZ
www.hoddereducation.com
Impression number 10 9 8 7 6 5 4 3 2 1
Year 2027 2026 2025 2024 2023
All rights reserved. Apart from any use permitted under UK copyright law, no part of this publication may be
reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying and
recording, or held within any information storage and retrieval system, without permission in writing from the
publisher or under licence from the Copyright Licensing Agency Limited. Further details of such licences (for
reprographic reproduction) may be obtained from the Copyright Licensing Agency Limited, www.cla.co.uk
Cover photo © ZinetroN - stock.adobe.com
Illustrations by Aptara, Inc.
Typeset in India by Aptara, Inc.
Printed in Bosnia and Herzegovina
A catalogue record for this title is available from the British Library.
369825_FM_Cam_LSC_SB_001-007.indd Page 3 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
Contents
Introduction 4
Glossary 236
Index 242
3
369825_FM_Cam_LSC_SB_001-007.indd Page 4 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
Introduction
About this book
Computer science is the study of computers, This Student’s Book will help you to understand
computing hardware and software, computer some of the key areas of computer science, such
networks and the design of computer programs. as:
It also includes the study of the way humans l network design
interact with computers and computing l algorithms and sub-routines
technology. l machine learning and Industry 4.0
Computer science is linked to all areas of the l one-dimensional arrays and string
4
369825_FM_Cam_LSC_SB_001-007.indd Page 5 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
KEYWORDS
sub-routine: standalone section of code that can Big Data: datasets that are too large or complex
be called from the main program for traditional data-processing applications, e.g.
machine learning: ability of a computer system to databases or spreadsheets, to process
learn over time prototype: initial product created for testing and
Industry 4.0: refers to how industry is combining reviewing, before a final product is released
electronics with new technologies, e.g. machine data type: classification applied to a data item
learning, artificial intelligence, robotics and green specifying which type of data that item represents,
energy e.g. in a spreadsheet some of the data types
one-dimensional array: series of items grouped available include currency, text and number
together under one identifier
string manipulation: process of changing the
format of a variable/string to allow it to be
analysed
9.2 Design your own network: Shape and size investigates how networks can be structured
in a variety of environments, providing scope to scale. It also covers ways in which networks
can be protected through design: how error-checking can work to improve transmission,
how machine learning is continuously improving the efficiency of utilities software and how
networks can be kept secure.
9.3 Coding and testing: Game development for the micro:bit develops your knowledge
and skills with the BBC micro:bit and MicroPython using count-controlled iteration and
arrays. You will create a MicroPython program to utilise the micro:bit as an element of a
‘What am I?’ game, developing your knowledge of using physical devices as part of game
development.
9.4 Drilling down: How the processor handles instructions looks at the steps a processor
carries out during the execution of a computer program. You will learn about the fetch–
decode–execute cycle and how program instructions are stored in lists that are run one at a
time. You will also learn why a range of language translators are needed to ensure that the
processor can understand and carry out program instructions users write. You will explore
logic circuits and learn about the benefits of machine learning and computerisation in a
range of industry and manufacturing areas.
9.5 Big Data modelling and analysis: Databases and spreadsheets explores the concept
and applications of ‘Big Data’. You will develop your data-modelling skills to create relational
5
369825_FM_Cam_LSC_SB_001-007.indd Page 6 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
databases of real-life models. You will learn how to use functions such as MAX, MIN, COUNT
and IF in spreadsheet models. You will investigate how to manipulate relational-database
models and spreadsheet models using complex queries and formulae, respectively.
9.6 An array of skills focuses on iterative development and developing a program over
time to meet a set of requirements. You will make use of all three programming constructs
(sequence, selection and iteration) and use arrays in the development of your program. You
will develop a game to improve knowledge of times tables and systematically debug and test
the solution using trace tables.
Get started!
This box introduces the unit and gives you some questions to
discuss in pairs or small groups.
Learning outcomes
This box lists the learning outcomes that you will achieve in the
unit.
Warm up
This box provides a task to do in pairs or small groups to get the
learning started.
DID YOU KNOW?
This box provides an
SCENARIO
interesting or important
This box contains a scenario that puts the tasks in the unit into a real- fact about the task or
world context. section.
Do you remember?
This box lists the skills you should already be able to do before
starting the unit.
Learn
This box introduces new concepts and skills.
6
369825_FM_Cam_LSC_SB_001-007.indd Page 7 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
Practise
This box contains tasks to apply and practise the new skills and
knowledge from the ‘Learn’ box.
Go further
This box contains tasks to enhance and develop the skills you
have previously learned in the unit.
Challenge yourself
This box provides challenging tasks with additional instructions
to support new skills.
Final project
This box contains a final project that encompasses all the
skills you have developed over the unit, in the context of the
Scenario. The tasks in this box can be used to support teacher
assessment of the learning objectives from the ‘Learning
outcomes’ box.
Evaluation
KEYWORDS
This box provides guidance on how to evaluate and, if necessary, Important words
test the Final project tasks. are shown in
emboldened orange
font and are defined
in this box. They
What can you do? also appear in the
Glossary at the back
of the book.
This box provides a summary of the skills you have learned in
the unit and can be used to support self/peer assessment of
the learning objectives.
Computational thinking
Most computational thinking skills are embedded into the These speech
Practise tasks. However, where you see this box, an individual bubbles provide
computational thinking skill is highlighted for your attention. hints and tips as
you complete the
tasks.
Student resource files, used in some of the ‘Practise’ boxes, are available
at www.hoddereducation.co.uk/cambridgeextras
7
369825_9.1_Cam_LSC_SB_008-054.indd Page 8 06/03/23 9:46 AM A4902 /142/HO02737/work/indd
Get started!
Have you ever wondered how a
computer program can help you
to make a decision? How does a
sequence of questions help you
work out what to do?
Questioning allows you to ask
specific questions and gain insight
through the answers. If structured
correctly, these questions can help
you to find a solution to a problem
or make a decision.
Try this game in pairs: One student
should think of an object and the other student must ask up to 20 questions to try to
guess what the object is. The questions can have a response of only ‘Yes’ or ‘No’.
Discuss with your partner:
● How did the questions help to narrow down what the object was?
● What questions did you start with and why?
● Did you plan the questions you would ask before you started?
● What would you do differently if you were to do this activity again?
Questioning is an effective tool and, when used correctly, can help KEYWORD
you find out about something or help to narrow down a selection.
chatbot: software
In this unit, you will develop a Python program to act as a chatbot. application that
A chatbot is a program that asks the user a series of questions, uses text to ask
questions to help
stores the answers and then uses the information to help the user to a user
make a decision.
8
369825_9.1_Cam_LSC_SB_008-054.indd Page 9 06/03/23 9:46 AM A4902 /142/HO02737/work/indd
Learning outcomes
In this unit, you will learn to:
● follow, understand, edit and correct algorithms that are presented as pseudocode
● follow flowchart or pseudocode algorithms that use loops
● create algorithms using flowcharts and pseudocode
● use and explain iteration statements with count-controlled loops in either pseudocode
or flowcharts
● predict the outcome of algorithms that use iteration
● compare and contrast two algorithms for the same solution and decide which is better
suited to a task
● create an algorithm as a flowchart or pseudocode using more than one of these
constructs: sequence, selection and count-controlled iteration
● identify and explain the purpose of a one-dimensional array
● identify and describe data types in Python programs, including integer, real, character,
string and Boolean
● develop a Python program with count-controlled loops
● access data from an array using Python
● develop Python programs using string manipulation, including length, uppercase and
lowercase
● use iterative development on Python prototypes to create solutions to problems
● develop and apply test plans that include normal, extreme and invalid data
● identify test data that covers normal, extreme and invalid data
● identify and describe a range of errors, including syntax, logic and runtime errors
● use a trace table to debug errors in a Python program.
Warm up
You make decisions every day, such as what clothes to wear,
what to have for breakfast, what to take to school, and many
more. Some decisions can be difficult to make and you may need
to answer some questions to help you to choose. For example,
the flowchart on the next page could help you to decide what to
have for breakfast.
Each question helps to narrow down your options. The questions
lead on from one another in a sequence, and every question
has a ‘Yes’ or ‘No’ path to follow. These paths lead either to
another question or to the final output – the
decision. KEYWORD
flowchart: visual
In pairs, create a flowchart to help you
representation of
to make a decision, such as choosing a an algorithm
topping for a pizza.
9
369825_9.1_Cam_LSC_SB_008-054.indd Page 10 06/03/23 9:46 AM A4902 /142/HO02737/work/indd
Start
OUTPUT "Breakfast
options are toast,
cereal or fruit."
No No OUTPUT
Do you want toast? Do you want cereal?
"Fruit it is!"
Yes Yes
OUTPUT OUTPUT
"Have toast!" "Have cereal!"
No OUTPUT
Do you want milk?
"Start eating!"
Yes
OUTPUT "Add
milk to cereal!"
SCENARIO
You use technology in a wide range of ways, user a series of questions, store their answers
and when you need help it is not always and use this to help make a final decision. The
possible to speak to a person. A chatbot solution will:
allows a company to support their customers ● be presented as pseudocode to show the
to find a solution to their problem through algorithm for your chatbot program
questioning. ● use variables and/or an array to store the
Your school has asked you to create a chatbot answers to the questions asked of the user
program to interact with students during ● use a count-controlled loop
the selection of options or subject areas to ● follow an iterative process to design, develop,
continue to study. The chatbot will ask the test and review to create a final prototype.
10
369825_9.1_Cam_LSC_SB_008-054.indd Page 11 06/03/23 9:46 AM A4902 /142/HO02737/work/indd
Do you remember?
Before starting this unit, you should be able to:
✔ develop a Python program using an iterative process
✔ follow and understand an algorithm presented as pseudocode
✔ explain and use the rules AND, OR and NOT to create logic within an algorithm
✔ follow flowcharts and pseudocode algorithms that use conditional statements
✔ predict the outcome of algorithms that use pseudocode
✔ create a Python program that uses conditional statements
✔ create a program in Python that uses a range of different data types
✔ develop a Python program that uses rules involving AND, OR and NOT
✔ decompose a problem into smaller sub-problems to make it easier to solve
✔ identify and describe the data types in a Python program
✔ develop and apply a test plan to ensure a Python program or algorithm works correctly.
In this unit, you will use the Python need to install IDLE on your own personal
programming language. device:
1 Go to www.python.org/downloads
Python’s Integrated Development and
2 Select Download Python.
Learning Environment (IDLE) provides
features for creating, editing and running 3 Once downloaded, double-click on the file
programs. Before using Python, you will to open it and then choose Install Now.
4 Once IDLE has installed, it should appear
in your Start Menu.
Chatbots
Learn
Chatbots have become increasingly useful
to growing businesses as they strive to meet
customer demands. Instead of a customer
sitting in a queue to speak to someone about
the questions they have, they can use a
chatbot to answer their questions and
receive possible solutions. This is a
developing technology that has limitations,
so if the chatbot is unable to help it will
direct the customer to speak to a person. In
this way, chatbots filter the calls that need to
be answered by a person by offering quick
answers to the problems they can solve.
For example, an IT helpline may be able to support a selection of customers by asking
some key questions about the issues they have and using this to offer possible ways for
the customers to solve the problem themselves.
11
369825_9.1_Cam_LSC_SB_008-054.indd Page 12 06/03/23 9:46 AM A4902 /142/HO02737/work/indd
Rule-based chatbots have predefined questions built in, so they are structured and less
conversational. The questions do not evolve with the user’s answers and are limited to
the set questions that have been programmed to be asked. Examples include IT first-line
support to gain an understanding of a system error or a health chatbot asking questions
to determine the level of a health issue or how to advise on the next steps.
Chatbots with artificial intelligence (AI) offer intelligent conversations as the AI learns
from your selections and answers to guide the next question or offer advice. It is called
machine learning when a device learns over time. This type of chatbot is a developing
technology, but more of the basics of AI are being integrated into chatbots where they
learn from the user’s choices, for example song selections or programme selections guide
suggestions for future choices.
Practise
KEYWORDS
1 Discuss with your partner the difference between a rule- rule-based chatbot: chatbot
based chatbot and an artificial-intelligence chatbot. with a set of questions built
in that it asks and the user
2 Chatbots are integrated into websites to help the
answers
customer. In pairs, investigate how chatbots are used in
evolving: changing and
retail and support, and consider the following questions. improving
a What is the chatbot’s main function? artificial intelligence: ability
b Who is the chatbot for (what type of user, for of a computer system to
example, a teenager)? learn and develop its own
programming from the
c How does it use questions to offer a solution?
experiences it encounters
d What is good about this type of chatbot? machine learning: ability of
3 Discuss as a class the range of chatbots you have found a computer system to learn
and any similarities or differences between them. over time
12
369825_9.1_Cam_LSC_SB_008-054.indd Page 13 06/03/23 9:46 AM A4902 /142/HO02737/work/indd
A string is a series of characters, and the characters are placed inside quotation marks,
for example: "string". Some programming languages, such as Java, include a character
data type that is used to store a single letter, digit or symbol. However, Python does not
use this data type. Here is an example showing a character data type being set up in the C
programming language: char variableName = 'A'. The content of the variable is a single
character defined by the code char, and the content following the = is the single letter A.
If you want to use a number in an equation or comparison, you must set it as either an
integer or a real data type. The integer data type stores whole numbers, and the real
data type stores numbers that contain decimal places, for example 15.75. You should
also be familiar with the Boolean data type that stores either True or False; for example,
if age > 20: would generate a True or False outcome.
It is important to set the data type when creating a variable. The following program
should store two numbers the user enters, add them together and display the total.
However, when this program is run and the user enters 5 and 3, the output is shown as 53.
KEYWORDS
algorithm: step-by-step
instructions to solve a particular
problem
Python assumes that an input is a string unless it is told
string: sequence of characters
otherwise. Therefore, in this program it has linked the
that can be text, numbers or
numbers together to form a longer string, rather than symbols; quotation marks
adding them. This is called concatenation. To add the values around the characters define it
together, the computer needs to be told to store each input as a string
as an integer. Remember: this is done by adding int to the character: single letter, digit or
input statement. When you convert the value from one data symbol
type to another, it is called casting because you cast it. integer: whole number
real: also known as a float; a
decimal number
float: decimal number
concatenation: joining two
strings together
cast: change the data type of a
Now when the program is run it gives the result expected: variable
Consider a chatbot that is going to ask you how many hours you have free, what your
favourite activity is and how long the activity will take, and then output as a sentence how
much time you will have left when you have completed the activity. A table can be created
to plan the variables required and their data types. Here is an example.
13
369825_9.1_Cam_LSC_SB_008-054.indd Page 14 06/03/23 9:46 AM A4902 /142/HO02737/work/indd
The data type is not shown in the pseudocode, so having a table with the variable names
and data types planned out clearly can help the programmer when they are creating the
code.
Remember: the name of a
You have already used int to set the data variable is important to ensure that
type to an integer in Python. To set the it tells you what it is storing. There are
data type as a real number, you use float two main naming conventions:
instead of int. In the program below, you camelCase: all lowercase; from the
can see that the variable ‘hours’ has been set second word, the first letter is capitalised
as an integer and the variable ‘activityTime’
snake_case: all lowercase; spaces are
has been set as a float (real). The variable replaced with an underscore ( _ )
‘activity’ does not have a data type set as it
will be stored as a string by default.
Notice that the output uses both text and the contents of variables. The text is encased in
quotation marks and a comma is placed between this and the name of the variable to be
used. A comma is added whenever the output changes between text and a variable.
KEYWORDS
pseudocode: textual representation of an algorithm
naming convention: the way a variable or array is named in programming
camelCase: all lowercase, and from the second word the first letter is
capitalised
snake_case: all lowercase, and spaces are replaced with underscores ( _ )
14
369825_9.1_Cam_LSC_SB_008-054.indd Page 15 06/03/23 9:46 AM A4902 /142/HO02737/work/indd
Practise
1 Discuss with your partner what this flowchart
Start
algorithm will do.
2 Copy the table below and add the variables
and data types that will be required when
adult = False
creating the program. cost = 7.95
activity = INPUT
3 Create the pseudocode to match the "Enter the activity"
flowchart algorithm.
4 Write the program code for the algorithm in
Python and save it as activityChatbotV1.py.
5 Test, using a test plan, that your program age = INPUT
works as expected. "Enter your age"
No
Stop
15
369825_9.1_Cam_LSC_SB_008-054.indd Page 16 06/03/23 9:46 AM A4902 /142/HO02737/work/indd
Developing in iterations
Learn
You have seen that a program is developed from an algorithm to program code. The initial
idea for the program can evolve throughout this process. When the programmer receives
the initial requirements, they have a starting vision. This vision, through development into
a prototype, may change or be adjusted. That is where the programmer needs to work
iteratively to take in any adjustments and apply them to the development. Iterative means ‘to
repeat’, and the development steps are repeated until the prototype is ready to be released.
The program code itself can also be developed iteratively. The code can be broken down
into smaller sections, and these can be developed, tested and reviewed before the next
section of code is added.
As a programmer starts to write the code, developments can be considered. The initial
idea may grow or change as the program develops, and a new development iteration may
be required.
To develop the opening of a chatbot program for selecting the type of support a user
requires, you would start with the pseudocode.
16
369825_9.1_Cam_LSC_SB_008-054.indd Page 17 06/03/23 9:46 AM A4902 /142/HO02737/work/indd
IF selection == 1 THEN
OUTPUT "Welcome to store products"
ELSEIF selection == 2 THEN
OUTPUT "The store locations are UK and USA"
ELSE
OUTPUT "Welcome to the special offers"
ENDIF
STOP
Step 2: Identify the variable and data type required in the program
17
369825_9.1_Cam_LSC_SB_008-054.indd Page 18 06/03/23 9:46 AM A4902 /142/HO02737/work/indd
KEYWORDS
evolving: changing and improving iterate/iterative/iteration: repeat/repeated/
user requirements: tasks a user expects of an repetition
application trace table: technique for predicting step by step
prototype: initial product created for testing and what will happen as each line of an algorithm or
reviewing, before a final product is released program is run, and to identify errors
Practise
1 A pizza shop wants to develop a chatbot to allow customers to select their pizza.
Customers may choose between chicken and sweetcorn, spicy lamb, and margherita.
a Discuss with your partner how you can use iterative development to create a
prototype chatbot for the pizza shop.
b Make a list of the requirements for the finished chatbot.
c Plan the algorithm for the chatbot using pseudocode.
2 a Use your pseudocode algorithm to write the program code for the chatbot and save
it as pizzaChatbotV1.py.
b Test your code to make sure that it works as you expect.
c Review your chatbot prototype to make sure that it meets your list of requirements.
3 a The pizza shop have decided that they would also like to offer a veggie pizza.
Develop your program code to include this option and save it as pizzaChatbotV2.py.
b Review your chatbot protype to make sure it meets this new requirement.
18
369825_9.1_Cam_LSC_SB_008-054.indd Page 19 06/03/23 9:46 AM A4902 /142/HO02737/work/indd
Code tracers
Learn
When developing a solution from algorithm to program, it is important to test both the
algorithm and the program code. When testing the finished program, it can be easier to
see errors when you use a structured test plan to document the output based on a range
of inputs.
An algorithm is the plan for a program that needs to be created and can be developed
visually using a flowchart or textually as pseudocode. The algorithm needs to be checked
and tested before it is handed over to the programmer to develop the program code.
A variable is a temporary storage location in memory whose contents can be called and
edited at any time in the program. The contents of each variable can be mapped out in a
trace table to show where they change as a program runs. A trace table is a structured
approach like a test plan that can be used to look at the algorithm, or program code, and
follow the variables and conditions.
Look at the structure of a trace table.
● Line: The line in the pseudocode algorithm or the step in the flowchart.
● Variable: You can put the name of the variable in the heading and make a note of
the value of the variable in the column each time it changes.
● Condition: The conditional statement that completes a check to see whether the
variable meets the set criteria; the output will be either True or False.
● Output: Where the program outputs the value stored in a variable.
Step 1: You can see that there is one variable in this pseudocode example: ‘number’. This
can be added to the second column in the trace table, under the heading ‘Variable’.
There is also a condition being tested (‘Is the number less than 10?’). This can be added to
the third column in the trace table, under the heading ‘Condition’.
19
369825_9.1_Cam_LSC_SB_008-054.indd Page 20 06/03/23 9:46 AM A4902 /142/HO02737/work/indd
Step 2: Look at the first line of the pseudocode. This just defines the ‘START’ and is not
added to the trace table.
Line 2: Here, the value 5 is set against the variable ‘number’. This is added to the first row
of the table. The line number is added to column 1 and the value stored in the variable is
added to column 2.
Step 3: Line 3 has the condition IF number < 10 THEN. The value that is stored in the
variable ‘number’ at this time is 5, and this is less than 10, so the output is True. This is
added to the next row of the table.
Step 4: Line 4 has an output. It will output the value that is stored in the variable ‘number’
plus 5. This is added to the next row of the trace table.
Steps 5–6: Lines 5 and 6 would not be used in this instance as they would run only if the
condition on line 3 was False. This is not added to the trace table.
Steps 7–8: Lines 7 and 8 do not use the variable as they define the end of the selection
section and the end of the algorithm, so they are not added to the trace table.
20
369825_9.1_Cam_LSC_SB_008-054.indd Page 21 06/03/23 9:46 AM A4902 /142/HO02737/work/indd
Yes
Step 2: Look at instruction 1, which would be
line 1 of the code. This is the ‘start’ shape on the
flowchart and is not added to the trace table. OUTPUT
"Access Granted"
Line 2: The variable ‘password’ is created and the
string ‘enter123’ is assigned to it.
Step 3: Line 3: The user enters their password, and the string they input is stored in the
variable ‘userInput’. For this test, the user is inputting the string ‘enter123’.
21
369825_9.1_Cam_LSC_SB_008-054.indd Page 22 06/03/23 9:46 AM A4902 /142/HO02737/work/indd
Step 5: Line 5: As the outcome to the condition is True, the output is ‘Access Granted’,
and this is added to the next line of the truth table.
Trace tables are a useful tool for anyone planning a program. They help the programmer
to carry out a dry-run test on an algorithm, to check the values of variables through a run
of a program, and to find and fix any errors.
KEYWORDS
flowchart: visual representation of an algorithm
pseudocode: textual representation of an algorithm
variable: named memory location that can store a value
trace table: technique for predicting step by step what will happen as each
line of an algorithm or program is run, and to identify errors
criteria: set of rules that must be met
selection: choice to be added to a program using if… elif… else and the
next instruction executed in the program is decided by the outcome of a
condition
integer: whole number
string: sequence of characters that can be text, numbers or symbols;
quotation marks around the characters define it as a string
truth table: breakdown of a logic circuit, listing all possible operations the
logic circuit can carry out
dry run: process of working through an algorithm manually to trace the
values of variables
22
369825_9.1_Cam_LSC_SB_008-054.indd Page 23 06/03/23 9:46 AM A4902 /142/HO02737/work/indd
Practise
You have seen that a trace table can be used to trace the flow
of a variable through an algorithm displayed as pseudocode
or as a flowchart. A trace table can also be used with a Python
prototype program to find and fix errors.
1 Open the file FoodSelectionChatbot.py provided by your
teacher. The program is a prototype for a chatbot to help you
to select a food to eat. Using the file:
a Copy and complete the trace table below when the input is 1.
b Complete the trace table when the input is 2.
c Complete the trace table when the input is 3.
d Complete the trace table when the input is 4.
2 Discuss with your partner the error that the trace table has
helped to identify.
3 Edit the Python program to correct the error, and save it as
FoodSelectionChatbotV2.py.
4 Repeat the trace table to check that the program now works
correctly.
5 Annotate your trace table to identify where the integer and
Boolean data types are used.
6 Discuss with your partner how you can use trace tables
as you use iterative development to create your software
prototype.
Error processing
Learn
In the previous section, you learned about trace tables and how they can be used to check
algorithms and Python program prototypes. This is a useful process to follow to identify
errors and fix them.
The main focus of iterative development is to produce a fully working prototype and
then a finished solution that is free from error. If a chatbot is released that has not been
thoroughly tested, it may not work properly and this would mean that it is not able to ask
23
369825_9.1_Cam_LSC_SB_008-054.indd Page 24 06/03/23 9:46 AM A4902 /142/HO02737/work/indd
the necessary questions to help the user to find a solution. As a program is developed, a
series of processes are followed to find and fix errors, for example, using trace tables.
Errors that are introduced at the design stage can filter through to the development
stage if they are not identified early on. This could result in the product needing to be
redeveloped, which could be very costly and would take extra time. Therefore, it is
important to find and fix any errors as early as possible in the process.
Errors can be categorised in three ways:
● Logic errors: The program will run but does not output what is expected; an example
of a logic error is the inclusion of an incorrect conditional operator.
● Syntax errors: Errors in the program code that stop the program from running;
an example of a syntax error is where the code has been typed incorrectly, for
instance, missing brackets, colons or indentation or incorrect spelling, to name
a few.
● Runtime errors: Errors that occur while the program is running as the instructions
cannot be completed; an example of a runtime error is where the variable name has not
been added correctly in one aspect of the program – it would not generate an error
until it is used.
Testing an algorithm before it is developed into the program code can help to find and fix
any errors early on.
In the previous section, you looked at trace tables. Trace tables can also be used to find
any logic errors in an algorithm. A logic error does not stop the program from running,
but the program doesn’t do what you expect it to.
One area that can cause a logic error is the use of conditional operators in conditional
statements.
KEYWORDS
Here’s a reminder logic error: error that allows a
of the conditional program to run but not output what
operators. is expected
syntax error: error in program code
that stops the program from running
Conditional operator Description runtime error: error that occurs while
a program is running; the instructions
== equal to cannot be completed
!= not equal to conditional operator: symbol,
> greater than e.g. >, < and =, used to carry out
comparisons between two values
>= greater than or equal to
conditional statement: completes a
< less than check to see whether set criteria is
<= less than or equal to either True or False
If these operators are used incorrectly, the outcome of comparisons could be wrong,
and this would result in the wrong output from the program. For example, if a chatbot
asks for a value to be added, then the correct value needs to be detected in the
comparison if food == 1.
24
369825_9.1_Cam_LSC_SB_008-054.indd Page 25 06/03/23 9:46 AM A4902 /142/HO02737/work/indd
Look at the example below of an algorithm (presented as pseudocode) and a trace table
to find and fix the logic error. The pseudocode has been developed as a plan for a chatbot
program to allow a student to enter their score and output the level they are working at,
along with a message of encouragement.
1 START
2 OUTPUT "Student score chatbot"
3 score = INPUT "Enter your recent score."
4 IF score > 90 THEN
5 OUTPUT "You are working at a Distinction level."
6 OUTPUT "Keep the focus on new subject areas."
7 ELSEIF score >= 51 AND <= 89 THEN
8 OUTPUT "You are working at a Merit level."
9 OUTPUT "You are doing well. Focus on revision techniques."
10 ELSEIF score >= 20 AND <= 50 THEN
11 OUTPUT "You are working at a Pass level."
12 OUTPUT "Some extra sessions may help improve your understanding."
13 ELSE
14 OUTPUT "You have not passed this assessment."
15 OUTPUT "Some one-to-one time would help with looking at content."
16 ENDIF
17 STOP
In the same way as you would test program code with a test plan and a range of data
inputs, you need to use a range of inputs to test the algorithm. Each input will require
a new trace table.
Test 1: Trace table for input of score 10
25
369825_9.1_Cam_LSC_SB_008-054.indd Page 26 06/03/23 9:46 AM A4902 /142/HO02737/work/indd
The trace table shows that when a score of 10 is entered, the conditions on lines
4, 7 and 10 are all False. The program moves to the else section and generates an
output of ‘You have not passed this assessment.’ and ‘Some one-to-one time would help
with looking at content.’ The trace table shows that the algorithm works correctly for
this value.
Test 2: Trace table for input of score 20
The trace table shows that when a score of 20 is entered, the conditions on lines 4 and
7 are both False. The condition on line 10 is True and generates an output of ‘You are
working at a Pass level.’ and ‘Some extra sessions may help improve your understanding.’
The trace table shows that the algorithm also works correctly for this value.
Test 3: Trace table for input of score 89
The trace table shows that when a score of 89 is entered, the condition on line 4 is False.
The condition on line 7 is True and generates an output of ‘You are working at a Merit
level.’ and ‘You are doing well. Focus on revision techniques.’ The trace table shows that
the algorithm also works correctly for this value.
26
369825_9.1_Cam_LSC_SB_008-054.indd Page 27 06/03/23 9:46 AM A4902 /142/HO02737/work/indd
When a score of 90 is input, the expected output would be for the student to receive the
level of Distinction. However, from tracking the variable in the trace table, you can see that
the condition is not producing the correct outcome. This is a logic error. The conditional
operator has been set as greater than ( > ) when it should be set as greater than or equal
to ( >= ).
1 START
2 OUTPUT "Student score chatbot"
3 score = INPUT "Enter your recent score."
4 IF score >= 90 THEN
5 OUTPUT "You are working at a Distinction level."
6 OUTPUT "Keep the focus on new subject areas."
7 ELSEIF score >= 51 AND <= 89 THEN
8 OUTPUT "You are working at a Merit level."
9 OUTPUT "You are doing well. Focus on revision techniques."
10 ELSEIF score >= 20 AND <= 50 THEN
11 OUTPUT "You are working at a Pass level."
12 OUTPUT "Some extra sessions may help improve your understanding."
13 ELSE
14 OUTPUT "You have not passed this assessment."
15 OUTPUT "Some one-to-one time would help with looking at content."
16 ENDIF
17 STOP
If this error had not be found at this stage, the wrong operator would have been used in
the program code and the error would not have been spotted until much further through
the process. If you are using conditions that involve comparisons, it is important to test
the algorithm using a wide range of data inputs. In this example, some specific numbers
were used in the dry-run testing, but it would be better to test each value that is used in a
conditional statement and a selection of other values in between.
27
369825_9.1_Cam_LSC_SB_008-054.indd Page 28 06/03/23 9:46 AM A4902 /142/HO02737/work/indd
Practise
1 Open the file StudentScoreChatbot.py provided by your
teacher.
a Run the program to find the syntax error.
b Correct the program and save it as
StudentScoreChatbotV2.py.
2 Create trace tables for the following inputs:
a 95 b 15 c 25 d 80
3 a Annotate the trace table to identify where the logic error is.
b Correct the program and save it as
StudentScoreChatbotV3.py.
4 a Discuss with your partner how trace tables helped to
identify the logic compared with how you identified the
syntax error.
b Evaluate how effective a trace table can be to identify
errors and help development.
Iteration introduction
Learn
So far, you have created Python programs
using two programming constructs: sequence
and selection. Remember: sequence is the order
in which the program code needs to be
Another programming construct is iteration. to work correctly; selection allows a choice
You have seen that iteration in program to be added to the program using if…
development is about repeating a series of elif… else so that the next instruction
steps to develop the program continuously executed in the program is decided by
until the final solution is reached. In the outcome of a condition.
programming, iteration is a set of instructions
that are repeated, and it is also referred to as
a loop.
A count-controlled loop is where a series of program instructions is repeated a set
number of times. This type of loop is also called a for loop.
Here’s an example of a for loop:
28
369825_9.1_Cam_LSC_SB_008-054.indd Page 29 06/03/23 9:46 AM A4902 /142/HO02737/work/indd
All the lines of code that need to be repeated when the loop runs are indented
underneath, in the same way that code is indented after if, elif and else.
● print("This is loop," i) outputs the text ‘This is loop’ followed by the value
stored in the variable ‘i’ to show the iteration that the program is on.
Program output
When the program above is run, the output displayed would be:
The loop variable always starts at 0 and the loop is executed until the value of
the loop variable is the same as the number in the brackets after range(). In
the example above, to output the number 5 the range would need to be increased
to 6.
A chatbot may need to ask the same set of questions more than once. You can use a for
loop to set the number of times a question is asked and test the input using selection. It is
important that the conditional statements are indented inside the for loop.
In the pseudocode below, the program outputting the iteration number is developed to
check the value stored in the variable ‘i’. If the value of i is greater than 3, then the output
is ‘This is loop’, the value of i and ‘Iterations complete’. If the value of i is 0, 1, 2 or 3, then
the output is ‘This is loop’ and the value of i. In pseudocode, the actual values of the count
variable are stated.
29
369825_9.1_Cam_LSC_SB_008-054.indd Page 30 06/03/23 9:46 AM A4902 /142/HO02737/work/indd
START
FOR i = 0 TO 4
IF i > 3 THEN
OUTPUT "This is loop",i,"Iterations complete"
ELSE
OUTPUT "This is loop",i
ENDIF
ENDFOR
STOP
It is important that the selection statements are indented inside the for loop. The output if
the conditional statement is True or False is indented under the IF and ELSE sections.
This pseudocode can be developed into a Python program, ensuring that the same
indentation is used.
KEYWORDS
sequence: order that program code needs to be in to work correctly
selection: choice to be added to a program using if… elif… else and the
next instruction executed in the program is decided by the outcome of a
condition
execute: carry out the instructions described in a computer program
iterate/iterative/iteration: repeat/repeated/repetition
count-controlled loop: set of instructions repeated a set number of times
for loop: the Python or MicroPython loop for a count-controlled loop
loop variable: variable that counts the number of times code has been
repeated in a count-controlled loop
Practise
Open your file FoodSelectionChatbotV2.py from the earlier
section ‘Code tracers’.
1 Discuss with your partner how a count-controlled loop could
be added to allow the question and selection program code to
be run twice.
2 Edit the program code to include a for loop. Save your new
program development as FoodSelectionChatbotV3.py.
30
369825_9.1_Cam_LSC_SB_008-054.indd Page 31 06/03/23 9:46 AM A4902 /142/HO02737/work/indd
Iteration in algorithms
Learn
Using a loop can avoid the need to rewrite lines of program code multiple times. Look at
the two flowcharts below. Compare them to identify their similarities and contrast them to
identify the differences between them.
Flowchart 1 Flowchart 2
Start Start
OUTPUT favSubject1 No
Stop if i < 3
Yes
favSubject2 = INPUT
"What is one of your
favourite subjects?" favSubject = INPUT
"What is one of your
favourite subjects?"
OUTPUT favSubject2
OUTPUT
favSubject
favSubject3 = INPUT
"What is one of your
favourite subjects?"
i=i+1
OUTPUT favSubject3
Stop
31
369825_9.1_Cam_LSC_SB_008-054.indd Page 32 06/03/23 9:46 AM A4902 /142/HO02737/work/indd
Both flowcharts have asked the user to enter their favourite subject and output what it is
three times. However, the use of a loop in flowchart 2 makes the algorithm more efficient.
The efficiency of a program is measured by how long it takes to run. Usually, if the code
can be written in fewer lines, it is more efficient.
You can use the flowchart to create pseudocode to represent the same algorithm.
Flowchart 1
Each shape of the flowchart is represented on a single line in pseudocode. Remember to
capitalise the words INPUT and OUTPUT and define the START and STOP.
Flowchart Pseudocode
1 START
Start
2 favSubject1 = INPUT "What is one of your favourite subjects?"
3 OUTPUT favSubject1
4 favSubject2 = INPUT "What is one of your favourite subjects?"
favSubject1 = INPUT
"What is one of your 5 OUTPUT favSubject2
favourite subjects?" 6 favSubject3 = INPUT "What is one of your favourite subjects?"
7 OUTPUT favSubject3
8 STOP
OUTPUT favSubject1
favSubject2 = INPUT
"What is one of your
favourite subjects?"
OUTPUT favSubject2
favSubject3 = INPUT
"What is one of your
favourite subjects?"
OUTPUT favSubject3
Stop
32
369825_9.1_Cam_LSC_SB_008-054.indd Page 33 06/03/23 9:46 AM A4902 /142/HO02737/work/indd
Flowchart 2
The for loop in pseudocode is defined using the starting value of the variable ‘i’ and the
value that it needs to count to. The end of the for loop is shown using ENDFOR.
Flowchart Pseudocode
START
Start
FOR i = 0 TO 2
favSubject = INPUT "What is one of
your favourite subjects?"
i=0
OUTPUT favSubject
ENDFOR
STOP
No
Stop if i < 3
Yes
favSubject = INPUT
"What is one of your
favourite subjects?"
OUTPUT
favSubject
i=i+1
The use of a loop can make the flowchart seem more complicated. However, the use of a
loop means that less code is going to be needed and makes the algorithm easier to follow.
You can take the pseudocode and use this to create the program in Python.
favSubject = INPUT
"What is one of
your favourite
subjects?"
OUTPUT favSubject
The program code is written using three lines of code. If you wrote this without using a
for loop, it would require six lines of code. You can see this in the comparison below. The
program with the count-controlled loop (for loop) is more efficient.
33
369825_9.1_Cam_LSC_SB_008-054.indd Page 34 06/03/23 9:46 AM A4902 /142/HO02737/work/indd
Program with a
for loop
Program without
a for loop
KEYWORD
efficient: the efficiency of a program can be measured by how quickly
it runs
Practise
Pseudocode 1 Pseudocode 2
1 START 1 START
2 import time library 2 import time library
3 3
4 countdown = 3 4 countdown = 4
5 OUTPUT countdown 5 FOR i = 0 to 2
6 countdown = countdown – 1 6 OUTPUT countdown – 1
7 wait 1 second 7 wait 1 second
8 OUTPUT countdown 8 ENDFOR
9 countdown = countdown – 1 9 OUTPUT "Let’s start"
10 wait 1 second 10 STOP
11 OUTPUT countdown
12 wait 1 second
13 OUTPUT "Let’s start"
14 STOP
Similarities Differences
34
369825_9.1_Cam_LSC_SB_008-054.indd Page 35 06/03/23 9:46 AM A4902 /142/HO02737/work/indd
35
369825_9.1_Cam_LSC_SB_008-054.indd Page 36 09/03/23 8:38 AM A4902 /Data%20Disk/Manoj%20R/2023/March/09-03-23/HO02737_142
Each item has quotation marks around it as they are all strings. This is the same as you
would use on an individual string being stored in a variable. The items in the list are
separated by commas.
Once you have created a list, there are various ways in which you can manipulate the
contents. The append() method is used to add an item to the end of a list. A full stop and
append() are added to the list name, and the item to be added is put inside the brackets.
In the example below, append() is used to add grapes to the list.
When the program is run, the print command outputs the contents of the list on one line,
including the square brackets and quotation marks.
To improve the presentation of the output, you can use a for loop to display each item
of the list on a separate line. This will also remove the square brackets, commas and
quotation marks.
Instead of using ‘i’ as the variable, you can use a more specific variable name. The
example below uses ‘item’, as each item in the shopping list will be printed.
The output is now in a vertical list with just the items showing.
The len() function can be used to find out how many items are in a list. In the
program below, the value is stored in a variable called ‘num’.
It can be used in an output to say how many values are in the list.
36
369825_9.1_Cam_LSC_SB_008-054.indd Page 37 06/03/23 9:46 AM A4902 /142/HO02737/work/indd
Look again at the chatbot program from the previous section that asks the user three
times what their favourite subject is and stores their answers. An empty list called
‘favSubjects’ can be set up at the start of the program:
The program now makes use of an array and two for loops to get the inputs from the user,
store them and then output them.
KEYWORDS
array: data structure in a program that can store more than one item of data
of the same data type under a single identifier; data items can be changed
list: data structure that stores multiple items of data in a single variable; the
values can be changed
data item: piece of information that represents part of the data that makes
up a person, place or thing, e.g. some of the data items that represent a
person are their first name and second name
Practise
A chatbot has been created to use an array to store a range of
colours that a user enters.
START
ARRAY rainbow = [red, orange]
FOR i = 0 TO 4
Add INPUT to ARRAY "Add a colour"
ENDFOR
37
369825_9.1_Cam_LSC_SB_008-054.indd Page 38 06/03/23 9:46 AM A4902 /142/HO02737/work/indd
38
369825_9.1_Cam_LSC_SB_008-054.indd Page 39 06/03/23 9:46 AM A4902 /142/HO02737/work/indd
Flowchart:
Start
ARRAY water =
"Swimming",
"Canoeing"
ARRAY team =
"Hockey",
"Volleyball"
INPUT
typeOfActivity
if typeOfActivity No
== "W"
Yes
i=0 i=0
INPUT No No INPUT
if i < 2 if i < 2
activity1 activity2
Yes Yes
OUTPUT OUTPUT
OUTPUT OUTPUT
"You have chosen" "You have chosen"
i + 1, water[i] i + 1, team[i]
activity1 activity2
i=i+1 i=i+1
Stop
39
369825_9.1_Cam_LSC_SB_008-054.indd Page 40 06/03/23 9:46 AM A4902 /142/HO02737/work/indd
Pseudocode:
START
ARRAY water = [Swimming, Canoeing]
ARRAY team = [Hockey, Volleyball]
OUTPUT "Do you prefer watersports or team games?"
INPUT typeOfActivity
ELSE
OUTPUT "Which of the following team games do you prefer?"
FOR i = 0 to 1
OUTPUT i + 1, team[i]
OUTPUT "Enter the number of your preferred activity."
INPUT activity2
OUTPUT "You have chosen" activity2
ENDIF
STOP
If the item stored in the variable ‘typeOfActivity’ is "W", then the chatbot displays a list of
water activities stored in an array called ‘water’.
The program then:
● outputs a question asking the user to select which of the water activities they prefer,
and saves their choice in a variable called ‘activity1’
● confirms their choice in an output.
Else the chatbot displays a list of team games stored in an array called ‘team’.
Then the program:
● outputs a question asking the user to select which of the team games they prefer, and
saves their choice in a variable called ‘activity2’
● confirms their choice in an output.
40
369825_9.1_Cam_LSC_SB_008-054.indd Page 41 06/03/23 9:46 AM A4902 /142/HO02737/work/indd
The program code matches the algorithm using variables, selection and iteration in a
Python program.
If the program is developed to ask the user to choose between three types of activity,
then an additional comparison will be needed. This will mean adding elif to the algorithm
and program.
Program development iteration 2
A new iteration of the algorithm is planned to refine the chatbot further by using the value
stored in ‘activity1’ or ‘activity2’ to suggest an alternative activity that the user might like
to try.
41
369825_9.1_Cam_LSC_SB_008-054.indd Page 42 06/03/23 9:46 AM A4902 /142/HO02737/work/indd
Flowchart
Start
ARRAY water =
"Swimming",
"Canoeing"
ARRAY team =
"Hockey",
"Volleyball"
INPUT
typeOfActivity
if typeOfActivity No
== "W"
Yes
i=0 i=0
INPUT No No INPUT
if i < 2 if i < 2
activity1 activity2
Yes Yes
No No
if activity1 == 1 if activity2 == 1
Yes Yes
Stop
42
369825_9.1_Cam_LSC_SB_008-054.indd Page 43 06/03/23 9:46 AM A4902 /142/HO02737/work/indd
Pseudocode
START
ARRAY water = [Swimming, Canoeing]
ARRAY team = [Hockey, Volleyball]
ARRAY waterNew = [Water polo, Sailing]
ARRAY teamNew = [Cricket, Beach volleyball]
OUTPUT "Do you prefer watersports or team games?"
INPUT typeOfActivity
ELSE
OUTPUT "Which of the following team games do you prefer?"
FOR i = 0 to 1
OUTPUT i + 1, team[i]
OUTPUT "Enter the number of your preferred activity."
INPUT activity2
OUTPUT "You have chosen" activity2
IF activity2 == 2 THEN
OUTPUT "Why not try" teamNew[0]
ELSE
OUTPUT "Why not try" teamNew[1]
END IF
END IF
STOP
43
369825_9.1_Cam_LSC_SB_008-054.indd Page 44 06/03/23 9:46 AM A4902 /142/HO02737/work/indd
advise the user which activity they might like to try. The program uses several variables,
conditional statements and count-controlled loops to allow different pathways through
the chatbot program. Note that the extra arrays have been set up at the start of the
program so that they can be accessed easily at any point when the program is run.
Practise
As a chatbot program is developed, the different concepts are
integrated. For example, if you need a conditional statement to
check what the user enters, then you need to use selection. If
you want to run program code for a set number of times, then
you need to use a count-controlled loop.
1 Discuss with your partner how this program could be
developed to include additional activities for the user to
choose between.
2 Plan a new iteration of the chatbot algorithm that asks the
user to choose from three different watersports or team
games and gives a suggestion for a new activity to try for
each activity chosen. Do this as pseudocode.
44
369825_9.1_Cam_LSC_SB_008-054.indd Page 45 06/03/23 9:46 AM A4902 /142/HO02737/work/indd
Testing times
Learn
As you already know, it is particularly important to test the programs that you write to
make sure that they run and that they produce the correct outputs. This is an important
process in developing a new prototype.
To recap, there are different types of errors that can be found when creating programs:
● Syntax
● Logic
● Runtime.
If a program contains a syntax error, it will not run. A syntax error occurs where the
programmer has written the code incorrectly. Possible syntax errors include a missing
bracket, a missing colon or missing indentation.
The program below is a chatbot to guide a user on what to do at the weekend. It contains
a syntax error on line 3 as the colon ( : ) is missing from the end of the line.
45
369825_9.1_Cam_LSC_SB_008-054.indd Page 46 06/03/23 9:46 AM A4902 /142/HO02737/work/indd
The error is detected as soon as the program is run, and an error message is produced.
Different integrated development environments (IDEs) present the error message in
different ways. For example, in IDLE the place where the program has failed is highlighted
and a pop-up suggests what the problem may be:
Both error messages give a hint to the location and an indication of what type of error has
been encountered.
As you saw with trace tables, a logic error is linked to the conditional operator that is used. The
program will run but the output will not be as expected if the wrong operator has been used.
A runtime error occurs during the running of a program when Python cannot execute an
instruction. For example, look at this program code for the chatbot program to select a
possible activity for the weekend.
Program
code
When
executed
46
369825_9.1_Cam_LSC_SB_008-054.indd Page 47 06/03/23 9:47 AM A4902 /142/HO02737/work/indd
The first part of the program runs correctly, but the program encounters a problem at
line 9. The program output stops and a traceback message is displayed that helps to
identify where the error occurred. Here, ‘activity’ has been used in the for loop instead of
‘activities’ for the name of the array.
Finding and fixing errors is an important part of a programmer’s role, as all aspects of a
program need to work correctly.
When you test a program, you should use a range of test data to check that the program
runs as expected. However, a programmer cannot test every possible input a user might
add to a program, so they must decide carefully which data to use when they create their
test plan.
Look at a chatbot program that asks the user to guess a number between 1 and 10.
There are three possible types of test data that should be used in a test plan for this
program.
● Normal data: A sensible input that the program should accept: any number between
1 and 10.
● Extreme data: Still an acceptable input but at the ends of the possible input range:
using 1 or 10 as the input.
● Invalid data: An input that should not be accepted: using a value outside the
acceptable range, such as 20.
These values can be added to a test plan and then used to test the program. This test plan
has been completed for the program above using a range of test data:
47
369825_9.1_Cam_LSC_SB_008-054.indd Page 48 06/03/23 9:47 AM A4902 /142/HO02737/work/indd
The test plan has shown that the program ran all the way from start to finish. This shows
that there are no syntax errors or runtime errors. However, one of the tests did fail. The
extreme test data used the input 10, which should produce the output ‘Not correct’, but
instead the output was ‘Not a valid guess’. This shows that a logic error has been found.
KEYWORDS
syntax error: error in program code that stops the program from running
integrated development environment (IDE): software that includes all the tools
needed to develop a program in a particular language
logic error: error that allows a program to run but not output what is expected
conditional operator: symbol, e.g. >, < and =, used to carry out comparisons
between two values
runtime error: error that occurs while a program is running; the instructions
cannot be completed
traceback message: displayed when a runtime error is encountered to help
identify where the error occurred and what went wrong
normal test data: data of the correct type that should be accepted by a program
extreme test data: acceptable input but at the ends of the possible input range
invalid test data: data that should be rejected by a program
Practise
1 Open the file TestProgram.py provided by your teacher.
a Discuss with your partner what normal, extreme and invalid data you would use to
test this program.
b Create a test plan that uses normal, extreme and invalid test data.
c Complete the test plan.
d Identify and fix the syntax, runtime and logic errors in the code.
e Save the corrected file as TestProgramV2.py.
f Test the program again to make sure that it works correctly.
2 Discuss with your partner the benefits of using normal, extreme and/or invalid test
data for a program’s development.
3 Discuss with your partner the different types of program errors and how a
programmer can find each one.
4 Evaluate in pairs the importance of using a range of test data as a process in program
development.
48
369825_9.1_Cam_LSC_SB_008-054.indd Page 49 06/03/23 9:47 AM A4902 /142/HO02737/work/indd
Go further
When a user inputs into a program an answer to a question, the answer is either stored
in a variable or added to an array. The input is stored exactly as the user types it. A user
may input their answer using uppercase or lowercase or a mix of both.
If you are using a conditional statement to compare two variables, the way the user
enters their answer may affect the outcome.
In the chatbot program below, the user is asked to enter a possible activity for the
weekend.
The conditional statement is looking for ‘swimming’ as the input. If swimming was added
using uppercase letters or with an uppercase letter at the start, then the program would
not recognise it as a True outcome as the string would not be an exact match.
As the input is being stored as a string data type, string manipulation can be used to
adjust aspects of the stored string. For, example, no matter how the user enters their
answer, the whole input can be converted to lowercase letters by adding .lower() to
the end of the input. This is useful in a chatbot program where you need to test the input
using selection or need all items in an array to have the same format.
Likewise, the input can be converted to uppercase letters by adding .upper() to the end
of the input.
It is also possible to convert the first letter of a string to uppercase and the rest of the
string to lowercase by adding .capitalize() to the end of the input.
String-manipulation code can also be used to output the length of the string, for
example, the length of the word being stored in a variable.
Or it can be used to find out the length of the array, that is, the number of items being
stored in the array.
49
369825_9.1_Cam_LSC_SB_008-054.indd Page 50 06/03/23 9:47 AM A4902 /142/HO02737/work/indd
In pseudocode, this would be written by defining the way the input should be entered.
START
activity = INPUT lowercase "Enter a possible activity."
FOR i = 0 TO 4
Add INPUT to ARRAY "Add a colour"
ENDFOR
50
369825_9.1_Cam_LSC_SB_008-054.indd Page 51 06/03/23 9:47 AM A4902 /142/HO02737/work/indd
Challenge yourself
You can now add items to an array and use a for loop to access the items. You can have
more than one array in a program and the items can be used multiple times in different
ways. For example, a chatbot may ask you to enter items of clothing you are looking
for and then your favourite colours. This could be used to show you clothes items in the
colours you entered.
Previously, you have used an array in a chatbot program to store three favourite subjects.
In this next iteration of the chatbot, the program is going to ask for the name and
favourite subject of three friends. The chatbot will then output the individual answers.
The pseudocode for the algorithm shows that:
● two empty arrays are set up at the start of the program
● the user is asked three times to enter a friend’s name and their favourite subject
● each name is stored in the array ‘names’
● each subject is stored in another array ‘favSubjects’
● there is an output acting as a separation using dashed lines and a title stating that the
details will follow
● the relevant items from both arrays are located and output in the same sentence.
START
ARRAY names = [ ]
ARRAY favSubjects = [ ]
FOR i = 0 to 2
Add INPUT to ARRAY names "Enter your friend’s name"
Add INPUT to ARRAY favSubjects "Enter their favourite subject"
ENDFOR
To create the final count-controlled loop that looks at both arrays, you need to use
a new function: zip().
The loop needs to look at each item in each array. Two variables can be set at the
start of the for loop to store the item in the list being looked at: for name, subject
in. It is important that the two variables (shown in green here) are separated by a
comma.
51
369825_9.1_Cam_LSC_SB_008-054.indd Page 52 06/03/23 9:47 AM A4902 /142/HO02737/work/indd
The two array names are placed inside the brackets of the zip() function, again
separated by a comma. Remember to add the colon at the end of the line to tell
the program that the for loop has been set up: for name, subject in zip(names,
favSubjects):
The output is placed in a print function. The variables defined at the start of the for
loop, to store the items from the arrays, are used in the output.
Final project
The skills you have learned in this unit are Part 1: Planning
all about using iterative development to
1 Plan and list the questions that your
produce solutions to problems. You have
chatbot will need to ask. Think about
learned how to trace the variables through
how you might help someone to choose
a program using a trace table and how a
between three different subjects.
count-controlled loop and an array can
2 List the variables and data types that
develop your Python programming further.
are going to be used in your program.
Look back to the start of this unit to 3 Identify suitable names for one or more
remind yourself of the Scenario. arrays to be used in your program. Add
You are going to create a program to help these to your list.
students during the selection of options
Part 2: Develop the algorithm
or subject areas to continue to study.
The chatbot will ask the user a series of 1 Plan the algorithm using pseudocode.
questions, store their answers and use this 2 Annotate your pseudocode to show
to help them to make a final decision. how your program will use an array and
● The solution will be presented as a count-controlled loop.
pseudocode to show the algorithm for 3 Annotate your pseudocode to describe
your chatbot program. the data types that are being used and
● Use variables and/or an array to store which are not being used and why.
the answers to questions asked of the 4 Add a caption to your pseudocode
user. to explain how you will use string
● Use a count-controlled loop. manipulation to adjust a user’s input.
● Follow an iterative process to design, Part 3: Test the algorithm
develop, test and review towards a final
1 Create a trace table and use this
prototype.
to check the contents of variables,
52
369825_9.1_Cam_LSC_SB_008-054.indd Page 53 06/03/23 9:47 AM A4902 /142/HO02737/work/indd
arrays and the outcome of conditional 4 Use your test plan to test the program
statements in a dry run of the using normal, extreme and invalid data.
pseudocode. 5 Using both the trace table and test
2 Identify suitable test data, including plan, identify any logic, syntax or
normal, extreme and invalid inputs, and runtime errors.
create a test plan to be used on your 6 Save each development as a new
program once it has been written. iteration of the program.
3 If necessary, correct any logic errors
identified by the dry run of your
Part 5: Evaluation of the prototype
program and work through the trace Once you have created, tested and
table again. Ensure that you save any reviewed your prototype program
developments as a new iteration of the solution, evaluate the impact of the
pseudocode. different parts of the process that you
have followed to create your final version
Part 4: Development of the program. Create a short report that
1 When you are sure that the explains:
pseudocode algorithm is complete 1 the iterative process you used to
and correct, start the development of develop your final program code
your Python code. 2 how you used trace tables
2 Continuously test, debug and improve 3 how you used test plans with normal,
your program code. extreme and invalid data
3 Create a trace table and use this 4 the difference between a logic error,
to check the contents of variables, a runtime error and a syntax error
arrays and the outcome of conditional and how you have tested for these
statements as the program is run. throughout the program development.
Evaluation
KEYWORDS
1 Swap programs with your partner and test their program. dry run: process of
Comment on the following: working through an
algorithm manually
a Does it cover all the requirements?
to trace the values of
b Is the solution easy to use? variables
c Do the inputs work as expected? evaluation: checking
d Are the questions suitable for the Scenario at the start of the suitability of a
the unit? solution to a problem
53
369825_9.1_Cam_LSC_SB_008-054.indd Page 54 06/03/23 9:47 AM A4902 /142/HO02737/work/indd
54
369825_9.2_Cam_LSC_SB_055-087.indd Page 55 06/03/23 11:09 AM A4902 /142/HO02737/work/indd
Get started!
Have you ever wondered how computer
networks, both big and small, are designed, or
what the boxes full of wires and other devices
that are found in classrooms, offices and homes
across the world actually do? Who decided
where to position them and why did they set up
the network in the way that they did? How do we
make sure that data transmitted across networks
is secure?
Discuss the following with your partner:
l How are devices connected to networks?
l When a device is connected to a network, what type of address is assigned to it?
l Are there ways of knowing whether data has been transmitted accurately?
In this unit, you will develop your understanding of the ways in which networks can be
designed and expanded. You will look at how the design of a network can affect the way
in which devices work on the network. You will investigate how devices communicate and
how data packets are transmitted. Importantly, you will learn how networks can be built
sustainably, so they can be expanded and developed to ensure that they are always fit
for purpose.
KEYWORDS
network: collection of computing devices connected sustainably: when a network is built in a way that it
to each other, either by wires or wirelessly is easy to maintain in the future
data: raw facts and figures fit for purpose: something that is well designed for
data packet: small unit of data that is packaged to its purpose
be sent across a network
Learning outcomes
In this unit, you will learn to:
● explain how different network topologies (bus, ring and star) transfer information
between devices
● explain the role of protocols in data transmission
● explain what scalability factors are and how scalability can affect a network
● explain why scalability should be considered when designing networks and how
networks can be designed to scale up
● explain what a parity bit is and its role in error detection
● perform parity bit and parity block calculations and identify errors in data transmission
● explain the choices that must be made when securing information on a network,
including cost, accessibility and the relative security requirements of different datasets.
55
369825_9.2_Cam_LSC_SB_055-087.indd Page 56 06/03/23 11:09 AM A4902 /142/HO02737/work/indd
Warm up
Connecting devices to a network brings a whole range of
possibilities to their use. Some devices simply wouldn’t work
as intended without an active network connection, such as an
internet-connected smart lightbulb or the online services of a
games console.
KEYWORDS
active internet
connection: where a
device has a working
connection to the
internet
high bandwidth:
connection that can
send and receive a
large amount of data
per second
interference:
Discuss the following with your partner: when electronic
signals disrupt data
l What devices do you use that connect to a network? transmissions
l Does the device require an active internet connection to network topology:
work? diagram that
l If the device has an internet connection, does it require a shows how devices
high-bandwidth connection? in a network are
connected to one
l What would happen if the internet connection disconnected another, and shows
due to interference? the network hardware
SCENARIO
A local youth-recreation centre has opened, access to, for example mobile phones, tablets,
with the aim of providing a facility for young gaming consoles, PCs or even smart watches!
people who wish to game, interact and The network should be able to support a large
hang out in a safe, monitored and flexible number of members in the youth centre, with
online environment. The centre has asked users connecting from a range of devices.
the IT department in your school for advice Your challenge is to learn all about network
on networking and security. They also need topologies (network layouts), technologies
advice about the hardware they will need to and the software required to support network
ensure that members can be connected in a communications, before you can advise them
network. The group hopes that students can on their hardware needs for the network.
link up using any electronic device they have
56
369825_9.2_Cam_LSC_SB_055-087.indd Page 57 06/03/23 11:09 AM A4902 /142/HO02737/work/indd
Do you remember?
Before starting this unit, you should be able to:
✔ decide what type of network should be used in different
scenarios
✔ understand the difference between copper and fibre cables
✔ explain whether wired or wireless networks should be used in
certain scenarios
✔ understand the security features that different types of
networks can have
✔ describe how an echo check can check for data accuracy in
transmission
✔ understand how firewalls, antivirus and anti-spyware can
provide protection to a network
✔ explain the purpose of operating systems
✔ understand what is meant by ASCII.
PANs
Personal Area Networks are a type of network where devices
communicate over a small area, usually no further than
10 metres or so. This type of network is often used for devices
that the user wears, such as headphones or a smart watch.
57
369825_9.2_Cam_LSC_SB_055-087.indd Page 58 06/03/23 11:09 AM A4902 /142/HO02737/work/indd
LANs
Local Area Networks are a type of network where
devices communicate over a small geographical
area. You could think of this as a single building
or a school site, for example. Devices within this
network range are able to access services offered
by the server on the same network, which is ideal
for sharing files, printing or sharing a single internet
connection. In your school network, it is likely that you can access a students’ drive, or
similar, where teachers can place files for you to use.
WANs
Wide Area Networks are a type of network where
devices communicate over larger geographical areas.
An example of this would be a company with a few
offices at opposite sides of town, or even offices in
different countries. These networks usually connect
together via the internet, as it would be physically
impossible to lay dedicated cables between the office
buildings.
WANs rely on external networking equipment, usually Remember that there are
provided via the Internet Service Provider’s (ISP’s) also WPAN, WLAN and WWAN,
cabling, to create a ‘virtual’ link between the LANs of which are the same as PAN,
LAN and WAN but the devices
each office.
connect wirelessly!
KEYWORDS
Personal Area Network (PAN): type of network file storage, user management, printer sharing,
where devices communicate over a small area of no email access or web servers
more than 10 metres, usually connecting devices a Wide Area Network (WAN): type of network
person wears to a smartphone or computer where devices communicate over a large
Local Area Network (LAN): type of network geographical area, such as across a city or country
where devices communicate over a small Internet Service Provider (ISP): company that
geographical area, e.g. a single building provides users access to the internet, and is
server: usually a powerful computer that often responsible for the network equipment
offers a range of services to a network, e.g. that connects LANs to WANs
Network architecture
Network engineers are specialists in building Internet/WAN
networks so that they are fast, dependable and Wi-Fi access
point
safe to use. It is likely that any business, school or Router
government has used a network engineer to help
them to create their network, so that the users can Switch
use it without having problems.
www.africanews.com www.africanews.com www.africanews.com
58
369825_9.2_Cam_LSC_SB_055-087.indd Page 59 06/03/23 11:09 AM A4902 /142/HO02737/work/indd
Network switch
Network switches connect devices together on a network to form a wired network.
Router
A router connects together different networks, often connecting a LAN to the
internet.
If you want to send data from one place to another, a router finds the fastest
route to send the data. A router provides access to the internet and sometimes
has wireless access built in, especially in the home.
59
369825_9.2_Cam_LSC_SB_055-087.indd Page 60 06/03/23 11:09 AM A4902 /142/HO02737/work/indd
Ethernet cabling
These are cables that are designed to work with ethernet ports on a NIC to
connect devices to a network. They are dependable for high-speed connections,
with a maximum bandwidth of 10 Gbps (gigabits per second). The longer the
cable, the worse the performance.
Servers
Servers are computers on a network that offer a service to other devices. Here are
some common servers found on networks.
File servers: These offer devices on a network a place to store and access files.
On large networks, files are not usually stored on the device that the user is using,
but on the file server. This can be especially useful in a business where a number
of people need to access the same files, or where people may need to access their
files from any computer on the network.
Print servers: These enable devices on a network to share printers. In a large office it
would not be feasible for every device to have its own printer. A print server manages
which devices can print to each printer so that users can share them.
Mail servers: These store email messages and allow users to log in to send and
receive messages.
Web servers: These provide internet-accessible files and transmit files to users
over the world wide web.
Firewall
Most networks, especially business networks, use a hardware firewall. This
examines the incoming and outgoing network traffic to check for security risks
and block any suspicious activity.
You will learn more about how data is sent between the devices on a network later
in this unit.
KEYWORDS
file server: server that stores users’ files and network traffic: amount of data travelling through
enables them to be shared on a network a network, split into small parts for transmission
firewall: restricts the network traffic entering and
exiting a network, to ensure that it is safe
Practise
1 Open the file Network hardware.docx provided by your teacher. Complete the table
without using this book, where possible. Provide a brief summary of each of the
network devices. Copy and paste images from the internet of the devices you find.
2 a Open the file Network uses.docx provided by your teacher. For each of the rows in the
table, explain how the youth centre in the Scenario could use the device in their network.
If you need to remind yourself of the Scenario, look back at the start of this unit.
b Complete the diagram to show the following connections:
i the router to a port on the network switch
ii each of the laptops to the network switch to form a LAN
iii the LAN to the WAN.
60
369825_9.2_Cam_LSC_SB_055-087.indd Page 61 06/03/23 11:09 AM A4902 /142/HO02737/work/indd
Bus topology
In a bus topology, all the devices (servers, computers, printers) are joined to one cable
(the bus). There is a terminator at each end of the cable to absorb the signals and stop
them from being reflected back down the bus.
Terminator Terminator
Advantages Disadvantages
l Bus networks are easy to install. l If the main cable fails or is damaged, the whole network
l They are cheap as they don’t need a lot of will stop working.
cable. l As the network gets larger, it is more likely that data will
collide and be corrupted as it is sent between devices.
This reduces the performance of the network.
l All devices on the network are visible to each other, which
could pose a security risk.
KEYWORDS
router: hardware device that connects networks terminator: ending to a network cable that
together absorbs the signal to stop it bouncing back
network topology: diagram that shows how colliding: when data ‘bumps into’ other data,
devices in a network are connected to one which often causes errors or lost data
another, and shows the network hardware
bus topology: network in which all devices are
connected together via a main cable running
down the centre of the network
61
369825_9.2_Cam_LSC_SB_055-087.indd Page 62 06/03/23 11:09 AM A4902 /142/HO02737/work/indd
Ring topology
In a ring topology, each device is connected to two other devices, forming a ring for
the data to travel around. The data travels in one direction and is passed through each
device until it reaches its destination.
www.africanews.com
Desktop
www.africanews.com www.africanews.com
Desktop Desktop
www.africanews.com www.africanews.com
Desktop www.africanews.com
Desktop
Desktop
Advantages Disadvantages
l Data travelling on a ring network flows only one way, which l If the main cable of the ring network is
means that data does not collide. broken, it will stop the entire network
l Data can be transferred quite quickly, even if there are a working for all devices connected to it.
large number of devices connected.
Star topology
In a star topology, every device on the network has its own connection to a switch. The
main switch sends data packets to the destination device only.
Switch
62
369825_9.2_Cam_LSC_SB_055-087.indd Page 63 06/03/23 11:09 AM A4902 /142/HO02737/work/indd
Advantages Disadvantages
l Each device is connected separately. l If the main switch fails, then none of the devices can
l It is very dependable as the rest of the network communicate.
will continue to work if a cable or device fails. l It can be expensive to install as more ethernet cabling
l Network performance is good as the switch is needed.
directs data to the correct destination.
l It is easy to add new devices to the network, as
they can be attached directly to the switch.
In modern networks, star topologies are usually used, as data collisions do not occur
when a switch is performing its task of directing packets of data to the correct device
only.
When designing networks, it is important to consider what will be the best topology to
use before you start to create the network topology diagram.
Practise
KEYWORDS
1 Look around your classroom. Write a list of all the devices ring topology:
in the room, along with other devices that are used in your network in which
school network. Your teacher will help to identify these. all devices are
connected together
Include how many there are of each device, for example to form a ring
25 PCs, 5 tablets and 15 smartphones.
star topology:
2 Create a network topology diagram for your school. Include: network in which
a a basic icon and label for each of the devices each device is
b any WAPs and switches connected separately
The WAP and/or to a central switch
c lines to show how the devices are
switch may be visible to
connected to a WAP or switch,
you in your classroom
labelled to show whether the or might be in another
device is connected by a wire (W) room nearby.
or wirelessly (WL).
3 Assume that your school has a router, connecting your LAN
to the internet, and a firewall hardware device to improve its
security.
a Add a firewall above the switch, and connect the devices
together.
b Add a router above the firewall, and connect the devices
together.
c Add a WAN/the internet above the router.
d Connect the LAN and WAN together.
4 In groups, discuss the type of network that has been
designed.
a Is it a star, ring or bus network? Why has that type of
network been used?
b What would be the disadvantages of using a ring network
to redesign your school network?
63
369825_9.2_Cam_LSC_SB_055-087.indd Page 64 06/03/23 11:09 AM A4902 /142/HO02737/work/indd
64
369825_9.2_Cam_LSC_SB_055-087.indd Page 65 06/03/23 11:09 AM A4902 /142/HO02737/work/indd
Packet switching
When data is transmitted across a network, it is split up into small
packets. For example, if somebody wanted to transmit a video file
across a network, the file would be split as follows:
In reality, packets are so small that a video file would likely be split into thousands of
packets.
Packets contain the data that is being sent, and the sender IP address and receiver IP
address, so that the data can be directed to the correct destination.
Video packet 1
Sender IP address 88.34.23.3
Receiver IP address 212.51.22.2
Packet number 5/340
Data 010000101011110110101000101111010110101…
65
369825_9.2_Cam_LSC_SB_055-087.indd Page 66 06/03/23 11:09 AM A4902 /142/HO02737/work/indd
You will notice that the request includes the domain name, but also includes some
additional information, such as the type of document it is requesting (in this case, html,
which is a webpage document). It also shows what type of web browser the user is using
(Mozilla).
Practise
1 Open the file Protocol.docx provided by your teacher.
a Explain what is meant by a protocol.
b Explain the role of TCP/IP in transmitting data.
c Explain what HTTP and HTTPS are used for.
d Complete the information that needs to be added to the
data packet by the TCP/IP protocol before it can be sent.
e Use your knowledge of data packets to identify which
device should receive each of the data packets shown.
2 Discuss with your partner what is meant by packet switching.
66
369825_9.2_Cam_LSC_SB_055-087.indd Page 67 06/03/23 11:09 AM A4902 /142/HO02737/work/indd
Scalable considerations
Learn
Imagine you are a network engineer and have spent a lot of time building the perfect,
fast, reliable and safe network. Everything is running smoothly until your boss asks you
to add another 100 devices to the network! Is it possible to add devices to a network
without changing other aspects of the network? It’s a good question and will need some
investigation.
Network scalability means how well a network can cope if it suddenly needs to move
a lot more data between more devices. If your school opened a new building full of
classrooms, but didn’t upgrade their network hardware, having lots more users on the
same connection would slow down the speed. It could also make the network less secure.
Think about the impact there would be if your school allowed all students to connect their
smartphones to the Wi-Fi. It is important that scalability is considered when a network is
being planned and built.
To assess the scalability of a network accurately, you need to consider the following.
Security
If the network becomes unstable due to a rapid increase in the KEYWORDS
number of devices connected and the amount of data being scalability: capacity
to make something
transmitted, it could cause network hardware to not operate
larger, e.g. a network
properly. For example, if the network were unstable and caused enlarged with more
the firewall to disconnect from the network, the network could devices
be open to the threat of a cyber-attack. cyber-attack:
attempt to gain
It could be an excellent idea to use multiple firewalls. For unauthorised access
example, in a school it might be useful to have a firewall for staff to a network, to
offices and a separate firewall for student computer rooms. This damage or destroy a
way, there is a more limited amount of data flowing through a computer system
single firewall at any time. firewall: restricts
the network traffic
Storage solutions entering and exiting
a network, to ensure
What effect would adding lots more devices have on storing files that it is safe
on the network? If there is a file server, would this need to be
file server: server
expanded, so that the impact of having more users is avoided. that stores users’ files
and enables them
To improve scalability of storage, it would be important to to be shared on a
add either more storage capability to the current file server or network
another file server into the network.
Accessibility of data
If the network is not scalable, then adding more devices that are transmitting a lot of
data around the network could have an impact on the speed of data transmission, as the
bandwidth has to be shared between all the devices. This could also make the network
unstable, causing devices to become disconnected from the network. This may mean
67
369825_9.2_Cam_LSC_SB_055-087.indd Page 68 06/03/23 11:09 AM A4902 /142/HO02737/work/indd
Innovation in networking
Cloud computing makes use of servers
on the internet to provide services to
store, manage or process data. Lots of
companies worldwide now use cloud
servers, rather than having their own
servers on their premises. Lots of
smartphone users, for example, use cloud
photo storage, rather than having to
increase the storage available on their device.
Because of the challenges of scalability in networking, new solutions are constantly being
developed. Lots of the most innovative solutions take advantage of cloud computing or
use devices outside the network to do some of the work. For example, if your school were
to open a new building, by using a file server on the internet there would be no reason to
upgrade the file server that is in school. The school would simply pay for an online service
to store staff and student files. Examples of online storage services include Microsoft
OneDrive, Google Drive and Dropbox.
Network system software
Network operating systems (NOS) play an important role in keeping a network running
quickly, reliably and safely. Network operating systems work in the same way as a normal
operating system, but they are designed to be installed on servers. Often, the NOS
manages the users on the network, maintains the network connections, manages file
server features and provides utilities software for keeping the network running well.
68
369825_9.2_Cam_LSC_SB_055-087.indd Page 69 06/03/23 11:09 AM A4902 /142/HO02737/work/indd
Network operating systems also manage resources such as the router, switches and
firewalls.
A common task that the operating system carries out on a network file server is disc
defragmentation. This organises files on a hard disc drive, which can improve the speed
at which files can be accessed on the file server.
User management is essential on a well-maintained network. Network administrators
can control which files, printers, software and other network facilities different types
of user can access. The image on the previous page shows that network administrators
have a number of tools at their disposal to keep the network running well, including file
management. For example, it would not be a good idea to give students access to the
confidential staff folders.
Network utilities software
Utilities software on an NOS works in a similar
way to utilities software on a personal device. Encryption software on
Networks still need to have virus scanning, a network can be extremely
backup and encryption software installed. Instead important, especially if the
of performing this on individual devices, network network holds personal
utilities allow the network administrator to run information about people.
scans, checks and tools on all of the devices on Encryption software can also
the network at the same time. They even allow be used if people connect to the
network remotely, to make sure
network administrators to schedule the tasks to
that the data cannot
run at specific times of the day. For example, in a
be intercepted.
school it would be useful for these to run at 5 a.m.,
before staff and students have arrived.
KEYWORDS
administrator: account with top-level access, with device driver: software program that operates a
the ability to change settings or add and remove hardware device connected to a computer
users from a network defragmentation: reorganising files stored on a
cloud computing: using servers on the internet for hard drive to ensure that all parts of the same file
services are located one after the other on the drive
online storage services: using file storage servers hard disc drive: removable disc in computers for
on the internet to store files storing large amounts of data, typically measured
network operating system (NOS): computer in gigabytes or terabytes
operating system that supports networks, often user management: adding or removing users to
including additional administrator software and control access to a network
monitoring tools virus scanning: checking files on a computer
operating system: software that manages all the system for malicious content
computer hardware and software; it also acts backup: copying files to another location in case
as an interface between computer hardware the original is lost or damaged
components and the user, and provides a platform
encryption: converting information into a
where applications can run
scrambled form, so that it cannot be understood if
utilities software: software that helps maintain the it is intercepted
smooth functioning of a digital device by helping
remotely: connecting to a network from another
the operating system manage tasks and resources
location via an internet connection
software: a program or a set of instructions that
tell a computer what to do to complete a task;
aspects of a device you cannot touch
69
369825_9.2_Cam_LSC_SB_055-087.indd Page 70 10/03/23 10:30 AM A4902 /142/HO02737/work/indd
Practise
1 Open the file Scalability.docx provided by your teacher. Read the scenario.
Ravi is the network administrator for a new company, which has an office. The
company has started selling lots more of their products due to an increase in
demand. They have taken on twelve new employees and need to open another
office in the same building, containing twelve desktop computers.
a Add to the existing network topology diagram of Office 1 to show Ravi how he
could scale up the network.
b Add a comment to the diagram to state the tasks that a network operating system
could carry out on the network.
c Add a paragraph below the diagram to explain what utilities software could be used
to keep the network secure or running more smoothly.
2 Ravi has been asked to remove four computers from Office 1, as they are no longer
needed. Using Scalability.docx, make changes to the network topology diagram of
Office 1 to accommodate the new request.
Internet/WAN
Router
Firewall
Office 1 Office 2
Switch
www.africanews.com www.africanews.com www.africanews.com www.africanews.com
Wi-Fi
Desktop Desktop
access point
www.africanews.com www.africanews.com
Desktop
Desktop
www.africanews.com www.africanews.com
www.africanews.com www.africanews.com
3 Ravi has designed the network topology, but a year later the network isn’t running
reliably. He investigates the issues and finds that the firewalls he is using are no longer
powerful enough to run a network of this size. Ravi has also noticed that his users are
running out of file storage space, so they are not able to save files on the network. In
the office, he has noticed that the Wi-Fi speeds are very slow, due to the number of
devices trying to access the network.
Explain how Ravi can improve the network, based on the following factors. Write a
paragraph under each heading.
l Security l Storage l Accessibility
70
369825_9.2_Cam_LSC_SB_055-087.indd Page 71 06/03/23 11:10 AM A4902 /142/HO02737/work/indd
KEYWORDS
data packet: small unit of data that is
packaged to be sent across a network
bit: short for ‘binary digit’: 0 or 1
binary data: data that is represented as a
1 or a 0
hacker: somebody who tries to gain
unauthorised access to a computer
system or network
Interference
Interference occurs when a number of electrical devices are being used in a small area.
The electrical and radio waves can disrupt each other’s signals. This can cause errors in
binary data, or causes devices to disconnect from the network.
Security breaches
Security breaches can be caused by malware or by hackers. For example, if a firewall
hardware device were hacked, its rules could be changed to allow any data into the
network, which could result in the system being overloaded and could cause errors in
the binary data being transmitted.
Hardware failure
If a network switch were to fail, this could cause errors in data transmission, with
packets no longer routed to the correct places.
71
369825_9.2_Cam_LSC_SB_055-087.indd Page 72 06/03/23 11:10 AM A4902 /142/HO02737/work/indd
Parity-checking
KEYWORDS
How can we check that data is received
parity-checking: type of error check
accurately by another device? Parity-checking! that ensures data has been transmitted
Parity checks are used to make sure that data correctly
has been sent and received correctly. Devices byte: eight bits of data, e.g. 01010011
transmitting data between each other agree to parity bit: bit added to a byte to make
use either an odd or even protocol for parity- the total number of 1 bits either even or
checking. odd
If devices have agreed that they will use an even number of bits, then any data
received should have an even number of 1s within it, so a byte would have two 1s,
four 1s, six 1s or eight 1s in total. The parity bit is set to either 1 or 0 to ensure that the
total number of 1s is even. For example, if the first 7 bits are 1001100, then the parity
bit would be set to 1 to make four 1s in total; if the first 7 bits are 1001000, then the
parity bit would be set to 0 as there is already an even number of 1s in this byte.
If any bytes are received that have an odd number of 1s, then this data has an error
and would need to be sent again.
Where devices have agreed that an odd number of bits should be sent (for example
one 1, three 1s, five 1s or seven 1s), if there are an even number of 1s, then the data
contains an error and would need to be sent again.
Example 1
Computer 1 and Computer 2 have agreed to use an even checking system.
0 1 0 1 0 1 0 1
0 1 0 1 0 1 0 1
The byte received by Computer 2 has four 1s, which is an even number.
There is no error.
1 1 1 1 1 1 0 1
There has been an electrical surge and the byte received by Computer 2
has seven 1s, which is an odd number. There is an error.
72
369825_9.2_Cam_LSC_SB_055-087.indd Page 73 06/03/23 11:10 AM A4902 /142/HO02737/work/indd
Example 2
A mobile phone and a tablet device have agreed to use an odd checking system.
0 1 1 1 0 1 0 1
The byte received by Computer 2 has five 1s, which is an odd number.
There is no error.
Parity checks give computers a way to check for errors. They can detect errors quickly
and require little computing power. However, this check does not identify which bit is
incorrect, if an error is detected, so the data has to be re-sent.
Practise
1 Answer the following questions in pairs.
a What is a parity bit?
b How can a parity bit help in error detection?
2 Look at each example below. Say whether an error would be detected and explain the
reason for each answer.
a A smart watch and a mobile phone have agreed to use an even parity-checking
system. The mobile phone receives the following byte:
0 1 1 1 1 1 0 1
b A PC and a server have agreed to use an odd parity-checking system. The server
receives the following byte:
0 1 0 0 0 1 0 0
0 0 0 0 0 0 0 0
73
369825_9.2_Cam_LSC_SB_055-087.indd Page 74 06/03/23 11:10 AM A4902 /142/HO02737/work/indd
It is crucial that this information is kept safely and cannot be accessed by anyone who
is not authorised to do so, as people could be identified from the information, and the
information is private. Other examples of private information include:
l medical records
l school records
l police records
l customers’ information kept by businesses
l bank details.
74
369825_9.2_Cam_LSC_SB_055-087.indd Page 75 06/03/23 11:10 AM A4902 /142/HO02737/work/indd
Firewalls
Most networks, especially business networks, use a firewall. This is a special type of
network hardware (or software) that examines the incoming and outgoing network
traffic to check for security risks and blocks any suspicious activity.
Firewalls can protect datasets by blocking access to the data from outside the network,
or from specific parts of the network.
User access controls
User access controls enable network managers to allow some users access to the data-
sets, but not others. This could be useful in a school, for example, by allowing teachers
to view the datasets about student progress and parental contact details. It would not
be a good idea to allow students access to this information, in case it was misused.
75
369825_9.2_Cam_LSC_SB_055-087.indd Page 76 06/03/23 11:10 AM A4902 /142/HO02737/work/indd
Biometric security requires a user to sign into systems using a biological password,
such as a fingerprint, facial recognition or an iris scan. This method of authentication
is becoming increasingly popular, with more and more devices supporting it.
Biometric security and two-factor authentication are powerful policies that a network
manager can put in place for certain staff, for example teachers, so that important
information can be protected.
Encryption
If data is sent between devices as plaintext, then a hacker could intercept the data. If
a teacher wanted to access details of a student from their laptop at home, if the data
were not encrypted and was sent as plaintext, a hacker could intercept the data and
read the contents of the data packets. Network managers can make sure that all data is
encrypted using secure protocols, such as HTTPS.
76
369825_9.2_Cam_LSC_SB_055-087.indd Page 77 06/03/23 11:10 AM A4902 /142/HO02737/work/indd
products now use machine learning to find threats. For example, if an IP address is linked
to a known hacker or security risk, firewalls with machine learning enabled will use this
information to look for this IP address and block it from accessing the network.
Machine learning can also detect when a login looks suspicious and block it, for example,
if a user tries to log in from a location that they do not usually use.
Practise
1 When designing network security, costs need to be considered. Create a table with
two columns: ‘Hardware’ and ‘Costs’. Find the cost of each of the following pieces of
network hardware, which will help you in the tasks that follow.
a Network switch
b Router
c Wireless access point
For this task, imagine that you are
d Ethernet cable a network manager, responsible for
e Firewall (hardware) keeping data safe on your network.
2 Discuss each of these scenarios with However, you also need to make
your partner. sure that data is as accessible as
l How secure does the data in the
possible for the people who need it.
Remember: hardware devices are
scenario need to be? Would it
quite expensive and can have a big
be damaging if this data were
impact on your budget, so you should
exposed? buy network hardware only if you
l How many ‘groups’ of users are really need to.
present in the system? (For example,
Customers and Staff)
l What security measures would you want to put in place?
l What would be the total cost to put these security measures in place, based on the
hardware costs you found in the previous task?
a Scenario 1
You are the network administrator for a large car sales garage. Sales assistants
can work remotely to access customer records, so that they can make sales calls
from home. All staff in the organisation are provided with a laptop when they start
working for the company. Managers in the company are given an upgraded laptop
and also have access to the personal details of the sales assistants, so that they can
contact them when required.
b Scenario 2
You are the network administrator for a restaurant business. There are three
Wi-Fi-connected laptops in the restaurant that the table staff use to input food
orders. A dataset is used to keep track of how well each food item sells. The laptops
have built-in fingerprint readers, but they are not currently being used. Staff have
not changed their passwords in over five years and the network does not have a
firewall in place.
77
369825_9.2_Cam_LSC_SB_055-087.indd Page 78 06/03/23 11:10 AM A4902 /142/HO02737/work/indd
c Scenario 3
A large bank in a city centre has hundreds of bank staff, IT specialists and managers.
The bank has three confidential datasets that it needs to protect: one containing the
personal details of all the staff; one containing private banking information; and one
containing customer details. The bank requires the highest level of security to keep
their data safe.
3 Explain to your partner how using a machine-learning security feature could improve
the security of a network.
a What would happen if somebody tried to log into the system from another country?
b What would happen if somebody tried to log into the system from another device?
c If a particular IP address has been identified by cloud software as a threat, what
action could it take if this device tried to access the system?
Go further
Error-checking during data transmission is all about trying to work out whether a
problem has occurred when transmitting data between devices. One problem with using
a parity check is that this type of check does not identify where the error has occurred.
You just know that there is an error, which means that the data has to be transmitted
again.
This is where two-dimensional parity checks
KEYWORDS
are used instead. Two-dimensional parity checks
two-dimensional parity check: check
allow you to identify exactly where the error
for finding where an error exists within a
exists in the data that has been transmitted. parity check
To do this, devices need to send a parity byte parity byte: byte added to a block of
in addition to the bytes of data that are to be data to check whether the data is valid or
transmitted. This means that data is sent in invalid
blocks, rather than one byte at a time. block: string of data (0s and 1s)
The parity bits and parity byte are used to parity bit: bit added to a byte to make
the total number of 1 bits either even or
determine whether the data has been transmitted odd
correctly using this process.
1 First, the parity bit for the byte of data in each
horizontal row is identified. In this example, even parity is being used.
78
369825_9.2_Cam_LSC_SB_055-087.indd Page 79 06/03/23 11:10 AM A4902 /142/HO02737/work/indd
2 Then, the parity byte is worked out by looking at the bits in each vertical column and
making sure that the parity bit identified is following the same odd or even rule. In this
example, using even parity, the total number of 1s and 0s in each column should be
even.
79
369825_9.2_Cam_LSC_SB_055-087.indd Page 80 06/03/23 11:10 AM A4902 /142/HO02737/work/indd
2 Open the file Calculating Parity Bits.docx provided by your teacher. Calculate the
parity bit for each question.
3 The example below (that has been received by a device) uses odd parity.
a Copy and complete the table below, identifying whether each column and row is
odd or even.
Parity Odd/
bit Even
Byte 1 0 1 1 0 0 0 1
Parity byte 0 1 0 0 0 1 1 0
Odd/Even ODD
Challenge yourself
Network administrators often use the KEYWORDS
command line to manage their network, or command line: a way of using an operating
devices on their network. system that is navigated by typing
commands
A command line is another way to access
operating system: software that manages
the operating system, without the need for a all the computer hardware and software; it
graphical user interface (GUI). For expert users, also acts as an interface between computer
common tasks can be completed more quickly hardware components and the user, and
using the command line, and it allows for more provides a platform where applications can
advanced operations, such as sharing folders run
across the network, analysing packets of data graphical user interface (GUI): way of using
sent around the network, and much more. software that is navigated by pointing and
clicking on graphics on a screen
Network administrators need to learn how to
use the command line when they are training
for their role.
80
369825_9.2_Cam_LSC_SB_055-087.indd Page 81 09/03/23 8:39 AM A4902 /Data%20Disk/Manoj%20R/2023/March/09-03-23/HO02737_142
When the Run window appears, type in cmd, then press Enter. You are now in the MS-
DOS command line.
This shows you which folder you are currently in. In the example above, ‘Network Admin’
is the username of the computer.
1 Use the command md to create a folder called ‘network-users’. Use the example below
to help you.
81
369825_9.2_Cam_LSC_SB_055-087.indd Page 82 09/03/23 1:08 PM A4902 /142/HO02737/work/indd
2 Use the command dir to list all the folders in the current folder that you are in. If you
created your ‘network-users’ folder correctly, you should see it in the list.
3 Change into the ‘network-users’ folder that you have created. At the moment, there
will be no files or folders in there.
Use the command cd (change directory) to move into the ‘network-users’ folder. Use
the following example to help you to complete the command.
82
369825_9.2_Cam_LSC_SB_055-087.indd Page 83 09/03/23 1:09 PM A4902 /142/HO02737/work/indd
4 You now need to create folders for five users on the network. Pick the names of five
people in your class and use the example below to help you to write a command to
create folders for all the users.
You will use the md command, but this time you will be creating multiple folders.
5 To check that this has worked properly, use dir to list the files in your ‘network-users’
folder.
83
369825_9.2_Cam_LSC_SB_055-087.indd Page 84 06/03/23 11:10 AM A4902 /142/HO02737/work/indd
6 Examine the folders that you have created using Windows Explorer. Windows Explorer
is the application that allows you to view your files when using the GUI version of
Windows. You can access it via the Start Menu, by clicking the Start Menu and then
clicking on Documents and navigating through your files.
Click on This Computer, then your Hard Drive (usually C: drive), then Users, then
your username. In here, you should find your ‘network-users’ folder.
Have a look inside the ‘network-users’ folder to see whether your folders are there.
84
369825_9.2_Cam_LSC_SB_055-087.indd Page 85 06/03/23 11:10 AM A4902 /142/HO02737/work/indd
Final project
Look back to the start of this unit to remind yourself of the Scenario. Your task is to
create a presentation to advise the youth centre on best practices for establishing a
safe, monitored and flexible online environment.
The network must support:
l five PCs
l ten laptops
l five tablets
l fifteen smartphones
l two games consoles
l five smart watches.
Use Microsoft Word to plan the content of your presentation, and then use Microsoft
PowerPoint to create your final presentation which should meet the criteria from the
youth centre.
Part 1: Network topology
Make recommendations to the youth centre on the type of network topology you would
recommend and the hardware you think they would need to support the setup of their
local hub.
On paper, draw a network topology diagram that shows the layout of the network, with
the hardware that you have chosen to include. It is important that you identify what
type of topology your diagram shows (bus, ring or star).
Write notes on your Word document to include the following:
l A network hardware shopping list, with a short justification of why each item is
needed.
l A list of the software tools that a network administrator might need to manage the
network.
– What are they called?
– What would they be used for?
l Identify two protocols that your network will use.
– What are they called?
– Why would they be used?
l If the hub were to expand at a later date to double the number of devices it could
support, what additional network hardware would you put in place and why?
– How would this improve the scalability of your network?
– If the youth centre were to grow the number of users, what could happen if you
had not planned for it?
l Explain how parity-checking could improve the validity of data on your network.
– How does parity-checking work? What does it help to find?
– What is a parity bit?
85
369825_9.2_Cam_LSC_SB_055-087.indd Page 86 06/03/23 11:10 AM A4902 /142/HO02737/work/indd
l Discuss how the security needs at each level of the network may vary. The youth
centre will employ management staff, network staff and teaching staff and will also
have user accounts for students. There are some highly personal datasets that need
to be accessed by some accounts.
– Which accounts would you give the higher-level access to and why?
– What would each staff member have access to?
– What other methods could you use to secure information on the network?
Part 2: Presentation
Use your planning document to create your presentation.
Create a presentation that outlines the following:
l Slides 1–2:
– A screenshot or picture of your network topology diagram.
– A justification of why you have chosen to set the network out in the way that you
have.
– A list of the hardware that will be needed to set up the network.
l Slide 3:
A list of software tools that a network administrator may need to help them to
operate and maintain the network, and an explanation of what each one would be
used for.
l Slide 4:
Details about which network-security protocols will be used to keep data packets
secure.
l Slide 5:
An explanation about how using parity bits and parity blocks can check for errors, to
reassure the hub staff that the network setup will be robust; assume that they do not
know anything about how data is transmitted, so you will need to explain the process
to them.
l Slide 6:
Explain how you intend to:
– secure the information on the network
– control users’ access the network, and explain why you have chosen these
methods
– keep the datasets secure.
86
369825_9.2_Cam_LSC_SB_055-087.indd Page 87 06/03/23 11:10 AM A4902 /142/HO02737/work/indd
Evaluation
1 Swap presentations with your partner or listen to each other’s presentation. Make
notes that comment on the following:
a Does it cover all the requirements?
b Is the content easy to understand?
c How could the network topology be improved?
d Make a list of recommendations of how they could improve their report/network
topology diagram.
e Feed back your recommendations to your partner.
2 When you receive feedback from your partner, read the recommendations carefully.
Use the feedback that you have been given to improve your presentation.
87
369825_9.3_Cam_LSC_SB_088-128.indd Page 88 06/03/23 9:50 AM A4902 /142/HO02737/work/indd
Get started!
Have you ever wondered how a computer game is developed to
use a physical device as a key component in gameplay? For
example, the Nintendo Switch allows both sides to be
removed and used as individual controllers within the game
displayed on the screen.
Discuss with your partner:
l What computer games do you play that include a physical device?
l How is the physical device used in the game?
KEYWORDS
The micro:bit is a physical device: a small microprocessor that
physical computing
has a range of inputs and outputs. The data that is gathered device: device that can
by the micro:bit can be used in many ways: for example, be programmed using
pressing the A button sends data to the microprocessor and, block or text-based
if programmed, the micro:bit will react to this input. programming languages
microprocessor: device
In this unit, you will learn to develop a program using that has one circuit but the
MicroPython for the micro:bit to create a simple game. The input, process and output
game will use more than one of the inputs to allow the user to functions of a computer
interact with the game. The display and the buzzer will allow data: raw facts and figures
the user to see and hear the output from the game.
Learning outcomes
In this unit, you will learn to: l identify and explain the purpose of a
l follow, understand, edit and correct one-dimensional array
algorithms that are presented as l identify and describe data types in
pseudocode MicroPython programs including integer,
l follow flowchart or pseudocode real, character, string and Boolean
algorithms that use loops l develop MicroPython programs with
l create algorithms using flowcharts and count-controlled loops
pseudocode l access data from an array using
l explain and use iteration statements MicroPython
with count-controlled loops in either l use iterative development on micro:bit
pseudocode or flowcharts prototypes to create solutions to
l predict the outcome of algorithms that problems
use iteration l develop and apply test plans that
l compare and contrast two algorithms include normal, extreme and invalid data
for the same solution and decide which l identify test data that covers normal,
is best suited to the task extreme and invalid data
l create an algorithm as a flowchart l use a trace table to check the flow of a
or pseudocode using more than one variable or array through an algorithm
construct: sequence, selection and l program a micro:bit to use data to solve
count-controlled iteration a problem.
88
369825_9.3_Cam_LSC_SB_088-128.indd Page 89 06/03/23 9:50 AM A4902 /142/HO02737/work/indd
Unit 9.3 Coding and testing: Game development for the micro:bit
Warm up
1 In pairs, consider a basic game that you
have played on a computing device. There
are many inputs and outputs that are used
to allow you to interact with a game. For
example: in the game Tetris, the aim is to
guide the different-shaped blocks to the
bottom of the screen and position them to
complete a horizontal line.
2 Discuss the game Tetris, shown here, with
your partner.
a How do you control the blocks?
b How do you know when a game starts?
c How do you know when a horizontal
line is matched up? If you’ve never played Tetris,
discuss possible answers with your
d How do you know when you win?
partner, and then compare answers
e How do you know if you lose? with a pair who have played the
You can see how Tetris is played here: game.
https://tetris.com/play-tetris
89
369825_9.3_Cam_LSC_SB_088-128.indd Page 90 06/03/23 9:50 AM A4902 /142/HO02737/work/indd
SCENARIO
You are likely to have played a computer-
based game that allows you to interact with
A ‘What am I?’ game
it, whether that is through the use of the allows one player to ask questions to try
keyboard or an external physical device such to discover the name of an object/animal/word.
as a joystick. Either way, the physical device The other player can answer only ‘yes’ or ‘no’
allowed you to play and experience the game. until the first player guesses correctly. The object/
animal/word can be shown on a device placed on
Games have a wide range of purposes, and the first player’s head so that they cannot see it.
they can be used in an educational way, to Once they have guessed correctly, the player
help students to learn through games. Your either moves the device or presses a button
school has asked you to create a prototype to access a new object/animal/
game on the micro:bit that acts as the word to guess.
physical device of a ‘What am I?’ game.
Do you remember?
Before starting this unit, you should be ✔ identify and use conditional operators in
able to: a conditional statement
✔ create a program for the micro:bit using ✔ send a program to the micro:bit
selection in MicroPython ✔ create a flowchart using sequence and
✔ identify and use a range of inputs and selection
outputs available on the micro:bit ✔ follow and understand an algorithm
✔ identify and use conditional operators presented as a flowchart or pseudocode
to combine more than one input in a ✔ develop a test plan with a range of data
conditional statement inputs.
Before starting this unit, you will need to You will also need the following physical
access MicroPython on a computer through computing devices:
online software. To access MicroPython: l Micro:bit
1 Open your chosen web-browser l USB cable
software. l Optional battery pack for the micro:bit.
2 Go to https://python.microbit.org
90
369825_9.3_Cam_LSC_SB_088-128.indd Page 91 06/03/23 9:50 AM A4902 /142/HO02737/work/indd
Unit 9.3 Coding and testing: Game development for the micro:bit
Micro:bit recap
Learn
The micro:bit is a physical computing device
that can be programmed directly. You should
already have used it in activities in previous
stages. The text-based programming
language that is used with the micro:bit is
MicroPython, which is a version of the
Python programming language.
The micro:bit is a microprocessor. It is a small
device that fits in your hand and can store
and run one program at a time. The program
is downloaded from specific websites. The
program can be developed as a block-
based program on the platform MakeCode.
The platform that uses the text-based
programming language MicroPython is
KEYWORDS
https://python.microbit.org
text-based programming: written lines
The micro:bit itself has a set of inputs and outputs of code using a specific programming
that can be used in a program. language, e.g. Python
l The inputs are: MicroPython: programming language
used on the micro:bit
– A button
microprocessor: device that has one
– B button
circuit but the input, process and
– accelerometer (detects movement and output functions of a computer
direction) program: instructions that tell a
– microphone (a sound sensor) computer system how to complete
– light sensor (located on the display) a task
91
369825_9.3_Cam_LSC_SB_088-128.indd Page 92 06/03/23 9:50 AM A4902 /142/HO02737/work/indd
92
369825_9.3_Cam_LSC_SB_088-128.indd Page 93 06/03/23 9:50 AM A4902 /142/HO02737/work/indd
Unit 9.3 Coding and testing: Game development for the micro:bit
This program requires the use of the accelerometer built into the micro:bit. The
accelerometer can detect the change in direction of the device.
The accelerometer is continuously gathering data from the movement that the micro:bit
makes. This data is then used to activate an output.
In MicroPython, the code for using the accelerometer is:
The specific test for the direction is placed in the brackets and encased in single quotation
marks.
The different options include:
l up l left l face up l freefall
l down l right l face down l shake.
The MicroPython can be developed from the pseudocode plan by following these steps.
1 Set the program to use MicroPython. All programs
must start with this code. The use of while True
allows the program to check continuously whether an
input is being used.
2 Add the program code to show a changing arrow
that looks like it is rotating.
OUTPUT arrow N
DELAY 300
OUTPUT arrow E
DELAY 300
OUTPUT arrow S
DELAY 300
OUTPUT arrow W
DELAY 300
93
369825_9.3_Cam_LSC_SB_088-128.indd Page 94 06/03/23 9:50 AM A4902 /142/HO02737/work/indd
3 Add the conditional statement to check whether the micro:bit is tilted to the left.
IF micro:bit moved to left THEN
OUTPUT arrow W
DELAY 2000
ENDIF
4 Develop the program to add the other three conditional statements to check whether
the micro:bit is being tilted in any of the other directions.
IF micro:bit moved to right THEN
OUTPUT arrow E
DELAY 2000
ENDIF
IF micro:bit moved forwards THEN
OUTPUT arrow S
DELAY 2000
ENDIF
IF micro:bit moved backwards THEN
OUTPUT arrow N
DELAY 2000
ENDIF
94
369825_9.3_Cam_LSC_SB_088-128.indd Page 95 06/03/23 9:50 AM A4902 /142/HO02737/work/indd
Unit 9.3 Coding and testing: Game development for the micro:bit
The test plan above shows that the program and the use of the accelerometer works as
expected.
KEYWORDS
test plan: document that details the tests to extreme test data: acceptable input but at the
be carried out when a program is complete and ends of the possible input range
whether or not they are successful invalid test data: data that should be rejected by
normal test data: data of the correct type that a program
should be accepted by a program
95
369825_9.3_Cam_LSC_SB_088-128.indd Page 96 06/03/23 9:50 AM A4902 /142/HO02737/work/indd
Practise
DID YOU KNOW?
1 Discuss with your partner what the pseudocode below is Another device that
designed to do. has an accelerometer
START in it is a smartphone.
As you move the mobile
IMPORT random library phone from portrait to
number = 0 landscape, the display
moves with it.
OUTPUT happy face
DELAY 300
OUTPUT sad face
STOP
2 Create a test plan using the template below, using normal and
invalid test data, so that it is ready to use when the program
has been created.
96
369825_9.3_Cam_LSC_SB_088-128.indd Page 97 06/03/23 9:50 AM A4902 /142/HO02737/work/indd
Unit 9.3 Coding and testing: Game development for the micro:bit
97
369825_9.3_Cam_LSC_SB_088-128.indd Page 98 06/03/23 9:50 AM A4902 /142/HO02737/work/indd
These index positions can help to identify the specific item to be used or output to the
micro:bit display. To output the item that is stored in position 2, you need to use the
syntax to display something on the screen: display.scroll(). The array details are placed
inside the brackets. The format for this is the name of the array followed by the position
you want to output in square brackets:
The table below shows the array used in the program code above and the different
positions the items are in.
Position 0 1 2 3 4 5
Array item 50 25 65 90 33 12
You can check that 12 has been added correctly by outputting the contents stored at
position 5 of the array. You can do this by:
l using the MicroPython code to output to the display: display.scroll()
l adding the name of the array inside the brackets: display.scroll(score)
l adding the position of the item you want to output in square brackets after the array
name: display.scroll(score[5]).
98
369825_9.3_Cam_LSC_SB_088-128.indd Page 99 06/03/23 9:50 AM A4902 /142/HO02737/work/indd
Unit 9.3 Coding and testing: Game development for the micro:bit
The position in the array can be used in a program to output a random value. You have
generated a random number in the previous section. In the pseudocode below, the
micro:bit will generate a random selection from a list of six numbers.
START KEYWORD
IMPORT random library random value: randomly
generated number in a program
ARRAY numbers = [1, 2, 3, 4, 5, 6] that can be set within a range
2 Create the array containing the numbers 1 to 6. The numbers are stored as integers.
3 Set the input for the program to be when the micro:bit is shaken.
99
369825_9.3_Cam_LSC_SB_088-128.indd Page 100 06/03/23 9:50 AM A4902 /142/HO02737/work/indd
4 The next step is to output a randomly generated item from the array to the
micro:bit display. There are two ways in which something can be displayed using
the micro:bit LEDs:
– display.show() is used for an integer, letter or image; if there is more than one digit
or image, they will be shown in sequence with a delay between each one
– display.scroll() is used for a string; the text will scroll across the screen.
When using display.show(), place the array name inside the brackets:
However, instead of a set index position being used inside the square brackets, a
random position needs to be generated. The array has six items, which means that the
positions are within a range of 0 to 5.
Position 0 1 2 3 4 5
Array item 1 2 3 4 5 6
The code to randomly generate a value between 0 and 5 – the known positions in this
array – is:
This is placed inside the square brackets to replace the position number:
5 To finish the program, a short delay is added to allow the number to be shown before
the display is cleared:
The program can now be sent to the micro:bit, and every time the micro:bit is shaken, a
random number between 1 and 6 is displayed.
100
369825_9.3_Cam_LSC_SB_088-128.indd Page 101 06/03/23 9:50 AM A4902 /142/HO02737/work/indd
Unit 9.3 Coding and testing: Game development for the micro:bit
To test that a random number is being generated, you can create a test table to
document the output after each shake. An example is shown below.
Test number Output
1 5
2 1
3 5
4 3
5 4
6 2
7 4
8 6
9 4
10 6
Practise
1 A game such as a quiz requires the players to be placed in a group or team. Look at
the pseudocode below.
START
IMPORT random library
101
369825_9.3_Cam_LSC_SB_088-128.indd Page 102 06/03/23 9:50 AM A4902 /142/HO02737/work/indd
b Discuss with your partner what is different about the pseudocode above compared
with the pseudocode below.
START
IMPORT random library
ARRAY numbers = 1, 2, 3, 4, 5, 6
3 Create a test plan for the pseudocode above using normal and invalid test data.
102
369825_9.3_Cam_LSC_SB_088-128.indd Page 103 06/03/23 9:50 AM A4902 /142/HO02737/work/indd
Unit 9.3 Coding and testing: Game development for the micro:bit
Learn
Look at this program. It has been created to output a section of a times table using the
micro:bit to display the answer. This example outputs the answer to 1 × 2, 2 × 2 and 3 × 2.
KEYWORD
trace table: technique for predicting
step by step what will happen as each
line of an algorithm or program is run,
and to identify errors
103
369825_9.3_Cam_LSC_SB_088-128.indd Page 104 06/03/23 9:50 AM A4902 /142/HO02737/work/indd
l Line 7 – an equation (number * times _ table) updates the value stored in the
variable ‘answer’; the values stored in the variables make this equation 1 × 2, so the
answer 2 is stored in the variable ‘answer’.
Line Variable Variable Variable Output
number times_table answer
3 1
4 2
5 0
7 2
l Line 8 – the value stored in the variable ‘answer’ is displayed on the micro:bit.
Line Variable Variable Variable Output
number times_table answer
3 1
4 2
5 0
7 2
8 2
l Line 12 – an equation (number * times _ table) updates the value stored in the
variable ‘answer’; the values stored in the variables make this equation 2 × 2, so the
answer 4 is stored in the variable ‘answer’.
Line Variable Variable Variable Output
number times_table answer
3 1
4 2
5 0
7 2
8 2
11 2
12 4
104
369825_9.3_Cam_LSC_SB_088-128.indd Page 105 06/03/23 9:50 AM A4902 /142/HO02737/work/indd
Unit 9.3 Coding and testing: Game development for the micro:bit
l Line 13 – the value stored in the variable ‘answer’ is displayed on the micro:bit.
Line Variable Variable Variable Output
number times_table answer
3 1
4 2
5 0
7 2
8 2
11 2
12 4
13 4
l Line 17 – an equation (number * times _ table) updates the value stored in the
variable ‘answer’; the values stored in the variables make this equation 3 × 2, so the
answer 6 is stored in the variable ‘answer’.
Line Variable Variable Variable Output
number times_table answer
3 1
4 2
5 0
7 2
8 2
11 2
12 4
13 4
16 3
17 6
105
369825_9.3_Cam_LSC_SB_088-128.indd Page 106 06/03/23 9:50 AM A4902 /142/HO02737/work/indd
l Line 18 – the value stored in the variable ‘answer’ is displayed on the micro:bit.
Line Variable Variable Variable Output
number times_table answer
3 1
4 2
5 0
7 2
8 2
11 2
12 4
13 4
16 3
17 6
18 6
The program allows the micro:bit to output the answers to 1 × 2, 2 × 2 and 3 × 2. The
program code is long, and sections are repeated. If you wanted to extend the program
to output more of the times table, you would need to repeat the lines of code below
the others. However, the program code can be reduced greatly by using a count-
controlled loop.
The pseudocode below shows how a count-controlled loop, a for loop, can be used. In
this example, ‘number’ is a variable that keeps track of how many times the code has
repeated. This is known as the counter variable, and can be set to any variable name
you choose. Each run of the instructions inside the loop is called an iteration. The
counter variable begins with a value of 0 and increases by 1 every time the loop iterates
over the instructions. The end value is the number of times the loop needs to run.
1 START KEYWORDS
2 answer = 0 count-controlled loop: set of
3 times _ table = 2 instructions repeated a set number of
4 times
5 FOR number = 0 to 3 for loop: the Python or MicroPython
loop for a count-controlled loop
6 answer = number * times _ table
counter variable: variable that stores
7 OUTPUT answer the number of times an iteration has
8 DELAY 500 iterated
9 ENDFOR iterate/iterative/iteration: repeat/
10 STOP repeated/repetition
106
369825_9.3_Cam_LSC_SB_088-128.indd Page 107 06/03/23 9:50 AM A4902 /142/HO02737/work/indd
Unit 9.3 Coding and testing: Game development for the micro:bit
This can be seen in the trace table below. The yellow and green shading highlights
each iteration of the loop. The line numbers are revisited with each iteration (lines 5, 6
and 7) and there are four iterations of the indented instructions.
Line Variable Variable Variable Output
number times_table answer
2 0
3 2
5 0
6 0
7 0
5 1
6 2
7 2
5 2
6 4
7 4
5 3
6 6
7 6
107
369825_9.3_Cam_LSC_SB_088-128.indd Page 108 06/03/23 9:50 AM A4902 /142/HO02737/work/indd
START
IMPORT speech library
FOR number = 3 to 1
OUTPUT speech number
DELAY 1000
ENDFOR
OUTPUT speech "Go"
STOP
2 So far, you have used a for loop that counts up to a set value. To count backwards,
the range needs to have a start and end point and be told to reduce the number by
1 each time.
3 In this program, the speech function of the buzzer is used to output the number for
each iteration. The speech aspect on the micro:bit can output only a string. The value
stored in the variable ‘number’ must therefore be converted, or cast, to a string for it to
be output.
l The structure of the code for the speech function is KEYWORD
speech.say(). cast: change the data
type of a variable
l The words to be displayed are placed inside the brackets.
108
369825_9.3_Cam_LSC_SB_088-128.indd Page 109 06/03/23 9:50 AM A4902 /142/HO02737/work/indd
Unit 9.3 Coding and testing: Game development for the micro:bit
l To output the contents of the variable and convert it to a string, the code
str(number) is placed inside the brackets:
This will now take the value stored in the variable ‘number’, convert it from an
integer to a string and output it through the buzzer as speech.
l This code must be indented inside the for loop:
4 A delay is added after the speech to leave a gap of 1 second before the next number.
1 second is 1000 milliseconds and so this is the value added in the brackets of the sleep
function:
5 The final speech output will be ‘Go’. This is not part of the for loop and therefore it
should not be indented. It will be the next instruction to run once the iterations of the
count-controlled loop are completed:
109
369825_9.3_Cam_LSC_SB_088-128.indd Page 110 06/03/23 9:50 AM A4902 /142/HO02737/work/indd
Practise
1 START
2 IMPORT speech library
3
4 ARRAY shoppingList = [bread, milk, chocolate]
5
6 OUTPUT speech "You need to buy"
7 DELAY 1000
8
9 FOR each item in ARRAY shoppingList
10 OUTPUT speech item KEYWORD
11 DELAY 1000 algorithm: step-by-step
instructions to solve a
12 ENDFOR
particular problem
13 STOP
1 a With your partner, predict the outcome of the pseudocode above.
b Explain how iteration has been used in this pseudocode.
c Copy and complete the trace table below to follow the variable and array outputs
through the algorithm.
Line Array Variable Output
shoppingList item
4
6
9
10
9
10
9
10
d Discuss with your partner how using a trace table can help to identify how data is
used in a program.
2 a Create the MicroPython program to match the pseudocode using a count-controlled
loop.
b Connect the micro:bit to the computer and send the program to the micro:bit.
c Test the program to make sure that the output is what you expected.
d Download the program to your computer and save it.
– Select the three vertical dots next to the Save icon.
– Select Save Python Script.
– Move it from the ‘Downloads’ folder to your own folder and save it as
shoppingList.py’.
110
369825_9.3_Cam_LSC_SB_088-128.indd Page 111 06/03/23 9:50 AM A4902 /142/HO02737/work/indd
Unit 9.3 Coding and testing: Game development for the micro:bit
For example, these steps create an array to output the musical sequence for the
traditional song ‘Frère Jacques’.
1 The first line of notes is: C D E C. The octave remains the same at 4, KEYWORD
a midpoint note. The length of each note is also 4. This needs only character:
to be set on the first note and the program remembers this for each single letter,
note that follows until it is told to change: digit or
symbol
C4:4, D4, E4, C4
2 Each of these notes now needs to be placed inside quotation marks:
"C4:4", "D4", "E4", "C4"
3 This line of notes can now be placed inside the square brackets with
the name of the array:
line1 = ["C4:4", "D4", "E4", "C4"]
111
369825_9.3_Cam_LSC_SB_088-128.indd Page 112 06/03/23 9:50 AM A4902 /142/HO02737/work/indd
4 Follow these steps to output this array using the buzzer on the micro:bit.
a First you need to ensure that you have imported the music library. You must do
this at the start of the program, after the importing the micro:bit library:
from microbit import *
import music
b Add the code to program an output to the buzzer:
music.play()
c Add the name of the array inside the brackets. This now says to run the contents
of the array through the buzzer:
music.play(line1)
d This will output the line once. However, the line is repeated in the song. You could
write this by adding the same line again:
e But this is not an efficient way of adding and running code. You can use a count-
controlled loop to repeat the same line a set number of times:
112
369825_9.3_Cam_LSC_SB_088-128.indd Page 113 06/03/23 9:50 AM A4902 /142/HO02737/work/indd
Unit 9.3 Coding and testing: Game development for the micro:bit
5 You can use a trace table to see how this program is using the array when it is run.
The counter variable will start at 0 and will change to 1 for the second iteration, for
example:
Line Array Variable Output
line1 counter
4 "C4:4", "D4", "E4", "C4"
6 0
7 "C4:4", "D4", "E4", "C4"
6 1
7 "C4:4", "D4", "E4", "C4"
6 You can create the next line of the song in the same way. You can use an array to
store the individual notes as items. This time, the last note needs to be longer than
the other two notes. Therefore, you need to add (:8) to the end of the note to tell
the program to double the length of the note:
"E4:4", "F4", "G4:8"
7 You can then create the program in the same way as before, with the array at the
start and a new for loop following the first:
On the next page is a trace table for the array and the two for loops. The line
numbers help to identify which count-controlled loop is being run.
113
369825_9.3_Cam_LSC_SB_088-128.indd Page 114 06/03/23 9:50 AM A4902 /142/HO02737/work/indd
8 Once the program executes the first for loop on lines 7–8 in the
KEYWORD
code above, the program will continue to the second for loop
execute: carry out
on lines 10–11. It is important to set up the arrays at the start of the instructions
the program for the musical notes and then add the sequence described in a
of for loops to represent the musical output sequence required computer program
to play the song correctly.
Practise
1 With your partner, predict the outcome of the pseudocode below. Do array ‘line1’ and
‘line2’ look familiar?
1 START
2
3 ARRAY line1 = [C4:4, D4, E4, C4]
4 ARRAY line2 = [E4:4, F4, G4:8]
5 ARRAY line3 = [G4:2, A4, G4, F4, E4:4, C4]
6 ARRAY line4 = [C4:4, G3, C4:8]
7
8 FOR i = 0 to 1
9 OUTPUT line1 to buzzer
10 ENDFOR
11
12 FOR i = 0 to 1
13 OUTPUT line2 to buzzer
14 ENDFOR
15
16 FOR i = 0 to 1
114
369825_9.3_Cam_LSC_SB_088-128.indd Page 115 06/03/23 9:50 AM A4902 /142/HO02737/work/indd
Unit 9.3 Coding and testing: Game development for the micro:bit
115
369825_9.3_Cam_LSC_SB_088-128.indd Page 116 06/03/23 9:50 AM A4902 /142/HO02737/work/indd
To edit the image displayed, HEART is replaced with one of the predefined images in
uppercase letters:
The following example of a guess-the-animal game using images has been planned using
pseudocode.
1 START
2 IMPORT random library
3 IMPORT music library
4
5 ARRAY images = [DUCK, TORTOISE, BUTTERFLY, GIRAFFE, SNAKE]
6 ARRAY correctTune = [G4:1, C5, E, G:2, E:1, G:3]
7
8 IF button A is pressed THEN
9 OUTPUT random image from ARRAY images
10 ENDIF
11
12 IF button B is pressed THEN
13 OUTPUT correctTune
14 DELAY 500
15 OUTPUT clear screen
16 ENDIF
17
18 STOP
l Two arrays have been set up: ‘images’ and ‘correctTune’.
– ‘images’ stores the list of possible images.
– ‘correctTune’ stores the notes to play a tune when the user guesses correctly.
l When the A button is pressed, a random image is displayed on the micro:bit.
l When the B button is pressed, a celebration musical sequence is played, and after 500
milliseconds the display is cleared.
116
369825_9.3_Cam_LSC_SB_088-128.indd Page 117 06/03/23 9:50 AM A4902 /142/HO02737/work/indd
Unit 9.3 Coding and testing: Game development for the micro:bit
A trace table can be used to follow the data that is being used in this algorithm. It can
help to find any errors that may have occurred while writing the program, for example, an
incorrect or misspelt array name.
Line Array Array Condition Condition Output
images correctTune A button = True B button = True
5 DUCK, TORTOISE,
BUTTERFLY,
GIRAFFE, SNAKE
6 G4:1, C5, E, G:2, E:1, G:3
8 True
9 One array image
12 True
13 correctTune
15 Clear screen
The pseudocode can be used to create the program by following these steps.
1 To use ‘random’ and ‘music’ in the program, you first need to import both the
‘random’ and ‘music’ libraries:
2 You need to create the array to store the images. As the array is going to store the
images that can be displayed, you need to use the correct syntax for the array items.
An image is defined in the program as Image.DUCK, so this is the correct format to
use for each list item:
3 Create the array to store the celebration musical sequence. The notes and sequence
have been set as "G4:1", "C5", "E", "G:2", "E:1", "G:3".
117
369825_9.3_Cam_LSC_SB_088-128.indd Page 118 06/03/23 9:50 AM A4902 /142/HO02737/work/indd
4 IF the A button is pressed, THEN the program should display a random image.
There is a function that allows the program to choose an item randomly from
the list: random.choice(). The array name is placed inside the brackets: random.
choice(images).
To output a random image, place this function inside the brackets of the code to
output an image to the micro:bit display: display.show(random.choice(images)).
This code is indented below while True: to ensure that the micro:bit continuously
reacts if the button is pressed.
5 IF the B button is pressed, THEN the program should play the celebration musical
sequence, wait and then clear the screen.
Once a program has been written, it is important to test it. If the program involves a
random element, this should be reflected in the test plan.
The normal test data would be the expected inputs to the program. In this program,
the A button is tested more than once to check that a randomly generated image is
displayed each time.
The invalid test data would be any other input on the micro:bit to ensure that it does
not activate any element of the program.
KEYWORD
function: sub-program that can exist as part of a bigger program
118
369825_9.3_Cam_LSC_SB_088-128.indd Page 119 06/03/23 9:50 AM A4902 /142/HO02737/work/indd
Unit 9.3 Coding and testing: Game development for the micro:bit
Practise
1 START
2 IMPORT random library
3 IMPORT music library
4
5 ARRAY images = [CLOCK 12, CLOCK 1, CLOCK 2, CLOCK 3, CLOCK 4,
CLOCK 5, CLOCK 6, CLOCK 7, CLOCK 8, CLOCK 9, CLOCK 10, CLOCK 11]
6 ARRAY correctTune = [G4:1, C5, E, G:2, E:1, G:3]
7
8 score = 0
9
10 IF button A is pressed THEN
11 OUTPUT random image from ARRAY images
12 ENDIF
13
14 IF button B is pressed THEN
15 OUTPUT images
16 score = score + 1
119
369825_9.3_Cam_LSC_SB_088-128.indd Page 120 06/03/23 9:50 AM A4902 /142/HO02737/work/indd
17 DELAY 500
18 OUTPUT clear screen
19 ENDIF
20
21 IF micro:bit is shaken THEN
22 OUTPUT score
23 DELAY 1000
24 score = 0
25 ENDIF
26
27 STOP
1 With your partner, predict what the pseudocode above will do.
2 a ‘correctTune’ should play if the B button is pressed. Rewrite this part of the
pseudocode correctly.
b Check the pseudocode using a new trace table.
3 Discuss with your partner how data is stored and used in this program.
4 Create a test plan using normal and invalid test data.
5 a Create the MicroPython program to match the pseudocode.
b Connect the micro:bit to the computer with the USB cable and send the program to
the micro:bit.
c Test the program using your test plan, to make sure that the output is as expected.
d Download the program to your computer and save it as clockfaceGuessingGame.py.
Go further
Remember: Development of a program is done in iterations. The program is written,
tested and reviewed and, at this point, potential improvements may be identified. A new
iteration of the program is then developed, tested and reviewed. It is important to save
each iteration as a new version of the program. If you save over the previous version, you
will not have the original to go back to if the new additions do not work. This is called
version control. It allows the programmer to track the changes that have been made
through the different development iterations.
In the previous section, you created a program that used KEYWORD
the predefined images available on the micro:bit. You can version control: saving
each development
also create your own images. Each individual LED light on
iteration as a new
the micro:bit can be used to create a unique image. You filename to track
can switch a light on using the number 9 and off with the changes
number 0.
120
369825_9.3_Cam_LSC_SB_088-128.indd Page 121 06/03/23 9:50 AM A4902 /142/HO02737/work/indd
Unit 9.3 Coding and testing: Game development for the micro:bit
For example, you can create a question mark and add this to the array, using a 5 × 5
grid to plan the image. Each square on the grid represents an individual LED light on the
micro:bit.
You must place the code for the new image near the top of the program, after the arrays
have been created. The pseudocode below shows that the numbers for the image are
placed in a grid style too. This is to ensure that the right numbers are added in the
correct positions. You can enter them on a single line with each number separated by a
comma, but this makes it harder to check the image layout.
START
IMPORT random library
IMPORT music library
questionMark = 09990
00090
00990
00000
00900
121
369825_9.3_Cam_LSC_SB_088-128.indd Page 122 06/03/23 9:50 AM A4902 /142/HO02737/work/indd
STOP
2 To add this new image to the array, you need to use the append() function:
122
369825_9.3_Cam_LSC_SB_088-128.indd Page 123 06/03/23 9:50 AM A4902 /142/HO02737/work/indd
Unit 9.3 Coding and testing: Game development for the micro:bit
3 The program will now have a question mark added to the array and this will be a
possible output when the A button is pressed.
123
369825_9.3_Cam_LSC_SB_088-128.indd Page 124 06/03/23 9:50 AM A4902 /142/HO02737/work/indd
Challenge yourself
A game often has a time limit. In a guessing game, the player may have 60 seconds to
guess as many of the images displayed as possible. Using a second micro:bit allows a
player to start a timer once the other player begins their guesses.
When you are using a count-controlled loop, you can use selection to check a variable
each time a loop is run. The code to be run as part of the selection statement is indented
another layer within the for loop. Where one programming construct, such as selection,
occurs inside another construct, such as a count-controlled loop, this is known as nesting.
In the example below, each iteration reduces the value stored in the variable ‘time’ by 1.
On each iteration, the value is tested to see whether it meets the conditional statement,
which is to see whether it is equal to 0.
l If the outcome is False, then the next iteration continues.
l If the outcome is True, then an ‘X’ is displayed on the micro:bit.
KEYWORDS
selection: choice to be
added to a program using
if… elif… else and the
next instruction executed in
the program is decided by
the outcome of a condition
nesting: one programming
construct, e.g. selection,
occurring inside another
construct, e.g. a count-
controlled loop
You can use a trace table to see the values of the variables and the outputs as the
program iterates through each run of the code in the loop.
Line Variable Variable Condition Output
time i time == 0
3 3
4 3
6 0
7 2
8 2
9 False
6 1
7 1
8 1
9 False
124
369825_9.3_Cam_LSC_SB_088-128.indd Page 125 06/03/23 9:50 AM A4902 /142/HO02737/work/indd
Unit 9.3 Coding and testing: Game development for the micro:bit
The next development iteration uses a second micro:bit. The second micro:bit acts as
the timer for the game. The countdown needs to go from 30 to 0, and when it gets to 0
an X should be displayed, along with a musical sequence or text output using speech to
represent the end of the game.
1 Plan the algorithm for the second micro:bit program in pseudocode. Your algorithm
should use speech, time, a count-controlled loop and nested selection, and you should
also consider how the timer is activated.
2 Create a trace table and test the flow through the pseudocode.
3 Create a test plan using normal and invalid test data and include extreme test data to
check the start and end countdown displayed.
4 a Create the program code to match the pseudocode.
b Connect the micro:bit to the computer with the USB cable and send the program to
the micro:bit.
c Use the test plan to check that the program output is what you expected.
d Download the program to your computer and save it as countdownTimer.py.
Final project
The skills you have learned in this unit are all about using arrays, count-controlled
loops and new functions on the micro:bit. You have developed some of the programs
iteratively to create new outputs for the micro:bit. You have learned how to trace a
variable or array through pseudocode or a program using a trace table and how using
music and speech can enhance a game.
Look back to the start of this unit to remind yourself of the KEYWORD
Scenario. You now have all the skills and knowledge to follow criteria: set of rules
the criteria to create your own program for the ‘What am ?' that must be met
game.
125
369825_9.3_Cam_LSC_SB_088-128.indd Page 126 06/03/23 9:50 AM A4902 /142/HO02737/work/indd
KEYWORDS
The game should:
l display an item from a pre-set list to the player
data type: classification
applied to a data item
randomly specifying which type of
l use an input either through the accelerometer or a data that item represents,
button to represent when the player has correctly e.g. in a spreadsheet some
guessed, and play a tune to represent a correct of the data types available
answer include currency, text and
number
l reset through another input, to start the game again
l use speech, music and images within the game
prototype: initial product
created for testing and
l utilise a count-controlled loop, selection, array and
reviewing, before a final
variables product is released
l use a time delay to aid gameplay.
126
369825_9.3_Cam_LSC_SB_088-128.indd Page 127 06/03/23 9:50 AM A4902 /142/HO02737/work/indd
Unit 9.3 Coding and testing: Game development for the micro:bit
Evaluation
Part 1: Planning
Swap planning documents (planning table, pseudocode and trace table) with your
partner. Discuss the following:
1 Are all variables and arrays planned using a structured table?
2 Does the pseudocode use a count-controlled loop, array, speech, micro:bit inputs and
musical and image outputs?
3 Does the pseudocode show the use of a time delay?
4 Does the trace table show the correct flow of the array outputs and variables through
the algorithm?
Part 2: Development
Swap programs with your partner. Discuss the following:
1 Does the program randomly generate an item from the array?
2 Does the program use a count-controlled loop?
3 Does the program use speech, music and images?
127
369825_9.3_Cam_LSC_SB_088-128.indd Page 128 06/03/23 9:50 AM A4902 /142/HO02737/work/indd
128
369825_9.4_Cam_LSC_SB_129-159.indd Page 129 06/03/23 9:51 AM A4902 /142/HO02737/work/indd
Get started!
Have you ever thought about the different ways in
which we, as users, are able to gain access to the
many digital devices we use in our daily lives?
Discuss the following with your partner:
● How do you gain access to a digital device to be
able to start using it?
● What do you need to do to complete a task using
the device, for example sending a message or an
email to a friend?
● How does the device know what to do when you click on a particular icon or select an
option on screen?
In this unit, you will learn more about the software in digital devices that allows users
to operate and manage the devices appropriately: applications software and systems
software. You will look in more detail at how the processor executes computer
programs in digital devices. You will develop your knowledge of logic gates to help
you to understand how devices use logic gates to store data and how they can be
combined to carry out tasks described by computer programs. You will examine
programs that use machine learning, and you will consider how machine learning
and computerisation have helped to improve the way in which tasks are completed in
various manufacturing scenarios.
KEYWORDS
software: program or set of instructions that tell a often called the central processor or central
computer what to do to complete a task; aspects processing unit
of a device you cannot touch execute: carry out the instructions described in a
applications software: software designed to do a computer program
particular task, e.g. a word processor, spreadsheet, program: instructions that tell a computer system
web browser, mobile-phone app how to complete a task
systems software: software that helps a user run a data: raw facts and figures
computer
machine learning: ability of a computer system to
processor: electronic circuitry that executes the learn over time
instructions described in a computer program;
129
369825_9.4_Cam_LSC_SB_129-159.indd Page 130 06/03/23 9:51 AM A4902 /142/HO02737/work/indd
Learning outcomes
In this unit, you will learn to:
● identify improvements to the design of digital devices based on prototypes
● explain why factors such as user experience, accessibility, ergonomics and emerging
technologies are important to the design of digital devices
● explain which tasks an operating system carries out
● describe examples of utility programs, including drivers, security software and
defragmentation
● explain the different types of translator
● describe the main characteristics of compilers and interpreters
● explain how analogue sound is digitised
● explain how to convert between storage units
● draw logic circuits for Boolean expressions
● explain how computers store lists of instructions to be run one at a time
● explain the fetch–decode–execute cycle
● describe what is meant by machine learning and identify a range of applications and
scenarios where machine learning is used
● explain the benefits and risks of computerising tasks in industry and manufacturing.
Warm up
1 In pairs, think about all the digital
devices you have access to on a daily
basis.
2 Write down the names of some of the
software you use on each device. Most
devices may have more than one piece
of software installed. Beside each piece
of software, write down the task you use
it for.
3 Review your list of software and think
about all the tasks you complete using
the device. Have you included all tasks,
such as logging on to the device, organising files on the device, creating new accounts
on the device?
SCENARIO
A new computing technology company promoting student interest in the computing industry
is delivering a workshop for Stage 9 students to increase understanding of how computing
technology and machine learning are used in industry and home technologies.
Your task is to help the company to prepare for the workshop. You will need to create resources
(a presentation, worksheets, a poster and a prototype design) that can be used to explain the
technologies to students.
130
369825_9.4_Cam_LSC_SB_129-159.indd Page 131 06/03/23 9:51 AM A4902 /142/HO02737/work/indd
The resources you are tasked with developing need to cover the following areas:
l Information about how an operating system carries out tasks
l Examples of utility programs, including drivers, security software and
defragmentation
l Why different types of translators are needed to convert computer programs into a
form the processor can understand
l A description of the main characteristics of compilers and interpreters
l How analogue sound is digitised
l How to convert between storage units used to measure the size of data files
l How to draw logic circuits for Boolean expressions
l How computers store lists of instructions to be run one at a time
l What the fetch–decode–execute cycle does
l The meaning of machine learning and a range of scenarios where machine learning is used
l The benefits and risks of the computerisation of traditional manufacturing and
industrial practices
l How prototypes can be used to identify areas where the design of digital devices can
be improved.
KEYWORDS
prototype: initial product created for testing and interpreter: translates each line of high-level
reviewing, before a final product is released language code into machine code
operating system: software that manages all the analogue: continually varying signal, e.g. a sound
computer hardware and software; it also acts signal
as an interface between computer hardware digitise: convert into digital format, i.e. into 1s and
components and the user, and provides a platform 0s
where applications can run
convert: change from one unit to another, e.g.
device driver: software program that operates a storage units (e.g. bits/bytes/kilobytes)
hardware device connected to a computer
storage units: number of bits used to store a data
security software: any type of software that item in a digital device
secures and protects a digital device
logic circuit: combination of logic gates for solving
defragmentation: reorganising files stored on a a problem in a digital device
hard drive to ensure that all parts of the same file
list: data structure in Python that can store
are located one after the other on the drive
multiple items of data of mixed data types under a
translator: converts program instructions into single identifier; data items can be changed
machine-code format so the processor can carry
traditional manufacturing: the making of products
out the instructions
before computerisation; it often relied on human
compiler: translates an entire computer program production lines, where people completed
into machine code and creates a file containing individual tasks, which were passed along the
machine code for the entire program production line until the final product was
complete
131
369825_9.4_Cam_LSC_SB_129-159.indd Page 132 06/03/23 9:51 AM A4902 /142/HO02737/work/indd
Do you remember?
Before starting this unit, you should be able to:
✔ describe the differences between applications software and systems software
✔ explain that the operating system is an example of systems software
✔ explain the role of utility programs in a computer system
✔ explain that data and programs that are to be reused are stored in secondary storage
devices such as a hard disc drive
✔ explain that ASCII is a set of binary codes that can represent the character set of a
digital device
✔ explain that data such as sound can be represented in digital format
✔ explain the role of logic gates in circuits, including AND, OR and NOT gates
✔ draw the symbols that represent AND, OR and NOT gates in a logic circuit
✔ describe how AND, OR and NOT gates operate
✔ identify text-based programming languages, such as Python
✔ explain what is meant by the term machine learning and identify applications where
machine learning is used.
Understanding software
Learn
Digital devices use a number of different types of software to complete a task. To recap,
the software available on any digital device can be divided into two broad categories:
applications software and systems software; systems software in turn can be broken
down into the operating system and utilities software.
Software
132
369825_9.4_Cam_LSC_SB_129-159.indd Page 133 06/03/23 9:51 AM A4902 /142/HO02737/work/indd
The operating system is a key part of any digital device. Without the operating system,
the user would not be able to interact with the device and other programs could not run
on the device. The operating system has a number of key tasks. It:
● manages the hardware of the device, including the processor
● runs applications
● provides an interface for the user to interact with the device
● manages the storage and retrieval of files.
The operating system cannot guarantee the smooth operation of a digital device on its
own. Utility programs also have an important role to play. Some examples of important
utility programs (sometimes known as tools) include: device drivers, security software
and defragmentation programs.
Device driver
This is a software program that operates a hardware device connected to a computer.
Device drivers are essential for a computer to work properly. Many devices are now
known as plug-and-play devices. This means that the device is automatically detected
and set up correctly for use by the operating system. No human intervention is needed.
Security software
When considering security software, most people
think about the software used to limit access to
digital devices: for example, the use of passwords
or personal identification numbers (PINs). Some
devices even use biometric security methods such
as facial recognition, fingerprint recognition or
voice-pattern recognition.
All these features and all the tasks you carry out using a digital device are possible
only because of the software you have installed on the device.
Disc defragmenter
When you save a file on your digital device, you should give the file a relevant filename.
The operating system uses an algorithm to decide where on the hard drive the file
is to be saved. This can lead to pieces of files being stored in different places on the
hard drive, which is called fragmentation. It means that when you try to open that file,
the operating system has to spend a lot of time locating all the parts of the file and
reassembling them correctly in Random Access Memory (RAM).
133
369825_9.4_Cam_LSC_SB_129-159.indd Page 134 06/03/23 9:51 AM A4902 /142/HO02737/work/indd
You can use the defragmentation utility tool to reorganise the data on the disc so
that all parts of the same file are stored together. The diagram below shows what the
surface of a disc looks like before defragmentation takes place. A file may be stored
in different portions of a hard disc surface. After defragmentation, the disc surface is
reorganised so that all the data relating to a file is stored beside each other on the disc
surface. This makes the data easier to access.
KEYWORDS
applications software: software designed to do a password: code made up of numbers or numbers
particular task, e.g. a word processor, spreadsheet, and letters and other characters (depending on the
web browser, mobile-phone app device), which allows a user access to a digital device
systems software: software that helps a user run a biometric security: security method that identifies
computer people using a physical attribute (e.g. a fingerprint)
operating system: software that manages all the or a behaviour (e.g. a hand gesture)
computer hardware and software; it also acts facial recognition: system that matches a real-time
as an interface between computer hardware image of a human face with a database of saved
components and the user, and provides a platform facial representations to allow a user access to a
where applications can run digital device
utilities software: software that helps maintain the fingerprint recognition: system that matches a real-
smooth functioning of a digital device by helping the time image of a human fingerprint with a database
operating system manage tasks and resources of saved fingerprint representations to allow a user
hardware: physical parts of a computer that you access to a digital device
can touch and see, e.g. the processor, storage voice-pattern recognition: software that can
devices, input devices, output devices understand and carry out spoken instructions
device driver: software program that operates a algorithm: step-by-step instructions to solve a
hardware device connected to a computer particular problem
security software: any type of software that hard disc drive: removable disc in computers for
secures and protects a digital device storing large amounts of data, typically measured
defragmentation: reorganising files stored on a in gigabytes or terabytes
hard drive to ensure that all parts of the same file fragmentation: situation that occurs when pieces
are located one after the other on the drive of files are scattered across the surface of a hard
plug-and-play device: device that is detected disc when the operating system is storing the file
automatically and set up correctly for use by the Random Access Memory (RAM): memory used to
operating system; no human intervention is needed store programs and data currently being used by
personal identification number (PIN): sometimes the processor
called a PIN number or PIN code; a numerical
passcode that allows a user access to a digital device
134
369825_9.4_Cam_LSC_SB_129-159.indd Page 135 06/03/23 9:52 AM A4902 /142/HO02737/work/indd
Practise
Your teacher may provide you with a file called Systems Software Presentation.pptx
to help you complete the following tasks.
1 List three examples of operating systems.
2 List five examples of applications software.
3 Use the internet to research the tasks that the following utility programs carry out.
a Disc management tools
b Compression tools Remember to
c Disc clean-up tools describe the role of
d File-management systems each utility program
e Backup utilities and security
software tool you
4 Research the roles played by the following examples
have researched.
of security software.
a Firewalls c Anti-spyware
b Antivirus d Anti-malware
5 Summarise your findings from tasks 3 and 4 in a short report or presentation.
6 Discuss with your partner the meaning of the term fragmentation and explain the
role of disc-defragmentation programs. Make short notes on the outcome of your
discussion. You may wish to record your notes on a new slide in your copy of the file
Systems Software Presentation.pptx.
Digitising sound
Learn
All programs and data stored inside a digital device are stored in binary format; this
includes the operating system and utility programs. Security programs, such as the
biometric login security applications on digital devices, store details about users’ facial
representations or fingerprints, or even voice patterns, in digital formats. You have
previously considered how images can be digitised, but what about applications that
need to store sound in digital format?
Today, most digital devices accept input from users
via microphones in the form of spoken words.
Sound waves create what is called an analogue
sound wave, such as the one shown on the right.
Computers do not store data in analogue format so the sound wave must be converted
into digital format. Converting analogue signals into digital is carried out by a device
called an analogue-to-digital convertor (ADC).
www.africanews.com
ADC DAC
Sound input into a digital device Before a sound can be output from a digital
must be converted from analogue device, it must be converted from digital
to digital format. This task is carried format back into an analogue signal. This
out by an analogue-to-digital task is carried out by a digital-to-analogue
converter (ADC). converter (DAC).
135
369825_9.4_Cam_LSC_SB_129-159.indd Page 136 06/03/23 9:52 AM A4902 /142/HO02737/work/indd
ADCs take samples of the sound wave at fixed intervals in time; this process is called
sampling. The number of samples taken each second is called the sample rate. The
sample rate is measured in number of times per second, which is known as hertz (Hz). So,
for example, if the sample rate were 1 Hz, this would mean that only one sample was taken
per second. The diagram below shows an analogue sound wave that has been sampled
twenty times in 1 second.
Sample 2 Sample 3
111
110 Analogue input
Binary values
Sample 1
Each sample is represented by binary digits (in this case three) using the values
on the y-axis of the graph (‘Binary values’), for example:
● Sample 1 = 100
● Sample 2 = 101
● Sample 3 = 110
In the example above, 3 bits are used to store each sound sample. The number of bits used
to store each sound sample is called the bit depth. The more samples taken, and the more
bits used to record each sound sample, the better the quality of the digital sound file.
KEYWORDS
analogue: continually varying signal, e.g. a sound hertz (Hz): unit of measurement of how many
signal sound samples are taken in 1 second
analogue-to-digital converter (ADC): converts binary digit: 0 or 1; the smallest unit of binary data
analogue signals, e.g. the human voice, to digital represented on a digital device
signals
bit: short for ‘binary digit’: 0 or 1
sampling: taking samples of a sound wave at fixed
bit depth: the number of bits used to store a single
intervals
sound sample
sample rate: number of sound samples taken each
second
136
369825_9.4_Cam_LSC_SB_129-159.indd Page 137 06/03/23 9:52 AM A4902 /142/HO02737/work/indd
Practise
1 Write a short paragraph explaining how
For example, look at the sample taken at time
analogue sound is converted into digital
0 = 10, the sample taken at time 0.1 = 10 and
format.
the sample taken at time 0.2 = 11. Where
2 Use sampling to convert the sound wave would the red line that represents the binary
below into digital format. The sample rate sound sample be at time 0.3, 0.4, 0.5?
is 10 Hz.
11
10
Binary values
01
00
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Time (seconds)
3 The sample above was recorded using only 2 bits (a bit depth of 2).
a Try sampling the same sound wave using 4 bits (a bit depth of 4).
1101
1100
1011
1010
1001
Binary values
1000
0111
0110
0101
0100
0011
0010
0001
0000
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Time (seconds)
137
369825_9.4_Cam_LSC_SB_129-159.indd Page 138 06/03/23 9:52 AM A4902 /142/HO02737/work/indd
Data storage
Learn
All programs and data stored inside a digital device are stored in binary format; this includes
the operating system, utility programs and even data that is associated with a biometric
security system, for example, the sound pattern represented in the previous ‘Learn’ box.
A single binary digit (1 or 0) stored inside a digital device is known as a bit. In Stage 8,
you learned that special switches called transistors are used to represent each binary
digit inside a digital device. When data is stored inside a computer, the bits used to
represent the data can be grouped together and processed in larger units, shown in the
diagram below.
Byte = 8 bits
Eight bits grouped together is called a
byte, which can be used in computers to
Nibble = 4 bits represent a single character of text: for
example, 01000001 represents the letter
Bit = 1 or 0 (single binary digit) ‘A’ in most computer systems.
When saving a file, it is important to know whether there is enough space in an area of
memory or on the storage device to store the file. To do this, you need to be able to
convert between one storage unit and another.
To help you to complete this task, it is important that you remember the name of each
unit and the order in which the units appear. By multiplying or dividing repeatedly by
1000, it is easy to convert a file size from one unit into another, as shown below.
divide by 1000 divide by 1000 divide by 1000 divide by 1000 divide by 1000
multiply by 1000 multiply by 1000 multiply by 1000 multiply by 1000 multiply by 1000
138
369825_9.4_Cam_LSC_SB_129-159.indd Page 139 06/03/23 9:52 AM A4902 /142/HO02737/work/indd
KEYWORDS
binary digit: 0 or 1; the smallest unit of binary data byte: eight bits of data, e.g. 01010011
represented on a digital device character: single letter, digit or symbol
bit: short for ‘binary digit’: 0 or 1 convert: change from one unit to another, e.g.
transistor: tiny switch activated by electrical storage units (e.g. bits/bytes/kilobytes)
signals – when the transistor is ON it represents 1; storage units: number of bits used to store a data
when the transistor is OFF it represents 0 item in a digital device
process: carrying out an operation on data, e.g. backup: copying files to another location in case
querying a database or doing a calculation using the original is lost or damaged
data in a spreadsheet
Practise
1 Create a rhyme or poem to help you remember the terms associated with units of
storage shown in the diagram above. Use your poem or rhyme to help you learn the
storage units from byte to petabyte in the correct order.
2 Explain to your partner how you can convert a file that is 2 PB
in size into GB.
Think about the
3 Explain to your partner how you can convert a file that is steps you followed
12,000,000 bits into MB. to convert between
4 Calculate in bytes the size of each of the following the storage units
programs. in the ‘Learn’ box.
a A 2-hour movie that is 7 GB. Make sure that you
stop dividing or
b A backup of the contents of the school server, which is
multiplying by 1000
3 petabytes. when you have
5 Convert the following files into the most appropriate arrived at a suitable
storage unit. storage unit.
a A word-processed document that contains 24,300 bytes
of data.
b A multimedia presentation that contains 2500 bytes of data.
139
369825_9.4_Cam_LSC_SB_129-159.indd Page 140 06/03/23 9:52 AM A4902 /142/HO02737/work/indd
The table below shows the difference between program instructions written in an HLL and
an LLL.
Each HLL instruction is often made up from more than one LLL instruction. Before a
programmer can write a program in an LLL, they need to understand what is happening
inside the processor. (You will explore this in detail in the next section.)
Low-level program instructions can be carried out by the processor easily as they
are already in a format the processor understands. However, they are not easy for a
programmer to understand. Programmers sometimes write instructions in a more easily
understood version of machine code, called an assembly language.
140
369825_9.4_Cam_LSC_SB_129-159.indd Page 141 06/03/23 12:58 PM A4902 /142/HO02737/work/indd
The diagram below will help you to understand the link between the CPU hardware,
machine code, assembly language and high-level languages.
141
369825_9.4_Cam_LSC_SB_129-159.indd Page 142 06/03/23 9:52 AM A4902 /142/HO02737/work/indd
KEYWORDS
high-level language (HLL): programming assembly language: set of codes or symbols that
language that uses commands and terms that are represent each instruction, rather than a group of
linked to the words or symbols a human would use 1s and 0s
when carrying out the same task translator: converts program instructions into
Central Processing Unit (CPU): the part of the machine-code format so the processor can carry
computer that carries out program instructions, out the instructions
sometimes known simply as the processor interpreter: translates each line of high-level
instruction set: all the instructions in machine code language code into machine code
that a Central Processing Unit can execute assembler: translates assembly-language
machine code: combination of 1s and 0s that instructions into machine code and creates one
represent each instruction in the instruction set of line of machine code for each assembly-language
a digital device instruction
low-level language (LLL): programming language compiler: translates an entire computer program
that uses commands that are similar to the type of into machine code and creates a file containing
instructions the processor understands machine code for the entire program
data item: piece of information that represents main memory: another name for RAM, which is
part of the data that makes up a person, place or used to store the programs and data the Central
thing, e.g. some of the data items that represent a Processing Unit is currently using
person are their first name and second name platform: hardware and operating system that runs
variable: named memory location that can store a an application
value
Practise
Create a mind map that explains why program translators are needed. Your mind map
should:
● show the key differences between high-level languages and low-level languages
● explain the different types of translators; make sure you list the characteristics of
compilers and interpreters.
142
369825_9.4_Cam_LSC_SB_129-159.indd Page 143 06/03/23 9:52 AM A4902 /142/HO02737/work/indd
Learn
The main role of the Central Processing Unit (CPU) is to run (or execute) a set of stored
instructions known as a computer program. The CPU coordinates all the other parts of the
computer when it is executing a program.
A CPU has three main components, and it uses these components when it is carrying out
(executing) the instructions in a computer program.
Arithmetic logic unit (ALU) – carries out the calculations needed during the execution
of a program.
Control unit (CU) – issues commands to the other hardware components to ensure
that programs are carried out correctly.
Registers – store data about memory locations, instructions and data used during
execution of an instruction. The different registers are:
● Accumulator (ACC) – a register used by the ALU to store the results of the
processing the ALU carries out
● Program counter (PC) – stores the address of the next instruction waiting to be
executed (carried out) by the CPU
● Current instruction register (CIR) – stores the address of the instruction the CPU is
currently executing
● Memory address register (MAR) – holds the address of the memory location being
accessed, either to read data from or write data to
● Memory data register (MDR) – any data or instructions that pass into or out of main
memory must pass through the MDR.
Central processing unit Main memory
143
369825_9.4_Cam_LSC_SB_129-159.indd Page 144 06/03/23 9:52 AM A4902 /142/HO02737/work/indd
Fetch–decode–execute
Computer programs stored in RAM are carried out by the CPU, one instruction at a time.
The CPU operates at an extremely high speed and, when it is executing a computer
program, it is able to carry out many instructions every second. It does this by going
through a set of steps known as the fetch-decode-execute cycle.
The fetch-decode-execute cycle has three stages:
1 Fetch – the CPU fetches an instruction from a Fetch
the next
location in memory. instruction
KEYWORDS
Central Processing Unit (CPU): the part of the current instruction register (CIR): stores the
computer that carries out program instructions, address of the instruction the Central Processing
sometimes known simply as the processor Unit is currently executing
arithmetic logic unit (ALU): carries out the memory address register (MAR): holds the
calculations needed during the execution of a address of the memory location being accessed,
program either to read data from or write data to
control unit (CU): issues commands to the other memory data register (MDR): any data or
hardware components to help ensure programs instructions that pass into or out of main memory
are carried out correctly must pass through the MDR
register: location in main memory that temporarily main memory: another name for RAM, which is
stores data about memory locations, instructions used to store the programs and data the Central
and data used during the execution of an Processing Unit is currently using
instruction fetch: collect an instruction from another location
accumulator (ACC): holds the results of processing decode: work out what an instruction means/what
carried out by the arithmetic logic unit it is telling the Central Processing Unit to do
program counter (PC): stores the address of the execute: carry out the instructions described in a
next instruction waiting to be executed (carried computer program
out) by the Central Processing Unit
Practise
1 Open the file CPU.docx provided by your teacher. Label each of the parts of the CPU
on the diagram. Include a description of the role each part plays in the fetch–decode–
execute cycle.
2 When you have completed the diagram, use the keywords in the diagram to explain how
computers store lists of instructions in main memory and how the processor uses the
fetch–decode–execute cycle to carry out those instructions one line of code at a time.
144
369825_9.4_Cam_LSC_SB_129-159.indd Page 145 06/03/23 9:52 AM A4902 /142/HO02737/work/indd
Main memory
Address Contents The main memory
0 Load the contents of location 10 into the accumulator locations 0, 1 and 2
would contain the machine-
Add the contents of location 11 to the contents of the
1 code instructions needed to
accumulator
carry out the Python instruction
2 Store the contents of the accumulator in location 12 answer = num1 + num2
3
Memory location 10 is used to
4 store the number stored using
5 variable ‘num1’; location 11 is
6
used to store the number stored
using variable ‘num2’; and
7 location 12 will be used to
8 store the answer variable
9 when the program
instruction is
10 (num1) 8
completed.
11 (num2) 2
12 (answer)
145
369825_9.4_Cam_LSC_SB_129-159.indd Page 146 06/03/23 9:52 AM A4902 /142/HO02737/work/indd
Three fetch–decode–execute cycles are now needed for the processor to carry out this
simple task.
● Cycle 1 will fetch, decode and execute the instruction stored in location 0.
● Cycle 2 will fetch, decode and execute the instruction stored in location 1.
● Cycle 3 will fetch, decode and execute the instruction stored in location 2.
KEYWORD
machine code: combination of 1s and 0s that represent each instruction in
the instruction set of a digital device
Practise
1 a Copy and complete the table below to convert the high-level programming
instruction into a description of the set of machine code instructions that the
processor would need to carry out to complete this line of code:
answer = num1 – num2 + num3
Main memory
Address Contents
0 Load the contents of location 12 into the accumulator
1
2
3
4
5
6
7
8
9
10
11
12 (num1) 8
13 (num2) 2
14 (num3) 7
15 (answer)
b Use your machine-code instruction example to show how the processor would need
four fetch–decode–execute cycles to complete this single line of code.
2 Discuss with your partner the steps a processor carries out when completing a
program instruction (the fetch–decode–execute cycle). In your discussion, describe the
registers the processor uses and the role each register plays during the fetch–decode–
execute cycle of the instruction shown in location (memory address 0).
146
369825_9.4_Cam_LSC_SB_129-159.indd Page 147 06/03/23 9:52 AM A4902 /142/HO02737/work/indd
Logic circuits
Learn
All processing inside a digital device is carried out using logic gates and logic circuits.
Most logic gates, for example the AND and OR gates, accept two inputs. The exception
to this rule is the NOT gate, which accepts just one input. Logic gates can be represented
using the following symbols:
Logic gates can be combined to represent conditional statements that have two or
more inputs to consider. Conditional statements use conditional operators. For example,
consider the scenarios in the table below and the algorithms used to describe the
processing required in each scenario.
Operator Meaning
= equal to
You met these > greater than
conditional operators < less than
in Stage 8.
>= greater than or equal to
<= less than or equal to
!= not equal to
A local gym uses the following conditional statement A computer program is helping a student to decide
to decide whether a new member is the correct age to whether the food type they have selected is a healthy
become a junior member of the gym. snack option.
IF age > 12 AND age < 16 then IF food = "apple" OR food = "orange" then
OUTPUT "This young person can become OUTPUT "The food you have selected
a junior member of this gym." is a healthy snack option."
END IF END IF
The conditional statement in this example could be The conditional statement in this example could be
described using the following Boolean expression: described using the following Boolean expression:
X = A AND B X = A OR B
where: where:
X = output statement X = output statement
A = condition 1 (age > 12) A = condition 1 (food = "apple")
B = condition 2 (age < 16) B = condition 2 (food = "orange")
Some problems require more than two inputs to be processed correctly. Consider the
following scenarios.
147
369825_9.4_Cam_LSC_SB_129-159.indd Page 148 06/03/23 9:52 AM A4902 /142/HO02737/work/indd
A trip is being offered to students in school. A student A fun-run event is being organised in school and
can attend if they are Stage 9 OR if they are Stage 8 and students can get involved if they are Stage 8 or 9 AND
special permission has been given. they have brought in their permission forms.
IF (stage = 8 AND permission = TRUE) OR IF (stage = 8 OR stage = 9) AND
stage = 9 permission = TRUE
The conditional statements in this example could be The conditional statement in this example could be
described using the following Boolean expression: described using the following Boolean expression:
X = (A AND B) OR C X = (A OR B) AND C
where: where:
X = output statement X = output statement
A = condition 1 (stage = 8) A = condition 1 (stage = 8)
B = condition 2 (permission = TRUE) B = condition 2 (stage = 9)
C = condition 3 (stage = 9) C = condition 3 (permission = TRUE)
When a digital device needs to consider more than two conditional statements to solve a
problem, logic gates can be combined to create a logic circuit.
Boolean expressions, such as the examples above, can show how the logic circuit will
operate. The Boolean expressions can be used to draw a diagram showing how the logic
gates will combine to solve the problem.
For example, consider the logic circuit needed for the fun-run scenario above:
X = (A OR B) AND C
The following steps will help you to create a logic circuit from a Boolean expression.
1 Identify the label that represents the output from the circuit and show it at the right-
hand side of your diagram.
X
2 You must evaluate first any part of the expression shown inside brackets.
Add the correct logic-gate symbol for the conditional statement and label the inputs
on the left-hand side of your diagram.
A You need an OR to help you
P
with the first condition. You need
B X
to output True if the student is in
The output from this logic gate will be True if the Stage 8 OR Stage 9. You can label
student’s stage = 8 OR 9. the output from this logic gate with
another letter: in this example, P.
3 You can combine the True/False output from the
first logic gate with the third input value to consider.
Add a third input to your diagram to represent condition C: Permission = True.
A P
B X
4 Add an appropriate gate to show how this third conditional statement can be
combined with the output from your first logic gate to make the final decision.
148
369825_9.4_Cam_LSC_SB_129-159.indd Page 149 06/03/23 9:52 AM A4902 /142/HO02737/work/indd
Remember: a student can participate in the fun run if they are Stage 8 or Stage 9
AND they have permission to attend.
A P
Machine
B
learning and
X
computerisation
Remember to show how the output from the first
gate becomes an input to the second gate, along
C with the third input to the circuit.
KEYWORDS
conditional statement: completes a check to see Boolean expression: expression that contains
whether set criteria is either True or False conditional operators; symbols, e.g. >, < and =,
conditional operator: symbol, e.g. >, < and =, used used to carry out comparisons between two values
to carry out comparisons between two values logic circuit: combination of logic gates for solving
a problem in a digital device
Practise
1 Use the steps above to create a logic circuit for the Boolean expression below.
A trip is being offered to students in school. A student can attend if they are Stage 9
OR if they are Stage 8 and special permission has been given.
2 Follow the steps below to write the Boolean expression for this problem.
A student is NOT able to participate in a school sports event if they are absent from
school OR late to the track.
In this case, there are only two inputs. X can be used to represent output from the circuit.
A = absent
B = late to the track
149
369825_9.4_Cam_LSC_SB_129-159.indd Page 150 06/03/23 9:52 AM A4902 /142/HO02737/work/indd
You have learned about machine learning in previous stages. Here’s a recap.
Machine learning is often confused with robotics and artificial intelligence (AI). Machine
learning is important in helping to develop AI devices: think, for example, about how mobile
phones start to understand your patterns of speech and can make recommendations for
keywords in text messages you send. While it is true that some robots use machine learning
to make sure that they work correctly in situations the programmer could not always
anticipate (for example, some robots in industrial settings use sensors and AI to allow them
to work safely in the busy environment around them), not all robots use machine learning.
Machine learning is found on many of the digital applications you use on a daily basis, for
example, internet search engines, email filters, online banking and biometric security systems.
150
369825_9.4_Cam_LSC_SB_129-159.indd Page 151 06/03/23 9:52 AM A4902 /142/HO02737/work/indd
Speech input Many digital assistants allow users to input instructions by speaking in normal sentences.
and language By combining machine learning with AI, the devices are able to follow voice commands and
translation complete tasks correctly. Communicating with other people using unfamiliar languages has
been made easier using apps that automatically translate spoken, written or scanned text
from one language into another.
Self-driving cars Self-driving cars use data collected from sensors and online sources to make decisions.
They use this data to select the most efficient route to take to a destination and to avoid
obstacles on the journey.
Online shopping Online shopping and banking have provided criminals with opportunities to commit crimes
and banking through the creation of fake websites to steal login and bank details. Machine learning
ensures that unusual online activity is quickly detected so that customers can be alerted, and
unauthorised activities can be stopped quickly.
Medicine Machine learning is often used by manufacturers of medicines to predict how an illness will
respond to new medications. When diagnosing illnesses, machine learning can analyse large
amounts of patient data, including images of scans, to make an accurate diagnosis and
create personalised health plans for patients.
Image recognition Used with many digital devices to allow authorised users access to the device, some software
uses facial recognition to allow users to categorise photographs according to content or
faces.
Security Machine learning analyses emails and internet use and can alert authorities quickly to
potential threats.
Route calculations Satellite-navigation systems in cars use data from a range of sources, e.g. sensors in the car
and real-time traffic data. This is used to choose the fastest or most economical route for a
journey.
Product targeting Many online stores and services collect data about users, including websites viewed, TV
shows watched and online shopping purchases made in the past. This data can be used to
make recommendations for future purchases.
Computerisation
The range of applications for machine learning and computing technology is far reaching.
Many traditional manufacturing and industrial practices have also been computerised.
151
369825_9.4_Cam_LSC_SB_129-159.indd Page 152 06/03/23 9:52 AM A4902 /142/HO02737/work/indd
Industry 4.0
As so much manufacturing today requires the use of computers and digital technology, it
is often referred to as the fourth industrial revolution or Industry 4.0.
The table below shows of the pros and cons of Industry 4.0.
Pros Cons
● Improved security and access to data for analysis can ● Many people are still concerned about the security
lead to better surveillance and traffic monitoring and of personal data that is needed to support online
help businesses save money on the transportation of activity
goods ● High reliance on technology leads to problems if the
● Improved communications can reduce travel needs, technology fails
make it easier to conduct business and shop online, ● Many of the staff normally employed in industry and
allowing products to reach a wider market manufacturing may no longer be needed, leading to
● New technologies, e.g. drones, can monitor job losses
traffic and help businesses save money on the ● Staff need to be retrained; this can be stressful for
transportation of goods some who are not confident in the use of technology
152
369825_9.4_Cam_LSC_SB_129-159.indd Page 153 06/03/23 9:52 AM A4902 /142/HO02737/work/indd
Pros Cons
● Increased telecommunications links mean that all ● Many worry about the lack of social and personal
areas are connected digitally, improving social links in interactions, which is important to staff
remote areas; this can help products to be advertised ● Technology is expensive and a lot of investment is
and available to a wider market needed
● Production lines are now more efficient and this can
help organisations to increase their productivity
● Production can easily be amended to respond to
customer need
● Predictive maintenance means problems with
technology are anticipated and responded to quickly
and this helps to limit equipment downtime
● High- and consistent-quality goods are now available
to customers
KEYWORDS
machine learning: ability of a computer system to chatbot: software application that uses text to ask
learn over time questions to help a user
artificial intelligence (AI): ability of a computer industrial revolution: rapid change in how
system to learn and develop its own programming society works following the introduction of new
from the experiences it encounters developments, e.g. machines, computers, robots,
traditional manufacturing: the making of products AI, machine learning
before computerisation; it often relied on human Industry 4.0: refers to how industry is combining
production lines, where people completed electronics with new technologies, e.g. machine
individual tasks, which were passed along the learning, artificial intelligence, robotics and green
production line until the final product was complete energy
radio frequency identification (RFID) tags: cookies: small pieces of data, collected from
technology that uses radio signals to send data to websites and stored as text by web browsers
another device
Practise
1 Write a short paragraph explaining what is meant by the term machine learning.
2 a Use the ‘Learn’ box to describe to your partner three examples where machine
learning is used in today’s society.
b Use the internet to carry out research and find three additional applications or
scenarios where machine learning may be useful to society.
3 Copy and complete the table below to show how machine learning has affected the
scenarios you examined in task 2.
Industry Task How the task How the task is Benefits of Cons of
was completed completed now computerising computerising
previously
Car Assembling Previously Robots now use Design software Fewer staff are
manufacturing parts to carried out using sensors to ensure that can easily be needed so some
make car robots designed movements are precise altered to create jobs are lost
bodies for only one task Robots are also linked custom cars The software and
to computer-aided Cars produced technology needed
design software are high quality is expensive
153
369825_9.4_Cam_LSC_SB_129-159.indd Page 154 06/03/23 9:52 AM A4902 /142/HO02737/work/indd
Improving technology
Learn
The way you do tasks on a day-to-day basis and the way in which tasks are completed
in industry continually change as new devices and programs are developed and
improvements are made to the technologies we use. Consider how mobile phone
technology has changed over time.
As users’ needs change, designers must consider how their digital devices operate, what
they look like and how user friendly they are. When a new technology is being developed,
it is common for the designers to build a prototype of the new product. Prototypes can
be created in a variety of formats: for example, they can be a paper-based design, a
computer-aided design representation, a physical model or a 3D model of the product.
Product designers and even software developers often use the prototype to help
them test the product, and also use it to help make decisions about how they can
improve the product before finalising the design. Sometimes, the developer may allow
potential customers to use the prototype so they can get some feedback on possible
improvements that may be needed.
As designs are reviewed, here are some of the areas that designers might consider.
● User experience: This refers to whether a user is able to use the product easily and
confidently, no matter how familiar they are with technology. For example, if the
product is for young children it should be intuitive.
● Accessibility: This refers to how successfully a new product or piece of software can
be used by anyone. Things to consider include any physical limitations the expected
user might have.
● Ergonomics: This is how a product or piece of software is designed or arranged so the
user can use it efficiently. Examples include computer screens with swivel bases so that
users can adjust the viewing angle, and computer-control devices such as mice and
joysticks that are designed to fit into a user’s hand so that they are comfortable to use.
● Emerging technologies: New technologies can be incorporated into a design to
improve how the product operates.
154
369825_9.4_Cam_LSC_SB_129-159.indd Page 155 06/03/23 9:52 AM A4902 /142/HO02737/work/indd
KEYWORDS
prototype: initial product created for testing and accessibility: how successfully a new product or
reviewing, before a final product is released piece of software can be used by anyone
feedback: comments made to help improve a ergonomics: how a product or piece of software
product is designed or arranged so that it can be used
user experience: how intuitive the product is efficiently
based on the user’s previous experience with emerging technologies: new technologies that can
digital products or applications be incorporated into a design to improve how the
product operates
Practise
1 With your partner, identify an item of technology that you have access to at home or
in school.
a Discuss the device as though it were a prototype design. Identify what you could do
to improve the ‘prototype’ to make the technology easier for another person to use.
b Make a list describing how you can make the device more:
– user friendly
– accessible
– ergonomic.
c Are there any emerging technologies that you would like to include in your design?
2 Present your prototype to a small group of four. In your presentation:
– identify improvements you made to the design based on increasing the product’s
user-friendliness, accessibility and ergonomic appeal to other users
– explain why factors such as user experience, accessibility, ergonomics and
emerging technologies are important.
Go further
Converting between storage units is an important part of
managing memory in digital devices. Remember: use multiply and
Use what you learned in the ‘Data storage’ section to divide by 1000 to convert
work out the minimum amount of storage between data-storage units.
needed to store each of the files below.
155
369825_9.4_Cam_LSC_SB_129-159.indd Page 156 06/03/23 9:52 AM A4902 /142/HO02737/work/indd
● A word-processed document
● The text in the file is represented using 8-bit ASCII
● The text file contains 2500 characters
Challenge yourself
Some complex logic circuits are created when processors A P
carry out complex tasks. Creating Boolean expressions B
from logic circuits is an important part of understanding Z
processing in the CPU.
1 Copy and complete the Boolean expression below to explain C
Q
how the logic circuit shown on the right operates.
Z=( ) AND
2 Truth tables are used to describe the operation of logic gates.
a Do some research about truth tables using the internet.
b Copy the truth table below. Complete it to describe the operation of the complex
logic circuit shown in question 1.
A B C P = A OR B Q = NOT C Z = P AND Q
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
KEYWORD
truth table: breakdown of a logic circuit, listing all possible operations the
logic circuit can carry out
156
369825_9.4_Cam_LSC_SB_129-159.indd Page 157 06/03/23 9:52 AM A4902 /142/HO02737/work/indd
Final project
Look back at the start of this unit to remind yourself of the Scenario. You now have
all the skills and knowledge you need to create the resources that the computing
technology company needs to deliver the workshops.
Compete the tasks below.
Part 1: Presentation
Create a presentation that explains the following.
● Slides 1–2:
Different types of systems software, including the role played by the operating system
and utility programs such as device drivers, security software and disc defragmentation.
● Slides 3–4:
The difference between high-level languages and low-level languages and the need
for language translation.
– Include a description of why different types of translators are needed.
– Describe the key features of a compiler and an interpreter; provide examples of
when each might be used.
● Slides 5–6:
What is meant by the fetch–decode–execute cycle and how it carries out instructions
stored in memory one after another.
– Include the registers used in the fetch–decode–execute cycle and the role they play.
● Slides 7–8:
What is meant by machine learning.
– Research and include examples of applications that use machine learning.
– Include a short description of how at least three manufacturing or industrial
practices use machine learning today.
● Slides 9–10:
The advantages and disadvantages of computerisation.
– Include examples of traditional manufacturing and industry areas that
computerisation has affected.
Part 2: Poster
Create a poster that helps other students understand units of storage, from a single bit
up to and including a petabyte. Include examples of files or applications where each
unit can describe a file or a data item: for example, a bit is used to store a single binary
digit (0 or 1).
Part 3: Worksheets
1 a C reate a worksheet containing five questions that another student can complete
to practise converting data between units of storage.
b Create an answer sheet that allows a class teacher to mark the other student’s work.
2 Create an information worksheet that includes a diagram explaining to another
student how analogue sound is converted to binary format.
– Include in your worksheet the terms ADC, sampling, sample rate and bit depth.
– Include advice on how to increase the quality of a sound sample.
157
369825_9.4_Cam_LSC_SB_129-159.indd Page 158 06/03/23 9:52 AM A4902 /142/HO02737/work/indd
Evaluation
1 Swap presentations with your partner and comment on the following:
– Is your partner’s definition of systems software accurate? Does it include the role
played by the operating system and utility programs such as device drivers, security
software and disc defragmentation?
– Is it clear from your partner’s presentation why language translation is needed?
Have they clearly described the key features of a compiler and an interpreter?
– Has your partner clearly explained the fetch–decode–execute cycle and how it is
used to carry out instructions stored in memory one after another?
– Has your partner clearly explained what is meant by machine learning?
Have they included appropriate examples of how machine learning is used in
manufacturing or industrial practices today?
– Has your partner identified the advantages and disadvantages of computerisation
and included examples of traditional manufacturing and industry areas that
computerisation has affected?
2 Swap posters and discuss the following:
– How clearly does your partner’s poster describe the units of storage from bit to
petabyte?
– How appropriate are your partner’s examples of files or applications for each unit?
3 Ask your partner to complete your worksheets. Use your answer sheet to mark their
work. Comment on any answers you disagreed with and discuss the differences. Make
corrections as necessary.
4 Swap prototype designs. Comment on the following in your partner’s design:
– How user friendly it is
– How accessible it is
– How ergonomic it is.
Suggest how your partner could improve their design.
Improve your design based on your partner’s comments.
158
369825_9.4_Cam_LSC_SB_129-159.indd Page 159 06/03/23 9:52 AM A4902 /142/HO02737/work/indd
159
369825_9.5_Cam_LSC_SB_160-197.indd Page 160 06/03/23 9:53 AM A4902 /142/HO02737/work/indd
Get started!
Many organisations need huge amounts of data to
operate successfully. For example, shops that sell
clothing or music online store details about their
customers, such as usernames and passwords,
delivery addresses and payment details. They collect
the data they use from many different sources, and it
can be in many different formats.
Social-media applications provide users with data in
the form of video, animated graphics, text and images.
They also collect data about users, and this can be
in many different formats. Like other organisations,
social-media companies analyse the data they collect
to learn more about their users. Many social-media
applications collect, for example, data about users’
physical location, other social-media pages they have
visited or even other internet pages they have visited.
Doing this allows the social-media platform to display
advertisements or suggest other pages and content
that might be of interest to the user.
Discuss with your partner:
l What type of data do you think organisations such as social-media providers collect
when they are trying to learn more about their users?
l What do you think they use this data for?
l How do you think the organisation is able to analyse this data?
In this unit, you will learn more about the concept of ‘Big Data’. You will examine the
key features of Big Data and how Big Data is valuable to organisations in a range of
application areas. You will also explore a range of scenarios and examples to help you
to learn more about a variety of the functions in applications such as MS Access and MS
Excel for modelling real-life scenarios. By exploring how a school managing a new online
learning application can use both applications, you will learn how to use the MIN, MAX, IF
and COUNT functions in MS Excel, in addition to learning new skills to develop and use a
complex MS Access database containing more than one table of data.
KEYWORD
social-media application: web-based software that allows users to share
ideas, information and thoughts in an online community
160
369825_9.5_Cam_LSC_SB_160-197.indd Page 161 06/03/23 9:53 AM A4902 /142/HO02737/work/indd
Unit 9.5 Big Data modelling and analysis: Databases and spreadsheets
Learning outcomes
In this unit, you will learn to:
l evaluate the use of models that represent real-life systems
l use functions in spreadsheets to analyse data, such as IF, MIN, MAX, COUNT
l create spreadsheets that model real-life systems
l evaluate the suitability of a spreadsheet for given purposes
l create relational databases with two or more linked tables
l create complex searches for data in databases using two or more criteria
l create complex searches in relational databases
l explain the term Big Data and describe its applications.
Warm up
In the last week, it is highly likely that
you, or family members, have provided
an organisation with some data. It is also
highly likely that an organisation you
interact with has accessed and used data
it has recorded about you.
With your partner, think about
organisations that hold data about you or
your family members.
1 Make a list of the data items you think
each organisation stores about you.
2 What do you think they will use that
data for?
3 What software do you think they might use to help them to analyse that data?
SCENARIO KEYWORDS
You school is introducing a new online learning tool, a virtual learning data: raw facts and
figures
environment (VLE), which teachers will use to make learning resources
data item: piece of
available to students. Teachers will post handouts, homework and information that
assessments on the VLE, sorted by subject page. Students will use an represents part of
app to access the subject pages on the VLE. the data that makes
up a person, place or
The school has collected a lot of data about the potential users of the thing, e.g. some of
VLE, the pages each subject department is creating on the VLE, the the data items that
times and who is accessing each VLE page, and why the pages are represent a person
being accessed: for example, is a teacher accessing the page to update are their first name
and second name
content, or is a student viewing a page to read content?
virtual learning
The school have heard of the term Big Data and wonder whether environment (VLE):
the amount of data they need to enable them to model student and online classroom
where teachers and
teacher use of their new VLE can be categorised as Big Data. They students can share
have asked you to help them to understand what this term means. learning materials
161
369825_9.5_Cam_LSC_SB_160-197.indd Page 162 06/03/23 9:53 AM A4902 /142/HO02737/work/indd
Before starting this unit, you will need to install the following
software on your own personal device (or use a similar database
and spreadsheet software application):
l MS Access l MS Excel
162
369825_9.5_Cam_LSC_SB_160-197.indd Page 163 06/03/23 9:53 AM A4902 /142/HO02737/work/indd
Unit 9.5 Big Data modelling and analysis: Databases and spreadsheets
Big Data
Volume Value Veracity Variety Velocity
163
369825_9.5_Cam_LSC_SB_160-197.indd Page 164 06/03/23 9:53 AM A4902 /142/HO02737/work/indd
The analysis of Big Data sets is known as Big Data analytics. The analysis of Big Data sets
can help organisations to use the data they have collected more efficiently and to identify
new opportunities.
The following table gives some of the applications of Big Data.
KEYWORDS
data type: classification applied to a data item process: carrying out an operation on data, e.g.
specifying which type of data that item represents, querying a database or doing a calculation using
e.g. in a spreadsheet some of the data types data in a spreadsheet
available include currency, text and number Big Data: datasets that are too large or complex
Global Positioning System (GPS): satellite-based for traditional data-processing applications, e.g.
system that keeps track of users’ physical locations databases or spreadsheets, to process
and helps with navigation 5Vs: the terms used to describe the concept of Big
database: application that organises data for Data: volume, velocity, variety, value, veracity
storing, processing and accessing electronically volume: the massive amounts of data collected
spreadsheet: application that uses rows and analysed on an ongoing basis
and columns to organise data and carry out velocity: how quickly data is generated, processed
calculations using that data and turned into useful information
164
369825_9.5_Cam_LSC_SB_160-197.indd Page 165 06/03/23 9:53 AM A4902 /142/HO02737/work/indd
Unit 9.5 Big Data modelling and analysis: Databases and spreadsheets
KEYWORDS
variety: the range of data formats and data types vehicle telematics: information monitored and
collected transmitted from vehicles, e.g. their location and
value: how useful data is to an organisation speed, using GPS, engine diagnostics and driving
style
veracity: accuracy and quality of data
algorithm: step-by-step instructions to solve a
Big Data analytics: the analysis of sets of data
particular problem
known as Big Data
meteorology: study of climate and the weather
Practise
1 Search the internet for more information on how Big Data is used. Write a paragraph
to explain the term Big Data and describe its applications.
2 Select one of the applications of Big Data in the table in the ‘Learn’ box. Copy and
complete the table below to include a list of pros and cons of using Big Data analytics
in the application area you have selected.
Pros of Big Data in [add your application here] Cons of Big Data in [add your application here]
3 With your partner, describe an example of an organisation you are familiar with
that uses Big Data. Tell your partner how the organisation uses Big Data and the
advantages to that organisation of using Big Data.
165
369825_9.5_Cam_LSC_SB_160-197.indd Page 166 06/03/23 9:53 AM A4902 /142/HO02737/work/indd
166
369825_9.5_Cam_LSC_SB_160-197.indd Page 167 06/03/23 9:53 AM A4902 /142/HO02737/work/indd
Unit 9.5 Big Data modelling and analysis: Databases and spreadsheets
continentTBL
The database now consists of two tables, as shown below: countryTBL and continentTBL.
countryTBL can use continentTBL to look up additional details for each country.
countryTBL continentTBL
Size of
Country Country continent Continent
name Capital city population Continent Continent (square miles) population
India New Delhi 1,420,062,022 Asia Asia 17,139,445 4,436,224,000
Brazil Brasilia 209,737,513 South Africa 11,677,239 1,216,130,000
America
Nigeria Abuja 200,962,417 Africa Australasia 2,697,909 34,601,860
Philippines Manila 108,106,310 Asia Europe 3,997,929 738,849,000
Vietnam Hanoi 97,429,061 Asia North America 9,361,791 579,024,000
Germany Berlin 82,438,639 Europe South America 6,880,706 442,535,000
France Paris 67,480,710 Europe
UK London 66,959,016 Europe
Canada Ottawa 37,279,636 North
America
Saudi Arabia Riyadh 34,140,662 Asia Notice that the attribute
Peru Lima 32,933,835 South ‘Continent’ appears in both tables.
America The ‘Continent’ field provides
a link between countryTBL and
Australia Canberra 25,088,636 Australasia
continentTBL.
Taiwan Taipei 23,758,247 Asia
When a continent name appears
in countryTBL, the database will
In this example, ‘Continent’ is the primary access continentTBL to look up the
key for continentTBL but it also appears in remaining information.
countryTBL to create a link between the two ‘Country name’ is unique for each
tables. When the primary key from one table record in countryTBL so it can be used
appears in another table to create a link, it is as the primary key in countryTBL.
known as a foreign key. ‘Continent’ is a foreign ‘Continent’ can
key in countryTBL. be used as the primary key in
continentTBL.
167
369825_9.5_Cam_LSC_SB_160-197.indd Page 168 06/03/23 9:53 AM A4902 /142/HO02737/work/indd
KEYWORDS
table: set of facts or figures that are set out in a column and row structure
flat-file database: database that stores all data items using one table
data redundancy: when data is unnecessarily repeated in a database
data-entry error: error that occurs when data is being entered into a
database
relational database: database that stores data using two or more linked tables
entity: person, place or object represented in a table in a relational database
attribute: heading for organising data in a relational database
primary key: field in a database table that provides a unique identifier for a
record/entity
foreign key: when the primary key from one table appears in another table
to establish a link between two entities
Practise
1 The flat-file database below stores data about students’ scores in examinations they
have taken at school this year.
Add your table name here Add your table name here
List the table attributes here List the table attributes here
168
369825_9.5_Cam_LSC_SB_160-197.indd Page 169 06/03/23 9:53 AM A4902 /142/HO02737/work/indd
Unit 9.5 Big Data modelling and analysis: Databases and spreadsheets
4 Copy and complete the following to show the attributes needed for each table to
convert this flat-file database into a relational-database model.
Remember to * the primary keys in each table.
169
369825_9.5_Cam_LSC_SB_160-197.indd Page 170 06/03/23 9:53 AM A4902 /142/HO02737/work/indd
170
369825_9.5_Cam_LSC_SB_160-197.indd Page 171 06/03/23 9:53 AM A4902 /142/HO02737/work/indd
Unit 9.5 Big Data modelling and analysis: Databases and spreadsheets
Practise
Part 1
1 In Stage 8, you used data dictionaries to design suitable data tables for database models.
The following data dictionary describes the tables used to create the library-book loan
database in the ‘Learn’ box. Remember how the data dictionary includes details about
validation methods, and how input masks help to reduce the chance of a user making
an error when adding data to the database table. In the example below, you do not need
to consider validation or input masks as they are not included in the data dictionary.
studentTBL
Field name Data type Field length
*studentID Number –
studentName Short text 20
Class Short text 3
loanTBL
Field name Data type Field length
*loanID Short text 2
dateOut Date/Time –
dateBack Date/Time –
studentID Number –
bookID Short text 6
overdue? Yes/No
bookTBL
Field name Data type Field length
*bookID Short text 6
bookTitle Short text 30 The * shows the
primary keys in each
bookAuthor Short text 25
of the three tables.
a Open MS Access.
b Create a database by clicking once on Blank database, giving the database the name
libraryDB and clicking Create. A blank table will appear on screen as shown below.
View the table in Design View.
171
369825_9.5_Cam_LSC_SB_160-197.indd Page 172 06/03/23 9:53 AM A4902 /142/HO02737/work/indd
c Name the table studentTBL and use the data dictionary on the previous page to
add the appropriate fields and data types to the table design.
d Close the table and save your changes.
2 a Click on the Create tab and select Table.
b View the table in Design View. You will be asked to give the table a name. Call the
table loanTBL.
c Add the fields and data types shown in the data dictionary for loanTBL.
d Close the table and save your changes.
3 Use the data dictionary and repeat the steps in task 2 to create the final table, called
bookTBL.
Part 2
1 Now that there are three tables for the loanDB database, you can create the
relationships between the tables. The following entity relationship diagram will help
you with this task as it shows you the types of relationships needed between the
student and loan table (one-to-many) and the book and loan table (one-to-many).
KEYWORDS
data dictionary: table that represents the validation: automatic checks applied to individual
structure of a database table at the design stage of fields in a database table to help reduce the chance
developing a database; often contains details, e.g. of error when adding data to the table
data type, field length and details about validation input mask: control added to a field in a database
checks applied to data items table to control the format of data being added
172
369825_9.5_Cam_LSC_SB_160-197.indd Page 173 06/03/23 9:53 AM A4902 /142/HO02737/work/indd
Unit 9.5 Big Data modelling and analysis: Databases and spreadsheets
b Add all three tables to the Relationships window and arrange them as shown.
c Click and drag from studentID on the studentTBL to studentID on the loanTBL to
let MS Access know that you would like to create a link between the two fields. You
will be asked to edit the relationship between the two tables. Select the following
options.
173
369825_9.5_Cam_LSC_SB_160-197.indd Page 174 06/03/23 9:53 AM A4902 /142/HO02737/work/indd
Clicking on Enforce
Referential Integrity ensures
that a foreign key cannot be
added to a table if it does not
already exist in another table as
a key field. In this case, it would
stop a loan being added for a
student who did not exist in
studentTBL.
174
369825_9.5_Cam_LSC_SB_160-197.indd Page 175 06/03/23 9:53 AM A4902 /142/HO02737/work/indd
Unit 9.5 Big Data modelling and analysis: Databases and spreadsheets
2 Open each table in turn and add the appropriate data, shown below, to each table in
the database.
studentTBL bookTBL
loanTBL
loanID dateOut dateBack studentID bookID overdue?
L1 21 Jan 30 Jan 1001 B9865 True
L2 22 Jan 31 Jan 1002 B8856 True
L3 22 Jan 31 Jan 1003 B7787 True
L4 1 Feb 10 Feb 1001 B5654 False
L5 3 Feb 13 Feb 1002 B7231 False
L6 12 Feb 22 Feb 1001 B5541 False
L7 12 Feb 22 Feb 1001 B6632 False
3 a Open studentTBL to check that your relationship has been created correctly.
Notice the + sign to the left of each record in the table.
175
369825_9.5_Cam_LSC_SB_160-197.indd Page 176 06/03/23 9:53 AM A4902 /142/HO02737/work/indd
KEYWORDS
query: tool that allows users to search for data that report: feature in MS Access for displaying data in
meets specific rules or criteria a user-friendly format
search criterion: data item used for comparison parameter query: query where the end user
when carrying out a search provides the search criteria
criteria: set of rules that must be met wildcard query: query where special characters
simple query: where only a single search criterion are used to stand in for unknown characters (this
is used to select data items from a database is useful when trying to find lots of data items that
are similar but not exactly the same)
complex query: where more than one criterion can
be used to search a database, or a query can be multi-table query: query that uses data from more
used to combine data from more than one table, or than one data table
calculations can be performed using the data in a multiple-criteria query: query that uses more than
query one criterion to select data items from a database
176
369825_9.5_Cam_LSC_SB_160-197.indd Page 177 06/03/23 9:53 AM A4902 /142/HO02737/work/indd
Unit 9.5 Big Data modelling and analysis: Databases and spreadsheets
Practise
Parameter queries
1 Parameter queries allow the user to enter their own data items when searching for a
data item: for example, a librarian may wish to search for a book with a specific title.
a Open LibraryDB2.accdb provided by your teacher.
b Click on the Create tab and click on Query Design.
177
369825_9.5_Cam_LSC_SB_160-197.indd Page 178 06/03/23 9:53 AM A4902 /142/HO02737/work/indd
e Add [Please enter book title] to the Criteria row, underneath the bookTitle field.
2 a Click the Run icon in the Design tab. The following should appear.
b Enter the book title Big Data and click OK. The details regarding this book should
now be displayed.
c Close the query and save it as bookTitleQRY.
Wildcard queries It is good practice to
1 Parameter queries are ideal when the user knows include the letters QRY at
exactly what they are searching for. However, the end of the name of a new
sometimes the user may know only part of the query as it helps to distinguish
it from other objects in
search criteria, and this is when you can use
the database.
wildcard queries.
a Open LibraryDB2.accdb. Click on the Create
tab and click on Query Design.
b In the Show Table window that appears, double-click on bookTBL and then close
the Show Table window.
c Double-click on each field in bookTBL so that they appear in the query field list at
the bottom of the window.
d Add *data* to the Criteria row in the bookTitle field. Using * before and after
e Press the enter key on your keyboard. The criteria will the word ‘data’ means
now be automatically updated to read as follows: that the query will return
any record that has the
combination of letters
‘data’ somewhere in
the data stored in the
bookTitle field.
178
369825_9.5_Cam_LSC_SB_160-197.indd Page 179 06/03/23 9:53 AM A4902 /142/HO02737/work/indd
Unit 9.5 Big Data modelling and analysis: Databases and spreadsheets
2 a Click the Run icon to test the query. The following data items should be displayed.
179
369825_9.5_Cam_LSC_SB_160-197.indd Page 180 06/03/23 9:53 AM A4902 /142/HO02737/work/indd
d Click the Run icon to test the query. The following data items should be displayed.
2 a You can narrow down this search further by adding [Enter StudentID] to the
criteria for StudentID.
b Click on the Run icon to test the query and enter a studentID such as 1002 when
prompted. Close the query and save it as loansByStudentIDQRY.
Multiple-criteria queries
1 Multiple-criteria queries search records using two or more You have now
data items as search criteria. The search criteria can be combined a multi-
provided by the user as parameters or can be added into table query with a
the query design under the criteria heading. parameter query.
For example, a librarian may want to search for all the
books loaned out to a particular student, which are also
overdue.
a Open LibraryDB2.accdb. Click on the Create tab and click on Query Design.
b In the Show Table window that appears, double-click on studentTBL, loanTBL and
bookTBL and then close the Show Table window.
c This time, double-click on each of the fields in all three tables to include them in the
query.
d Add the following criteria to the query design.
180
369825_9.5_Cam_LSC_SB_160-197.indd Page 181 06/03/23 9:53 AM A4902 /142/HO02737/work/indd
Unit 9.5 Big Data modelling and analysis: Databases and spreadsheets
e Notice how some data items appear twice in this query. You can stop data items
from displaying when you run a query by unticking Show. Remove the tick from
underneath the overdue? field.
2 a Click on the Run icon to test your query. Enter the studentID 1001 when prompted.
The following results should appear.
181
369825_9.5_Cam_LSC_SB_160-197.indd Page 182 06/03/23 9:53 AM A4902 /142/HO02737/work/indd
you can predict what would happen if you made certain changes. Spreadsheets can be
used to collect and store large amounts of data in rows and columns.
Spreadsheet software can be used to make decisions in real life. The spreadsheet can be
used to create a model of a real-life event and the relationships between different factors
in that event. For example, when creating a spreadsheet model to represent the costings
associated with organising a birthday party, there is a link between the overall cost of the
party and the number of people invited: as the number of people attending increases,
so too does the cost of the party. By changing data or a formula in the spreadsheet, it
is possible to see how certain data items in the model affect other data items and the
output. Spreadsheets contain a wide range of tools and special functions that can be used
to explore the links between data items.
Some of the MS Excel functions you will already be familiar with include SUM and AVERAGE.
For example, the Geography department in school created the model below to record
temperature and rainfall in a location over a period of one week. They used formulae to
calculate the average temperature and rainfall over seven days and the total rainfall in that
period of time.
=SUM (C2:C8)
=AVERAGE(B2:B8)
Additional functions can be used to help with the analysis of data in a spreadsheet model.
These include the following.
182
369825_9.5_Cam_LSC_SB_160-197.indd Page 183 06/03/23 9:53 AM A4902 /142/HO02737/work/indd
Unit 9.5 Big Data modelling and analysis: Databases and spreadsheets
KEYWORDS
function: sub-program that can exist as part of a IF statement: in Python, this evaluates a condition
bigger program which determines the path of the program
MIN function: returns the lowest value in a depending on whether the condition is true or false
specified range of cells in a spreadsheet COUNT function: checks all the cells in a specified
MAX function: returns the highest value in a range in a spreadsheet and outputs how many
specified range of cells in a spreadsheet contain a numeric value
Practise
1 Expand the Geography department’s
weather model. This model contains
the rainfall, temperature readings
and estimated percentage ( % ) cloud
coverage over a period of 28 days. Edit
the formulae to calculate the highest
temperature and rainfall level in a 28-day
period by following these steps using the
functions described in the ‘Learn’ box.
a Open the file Weather.xlsx provided by
your teacher.
b Edit the model to add the additional
label ‘Highest’ in cell A30.
– Add the formula =MAX(B1:B29) to
cell B30.
– Press enter to display the highest
temperature recorded in the 28-day
period.
c Copy the formula you created in part b
into cell C30 so that you can now also
calculate the highest rainfall level in the
28-day period.
2 With your partner, work out how you
can use the MIN function in cells B31 and
C31 to calculate the lowest temperature
and lowest rainfall in the 28-day period
in the Weather.xlsx model. Add the
label ‘Lowest’ to cell A31 to ensure that anyone viewing the
spreadsheet data can easily understand what the new data On days that there
items represent. were no clouds in
3 In Stage 8, you were introduced to the AVERAGE spreadsheet the sky, the teacher
function. Edit the formula to calculate the average temperature in recorded ‘No Clouds’
a 28-day period using the AVERAGE function. in column D.
– Add the label ‘Average Temperature’ to cell A32 and then use
a formula in cell B32 to calculate the average temperature in the 28-day period.
– Display the average temperature to 2 decimal places.
183
369825_9.5_Cam_LSC_SB_160-197.indd Page 184 06/03/23 9:53 AM A4902 /142/HO02737/work/indd
184
369825_9.5_Cam_LSC_SB_160-197.indd Page 185 06/03/23 9:53 AM A4902 /142/HO02737/work/indd
Unit 9.5 Big Data modelling and analysis: Databases and spreadsheets
Start End
185
369825_9.5_Cam_LSC_SB_160-197.indd Page 186 06/03/23 9:53 AM A4902 /142/HO02737/work/indd
When developers are asked to create a new solution to a problem, they are often
presented with a set of user requirements. User requirements are a list of the things that
the new digital solution is meant to include. They can involve comments on the colour
scheme for a new webpage, a list of queries that a database is expected to produce or a
list of questions that need to be answered by a spreadsheet model.
Evaluation can take place at different stages in the development of a digital solution, and
how the evaluation is carried out often depends on the type of solution being developed
for a problem: for example, a database solution would be evaluated in a different way
from a spreadsheet solution to a problem. When evaluating a database solution, it is
important to ensure that queries used to extract data can successfully provide the
user with the data they require from the database model of a real-life scenario. When
evaluating a spreadsheet model of a real-life scenario, it is not only important to ensure
that the spreadsheet is a suitable model for the real-life scenario, for example, by ensuring
that it includes all the required data items, but it is also important to ensure that the
results produced by formulae in the spreadsheet model are accurate.
The following table gives some of the key points to consider when evaluating database
and spreadsheet models.
Evaluating solutions
Does the solution meet all the user requirements?
Evaluating the suitability of a database model Evaluating the suitability of a spreadsheet model
✔ Does it include all the queries needed to answer the ✔ Does the spreadsheet include all the factors linked to
user’s questions? the scenario it is modelling?
✔ Do the queries produce the correct results? ✔ Are the factors all displayed in the correct data
✔ Does the model include all the important factors format?
linked to the scenario it is modelling? ✔ Are the correct factors in the model linked by
✔ Are all the data items in the model displayed using formulae?
the correct data type? (This will ensure that the ✔ Do the formulae output the correct results?
data is presented to the user in the correct format ✔ Can you make any improvements to the data model?
and that it can be processed correctly.)
✔ Can you make any improvements to the data model?
✔ Are there any easier ways of allowing the user to
query the database (e.g. instead of creating a query
for every title in the book database in a library,
could you use a parameter query instead)?
KEYWORDS
evaluation: checking the suitability of a solution to a problem
efficient: the efficiency of a program can be measured by how quickly it
runs
user requirements: tasks a user expects of an application
data type: classification applied to a data item specifying which type of data
that item represents, e.g. in a spreadsheet some of the data types available
include currency, text and number
186
369825_9.5_Cam_LSC_SB_160-197.indd Page 187 06/03/23 9:53 AM A4902 /142/HO02737/work/indd
Unit 9.5 Big Data modelling and analysis: Databases and spreadsheets
Practise
Evaluating a database model
In this task, you will evaluate the suitability of pre-existing database and spreadsheet
models of two real-life scenarios to ensure that they accurately represent the real-life
systems. As part of your evaluation, you will determine whether the models are suitable
for purpose in each instance.
1 Open the file LibraryDB2Evaluate.accdb provided by your teacher. It should cover the
following user requirements.
The database is to be used by the school librarian to help them to keep track of books
on loan to students at any given time. They have said that the database model should:
l store details about members of the library (students), so that they can be
contacted if their books are overdue
l work out how many days a book is overdue
l allow users to create a list of all the books borrowed by a student
l allow users to search for books by book title
l allow users to search for books by author name.
With your partner, evaluate the database against the user requirements above.
Check the following:
– That the database meets each of the user requirements. (Do the queries produce
the correct results?)
– Whether the queries work in the most efficient manner. (Can you think of a better
way of searching for the data?)
– Whether the database structure is correct: for example, are the correct data types
assigned to all fields, and are the field lengths appropriate?
2 As you evaluate the database, make a list of any of the requirements it does not meet,
and any improvements you would make to the design.
Evaluating a spreadsheet model
The Geography department have developed a spreadsheet model that shows the level of
traffic on a local road.
1 Open the file Traffic Evaluate.xlsx. It should cover the following user requirements...
187
369825_9.5_Cam_LSC_SB_160-197.indd Page 188 06/03/23 9:53 AM A4902 /142/HO02737/work/indd
2 With your partner, evaluate the spreadsheet against the user requirements.
As you evaluate the spreadsheet model, check the following:
– Does the model contain all the factors needed to generate a full picture of the scenario?
– Does the model meet each of the user requirements? (As you evaluate the
spreadsheet, make a list of any of the requirements it does not meet.)
– Do the formulae produce the correct results? (Correct any formula you find to be
incorrect in the model and re-save your copy of Traffic Evaluate.xlsx).
– Is the data formatted in the correct manner?
3 Correct any formula you find to be incorrect in the model.
4 Remember to save your updated spreadsheet at the end of the task.
Go further
Databases
Database queries can be used to generate additional data items: for example, a librarian
can compare today’s date with the dateBack date in the libraryDB to work out how many
days a library book is overdue.
1 Open LibraryDBGF.accdb provided by your teacher. Create a new query containing
the following data items and criteria.
Note how the criteria for overdue? has been set to True. You use
the criteria True as you want only to display those records where
the book is overdue.
188
369825_9.5_Cam_LSC_SB_160-197.indd Page 189 06/03/23 9:53 AM A4902 /142/HO02737/work/indd
Unit 9.5 Big Data modelling and analysis: Databases and spreadsheets
The instruction you are adding to the field row has three main parts.
DaysOverDue: This is the name of the new field you are creating as part of this query
Date() This is a special function that will insert today’s date into the equation
-[dateBack] This is an instruction that tells the query to subtract the value stored in
the dateBack field in the database from today’s date
189
369825_9.5_Cam_LSC_SB_160-197.indd Page 190 06/03/23 9:53 AM A4902 /142/HO02737/work/indd
You can use "" to indicate that you do not want to display anything.
=IF(OR(D2>=20,C2>2),"Umbrella needed","")
3 Press enter to test your formula. The words ‘Umbrella needed’ should appear in cell E2.
4 Replicate this formula to the rest of the cells in column E.
5 The Geography teacher realises that they have made a mistake with the formula and
that the words ‘Umbrella needed’ should be displayed only if the cloud cover is >=20
AND rainfall is >=2. Amend the formula in column E to reflect this change.
6 Save your updated version of the spreadsheet as Weather GF.xlsx.
Challenge yourself
Databases
Most relational database applications, such as MS Access, use
a special programming language called Structured Query
Language (SQL) to access the data stored in data tables. The
method you have used to create queries up until now is known
as Query by Example (QBE).
In exceptionally large databases, queries created using SQL
are processed more rapidly than those created using the
QBE method. This could be particularly important when the
library database becomes larger in size and the librarian is,
for example, answering queries on book availability at a time
when the library is very busy.
Create a query to search bookTBL for all the books written by
P Author.
1 Open LibraryDBCY.accdb provided by your teacher.
2 Click Create and then Query Design.
3 Close the Show Table dialogue box that appears on screen. Click View and then select
SQL view.
4 Add the following statement to the SQL query window.
SELECT [bookID], [bookTitle], [bookAuthor]
FROM bookTBL
WHERE [bookAuthor] = "P Author";
190
369825_9.5_Cam_LSC_SB_160-197.indd Page 191 06/03/23 9:53 AM A4902 /142/HO02737/work/indd
Unit 9.5 Big Data modelling and analysis: Databases and spreadsheets
3 Add a similar COUNTIF formula to cell H4 to count the number of days when cloud cover
was >15, and to cell H5 to count the number of days there were no clouds in the sky.
When you press enter, the following values should appear:
– Cell H4 = 9
– Cell H5 = 12
4 Resave your updated spreadsheet.
191
369825_9.5_Cam_LSC_SB_160-197.indd Page 192 06/03/23 9:53 AM A4902 /142/HO02737/work/indd
KEYWORDS
Structured Query Language (SQL): specialised language for accessing data
in relational databases
Query by Example (QBE): interface that allows users to select fields and
criteria for use in a query in a database application
Final project
Look back to the start of this unit to remind yourself of the Scenario. You now have
all the skills and knowledge you need to create a spreadsheet and database model
that can help the school to create and evaluate models that represent students’ and
teachers’ use of the new VLE.
Compete the tasks below.
Part 1: Big Data
After hearing about the term Big Data, the school are worried that the data generated
by the new VLE will be too complex to be analysed.
1 Produce a report that explains what is meant by the term Big Data.
2 In your report, explain what is meant by Big Data in terms of the 5Vs; also provide
examples to illustrate how Big Data is used in some real-life applications.
3 At the end of the report, comment on whether the VLE data can be considered an
example of Big Data; also explain why you think this is the case.
Part 2: The database
The school have asked you to help them create a relational database that will keep
track of information such as:
l a list of all the pages accessed using any of the following devices: PC, laptop,
mobile phone, tablet
l a list of all student logins and passwords
l a list of all teacher logins and passwords
l a list of all teachers and the subjects they teach
l a list of all user logins and the times they have accessed any page from a
selected subject
l a list of all the pages accessed by a teacher for updating; the list should include
information about when and on what type of device the page was accessed.
Your teacher will provide the file FinalProject.accdb for these tasks. The file contains
three tables and some of the data used to create a real-life model of teacher and
student use and access of the VLE. The tables contain:
l a list of users and details about the users
l a list of pages and information about the pages
l a list of times each page is accessed and information about who accessed the page
and why they accessed it.
192
369825_9.5_Cam_LSC_SB_160-197.indd Page 193 06/03/23 9:53 AM A4902 /142/HO02737/work/indd
Unit 9.5 Big Data modelling and analysis: Databases and spreadsheets
193
369825_9.5_Cam_LSC_SB_160-197.indd Page 194 06/03/23 9:53 AM A4902 /142/HO02737/work/indd
– Are there any improvements to be made to the designs of any of the queries
completed in Part 3?
– Review each of your queries in design view and look for any data items that are
not needed according to the query description provided in the task.
– Are there any queries that could be reused if a parameter query were used
instead of providing the data in the query design?
b Make the appropriate changes to your query design and save your updated
version of FinalProject.accdb.
Comment on the changes you have made in your report.
In your report, suggest three more possible queries that could be created using
the data available in the current model. List the field headings and the criteria
needed in each query.
Part 3: The spreadsheet
Your teacher will provide the file FinalProject.xlsx for these tasks. This spreadsheet
contains two worksheets:
l The first is a copy of some of the data exported from FinalProject.accdb and relates
to teacher and student access to the VLE pages (AccessData tab).
l The second is to help the school understand how some of the VLE pages are being
used by teachers and students (Dept Summary Spreadsheet tab).
1 a Examine the Dept Summary Spreadsheet tab in FinalProject.xlsx. Comment on
how effective this model is in helping the school model the VLE access so that
they can answer the following questions:
– What is the most popular time of day for students to access a VLE page?
– How long, on average, do teachers spend updating the VLE pages?
– What is the longest period of time spent on a Drama VLE page?
– How many minutes in total were spent on a Drama VLE page?
– How many times were the Computing VLE pages accessed in total?
– What is the average length of time spent on the Computing VLE pages?
– How many hours in total were spent on the Computing and Drama VLE pages?
– What was the shortest length of time spent on the Computing and Drama VLE
pages?
b Write a short report that comments on the effectiveness of the model in
addressing each of these questions. Comment on:
– any changes you think need to be made to formulae
– any additional formulae that need to be added
– any additional data items needed to answer the questions.
c Make any necessary changes to the spreadsheet formulae to ensure that the data
output is correct.
2 a Create a new sheet in FinalProject.xlsx. Do this by clicking on the + sign at the
bottom of the existing worksheet in your spreadsheet. Double-click on the new
tab and rename it ‘Teacher Student Access Summary’.
194
369825_9.5_Cam_LSC_SB_160-197.indd Page 195 06/03/23 9:53 AM A4902 /142/HO02737/work/indd
Unit 9.5 Big Data modelling and analysis: Databases and spreadsheets
b Copy and paste the data from the Access Data tab into Teacher Student Access
Summary.
c Sort the data in the spreadsheet so that it is displayed in order of userType.
i Click on the first label in the spreadsheet.
ii Select the Data tab and click on Sort.
iii Select Sort by userType and click on OK.
3 Add appropriate formulae to your spreadsheet to allow the school to extract the
following data from your model:
– The average number of minutes spent on the VLE by students
– The average number of minutes spent on the VLE by teachers
– The number of minutes spent accessing the VLE in total by both students and
teachers
– The total number of times the VLE was accessed by students
– The total number of times the VLE was accessed by teachers
– The longest period of time spent on any VLE page by a student
– The longest period of time spent on any VLE page by a teacher
– The longest period of time spent on any VLE page by either a student or a teacher
– The shortest period of time spent accessing a VLE page by either a student or a
teacher
– An output message that states ‘High Level of Use’ if the total time spent accessing
the VLE is over 200 minutes, or outputs the message ‘We need to encourage more
use’ if total access time is 200 minutes or less.
4 Save your updated version of FinalProject.xlsx.
195
369825_9.5_Cam_LSC_SB_160-197.indd Page 196 06/03/23 9:53 AM A4902 /142/HO02737/work/indd
Evaluation
Part 1: Big Data
1 Swap reports with your partner. Check that your partner has:
a correctly explained what the term Big Data means
b described Big Data correctly in terms of the 5Vs
c provided examples of how Big Data is used in a number of real-life applications
d commented on whether the data used by the school in developing real-life models
of their VLE scenario would be an example of Big Data.
2 Make changes to your report following your partner’s feedback.
l A list containing the pageTitle, subjectName, pageType and dates and times
when any History pages were accessed; saved as query1.
l A list containing the pageTitle, subjectName, pageType and dates and times
when any History pages were accessed on a laptop; saved as query2.
l A list containing the userLogin, userType, pageTitle and subject of any Stage 7
pages that have been updated; saved as query3.
l A list of all the data from pageAccessTable that shows when teacher3 accessed
the VLE to update pages; saved as query4.
l A parameter query that allows the school to search for the date, time and page
title of the pages accessed by a userLogin; saved as query5.
l A list of all the pages accessed by students in each stage in school.
l A list of times when teachers have accessed a markbook page on the VLE.
l A list of all the times when students have accessed a multimedia tutorial page on
the VLE.
196
369825_9.5_Cam_LSC_SB_160-197.indd Page 197 06/03/23 9:53 AM A4902 /142/HO02737/work/indd
Unit 9.5 Big Data modelling and analysis: Databases and spreadsheets
197
369825_9.6_Cam_LSC_SB_198-235.indd Page 198 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
Unit
9.6 An array of skills
Get started!
Consider a very simple game that requires you to navigate a player from one place to
another to collect an item. In the example below, the smiley face needs to move from its
current position to collect the apple.
The smiley face can understand only the commands:
198
369825_9.6_Cam_LSC_SB_198-235.indd Page 199 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
Learning outcomes
In this unit, you will learn to:
l identify and explain the purpose of a one-dimensional array
l develop a Python program with count-controlled loops
l access data from an array using Python
l develop Python programs using string manipulation, including length, uppercase and
lowercase
l use iterative development on Python prototypes to create solutions to problems
l develop and apply test plans using test data that is normal, extreme and invalid
l identify and describe a range of errors, including syntax, logic and runtime errors
l use a trace table to debug a Python program
l follow, understand, edit and correct algorithms that are presented as pseudocode
l use a sub-routine in flowcharts or pseudocode
l explain and use iteration statements with count-controlled loops in either pseudocode
or flowcharts
l predict the outcome of algorithms that use iteration.
Warm up
In pairs, consider the following list of numbers:
7, 19, 3, 11, 20, 65, 2, 34, 41, 14
How would you find out whether the number 34 is in this list? Think about the following
questions:
l Which number would you check first?
l What would you do if the first number that you check is not the number you are
looking for?
Now consider the same set of numbers, but ordered from smallest to largest:
2, 3, 7, 11, 14, 19, 20, 34, 41, 65
How would you find out whether the number 41 is in this list?
l Would you use the same method as you used for the list above?
l Can you think of another way to check for the number?
To complete these tasks, you have used data that is stored in a list. In this unit, you will
learn how to search through lists to retrieve data to use in your programs.
199
369825_9.6_Cam_LSC_SB_198-235.indd Page 200 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
SCENARIO
A local primary school has asked you to develop a game that can be used to teach younger students
their times tables. They want the program to be an adventure-style game that asks the students
questions based on a scenario to help their problem-solving skills. The game should follow these criteria:
l When the game starts, the player will need to log in using their name, and input their age as
they must be between 7 and 10 years old to play the game.
l They will then pick the character they want to play as and choose the times table that they
want to practise.
l The game will need to ask the player five multiplication questions that are phrased as
sentences. For example, instead of 2 × 5 it would ask questions such as ‘In the cave you see 2
chests each containing 5 coins. How many coins do you have?’
l The player will get two attempts to answer each question. If they get it right first time, they
will receive 2 points. If they get it right second time, they will receive 1 point. Otherwise, they
will receive 0 points.
l After the five questions have been asked, users will be given a score to indicate how well they
have done, including how many correct answers they got and how many they got right at the
first attempt.
As you work through this unit, you will be given flowchart and pseudocode algorithms and
examples of Python code to enable you to complete the tasks. You will also create new code, edit
code, design solutions using algorithms and test the program to make sure that it works correctly.
Do you remember?
Before starting this unit, you should be able to:
✔ identify and describe different data types that are used in Python
✔ predict and test the outcome of different algorithms
✔ break problems down into smaller sub-problems
✔ use program libraries to add additional functionality to programs
✔ develop programs that make use of selection
✔ develop programs that use different data types
✔ develop programs that use different Boolean operators
✔ refine and develop programs using iterative processes
✔ identify appropriate test data to ensure that programs work as expected.
Python’s Integrated Development and Learning Environment (IDLE) provides features for
creating, editing and running programs. Before using Python, you will need to install IDLE
on your own personal device.
1 Go to www.python.org/downloads
2 Select Download Python.
3 Once downloaded, double-click on the file to open it and then choose Install Now.
4 Once IDLE has installed, it should appear in your Start Menu.
200
369825_9.6_Cam_LSC_SB_198-235.indd Page 201 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
The first stage is planning, where the problem is decomposed into the different sub-
problems that need to be solved and the requirements of the finished product are identified.
The algorithms are then designed, and the program is developed and tested. At the
end of the cycle the work is reviewed and evaluated before the next cycle begins.
In Stage 8, you also learned how to use sub-programs in Python, so that each sub-
problem could be written as a mini-program. The sub-programs were combined to make
the finished program.
Here’s a recap.
To run the sub-program, it is called by writing its name followed by parentheses in the
main program. The main program is written below all the sub-programs.
You will be using sub-programs and an iterative process throughout this unit to develop
your program code.
KEYWORDS
iterate/iterative/iteration: repeat/repeated/repetition
program: instructions that tell a computer system how to complete a task
user requirements: tasks a user expects of an application
algorithm: step-by-step instructions to solve a particular problem
sub-program: small program that can be called from the main program to
run at any time
201
369825_9.6_Cam_LSC_SB_198-235.indd Page 202 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
Practise
1 Decompose the problem presented in An
the Scenario at the start of this unit to example of a sub-
identify the different sub-programs program that will be needed
that will be needed. is the process of generating the
2 Write a list of the requirements for each sub-program. question to be asked.
3 Evaluate and compare your list with your partner.
a Have you broken down the problem into similar
sub-programs that will need writing?
b Are your program requirements the same?
4 What are the benefits of developing a program Think
using decomposition and iterative development? about the size
of the problems once
5 Discuss with your partner:
they have been decomposed
a What is the next stage in the program and the complexity of them
development process? compared with one single
b How will you know if your program code is program
working correctly?
c What is the final stage in the program
development process?
202
369825_9.6_Cam_LSC_SB_198-235.indd Page 203 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
The range() states the number of times that the indented code below will be repeated.
The following program loops three times.
In the example above, ‘counter’ is a variable that keeps track of how many times the code
has repeated. It starts with the value 0 and is increased by 1 each time the code is run.
The loop ends when its value matches the number set in the range. The loop variable can
have any name you choose, and it is sensible to use a name that relates to the data that it
is storing.
The following program prints out the value of the loop variable; in this case, ‘number’.
However, you can add another parameter if you want to specify the starting value for the
count: for example, range(11, 16) means values from 11 to 16 (but not including 16), so
the program below will print out the numbers from 11 to 15.
203
369825_9.6_Cam_LSC_SB_198-235.indd Page 204 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
count = count + 1
The pseudocode below shows the algorithm for a login system. The user is given three
attempts to log in, and to access the game they must enter the name ‘Superstar’.
SUBPROGRAM login ()
username = "Superstar"
entry = ""
count = 0
FOR attempt = 1 to 3
entry = INPUT
count = count + 1
IF entry == username THEN
PRINT "Welcome to the game"
BREAK
ELSEIF count < 3 THEN
PRINT "Try again"
ELSEIF count == 3 THEN
PRINT "3 incorrect attempts. You are locked out."
EXIT()
ENDIF
ENDFOR
ENDSUBPROGRAM
204
369825_9.6_Cam_LSC_SB_198-235.indd Page 205 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
KEYWORDS
login system: method of accessing different systems using a username and/or password
iterate/iterative/iteration: repeat/repeated/repetition
count-controlled loop: set of instructions repeated a set number of times
variable: named memory location that can store a value
loop variable: variable that counts the number of times code has been repeated in a count-controlled loop
data: raw facts and figures
parameter: value that is passed into a function to be used as part of a sub-program
pseudocode: textual representation of an algorithm
flowchart: visual representation of an algorithm
incremented: when the value of a variable is increased by 1
function: sub-program that can exist as part of a bigger program
Practise
1 Write a flowchart algorithm for a program to do the following.
– Ask the user to enter their name and store it in a variable ‘name’.
– Ask the user to enter their age and store it in a variable ‘age’.
– Use a count-controlled loop to print out five times a sentence that includes the
user’s name and age.
2 Open a new program file in Python. Create the code for your flowchart. Use two
variables to store your name and age. Use a count-controlled loop to print out a
sentence five times that includes your name and age.
3 Using the pseudocode in the ‘Learn’ box, create the login system for the prototype
Times Table Adventure game. Write the login system as a sub-program called login().
The sub-program should:
– allow the player to enter a username
– check whether the username entered matches the one stored in the program
– give the user three attempts to enter the correct username
– give appropriate feedback after each attempt
– use break to exit the loop if the user enters the correct username
– use exit() to stop the program running if the username is entered incorrectly three
times.
205
369825_9.6_Cam_LSC_SB_198-235.indd Page 206 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
4 Add code to your main program, below the sub-program, to call login( ). Save the
completed program as TimesTableGameV1.py.
5 Copy and complete the table below to develop a test plan that uses normal, extreme
and invalid data to check the different pathways through your sub-program. An
example test has been included to get you started.
Expected
Test number Data entered outcome Pass/fail
1 Correct username = Welcome to
feedback "Superstar" the game
Think back to Unit 9.1, when
given when
you were introduced to normal,
the correct
username is
extreme and invalid data. Ensure
entered that you test data that should
be accepted, data that should
2 be rejected and data that is
3 on the boundaries of what is
acceptable.
4
KEYWORDS
prototype: initial product created for testing and reviewing, before a final
product is released
test plan: document that details the tests to be carried out when a program
is complete and whether or not they are successful
206
369825_9.6_Cam_LSC_SB_198-235.indd Page 207 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
String manipulation
Learn
When a user enters data into a system, they may use a number of different data types.
A reminder of the key data types is shown below.
As you’ve explored in previous units, when developing programs you need to consider
how the user might enter data, as it might not always be as you expect. You have already
used casting to change the data type of an input, for example, using int to store input
data as an integer. Remember that you can also use string manipulation to ensure that
the data is input in the correct format. Here’s a recap.
Imagine that you are developing a game that requires the user to enter their answer to
a multiple-choice question as a letter: for example, A, B, C or D.
However, there are also a range of different string manipulation techniques that can be
used to return new values where the contents of a string have been altered.
207
369825_9.6_Cam_LSC_SB_198-235.indd Page 208 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
When the program is run and the user enters ‘a’, it is changed to ‘A’.
In both of the examples below, the alphabetical characters have been changed to
lowercase. The numbers are ignored and remain the same.
The capitalize() method converts the first character of a string to uppercase and
all the rest of the characters to lowercase.
Note that all the characters input by the user are stored as a single string.
Therefore, if there is more than one word separated by a space, only the very first
letter of the first word is in uppercase.
208
369825_9.6_Cam_LSC_SB_198-235.indd Page 209 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
It can be used to check whether anything has been input, as the length of the string is 0 if
nothing is stored in it:
KEYWORDS
data type: classification applied to a data item specifying which type of data
that item represents, e.g. in a spreadsheet some of the data types available
include currency, text and number
cast: change the data type of a variable
string manipulation: process of changing the format of a variable/string to
allow it to be analysed
Practise
1 Open the file StringManipulation.py provided by your teacher.
a Add code where the comments are so that the program completes the following
string manipulation:
– ‘first’ is capitalised
– ‘middle’ is changed to uppercase
– ‘last’ is changed to lowercase.
b Test your program using the following inputs:
– first = sanya
– middle = ali
– last = ABBAS
209
369825_9.6_Cam_LSC_SB_198-235.indd Page 210 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
2 Open your file TimesTableGameV1.py from the previous section. You are going to use
iterative development processes to add further functionality to what you have created
previously.
a Edit the sub-program login() so that the program capitalises the username
entered by the user.
b Develop the sub-program further to add a check to make sure that a username has
been entered. To do this, you need to use a conditional statement to check the
length of the username the player has entered. If it has a length of 0, your program
should tell the player ‘You did not enter a username’.
c Save the updated program as TimesTableGameV2.py.
3 Test your code to make sure that the username entered by the player is capitalised,
and that a suitable message is output if no username has been entered.
4 Use the flowchart below to add a new sub-program age() to your times-table game to
check that the user is the correct age to play the game.
age()
INPUT age
No No OUTPUT
is age >= 7
is age < 7? "Sorry! You are
AND <= 10?
too old."
Yes Yes
OUTPUT OUTPUT
"You are the "Sorry! You are
correct age." too young."
Stop exit()
5 a If the player is too young or too old, the program should give appropriate feedback
and then use the function exit() to stop running.
b Save the program that you have developed as TimesTableGameV3.py.
6 Copy and complete the table on the next page and develop the test plan to check that
your new sub-program works correctly. Make use of normal, extreme and invalid test
data in your test plan. An example test has been included to get you started.
210
369825_9.6_Cam_LSC_SB_198-235.indd Page 211 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
7 Get your partner to use your test plan to check that your code works as it should.
KEYWORD
conditional statement: completes a check to see whether set criteria is
either True or False
Learn
When creating algorithms or writing programs, you should always test them thoroughly.
You are already used to doing this using a test plan.
As you explored in previous units, you can use trace tables alongside test plans to follow
each line of an algorithm or program through step by step.
l A test plan provides you with the data to be input and the expected outcome.
l Trace tables allow you to see the value of each variable as each line of code is executed
and can be used to identify any potential errors.
The program below uses two variables, ‘x’ and ‘y’. If ‘x’ is greater than or equal to ‘y’ then
it should add the contents of the two variables; otherwise, it should multiply them.
Remember: a trace table has headings for the line number and all the variables, as well as
a column for the output. You may also find it helpful to include a column heading for the
condition checks in an IF statement, to record the Boolean result.
211
369825_9.6_Cam_LSC_SB_198-235.indd Page 212 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
This example has helped to identify a logic error. The program has multiplied the two
values when ‘x’ is greater than ‘y’, when it should have added them.
Trace tables are extremely helpful when checking algorithms and programs that use
iteration as they can include a column to track the value of the loop variable.
Look at the pseudocode algorithm below.
1 value = 3
2 FOR number = 1 to 5
3 x = value * number
4 y = x * 2
5 IF y > 20 THEN
6 OUTPUT y
7 ENDIF
8 ENDFOR
Work through the trace table below to see how the values of the variables change for
each line of the algorithm.
212
369825_9.6_Cam_LSC_SB_198-235.indd Page 213 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
A simplified version of the trace table could show just the values at the end of each
iteration.
KEYWORDS
trace table: technique for predicting step by step what will happen as each
line of an algorithm or program is run, and to identify errors
execute: carry out the instructions described in a computer program
IF statement: in Python, this evaluates a condition which determines the
path of the program depending on whether the condition is true or false
213
369825_9.6_Cam_LSC_SB_198-235.indd Page 214 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
Practise
1 Copy and complete the trace table for the program below:
2 Open the file TraceTablesActivity1.py provided by your teacher and run the program.
Do the outputs in your trace table match those from the program? Have you managed
to trace a Python program successfully to ensure that it is free from errors?
3 Copy and complete the trace table for the program below.
214
369825_9.6_Cam_LSC_SB_198-235.indd Page 215 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
Line a b i Output
4 Open the file TraceTablesActivity2.py provided by your teacher and run the program.
Do the outputs in your trace table match those from the program?
5 Create trace tables for the following programs to demonstrate that you can follow
pseudocode algorithms that use loops.
a 1 num1 = 3
2 num2 = 2
3 total = 0
4 FOR x = 1 to 3
5 num1 = num1 * x
6 num2 = num2 * 2
7 total = num1 + num2
8 ENDFOR
9 OUTPUT total
b 1 x = 1
2 y = 1
3 z = 0
4 FOR x = 1 to 2
5 FOR y = 1 to 3
6 z = (x * y) * 3
7 OUTPUT z
8 ENDFOR
9 ENDFOR
215
369825_9.6_Cam_LSC_SB_198-235.indd Page 216 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
You can think of an array as a series of boxes, each of which contains one item of data.
These items of data can be indexed. This means that they can be accessed individually
using their index number, and the first item always has the index 0: for example,
name
0 1 2 3 4
Petra Adnan Amir Mira Rayah
If you wanted to print the name Amir from the array above, you would use the code
print(name[2]). The number in square brackets after the name of the array is the index
number or position where the element can be found.
A drawback of arrays is that they allow only data of the same data type to be stored.
name = ["Petra", "Adnan", "Amir", Allowed; all use the string data type
"Mira", "Rayah"]
topScores = ["Petra", 55, "Adnan", Not allowed; this a combination of string and integer
46, "Amir", 44] data types
Python uses data structures called lists and tuples to create arrays. These work in a
similar way to arrays, but they allow a mixture of different data types to be stored in them.
The difference between a list and a tuple is that the elements inside a list can be changed,
but the contents of a tuple cannot be changed.
216
369825_9.6_Cam_LSC_SB_198-235.indd Page 217 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
In Python, a list is created using square brackets: [ ]. Each item in the list is separated
from the next element by a comma.
Look at the program below. Can you work out what will be printed when the program is
run?
The program retrieves and prints elements from the list to create a sentence.
The data contained in a list can also be used to perform calculations. Look at the program
below. Can you work out what will be output when the program is run?
This program adds together 15 (index 0) and 12 (index 4) to give the answer 27.
In this list, there are no quotation marks. This is because the values are stored as integers
and not strings.
KEYWORDS
data item: piece of information that represents part of the data that makes
up a person, place or thing, e.g. some of the data items that represent a
person are their first name and second name
variable: named memory location that can store a value
one-dimensional array: series of items grouped together under one
identifier
index: numerical reference for a location of a piece of data stored in an array
list: data structure in Python that can store multiple items of data of mixed
data types under a single identifier; data items can be changed
tuple: data structure for storing multiple items of data in a single variable;
values cannot be changed
217
369825_9.6_Cam_LSC_SB_198-235.indd Page 218 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
Practise
1 Copy and complete this paragraph about the purpose of a one-dimensional array by
filling in the blanks. Select from the words below.
When you want to store multiple items of data about the same thing, instead of
using lots of … you should use an …. In Python, this can be done using lists or ….
Lists allow you to … the data they contain; tuples … you from changing the data. To
retrieve the value 5 from the list points = [4,7,5,3,8], you would write the code ….
2 Open a new program file in Python, and create a program that does the following.
a Creates a list called 'countries', which stores the following countries: Belgium,
Andorra, Malta, Mali, Sri Lanka.
b Displays the countries in alphabetical order by accessing them from the array in
Python using the print command: for example,
c Save the program as CountriesList.py and test it to ensure that it produces the
output shown above.
3 Follow the pseudocode below and copy and complete the table to determine the
output from each calculation.
score = [25, 34, 15, 17, 20]
OUTPUT score[2] + score[3]
OUTPUT score[4] - score[2]
OUTPUT score[2] * score[4]
OUTPUT score[1] / score[3]
OUTPUT (score[0] + score[2]) / score[4]
Calculation Output
score[2] + score[3]
score[4] - score[2]
score[2] * score[4]
score[1] / score[3]
(score[0] + score[2]) / score[4]
218
369825_9.6_Cam_LSC_SB_198-235.indd Page 219 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
4 Open your file TimesTableGameV3.py (from the ‘String manipulation’ section). You are
now going to add a sub-program called character() to allow the user to choose their
character name.
a Choose the names for five characters and store them in a list with a suitable name.
b Use the print command to display each character name in turn.
c Once all five names have been displayed, ask
the player to enter their choice of character,
and store this in a variable. The number that the player
d Confirm the character they have chosen by enters as their choice will be one
printing the character’s name as part of a higher than the index number
sentence. you need to use to print the
character’s name.
e Return the character name to the main
program.
Here is an example of what the sub-program may look like when it is run.
5 Add code to the end of the main program, to call the sub-program character() and
assign the value that is returned to a variable called ‘charName’.
6 Save the updated program as TimesTableGameV4.py. Test your code to make sure
that it is working correctly. Improve your code further so that if the user enters a
number that is not between 1 and 5, the program will automatically assign them the
first character name.
7 Save the updated program as TimesTableGameV5.py. Test your program to make sure
that it is working correctly.
8 Make sure that your program meets all the requirements listed in task 4.
219
369825_9.6_Cam_LSC_SB_198-235.indd Page 220 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
If this list contained 100 scores, using this approach would require a separate line of code
to print each piece of data. Instead, it is possible to use iteration to simplify and shorten
the code:
The example using iteration would always use just four lines of code, even if the program
displayed the top 100 scores.
Look at the second program in more detail.
220
369825_9.6_Cam_LSC_SB_198-235.indd Page 221 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
Iteration can be used to handle the data in lists for a range of different purposes. The
program below uses iteration to add together all the scores in the list.
Of course, the number of items in a list may vary, which can cause problems when using
a for loop that repeats a set number of times. To overcome this problem, you can use the
len() function to set the number of times the loop needs to run.
In the program below, the len() function is used in line 3 to find the number of items in
the list, and the value is stored in the variable ‘length’. In line 4, ‘length’ replaces a fixed
value for the upper boundary of the loop. If the number of items in the list increases or
decreases, then the program adjusts automatically to run the loop the correct number of
times: for example,
221
369825_9.6_Cam_LSC_SB_198-235.indd Page 222 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
Practise
1 Copy and complete the trace table to check the algorithm below for any bugs and
predict the outcomes. The first three lines have been completed for you.
1 scores = [7, 9, 14, 10, 3, 6, 9, 1]
2 total = 0
3 bonus = 0
4 FOR x = 0 to 7
5 total = total + scores [x]
6 IF scores [x] > 8 THEN
7 bonus = bonus + 2
8 ELSE
9 bonus = bonus + 1
10 ENDIF
11 ENDFOR
12 finalScore = total + bonus
13 OUTPUT finalScore
222
369825_9.6_Cam_LSC_SB_198-235.indd Page 223 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
Day Output
AM
AP
PM
223
369825_9.6_Cam_LSC_SB_198-235.indd Page 224 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
Index 0 1 2 3 4 5 6 7 8 9
Value 2 6 9 12 16 18 20 23 45 99
First, you need to find the middle value in the list. If there are an
even number of elements in the list then there isn’t a true middle
value, so it is usual to take the value to the left of the mid-point.
In this example, this would be index 4 with a value of 16.
Next you need to see whether the middle value is the one being
searched for. If it is, then the algorithm finishes. However, if it
is not, then the bottom half of the list plus the middle value is
discarded if the middle value is lower than the one being looked
for, or the top half of the list plus the middle value is discarded if
the middle value is larger than the one being looked for.
In this example, 16 is larger than 9, so 16 and all the values to the
right (that are higher than the target number) are discarded. The
remaining numbers form a new list:
Index 0 1 2 3
Value 2 6 9 12
Index 0 1
Value 9 12
6 9 15 18 20 24 27 33 37 40 42 49
224
369825_9.6_Cam_LSC_SB_198-235.indd Page 225 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
l The first is through trial and error. This requires you to write some code, run your
program and see whether it works. If it doesn’t work, then you need to make
changes to your code and try to run it again until it does what you want it to do.
l Another method of identifying errors is through using a test plan. You should
develop a test plan before you write your program. It should clearly identify what
tests you are going to carry out when you have developed the program and what
the program should do. When you have finished developing the program, you
should carry out these tests to find any potential issues.
You have already written and used test plans, and these have usually focused on
making sure that the program works and produces the outputs that you are expecting.
A thorough test plan includes three different types of data. Can you remember what
these are?
l Normal
l Extreme
l Invalid
When you try to run and test your program, there are three main types of errors that you
may come across. These are:
l syntax errors
l logic errors
l runtime errors.
225
369825_9.6_Cam_LSC_SB_198-235.indd Page 226 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
Logic errors
A logic error is an error in the algorithm that produces an incorrect or unexpected output.
The program will still run, but the desired output is not produced. Logic errors are harder
to spot because it is not always obvious that there is an issue with the program.
Common logic errors include the following.
Runtime errors
A runtime error occurs when Python understands the code but runs into a problem when
it tries to execute it. In English, a runtime error would be something like the sentence
‘Jump on the ceiling’. It makes sense but it is something that cannot be completed. The
name runtime error comes from how it is encountered once the program is running.
226
369825_9.6_Cam_LSC_SB_198-235.indd Page 227 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
KEYWORDS
normal test data: data of the correct type that should be accepted by a program
extreme test data: acceptable input but at the ends of the possible input range
invalid test data: data that should be rejected by a program
syntax error: error in program code that stops the program from running
logic error: error that allows a program to run but not output what is expected
runtime error: error that occurs while a program is running; the instructions cannot be completed
Practise
1 Identify the syntax errors in the program below. For each error, say which line it is on,
describe the error and write a corrected version of the program code.
2 The algorithm below should ask the user to enter three numbers and then calculate
the average of the three numbers. If the average is more than 50, it should output
‘Well done’; otherwise, it should output ‘Try again’. Identify the logic errors in the code
that prevent the algorithm from working correctly. For each error, say which line the
error is on and how to correct it.
1 total = 0
2 FOR x = 0 to 5
3 number = INPUT
4 total = total * number
5 ENDFOR
227
369825_9.6_Cam_LSC_SB_198-235.indd Page 228 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
6 average = total / 3
7 IF average < 50 THEN
8 OUTPUT "Well done"
9 ELSE
10 OUTPUT "Try agin"
9 ENDIF
3 Open the file RuntimeErrorsProgram.py provided by your teacher. This program
should add together all the numbers in the array and multiply them by the number
entered by the user. Correct the runtime errors in the program.
4 Develop a test plan for the ‘age’ sub-program of your game. Open the latest version
of your game (this should be TimesTableGameV7.py). Make sure that you include all
types of test data in your test plan.
Go further
Previously, you have looked at how you can retrieve data from lists in Python using one-
dimensional arrays. There are a number of ways in which the contents of an array can be
altered, including adding data, changing data and removing data.
Here are some examples of ways in which the contents of a list can be altered.
228
369825_9.6_Cam_LSC_SB_198-235.indd Page 229 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
1 Open the file Altering Lists.py provided by your teacher. This program stores in a list
the names of the five countries with the highest population and displays them in order.
2 The program needs editing to display the ten countries with the highest population. Update
the code that uses a one-dimensional array and use .append() to add Brazil, Bangladesh,
Russia, Mexico and Japan to the list. The finished program should look like this.
3 There has been an error in the order of countries. Insert Pakistan between Indonesia
and Nigeria. The finished program should look like this.
4 Now there are eleven countries in the list, the final country, Japan, needs to be
removed from the list. Update your code to reflect this.
229
369825_9.6_Cam_LSC_SB_198-235.indd Page 230 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
Challenge yourself
Now that you know how to alter the contents of a list, you are going to develop your
game further so that the player can add a character of their choice to the list or alter the
other characters that are available.
Your sub-program will still need to display the original list of characters, but will then
need to give the player some options to choose from.
You will need to edit the sub-program character() so that the program allows the player
to:
l add a character to the list
l change a character that is stored in the list for a character of their choice
l remove a character from the list
l choose a character from the existing list.
The updated list should be displayed to the user before allowing them to make their final
choice.
Use the pseudocode below as a guide for the options that your sub-program will need to
include.
OUTPUT "What would you like to do?"
OUTPUT "1. Add a character?"
OUTPUT "2. Change a character"
OUTPUT "3. Delete a character"
OUTPUT "4. Choose a character from the existing list"
INPUT option
IF option == 1 THEN …
1 Add the required code to the latest version of your times-table game program
from previous sections (this should be TimesTableGameV7.py). Ensure that your
developments complete each of the operations outlined.
2 Save your edited program as TimesTableGameV7cy.py and test it to make sure that it
works correctly.
230
369825_9.6_Cam_LSC_SB_198-235.indd Page 231 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
Final project
Look back at the start of this unit to remind yourself of the Scenario. You have already
created several parts of the game, but you now need to develop the code to ask the
questions and keep a score.
a Use random.choice() to select an item from each list and store these in separate
variables.
b Generate a random number between 2 and 12 and store it in a variable called
‘number’.
3 Use the pseudocode on the next page to help you to write the program code to
display the question and get the player’s answer. The letters ‘V’, ‘W’, ‘X’, ‘Y’ and ‘Z’
have been used to indicate where you should insert certain variables into the output.
231
369825_9.6_Cam_LSC_SB_198-235.indd Page 232 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
V = table
W = random number (2,12)
X = random choice(rooms)
Y = random choice(containers)
Z = random choice(items)
OUTPUT
"Try again"
INPUT answer
No
OUTPUT
"No. The answer
is V * W"
RETURN points
232
369825_9.6_Cam_LSC_SB_198-235.indd Page 233 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
5 a Create two variables in the main program called ‘score’ and ‘first’. They should
both have a value of 0.
b Use the pseudocode below to help you to call the function question(), store the
value that is returned and update the values of ‘score’ and ‘first’. You will need to
use a for loop to make this section of code run five times so that five questions are
asked.
FOR i = 1 to 5
points = SUBROUTINE question(table)
score = score + points
IF points == 2:
first = first + 1
ENDIF
ENDFOR
l First, address the player by name and tell them how many points they scored
and how many questions they answered correctly at the first attempt.
l Then give them some feedback based on the score that they achieved.
l Include the number of the times table that they were practising. This is shown
as V in the examples below.
a 8 or more points: ‘Well done! You know your V times table.’
b 5 or more points: ‘A good effort. You know some of your V times table.’
c Less than 5 points: ‘You need to practise your V times table.’
Here is an example of how this might look when the program is run:
233
369825_9.6_Cam_LSC_SB_198-235.indd Page 234 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
2 Copy the table below and create a test plan for the ‘feedback’ sub-program. Include
normal, extreme and invalid test data.
3 Copy and complete the table below, listing the variables used throughout your whole
program, their data types and a justification for the data type you have chosen.
4 Copy and complete the trace table for the following part of the algorithm if the
points returned from the sub-routine are 2, 1, 0, 1, 2.
1 FOR i = 1 to 5
2 points = SUBROUTINE question(table)
3 score = score + points
4 IF points == 2:
5 first = first + 1
6 ENDIF
7 ENDFOR
234
369825_9.6_Cam_LSC_SB_198-235.indd Page 235 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
Evaluation
1 Swap programs with your partner and play each other’s games. Comment on the
following.
a Does their game cover all the requirements?
b Is their game easy to use?
c Are the messages easy to understand?
d Does the game calculate the score correctly depending on how many attempts it
takes to get the correct answer?
2 Now open your own program and look at the code. Reflect on what you could improve
in your game. Things you might want to think about include:
– Is it easy to get full marks? How could you make the game easier/harder?
– How could you develop the game further? Could you add additional levels? What
would they look like? How could you use lists in your programming to do this?
3 Based on these evaluations, make a list of recommendations to improve your game.
4 Attempt to make the improvements to your game.
235
369825_Glo_Cam_LSC_SB_236-241.indd Page 236 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
Glossary
5Vs: the terms used to describe the concept of Big Data: Big Data analytics: the analysis of sets of data known
volume, velocity, variety, value, veracity as Big Data
accelerometer: detects a change in direction of a device binary data: data that is represented as a 1 or a 0
accessibility: how successfully a new product or piece of binary digit: 0 or 1; the smallest unit of binary data
software can be used by anyone represented on a digital device
accumulator (ACC): holds the results of processing binary search: divide-and-conquer algorithm that splits
carried out by the arithmetic logic unit an array in half each iteration, checking the middle
active internet connection: where a device has a value to determine whether it is higher or lower or it has
working connection to the internet found the required value
administrator: account with top-level access, with the biometric security: security method that identifies
ability to change settings or add and remove users from people using a physical attribute (e.g. a fingerprint) or a
a network behaviour (e.g. a hand gesture)
algorithm: step-by-step instructions to solve a particular bit: short for ‘binary digit’: 0 or 1
problem bit depth: the number of bits used to store a single
analogue: continually varying signal, e.g. a sound signal sound sample
analogue-to-digital converter (ADC): converts block: string of data (0s and 1s)
analogue signals, e.g. the human voice, to digital signals block-based program: individual code blocks connected
applications software: software designed to do a together to create a program
particular task, e.g. a word processor, spreadsheet, web Boolean expression: expression that contains
browser, mobile-phone app conditional operators; symbols, e.g. >, < and =, used to
arithmetic logic unit (ALU): carries out the calculations carry out comparisons between two values
needed during the execution of a program brute-force attack: type of unauthorised access to a
array: data structure in a program that can store more computer system that uses a large dictionary to try
than one item of data of the same data type under a multiple password combinations until it is successful
single identifier; data items can be changed bus topology: network in which all devices are
artificial intelligence (AI): ability of a computer system connected together via a main cable running down the
to learn and develop its own programming from the centre of the network
experiences it encounters byte: eight bits of data, e.g. 01010011
assembler: translates assembly-language instructions camelCase: all lowercase, and from the second word the
into machine code and creates one line of machine code first letter is capitalised
for each assembly-language instruction cast: change the data type of a variable
assembly language: set of codes or symbols that Central Processing Unit (CPU): the part of the
represent each instruction, rather than a group of 1s computer that carries out program instructions,
and 0s sometimes known simply as the processor
attribute: heading for organising data in a relational character: single letter, digit or symbol
database
chatbot: software application that uses text to ask
authenticate: confirm a user’s details to ensure that questions to help a user
they should be allowed access to a system
cloud computing: using servers on the internet for
backup: copying files to another location in case the services
original is lost or damaged
colliding: when data ‘bumps into’ other data, which
Big Data: datasets that are too large or complex for often causes errors or lost data
traditional data-processing applications, e.g. databases
command line: way of using an operating system that is
or spreadsheets, to process
navigated by typing commands
236
369825_Glo_Cam_LSC_SB_236-241.indd Page 237 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
Glossary
compiler: translates an entire computer program into data type: classification applied to a data item
machine code and creates a file containing machine specifying which type of data that item represents,
code for the entire program e.g. in a spreadsheet some of the data types available
complex query: where more than one criterion can be include currency, text and number
used to search a database, or a query can be used to database: application that organises data for storing,
combine data from more than one table, or calculations processing and accessing electronically
can be performed using the data in a query dataset: collection of related information that a
concatenation: joining two strings together computer can manipulate
conditional operator: symbol, e.g. >, < and =, used to decode: work out what an instruction means/what it is
carry out comparisons between two values telling the Central Processing Unit to do
conditional statement: completes a check to see defragmentation: reorganising files stored on a hard
whether set criteria is either True or False drive to ensure that all parts of the same file are located
control unit (CU): issues commands to the other one after the other on the drive
hardware components to help ensure programs are device driver: software program that operates a
carried out correctly hardware device connected to a computer
convert: change from one unit to another, e.g. storage digitise: convert into digital format, i.e. into 1s and 0s
units (e.g. bits/bytes/kilobytes) domain name: part of a URL that specifies the location
count-controlled loop: set of instructions repeated a set on the internet, e.g. google.com
number of times dry run: process of working through an algorithm
cookies: small pieces of data, collected from websites manually to trace the values of variables
and stored as text by web browsers efficient: the efficiency of a program can be measured
COUNT function: checks all the cells in a specified by how quickly it runs
range in a spreadsheet and outputs how many contain a emerging technologies: new technologies that can be
numeric value incorporated into a design to improve how the product
counter variable: variable that stores the number of operates
times an iteration has iterated encryption: converting information into a scrambled
criteria: set of rules that must be met form, so that it cannot be understood if it is intercepted
crocodile clips: cable for creating a temporary electrical entity: person, place or object represented in a table in a
connection between devices relational database
current instruction register (CIR): stores the address of entity relationship diagram (ERD): diagram that
the instruction the Central Processing Unit is currently illustrates the relationships between two entities in a
executing relational database
cyber-attack: attempt to gain unauthorised access to a ergonomics: how a product or piece of software is
network, to damage or destroy a computer system designed or arranged so that it can be used efficiently
data: raw facts and figures evaluation: checking the suitability of a solution to a
data dictionary: table that represents the structure of problem
a database table at the design stage of developing a evolving: changing and improving
database; often contains details, e.g. data type, field length execute: carry out the instructions described in a
and details about validation checks applied to data items computer program
data-entry error: error that occurs when data is being extreme test data: acceptable input but at the ends of
entered into a database the possible input range
data item: piece of information that represents part facial recognition: system that matches a real-time
of the data that makes up a person, place or thing, e.g. image of a human face with a database of saved facial
some of the data items that represent a person are their representations to allow a user access to a digital device
first name and second name
feedback: comments made to help improve a product
data packet: small unit of data that is packaged to be
fetch: collect an instruction from another location
sent across a network
file server: server that stores users’ files and enables
data redundancy: when data is unnecessarily repeated
them to be shared on a network
in a database
237
369825_Glo_Cam_LSC_SB_236-241.indd Page 238 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
fingerprint recognition: system that matches a real- Hypertext Transfer Protocol Secure (HTTPS): set of
time image of a human fingerprint with a database of rules for communicating with web servers, with added
saved fingerprint representations to allow a user access encryption to improve security
to a digital device IF statement: in Python, this evaluates a condition
firewall: restricts the network traffic entering and which determines the path of the program depending
exiting a network, to ensure that it is safe on whether the condition is true or false
fit for purpose: something that is well designed for its incremented: when the value of a variable is increased
purpose by 1
flat-file database: database that stores all data items index: numerical reference for a location of a piece of
using one table data stored in an array
float: decimal number industrial revolution: rapid change in how society works
flowchart: visual representation of an algorithm following the introduction of new developments, e.g.
machines, computers, robots, AI, machine learning
for loop: the Python or MicroPython loop for a count-
controlled loop Industry 4.0: refers to how industry is combining
electronics with new technologies, e.g. machine learning,
foreign key: when the primary key from one table
artificial intelligence, robotics and green energy
appears in another table to establish a link between two
entities input mask: control added to a field in a database table
to control the format of data being added
fragmentation: situation that occurs when pieces of
files are scattered across the surface of a hard disc when instruction set: all the instructions in machine code that
the operating system is storing the file a Central Processing Unit can execute
function: sub-program that can exist as part of a bigger integer: whole number
program integrated development environment (IDE): software
general-purpose input output (GPIO): pins at the that includes all the tools needed to develop a program
bottom of the micro:bit that allow additional inputs and in a particular language
outputs to be added through crocodile clips interference: when electronic signals disrupt data
Global Positioning System (GPS): satellite-based transmissions
system that keeps track of users’ physical locations and Internet Service Provider (ISP): company that provides
helps with navigation users access to the internet, and is often responsible for
graphical user interface (GUI): way of using software the network equipment that connects LANs to WANs
that is navigated by pointing and clicking on graphics on interpreter: translates each line of high-level language
a screen code into machine code
hacker: somebody who tries to gain unauthorised access invalid test data: data that should be rejected by a
to a computer system or network program
hard disc drive: removable disc in computers for storing IP address: unique number assigned to a computer on a
large amounts of data, typically measured in gigabytes network
or terabytes iterate/iterative/iteration: repeat/repeated/repetition
hardware: physical parts of a computer that you can linear search: sequential method of searching a list
touch and see, e.g. the processor, storage devices, input from start to end, checking each element in turn
devices, output devices
list: data structure in Python that can store multiple
hertz (Hz): unit of measurement of how many sound items of data of mixed data types under a single
samples are taken in 1 second identifier; data items can be changed
high bandwidth: connection that can send and receive Local Area Network (LAN): type of network where
a large amount of data per second devices communicate over a small geographical area,
high-level language (HLL): programming language that e.g. a single building
uses commands and terms that are linked to the words logic circuit: combination of logic gates for solving a
or symbols a human would use when carrying out the problem in a digital device
same task
logic error: error that allows a program to run but not
Hypertext Transfer Protocol (HTTP): set of rules for output what is expected
communicating with web servers
238
369825_Glo_Cam_LSC_SB_236-241.indd Page 239 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
Glossary
login system: method of accessing different systems programmed MAC address so that it can be identified
using a username and/or password on the network
loop variable: variable that counts the number of times network operating system (NOS): computer
code has been repeated in a count-controlled loop operating system that supports networks, often
low-level language (LLL): programming language including additional administrator software and
that uses commands that are similar to the type of monitoring tools
instructions the processor understands network switch: switch that connects devices together
MAC address: number programmed into a network to form a wired network
interface card that identifies each device on a network network topology: diagram that shows how devices in
machine code: combination of 1s and 0s that represent a network are connected to one another, and shows the
each instruction in the instruction set of a digital device network hardware
machine learning: ability of a computer system to learn network traffic: amount of data travelling through a
over time network, split into small parts for transmission
main memory: another name for RAM, which is used to normal test data: data of the correct type that should
store the programs and data the Central Processing Unit be accepted by a program
is currently using one-dimensional array: series of items grouped
many-to-many relationship: a primary key can exist together under one identifier
many times as a primary key on one table in a relational one-to-many relationship: a primary key can exist once
database and many times as a foreign key to link a as a primary key on one table in a relational database
second table in the relational database and many times as a foreign key to link a second table in
MAX function: returns the highest value in a specified the relational database
range of cells in a spreadsheet one-to-one relationship: a primary key can exist once
memory address register (MAR): holds the address of as a primary key on one table in a relational database
the memory location being accessed, either to read data and once as a foreign key to link a second table in the
from or write data to relational database
memory data register (MDR): any data or instructions online storage services: using file storage servers on the
that pass into or out of main memory must pass internet to store files
through the MDR operating system: software that manages all the
meteorology: study of climate and the weather computer hardware and software; it also acts as an
interface between computer hardware components
microprocessor: device that has one circuit but the
and the user, and provides a platform where
input, process and output functions of a computer
applications can run
MicroPython: programming language used on the
parameter: value that is passed into a function to be
micro:bit
used as part of a sub-program
MIN function: returns the lowest value in a specified
parameter query: query where the end user provides
range of cells in a spreadsheet
the search criteria
multiple-criteria query: query that uses more than one
parity bit: bit added to a byte to make the total number
criterion to select data items from a database
of 1 bits either even or odd
multi-table query: query that uses data from more than
parity byte: byte added to a block of data to check
one data table
whether the data is valid or invalid
naming convention: the way a variable or array is
parity-checking: type of error check that ensures data
named in programming
has been transmitted correctly
nesting: one programming construct, e.g. selection,
password: code made up of numbers or numbers and
occurring inside another construct, e.g. a count-controlled
letters and other characters (depending on the device),
loop
which allows a user access to a digital device
network: collection of computing devices connected to
Personal Area Network (PAN): type of network where
each other, either by wires or wirelessly
devices communicate over a small area of no more than
network interface card (NIC): every device that 10 metres, usually connecting devices a person wears to
connects to a network includes a NIC, which has a pre- a smartphone or computer
239
369825_Glo_Cam_LSC_SB_236-241.indd Page 240 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
personal identification number (PIN): sometimes relationship: feature in database applications for linking
called a PIN number or PIN code; a numerical passcode tables together
that allows a user access to a digital device remotely: connecting to a network from another
physical computing device: device that can be location via an internet connection
programmed using block or text-based programming report: feature in MS Access for displaying data in a
languages user-friendly format
plaintext: text that has not been encrypted and can be ring topology: network in which all devices are
read if it is intercepted connected together to form a ring
platform: hardware and operating system that runs an router: hardware device that connects networks
application together
plug-and-play device: device that is detected rule-based chatbot: chatbot with a set of questions
automatically and set up correctly for use by the built in that it asks and the user answers
operating system; no human intervention is needed
runtime error: error that occurs while a program is
primary key: field in a database table that provides a running; the instructions cannot be completed
unique identifier for a record/entity
sample rate: number of sound samples taken each
process: carrying out an operation on data, e.g. querying second
a database or doing a calculation using data in a
sampling: taking samples of a sound wave at fixed
spreadsheet
intervals
processor: electronic circuitry that executes the
scalability: capacity to make something larger, e.g. a
instructions described in a computer program; often
network enlarged with more devices
called the central processor or central processing unit
search criterion: data item used for comparison when
program: instructions that tell a computer system how
carrying out a search
to complete a task
security software: any type of software that secures
program counter (PC): stores the address of the next
and protects a digital device
instruction waiting to be executed (carried out) by the
Central Processing Unit selection: choice to be added to a program using if…
elif… else and the next instruction executed in the
protocol: agreed set of rules that computers follow to
program is decided by the outcome of a condition
communicate with each other over a network
sequence: order that program code needs to be in to
prototype: initial product created for testing and
work correctly
reviewing, before a final product is released
server: usually a powerful computer that offers a
pseudocode: textual representation of an algorithm
range of services to a network, e.g. file storage, user
query: tool that allows users to search for data that management, printer sharing, email access or web
meets specific rules or criteria servers
Query by Example (QBE): interface that allows users to simple query: where only a single search criterion is
select fields and criteria for use in a query in a database used to select data items from a database
application
snake_case: all lowercase, and spaces are replaced with
radio frequency identification (RFID) tags: technology underscores ( _ )
that uses radio signals to send data to another device
social-media application: web-based software that
Random Access Memory (RAM): memory used to allows users to share ideas, information and thoughts in
store programs and data currently being used by the an online community
processor
software: program or set of instructions that tell a
random value: randomly generated number in a computer what to do to complete a task; aspects of a
program that can be set within a range device you cannot touch
real: also known as a float; a decimal number spreadsheet: application that uses rows and columns to
register: location in main memory that temporarily organise data and carry out calculations using that data
stores data about memory locations, instructions and spreadsheet model: spreadsheet containing data that
data used during the execution of an instruction represents a real-life scenario
relational database: database that stores data using star topology: network in which each device is
two or more linked tables connected separately to a central switch
240
369825_Glo_Cam_LSC_SB_236-241.indd Page 241 06/03/23 9:54 AM A4902 /142/HO02737/work/indd
Glossary
storage units: number of bits used to store a data item tuple: data structure for storing multiple items of data in
in a digital device a single variable; values cannot be changed
string: sequence of characters that can be text, numbers two-dimensional parity check: check for finding where
or symbols; quotation marks around the characters an error exists within a parity check
define it as a string two-factor authentication: method of signing into a
string manipulation: process of changing the format of system that requires two types of authentication (e.g. a
a variable/string to allow it to be analysed password and a one-time SMS message code)
Structured Query Language (SQL): specialised user experience: how intuitive the product is based on
language for accessing data in relational databases the user’s previous experience with digital products or
sub-program: small program that can be called from the applications
main program to run at any time user management: adding or removing users to control
sub-routine: standalone section of code that can be access to a network
called from the main program user requirements: tasks a user expects of an application
sustainably: when a network is built in a way that it is utilities software: software that helps maintain the
easy to maintain in the future smooth functioning of a digital device by helping the
syntax: specific rules used in a programming language operating system manage tasks and resources
syntax error: error in program code that stops the validation: automatic checks applied to individual fields
program from running in a database table to help reduce the chance of error
when adding data to the table
systems software: software that helps a user run a
computer value: how useful data is to an organisation
table: set of facts or figures that are set out in a column variable: named memory location that can store a value
and row structure variety: the range of data formats and data types
terminator: ending to a network cable that absorbs the collected
signal to stop it bouncing back vehicle telematics: information monitored and
test plan: document that details the tests to be carried transmitted from vehicles, e.g. their location and speed,
out when a program is complete and whether or not using GPS, engine diagnostics and driving style
they are successful velocity: how quickly data is generated, processed and
text-based programming: written lines of code using a turned into useful information
specific programming language, e.g. Python veracity: accuracy and quality of data
traceback message: displayed when a runtime error is version control: saving each development iteration as a
encountered to help identify where the error occurred new filename to track changes
and what went wrong virtual learning environment (VLE): online classroom
trace table: technique for predicting step by step what where teachers and students can share learning
will happen as each line of an algorithm or program is materials
run, and to identify errors virus scanning: checking files on a computer system for
traditional manufacturing: the making of products malicious content
before computerisation; it often relied on human voice-pattern recognition: software that can
production lines, where people completed individual understand and carry out spoken instructions
tasks, which were passed along the production line until
volume: the massive amounts of data collected and
the final product was complete
analysed on an ongoing basis
transistor: tiny switch activated by electrical signals
Wide Area Network (WAN): type of network where
– when the transistor is ON it represents 1; when the
devices communicate over a large geographical area,
transistor is OFF it represents 0
such as across a city or country
translator: converts program instructions into machine-
wildcard query: query where special characters are used
code format so the processor can carry out the instructions
to stand in for unknown characters (this is useful when
Transmission Control Protocol/Internet Protocol (TCP/ trying to find lots of data items that are similar but not
IP): protocol for transferring data between devices exactly the same)
truth table: breakdown of a logic circuit, listing all wireless access point: allows devices to connect to a
possible operations the logic circuit can carry out network using Wi-Fi
241
369825_Ind_Cam_LSC_SB_242-248.indd Page 242 06/03/23 10:52 AM A4902 /142/HO02737/work/indd
Index
string manipulation 207 decomposition 201–2
A bus topology 61 defragmentation programs 69, 131,
accelerometers 93, 97, 126 133–4
active internet connections 56 device drivers 130, 131, 133
AI see artificial intelligence (AI) C disc defragmentation 69, 131, 133–4
algorithms 4, 5, 13 casting 13 domain names 66
code tracers 19–23 Central Processing Unit (CPU) 140, 141, dry-run testing 22, 27, 53
fragmentation 133 142, 143, 144, 145, 156
see also flowcharts; pseudocode
analogue sound 135
chatbot program 5, 10, 38–53
code tracers 19–23
E
digitisation of 130, 131, 135–7 development iterations 16–18, emerging technologies 154, 155
analogue-to-digital convertor (ADC) 38–44, 52–3 encryption software 69, 76
135–7 error processing 23–8, 45–8 entity relationship diagrams (ERDs) 170
AND logic gate 11, 147, 149 chatbots 8, 11–12, 152 ergonomics 154
antivirus software 57, 133 cloud computing 68, 76–7 error processing 23–8
applications software 129, 132 code tracers 19–23 changing contents of an array 228–9
the APRAnet 57 command lines 80–4 identifying errors and debugging
arrays 6, 35–8, 49–50, 51, 52, 53, 198 compilers 130, 131, 141, 142 225–30
altering contents of 228–30 computerisation 5, 129, 151–3, 157 logic errors 9, 24, 27, 45, 46, 48, 227–8
indexed items 98, 100, 216 concatenation 13 networks 5, 71–3
on the micro:bit 97–102 conditional operators 24, 27, 46, 48, 90, parity-checking systems 72–3,
musical notes 111, 113, 115, 117 147–8 78–80, 85
storing images 116–25 conditional statements 11, 24, 44, 49, 90 runtime errors 9, 24, 45, 46–7, 48,
see also lists; one-dimensional arrays combining logic gates 147–8 225, 228
artificial intelligence (AI) 12, 153 and the micro:bit 94, 124 syntax errors 9, 24, 45–6, 48, 91, 199
and machine learning 150 in Python 210, 211 ethernet cabling 60
and network security 76–7 cookies 152, 153 extreme test data 9, 47, 48, 53, 225
assembly language 140–1, 142, 145 count-controlled loops (for loops) 5, 9, for the micro-bit 95
authentication 75–6 28–30, 37, 44 Python 199, 206, 210–11
in game development 88, 124, 127
B creating a musical sequence F
112–14, 115
Big Data 4, 5–6, 160–97 facial recognition 76, 133, 135, 150, 151
and the micro:bit 103–11
and the 5Vs 163 fetch-decode-execute cycle 5, 130, 131,
in pseudocode 29–30, 33–5, 51–2
analytics 164, 165 143–4, 145, 146, 157
Python 199, 202–6
applications of 163–5 file servers 60, 67, 68, 69
counter variables 106
complex queries 176–81 file storage and retrieval 133
crocodile clips 91
data items 161, 163 fingerprint recognition 76, 133, 134
cyber-attacks 67
data searches 161 firewalls 57, 60, 63, 67, 69, 70, 75, 133
evaluating models of real-life systems flat-file databases 165, 166, 168, 169
185–8 D floats (real data types) 12, 13, 14
social media 160, 163 data accessibility 67–8, 70 flowcharts 9, 9–10, 11, 15, 16, 19
see also databases; relational databases 4, 163, 186, 187, 188–9 game development 88, 90, 127, 232
databases; spreadsheets see also relational databases iteration 31–3, 38–9, 204, 205
binary data 71, 135, 138–9, 140 data storage 130, 131, 138–9, 157 Python 199, 200
binary search 223–4 datasets 74 spreadsheet models 185
biometric security 75–6, 133, 134, 135, logic gates 129 for loops see count-controlled loops (for
150 data types 5, 9, 11, 12–15 loops)
block-based programs 91 in arrays 216
Boolean expressions/operators 130,
131, 147–9, 156, 158, 200
evaluating database models 186
MicroPython 88
G
data types 9, 13, 200 Python 9, 11, 200, 207 game development 5, 6, 88–128
IF statement 211, 213 test plans 9, 47, 48, 53, 225 creating a musical output 111–15
242
369825_Ind_Cam_LSC_SB_242-248.indd Page 243 06/03/23 10:52 AM A4902 /142/HO02737/work/indd
Index
creating your own image 120–3 using iteration with 220–3 connections 56, 57–60
microprocessors 88 see also arrays data packets 55, 64, 65, 71, 74
physical computing devices 88, 89 LLL (low-level languages) 140, 142, 145 disconnection due to interference 56
Python 200, 207, 210–11, 231–5 logic circuits 5, 130, 131, 147, 148–9, error detection 55, 71–3
Tetris 89 156, 158 fit for purpose 55
‘What am I?’ game 90, 111, 125–7 logic errors 9, 24, 27, 45, 46, 48, 227–8 hardware 59–60, 61, 63
see also micro:bit Python 199, 212 packet switching 65
general-purpose input output (GPIO) 91 logic gates 129, 132, 147–8 parity bits 55
graphical user interface (GUI) 80 protocols 55, 64–6, 76
scalability factors 55, 67–70
M storage 67, 70
H machine code 141, 142, 145 sustainable 55
hackers 71, 75 machine learning 129, 130, 131, 150–1, topologies and architecture 55, 56,
high bandwidth connections 56 153, 157 58–9, 61–3, 85–7
HLL (high-level languages) 140, 141, chatbots 12 traffic 60
142, 145 in network security 4, 5, 76–7 user management 69
HTTP (Hypertext Transfer Protocol) 66 potential uses of 151 Nintendo Switch 88, 89
HTTPS (Hypertext Transfer Protocol malware 71, 133 normal test data 9, 47, 48, 53, 225
Secure) 66, 76 manufacturing the micro-bit 95, 96, 123
computerising tasks in 130, 131 Python 199, 206, 210–11
machine learning and NOT logic gate 11, 147, 149
I computerisation in 129
icons 129 many-to-many relationships
IDLE (Integrated Development and in relational databases 170 O
Learning Environment) 11, 200 micro:bit one-dimensional arrays 4, 5, 9, 199
industrial practices, computerisation of accelerometer 93, 97, 126 chatbot program 45
130, 151–3 arrays 97–102 game development 88
Industry 4.0 4, 5, 152–3 and count-controlled loops 103–11 Python 216, 217, 218, 228
integers 9, 12, 13, 14, 21, 97, 99, 217 game development 5, 88, 90, 91–7, 111 one-to-many relationships
integrated development environments creating images 116–25 in relational databases 170,
(IDEs) 46, 48 creating a musical output 111–15 172, 174
Internet Service Providers (ISPS) 58 inputs and outputs 91 one-to-one relationships
interpreters 130, 131, 141, 142 programming 88, 90, 91–7, 100–1 in relational databases 170
invalid test data 9, 47, 48, 53, 225 random library 99, 100–1, 102 operating systems 130, 131, 132, 133,
the micro-bit 95, 96, 123 MicroPython 91 134
Python 199, 206, 210–11 accessing 90 command lines 80
IP addresses 64–5 arrays 97, 98 MOS (network operating systems)
iteration 6, 9, 16–18, 28–38, 52–3, 198, creating the program 110, 115 68–9
199 game development 5, 88, 90 network operating systems (NOS)
error processing 23–8 displaying an image 116–23 68–9
game development 88, 120–7 pseudocode plan 93 OR logic gate 11, 147, 149
login systems 202 MS Access 160, 162, 173–4, 190
program development 38–44 MS Excel 160, 162, 182
Python 9, 17–18, 52–3, 198, 199, 200–6 multiple-criteria queries 176, 180–1 P
using with lists 220–4 multi-table queries 176, 179–80 packet switching 65
statements 9 music 111–15 PANs (Personal Area Networks) 57
version control 120 parameter queries 176, 177–8
see also count-controlled loops (for parity-checking systems 72–3, 78–80,
loops) N 85
naming conventions 14, 97 passwords 75, 133, 134
nesting 124, 125 PINs (personal identification numbers)
L network interface cards (NICs) 59 133, 134
LANs (Local Area Networks) 58, 59, 61 network operating systems (NOS) 68–9, PlayStation 89
linear search 223 70 plug-and-play devices 133, 134
lists 35–7, 216–19, 231 networks 4, 5, 55–87 Pong 89
altering contents of 228–30 accessibility 67–8, 70 power surges 71
searching 223–4 administrators 68, 69, 75 programming languages 140–2, 145
storing 131 command lines 80–4 prototypes 4, 5, 18, 130
243
369825_Ind_Cam_LSC_SB_242-248.indd Page 244 06/03/23 10:52 AM A4902 /142/HO02737/work/indd
improving technology 154, 155, 158 robotics 150 test plans 15, 16, 19
micro:bit program codes 126 routers 59, 61, 63, 69 chatbot program 45–8, 53
Python 23, 199 runtime errors 9, 24, 45, 46–7, 48, 199, 225 data types 9, 47, 48, 53, 225
pseudocode 9, 11, 14, 15, 16–17, 19 micro:bit 88, 90, 95, 96, 102, 118–19,
count-controlled (for) loop in 29–30, 123
33–5, 106, 107–8, 110, 111, 204–5 S Python 11, 199, 206, 210–11
creating an image 121–2, 123 security 5, 55, 67, 70, 74–84 Tetris 89
error processing 25 breaches 71 times tables 6
iterative development 16–17, 40, machine learning 4, 5, 76–7 traceback messages 47, 48
43–4, 125 software 75–6, 130, 131, 133, 134, trace tables 6, 9, 16, 18, 19–23, 45,
for a micro:bit program 92, 96, 117, 135, 150 52–3
125, 127 selection 6, 9, 28, 30, 198 debugging a Python program 199
Python 199, 200, 231–2, 233 chatbot program 38, 41 error processing 24, 25–8
trace tables 19–23, 212–13 game development 88, 90, 124 for the micro:bit 88, 103–7, 110,
Python 5, 9, 198–235 nested 124, 125 124–5
count-controlled loops 199, 202–6 sequence 6, 9, 28, 38, 198 creating a musical output 113, 115
data types 9, 11, 200, 207 in game development 88, 90 displaying an image 117
decomposition and sub-programs servers 58, 60 Python 9, 23, 211–15, 221, 222–3
201–2 smartphones 96 traditional manufacturing
identifying errors and debugging Snake 89 computerising tasks in 130, 131,
225–30 social media 160, 163 151–2
IDLE 11, 200 software 4, 129, 132–5 translators 5, 130, 131, 141, 142, 157
IF statement 211, 213 applications software 129, 132 truth tables 156
iterative development 9, 17–18, 52–3, encryption software 69, 76 tuples 216, 217
198, 199, 200–6 network utilities 69, 70
lists 35–7, 216–19 security software 75–6, 130, 131,
using iteration with 220–3 133, 134, 135, 150 U
prototypes 23, 199 spreadsheets 181–4 user access controls 75
running 145 systems software 68–9, 70, 129, 132, user requirements 186
string manipulation 9, 199, 207–11 157 utilities software 130, 131, 132, 133,
test plan 11, 199, 206, 210–11 utilities software 130, 131, 132, 134, 134, 136, 157
trace tables 9, 23, 211–15, 221, 222–3 136, 157
tuples 216, 217 see also operating systems
variables 211, 216, 233 spreadsheets 4, 161, 163, 189–90 V
see also chatbot program data analysis 161 variable data collection 12–15
models 6, 161, 162, 181–4, 191 variables 18, 19, 211, 216, 233
creating 194–5 counter variables 106
Q evaluating 187–8, 197 vehicle telematics 164
Query by Example (QBE) 190–1, 192 star topology 62–3, 63 version control 120
questioning 8, 10 strings 12, 13, 14, 21 virus scanning backup 69
in arrays 36, 97 VLE (virtual learning environment)
converting variables to 109 161–2, 192, 194, 195, 197
R len(i) function 209 voice-pattern recognition 133, 134
radio frequency identification (RFID) manipulation 4, 5, 49
tags 152, 153 in Python 9, 199, 207–11, 219
random access memory (RAM) 133, 134 Structured Query Language (SQLs) 190, W
relational databases 5–6, 161, 162, 192 WANs (Wide Area Networks) 58, 59, 61
165–75 syntax errors 9, 24, 45–6, 48, 91, 199 while true code 99
creating 170–5, 192–4 systems software 68–9, 70, 129, 132, wildcat queries 176, 178–9, 181
data dictionaries 171, 172 134, 135, 157 wireless access point 59
foreign keys 167, 168, 169, 170, 174 see also operating systems
input masks 171, 172
primary keys 167, 168, 169, 170, 171, X
174 T Xbox 89
validation 171, 172 TCP/IP Protocol 64–5
ring topology 62, 63 terminators 61
244
369825_Ind_Cam_LSC_SB_242-248.indd Page 245 09/03/23 8:51 AM A4902 /Data%20Disk/Manoj%20R/2023/March/09-03-23/HO02737_142
Acknowledgements
The Publishers would like to thank the following for permission to reproduce copyright material.
Photo credits
p. 8 t © Coosh448/stock.adobe.com, b © Thapana_Studio/stock.adobe.com; p. 11 © Zapp2photo/
stock.adobe.com; p. 55 © Metamorworks/stock.adobe.com; p. 56 © Parilov/stock.adobe.com; p. 57 t
© Aitorserra/stock.adobe.com, b © Yurakrasil/stock.adobe.com; p. 58 t © Metamorworks/stock.adobe.
com, m © Paisan1leo/stock.adobe.com; p. 59 in descending order © Vadim/stock.adobe.com, ©
Sergey Ilin/stock.adobe.com, © An-T/stock.adobe.com, © Quality Stock Arts/stock.adobe.com;
p. 60 in descending order © Cybrain/stock.adobe.com, © MicroOne/stock.adobe.com, © RankSol/
stock.adobe.com; p. 64 © PCH.Vector/stock.adobe.com; p. 66 © WENN Rights Ltd/Alamy Stock Photo;
p. 68 t © WrightStudio/stock.adobe.com, b © Chaosamran_Studio/stock.adobe.com; p. 71 © Vitalii/
stock.adobe.com; p. 74 © Issaronow/stock.adobe.com; p. 75 © Kt Stock/stock.adobe.com; p. 88 ©
Rosinka79/stock.adobe.com; p. 89 t © Bohdan/stock.adobe.com, m © Oleksandr/stock.adobe.com,
b © Gorodenkoff/stock.adobe.com; p. 91 © Gargantiopa/Shutterstock.com; p. 96 © Jeler/stock.
adobe.com; p. 129 © Macrovector/stock.adobe.com; p. 130 © Adam121/stock.adobe.com; p. 133 ©
Prostock-studio/stock.adobe.com; p. 135 © DGTL Graphics sro/stock.adobe.com; p. 142 © ZinetroN/
stock.adobe.com; p. 147 © Frozen Design/stock.adobe.com; p. 150 © Sammby/Shutterstock.com;
p. 151 © Ico Maker/Shutterstock.com; p. 154 t © Bongkochrut/stock.adobe.com, ml © Gorodenkoff/
stock.adobe.com, m © Gorodenkoff/stock.adobe.com, mr © Gorodenkoff/stock.adobe.com; p. 155
t © Sakinakhanim/Shutterstock.com, b © Stakes/Shutterstock.com; p. 156 in descending order ©
Flatvector/Shutterstock.com, © Agatha-vector/Shutterstock.com, © Andrii/stock.adobe.com; p. 160 ©
Scanrail/stock.adobe.com; p. 161 © Natee Meepian/stock.adobe.com; p. 162 © Merla/stock.adobe.
com; p. 176 © Dimon_ua/stock.adobe.com; p. 181 © Wachiwit/stock.adobe.com; p. 185 © Worawut/
stock.adobe.com; p. 202 © Jane Kelly/stock.adobe.com.
Text credits
The following brands mentioned in this book are trademarks or registered trademarks:
● Android ● Dropbox ● Google.com
● Google Drive ● Google Maps ● iOS
● Javascript ● Linux ● macOS
● Mozilla ● micro:bit ● MicroPython
● Microsoft Access ● Microsoft Excel ● Microsoft OneDrive
● Microsoft Powerpoint ● Microsoft Windows ● Microsoft Word
● MS-DOS ● Nintendo Switch ● Netflix
● Pong ● Python ● Python’s Integrated Development
and Learning Environment
245
369825_Ind_Cam_LSC_SB_242-248.indd Page 246 06/03/23 10:52 AM A4902 /142/HO02737/work/indd
246
369825_Ind_Cam_LSC_SB_242-248.indd Page 247 06/03/23 10:52 AM A4902 /142/HO02737/work/indd
369825_Ind_Cam_LSC_SB_242-248.indd Page 248 06/03/23 10:52 AM A4902 /142/HO02737/work/indd