0% found this document useful (0 votes)
1K views223 pages

Isaac Cs Gcse Book 2022

The document is an excerpt from an Isaac Computer Science GCSE book. It provides an overview of network fundamentals and the internet. Some key points covered include different network topologies like star, mesh, and bus networks. It also discusses client-server and peer-to-peer models and protocols used on the internet like TCP/IP and HTTP. Quiz questions are included to test understanding of topics covered in the excerpt.

Uploaded by

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

Isaac Cs Gcse Book 2022

The document is an excerpt from an Isaac Computer Science GCSE book. It provides an overview of network fundamentals and the internet. Some key points covered include different network topologies like star, mesh, and bus networks. It also discusses client-server and peer-to-peer models and protocols used on the internet like TCP/IP and HTTP. Quiz questions are included to test understanding of topics covered in the excerpt.

Uploaded by

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

Isaac Computer Science GCSE Book

Isaac CS Team
Contents

1 Network fundamentals . . . . . . . . . . . . . . . . . . . . . 1
2 The internet . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3 Network hardware . . . . . . . . . . . . . . . . . . . . . . . . 9
4 Boolean logic . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
5 Systems architecture . . . . . . . . . . . . . . . . . . . . . . 19
6 Memory and storage . . . . . . . . . . . . . . . . . . . . . . 27
7 Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
8 Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
9 Operating systems . . . . . . . . . . . . . . . . . . . . . . . 47
10 High- and low-level languages . . . . . . . . . . . . . . . . . 53
11 Translators . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
12 Social engineering . . . . . . . . . . . . . . . . . . . . . . . . 62
13 Malicious software . . . . . . . . . . . . . . . . . . . . . . . 67
14 Network security . . . . . . . . . . . . . . . . . . . . . . . . . 70
15 Representation of numbers . . . . . . . . . . . . . . . . . . . 76
16 Representation of text . . . . . . . . . . . . . . . . . . . . . 89
17 Representation of images . . . . . . . . . . . . . . . . . . . . 95
18 Representation of sound . . . . . . . . . . . . . . . . . . . . 100
19 Compression . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
20 Encryption . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
21 Database concepts . . . . . . . . . . . . . . . . . . . . . . . . 114
22 SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
23 Data structures . . . . . . . . . . . . . . . . . . . . . . . . . 126
24 Searching algorithms . . . . . . . . . . . . . . . . . . . . . . 132
25 Sorting algorithms . . . . . . . . . . . . . . . . . . . . . . . . 145
26 Legislation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
27 Impacts of technology . . . . . . . . . . . . . . . . . . . . . . 156
28 Programming concepts . . . . . . . . . . . . . . . . . . . . . 158

i
ii CONTENTS

29 String handling . . . . . . . . . . . . . . . . . . . . . . . . . . 172


30 Subroutines . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
31 File handling . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
32 Integrated development environments (IDEs) . . . . . . . . 194
33 Procedural programming . . . . . . . . . . . . . . . . . . . . 198
34 Object-oriented programming . . . . . . . . . . . . . . . . . 200
35 Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
36 Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
37 Computational thinking . . . . . . . . . . . . . . . . . . . . . 216
1 Network fundamentals
A network is a group of devices connected together, wirelessly or using
cables, so that they can communicate with each other and share resources.
Networks can be structured in different ways (called topologies), and may
also be categorised as client–server or peer-to-peer networks. There
are benefits and drawbacks to each approach.
Network standards and protocols allow a wide range of devices from
different manufacturers to communicate with each other. The speed at which
a network operates is important to most users and you will learn about the
factors that impact a network’s performance.

1.1 Star network topologies


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_net_02

▶ A star network topology is where all the nodes are arranged in a star
layout and connected to a device at its centre point. What is the name
of the device at the centre of the star which can direct the signals to their
intended recipients only?

1.2 Client-server and peer-to-peer networking


OCR isaaccs.org/bq/gcse_net_11

▶ Below are statements that highlight some of the differences between client–
server and peer-to-peer networking. Pick one statement that is not correct.

⃝ In a peer-to-peer network, any device can share resources with any


other device in the network.

⃝ In a peer-to-peer network, a computer can act as both a client and a


server.

⃝ Management of network security and maintenance is usually easier in


a client–server model.

⃝ In a client-server model, all processing must be done in the server side.

1
2 1. NETWORK FUNDAMENTALS

1.3 Network topologies


EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_net_01

A local hospital has a computer network that uses a bus network topology.
It is finding that the network is slow and is taking too long to retrieve patient
records. They have been advised to create a mesh network.

▶ For which of the following reasons is a mesh network the correct choice?

⃝ All workstations are connected to a central point, like a hub or a switch.


⃝ Mesh networks are cheap to set up and data is transmitted very quickly.
⃝ Maintenance costs are lower on a mesh network, because they don’t
use terminators.
⃝ Mesh networks are the most reliable type of network, because data can
take a number of possible routes to get to the intended recipient.

1.4 Peer-to-peer networking


OCR isaaccs.org/bq/gcse_net_12

▶ Which one of the statements below correctly describes the peer-to-peer


networking model?

⃝ The peer-to-peer networking model is very secure, because every device


goes through an authentication process before it joins the network.
⃝ In peer-to-peer networking, devices can’t share their resources with,
and request resources from the other devices in the network.
⃝ In peer-to-peer networking, there is no central server.
⃝ Peer-to-peer networking involves a central, powerful computer called a
server, and a number of client computers that need to connect to the
server to carry out specific tasks.
1. NETWORK FUNDAMENTALS 3

1.5 Ethernet
AQA EDEXCEL OCR WJEC isaaccs.org/bq/gcse_net_17

▶ Which of the following statements about Ethernet is not correct?

⃝ All Ethernet devices can process the data received from the router,
because they all use the same protocols.
⃝ Ethernet is a method to connect computers to a network using a wire-
less router.
⃝ Ethernet is a group of networking technologies commonly used in local
area networks.
⃝ Ethernet routers use the same set of protocols.

1.6 Shape of the network 1


EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/net_network_g01

▶ What topology is illustrated in the diagram?


4 1. NETWORK FUNDAMENTALS

1.7 Shape of the network 2


AQA EDEXCEL EDUQAS WJEC isaaccs.org/bq/net_network_g02

▶ What topology is illustrated in the diagram?

1.8 Shape of the network 3


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/net_network_g03

▶ What topology is illustrated in the diagram?


2 The internet
The internet is a global system of interconnected computer networks. The
internet facilitates a wide range of services, including the World Wide Web,
email, internet telephony, and file sharing. In order to communicate to do
any of those things, computers must use a common set of protocols referred
to as the TCP/IP stack.
At a more advanced level, it is important to understand that standards
(as well as protocols) are essential for the internet to function. JSON and
XML are both standards for the interchange of data and provide a standard
for data exchange via the World Wide Web.

2.1 HTTP protocol


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_net_05

▶ Networks use protocols to establish a common set of rules to communicate.


Network communication on the internet is arranged in abstract layers called
the TCP/IP model (also referred to as the TCP/IP stack). At which layer
in this model would you expect to see the HTTP protocol?

⃝ Link or data link layer


⃝ Transport layer
⃝ Application layer
⃝ Network or internet layer

2.2 TCP protocol


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_net_06

▶ Networks use protocols to establish a common set of rules to communicate.


Network communication on the internet is arranged in abstract layers called
the TCP/IP model (also referred to as the TCP/IP stack). At which layer
in this model would you expect to see the TCP protocol?

⃝ Transport layer
⃝ Application layer
⃝ Network or internet layer
⃝ Link or data link layer

5
6 2. THE INTERNET

2.3 Data packets


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_net_10

When data is sent across a network it is broken into packets, each with their
own control information.

▶ Which of the following pieces of data are not part of a data packet?

⃝ Sender’s IP address

⃝ Receiver’s IP address

⃝ Time the data was sent

⃝ Checksum

2.4 Dude, where's my page?


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_net_13

▶ Number the following statements in order, to explain what happens when


you type the URL of a webpage into your browser. (Assume that none of
the information is cached.)

□ The DNS server sends your computer the relevant IP address.


□ The web server sends your computer the webpage.
□ The DNS server looks up the IP address of the server that you want.
□ You type the URL into your browser.
□ Your computer sends a request to the web ’servers IP address.
□ Your computer sends a lookup request to the DNS server.
2. THE INTERNET 7

2.5 Layers of protocols


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_net_14

The TCP/IP networking model is split into four layers. Each of these layers
has a specific purpose and supports different protocols (rules for communic-
ation). The four layers are:

1. Application layer

2. Transport layer

3. Network layer (internet layer)

4. Link layer (data link layer)

Below are four commonly used communication protocols. Each protocol


works on only a single layer of the layers listed above.
▶ Using the order of the layers given above, number the protocols so that
they are in the same position in the list as the layer that they work on:

□ UDP
□ IP
□ Wi-Fi
□ HTTP
2.6 IP addresses
AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/net_internet_g01

▶ Why do all devices that connect to a network or the internet need a unique
IP address?

⃝ To provide the device with a particular identifier

⃝ It reduces the reliance on the transport layer

⃝ It increases the speed of transmission


8 2. THE INTERNET

2.7 Protocols
AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/net_internet_g02

▶ What best describes an internet protocol?

⃝ A set of rules that enables two or more digital devices to communicate


⃝ Hardware that is used by DNS servers
⃝ Software that enables a digital device to access the internet

2.8 Layers and protocols


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/net_internet_g03

▶ Complete the table by adding the correct layer or protocol into the spaces
so that each protocol matches the layer at which it operates.

Layer Protocol
Application
TCP
Internet
Ethernet

□ Frame
□ Wireless
□ CAT4
□ Transport
□ Link
□ HTML
□ IP
□ HTTP
□ Packet
3 Network hardware
Network hardware is the term used for all of the hardware components that
can be found in computer networks. This includes the network inter-
face controllers, that are used to connect individual devices to a network,
and components such as switches and routers, that are used to build the
backbone of the network.
Devices can be connected by cable or wirelessly. Many networks have both
wired and wireless connections.

3.1 Network problem


EDUQAS OCR isaaccs.org/bq/net_hard_g01

▶ An international fashion brand with shops and offices in different cities


has many interconnected networks. In one of the offices there is a hardware
fault and none of the computers can communicate with each other. Devices
in other shops and offices can still communicate with each other. Which
option is the most likely hardware fault?

⃝ A switch connecting computers in the affected office has broken.

⃝ The router in the affected office has been switched off.

⃝ The NICs have lost their configuration settings.

⃝ The modem has broken.

3.2 Network media


AQA EDEXCEL OCR isaaccs.org/bq/net_hard_g02

▶ Which of the following network media can provide reliable communication


over a long distance?

⃝ Coaxial cable

⃝ Wi-Fi

⃝ UTP (Ethernet) cable

⃝ Fibre-optic cable

9
10 3. NETWORK HARDWARE

3.3 Your data packet


OCR isaaccs.org/bq/net_hard_g03

You are researching universities using a school computer which is connected


to the school’s LAN. You open a web browser and type the website address
of a university into the address bar and press the Enter key. This creates a
data packet.
▶ Put the following network hardware components in the order in which
they would receive the data packet containing this request.
(Note: This is not an exhaustive list of all hardware required. Some steps
in the journey have been left out.)

□ Router

□ Fibre-optic cable

□ Network interface card

□ Switch
4 Boolean logic
Computers are made up of digital circuits. Each component in a circuit
has an input voltage that can be evaluated as True or False, or 1 or 0.
Boolean logic is a way of describing the circuits inside a computer, and
the same concept can be represented by a logic circuit diagram, a truth
table, or a Boolean expression.
At a more advanced level, you will study more complex logic gates, although
all circuits can ultimately be derived from the combination of a small subset
of basic gates. Using a formal notation for describing the combination of
logical operations will allow you to apply standard rules to simplify complex
Boolean expressions. You will explore some standard circuits in detail, such
as a full adder, which allows arithmetic addition, and a D-type flip-flop
circuit, which is a very basic unit of memory.

4.1 Find the output


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_bool_02

▶ Is the output (D) of the circuit above T or F when all its inputs (A, B,
C) are T?

Answer:

11
12 4. BOOLEAN LOGIC

4.2 Which gate is it?


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_bool_08

▶ Which logic gate does the truth table below represent?

⃝ NOR
INPUT INPUT OUTPUT
0 0 1 ⃝ NOT
0 1 0
1 0 0 ⃝ NAND
1 1 0
⃝ XOR

4.3 Choose a truth table


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_bool_01

▶ Circle the correct truth table for the logic gate represented by the following
symbol.

A B OUTPUT A B OUTPUT
0 0 0 0 0 0
0 1 1 0 1 1
1 0 1 1 0 1
1 1 1 1 1 0

A B OUTPUT
0 0 0 A OUTPUT
0 1 0 0 1
1 0 0 1 0
1 1 1
4. BOOLEAN LOGIC 13

4.4 Choose a logic circuit diagram


AQA OCR isaaccs.org/bq/gcse_bool_03

A watering sprinkler (W) is on when the timer (T) is set, the temperature
(C) exceeds 26◦ Celsius, and the rain sensor (R) does not detect rainfall.

▶ Select the correct logic diagram for the sprinkler.

A B

C D

Answer:
14 4. BOOLEAN LOGIC

4.5 Find truth table values


AQA OCR isaaccs.org/bq/gcse_bool_04

▶ Fill in the missing values in the truth table for the logic circuit diagram
below, given the following inputs:

A B C D E
0 0 0 0 0
0 0 1 0 0
0 1 0 1 0
0 1 1 1 1
1 0 0 0
1 0 1 1 1
1 1 0
1 1 1 1 1
4. BOOLEAN LOGIC 15

4.6 Interpret a truth table


AQA EDUQAS OCR WJEC isaaccs.org/bq/gcse_bool_05_v2

▶ Select the Boolean expression that corresponds to this truth table:

INPUTS OUTPUT ⃝ Q = NOT (A OR B)


A B Q
0 0 1 ⃝ Q = NOT(A AND B)
0 1 1 ⃝ Q = A AND (NOT B)
1 0 1
1 1 0 ⃝ Q = (NOT A) OR B

4.7 Wire this up!


AQA OCR isaaccs.org/bq/gcse_bool_07

▶ Which of the circuits below represents the following Boolean expression?


=(A�B)�(C+B)

A B

C D

Answer:
16 4. BOOLEAN LOGIC

4.8 Tables and gates


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_bool_09

A truth table is a table showing the outputs for all possible combinations of
inputs to a logic gate or circuit. When putting values into a truth table, we
often write them as 1 or 0. These values are interchangeable with True and
False: 1 is True, and 0 is False.
Below we have an example of a logic gate:

▶ Circle the truth table that represent the logic gate provided:

A B Q A B Q
0 0 1 0 0 0
Option A 0 1 1 Option B 0 1 1
1 0 1 1 0 1
1 1 1 1 1 0

A B Q A B Q
0 0 1 0 0 1
Option C 0 1 0 Option D 0 1 1
1 0 0 1 0 1
1 1 0 1 1 0
4. BOOLEAN LOGIC 17

4.9 The XOR gate (exclusive OR)


AQA EDUQAS WJEC isaaccs.org/bq/gcse_bool_10

The following symbol represents an XOR gate (also known as Exclusive OR).

▶ Circle the correct truth table for an XOR gate from the options shown
below.

A B Q A B Q
0 0 1 0 0 1
Option A 0 1 1 Option B 0 1 0
1 0 1 1 0 0
1 1 0 1 1 0

A B Q A B Q
0 0 0 0 0 0
Option C 0 1 1 Option D 0 1 1
1 0 1 1 0 1
1 1 0 1 1 1

4.10 Which Boolean expression?


AQA isaaccs.org/bq/sys_bool_exp_truth_g1

▶ Which Boolean expression represents the function described by the truth


table?

Inputs Output ⃝ X ∧ ¬Y
X Y Q
0 0 0 ⃝ ¬(X ∧ Y )
1 0 1 ⃝ X ∨ ¬Y
0 1 0
1 1 0 ⃝ ¬X ∧ Y
18 4. BOOLEAN LOGIC

4.11 Which Boolean expression 2


AQA isaaccs.org/bq/sys_bool_exp_truth_g2

▶ Which Boolean expression represents the function described by the truth


table?

Inputs Output ⃝ ¬X ∧ Y
X Y Q
0 0 0 ⃝ X ∨ ¬Y
1 0 1 ⃝ X ∧Y
0 1 1
1 1 0 ⃝ X ⊻Y

4.12 Which logical operator?


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/sys_bool_truth_g1

▶ Which logical operator has been used in the following truth table to pro-
duce output Q?

Inputs Output ⃝ AND


X Y Q
0 0 0 ⃝ NOT
1 0 1 ⃝ XOR
0 1 1
1 1 0 ⃝ OR

4.13 Which logical operator 2?


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/sys_bool_truth_g2

▶ Which logical operator has been used in the following truth table to pro-
duce output Q?

Inputs Output ⃝ XOR


X Y Q
0 0 0 ⃝ AND
1 0 0 ⃝ NOT
0 1 0
1 1 1 ⃝ OR
5 Systems architecture
Systems architecture refers to the structure of the internal components
of a computer system. Modern computers often have a von Neumann
architecture, which involves: a processor; a memory unit, which stores
both instructions and data; connections for input and output devices; and
secondary storage for data. The fetch-decode-execute cycle describes
how instructions are retrieved and processed in order to run a program.
Several factors affect processor performance, including the number of cores
and the size of the cache.

5.1 Hardware
AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/embedded_systems_g_01

▶ Embedded systems are often part of a larger computer system. From the
options below, select 3 that describe the hardware components of embedded
systems.

□ All the components are on a single printed circuit board

□ The components have very close control over the hardware

□ They are specialised to the tasks they perform

□ They have a high number of features and functions

5.2 Identifying embedded systems


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/embedded_systems_g_02

▶ Embedded systems can be hard to spot, and general-purpose systems often


masquerade as embedded systems. From the list below, select 1 embedded
system.

⃝ A desktop computer

⃝ Raspberry Pi

⃝ A washing machine

⃝ A laptop

19
20 5. SYSTEMS ARCHITECTURE

5.3 Select the correct component


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_sys_01

▶ Which one of the following CPU components is used to reduce how long
the processor has to wait for data and instructions?

⃝ Arithmetic and logic unit (ALU)

⃝ Cache

⃝ Control unit (CU)

⃝ Bus

5.4 Decode stage processes


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_sys_02

▶ Which one of the following statements describes the decode stage of the
fetch-decode-execute cycle?

⃝ The control unit (CU) works out what the instruction is about.

⃝ The instruction to be executed is fetched from the main memory to


the CPU.

⃝ The results of the calculations that took place are stored back to the
main memory.

⃝ The arithmetic and logic unit (ALU) carries out the instruction.

5.5 Find the odd one out


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_sys_06

▶ Which one of the below is not an example of an embedded system?

⃝ Dishwasher

⃝ Car navigation system

⃝ Smartphone with a navigation app

⃝ Car anti-lock braking system (ABS)


5. SYSTEMS ARCHITECTURE 21

5.6 CPU performance


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_sys_07

▶ Matthew is a web designer who uses processor-intensive applications (e.g.


Adobe Photoshop). He wants to buy a new laptop and has the following
options. Which one is the best choice for him?

⃝ Clock speed = 3.5 GHz Cores = 6 Cache = 10 MB


⃝ Clock speed = 3.6 GHz Cores = 2 Cache = 4 MB
⃝ Clock speed = 4,600 MHz Cores = 4 Cache = 8 MB
⃝ Clock speed = 1.2 GHz Cores = 4 Cache = 2 MB

5.7 A fetching problem


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_sys_14

▶ During the fetch stage of the fetch-decode-execute cycle, a program in-


struction is fetched from the main memory. What is the name of the com-
ponent that connects the processor to main memory?

⃝ ALU
⃝ Register
⃝ Control unit
⃝ Bus

5.8 Clock speed


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_sys_15

▶ When comparing two processors which are identical except for the clock
speed - which of the following statements will be true about the processor
with the higher clock speed?

□ Data needs to be fetched from RAM less often

□ More instructions can be executed per second

□ Programs take less time to run

□ More cycles are completed per second


22 5. SYSTEMS ARCHITECTURE

5.9 Tick-tock
AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_sys_16

▶ The clock is used to synchronise the operations of the processor. Its speed
is measured in cycles per second, and expressed in hertz (Hz), where 1Hz is
one cycle per second. My computer system has a published processor speed
of 3.3 GHz. How many cycles per second is my processor designed to operate
at?

⃝ 3,300

⃝ 3,300,000,000

⃝ 3,300,000

⃝ 3.3

5.10 The decode stage


AQA CIE EDUQAS OCR WJEC isaaccs.org/bq/gcse_sys_17

▶ During the decode stage of the fetch-decode-execute cycle, which com-


ponent of the CPU is used to send signals to other components on what
needs to be done to execute the instruction?

⃝ Main memory (RAM)

⃝ Control unit (CU)

⃝ Arithmetic and logic unit (ALU)

⃝ Memory data register (MDR)

5.11 Processor performance


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/sys_arch_g01

▶ What may cause a processor to overheat?

⃝ Reducing the amount of cache memory

⃝ Increasing the number of cores

⃝ Overclocking the clock speed


5. SYSTEMS ARCHITECTURE 23

5.12 Prepare for processing


AQA CIE EDUQAS OCR WJEC isaaccs.org/bq/gcse_sys_18

▶ The CPU is responsible for processing data and executing instructions


inside a computer, there are a number of stages that instructions must go
through before they reach the CPU. Which of the following statements about
the instructions a CPU will execute are true? (Tick all that apply)

□ The instructions are loaded into main memory from secondary storage

□ The data required for the instructions has been loaded into main
memory

□ The instructions all need to be loaded into the processor at once so it


can read them

□ The user must enter their password to give permission for the instruc-
tions to be executed

□ The instructions are translated into machine code that the processor
can understand

5.13 Fetch, decode and execute


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_sys_20

▶ Which of the following statements best describes the fetch-decode-execute


cycle?

⃝ The fetch-decode-execute cycle is a process that the CPU repeats con-


tinuously in order to execute instructions.

⃝ The fetch-decode-execute cycle ensures improves the security of a com-


puter system.

⃝ The fetch-decode-execute cycle uses the the arithmetic logic unit (ALU)
to connect the registers to the main memory.

⃝ The fetch-decode-execute cycle uses a bus to store the data.


24 5. SYSTEMS ARCHITECTURE

5.14 Storing instructions and data


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_sys_19

▶ The term Von Neumann architecture is used to refer to any computer


system where an operation to fetch an instruction and an operation to fetch
data cannot occur at the same time because they share a common bus.
Which of these statements about von Neumann architecture are correct?
(Tick all that apply)

□ Instructions and data are held in separate units of main memory.

□ It uses registers to help prevent slowing down the fetch-decode-execute


cycle.

□ The program counter keeps track of the memory address of the instruc-
tion that needs to be executed next.

□ The memory address register holds the address in main memory that
is currently being read or written.

□ The accumulator is a data register that can be used to store the results
of calculations.

□ The memory data register holds data fetched from memory or data
waiting to be stored in memory.

5.15 Registers
AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/sys_arch_g02

▶ Which sentence below best describes dedicated or special-purpose re-


gisters?

⃝ Registers that are used to store the results of intermediate calculations


that are part of larger computations.

⃝ Processor-based registers that are used for a specific purpose.

⃝ Temporarily holds the data (data values or instructions) that are read
from or written to the main memory.

⃝ Temporarily stores the memory addresses used when searching for data
in RAM.
5. SYSTEMS ARCHITECTURE 25

5.16 Getting what you pay for


AQA CIE EDUQAS OCR WJEC isaaccs.org/bq/gcse_sys_22

A civil engineer needs to use applications that require a high specification


computer system (e.g. AutoCAD). She has only a basic laptop computer
and its configuration is not good enough to run the applications, which
are processor intensive. She has decided to buy a more powerful desktop
computer and there are a few options available.
In general terms, the higher the clock speed, the more instructions a com-
puter can process per second. However, other factors relating to the system’s
architecture, such as cache and the number of cores, should be considered.
▶ Consider the options below and select the specification that will best
match her needs to run processor-intensive applications.

⃝ Option A

Computer specification
Clock speed 3.6GHz

⃝ Option B

Computer specification
Clock speed 1.2GHz

⃝ Option C

Computer specification
Clock speed 4.6GHz

⃝ Option D

Computer specification
Clock speed 3.5GHz
26 5. SYSTEMS ARCHITECTURE

5.17 Embedded systems


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_sys_21

An embedded system is a computer system dedicated to a specific task (or


set of tasks). Embedded systems, just like general purpose computers, take
input, run processes, and produce output. The emebdded system combines
the processor, memory, and input/output devices into a single unit.
Most modern day devices and appliances contain embedded systems, as they
need some level of computational processing.
▶ Which of the options listed below would not be suitable for an embedded
system?

⃝ Central Heating
⃝ Laptop
⃝ Microwave
⃝ Digital clock
⃝ Medical Equipment
⃝ Vending Machine
6 Memory and storage
Computers have two fundamental types of memory — main memory and
secondary storage. Main memory is where data and instructions are stored
so that they can be accessed directly by the CPU. Secondary storage is
used to permanently store data such as the operating system and the user’s
files.

6.1 The purpose of RAM


AQA CIE EDUQAS OCR WJEC isaaccs.org/bq/gcse_sys_11

▶ Select the statement that describes a purpose of Random-access memory


(RAM).

⃝ RAM is used to store the BIOS which is used when the computer is
started.

⃝ RAM is used to store instructions and data that the processor can
directly access.

⃝ CD-RWs are made up of RAM so that they can be rewritable.

⃝ The hard disk drive (HDD) is made up of RAM so that data can be
permanently stored.

6.2 Remember, remember


AQA CIE EDUQAS OCR WJEC isaaccs.org/bq/gcse_sys_12

▶ Select four from the following statements about memory that are true:

□ The contents of ROM are lost when power is switched off

□ ROM is a type of primary memory

□ RAM is volatile memory

□ ROM can store the code needed to load the operating system into
RAM

□ Main memory is always volatile

□ Virtual memory uses secondary storage to store data from the RAM

27
28 6. MEMORY AND STORAGE

6.3 Back-up...
AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_data_14

Marik is about to back-up his mobile phone data. The back-up storage app
on his phone is reporting the following values in GB (gigabyte):

Description Size
Photos 17.25 GB
Documents 3.25 GB
Messages 21.25 GB
Other data 2.75 GB

▶ Marik’s total internal back-up storage phone capacity is 50 GB. How


much free space is left of Marik’s back-up storage phone capacity?

⃝ 5,500,000,000 bytes

⃝ 5,000,000,000 bytes

⃝ 5,000,500,000 bytes

⃝ 44,500,000,000 bytes

6.4 Data storage units in order


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_data_18

▶ Arrange the below units of data storage into order from smallest to largest.

□ 8000 MB

□ 9 TB

□ 7.8 GB

□ 5.7 kB

□ 2000 bits

□ 200 bytes
6. MEMORY AND STORAGE 29

6.5 How much space?


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_data_26

Tia is calculating the amount of disk storage that her bitmapped graphic
will use. She has calculated that the total file size in bits as 12, 200, 000.
▶ How many megabytes of storage space will the file need?

6.6 Hard drive disadvantage


AQA CIE EDUQAS OCR WJEC isaaccs.org/bq/gcse_sys_05

▶ Which one of the statements below describes a disadvantage of magnetic


hard drives (HDDs)?

⃝ Hard drives are usually physically smaller than solid state drives, which
means that they have less capacity for backing up data.
⃝ Hard drives can be difficult to manufacture.
⃝ It is significantly slower to access data stored on a hard drive than on
a solid state disk because the hard drive has moving parts, such as the
read/write head and the rotating platters.
⃝ Hard drives are prone to scratches because they have a moving read/write
head, and this can make parts of files unreadable.
30 6. MEMORY AND STORAGE

6.7 RAM or ROM?


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_sys_03

▶ Put the statements below into order to create one paragraph about the
characteristics of RAM and then the characteristics of ROM.

□ it is used to store software that doesn’t need to be changed

□ RAM

□ the CPU is currently working with because

□ such as the code needed to load the Operating System

□ is a volatile type of memory and

□ it is very useful for storing instructions and data

□ when the computer is switched on.

□ ROM

□ is a non-volatile type of memory and

□ it can be read from and written to.


6. MEMORY AND STORAGE 31

6.8 Optical storage


AQA CIE EDUQAS OCR WJEC isaaccs.org/bq/gcse_sys_13

▶ Select three of the following statements about optical storage that are
true:

□ A CD-ROM is a type of optical media

□ Optical media isn’t easily portable due to the internal moving parts

□ A laser beam burns tiny pits onto the disc

□ Optical media can only be read-only memory

□ Optical media has a limited amount of storage capacity compared to


other types of storage

□ Optical media is organised in groups of circular discs called platters

6.9 How many video files?


AQA CIE EDUQAS OCR WJEC isaaccs.org/bq/gcse_sys_08

▶ Pamela has a 128GB USB flash drive that is 60% full. How many video
files can she store on the flash drive if each file is 25.6MB? Assume 1kB =
1000 bytes.
32 6. MEMORY AND STORAGE

6.10 Which type of storage?


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_sys_04

Laura has planned to go hiking in Snowdonia. She wants to take photos and
videos of her trip with her digital camera and then show them to her friends,
but her camera is running out of space.
▶ Which type of storage is the most suitable in this case?

▶ Which storage device would you recommend so that Laura does not run
out of storage?

6.11 The levels of cache


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/sys_arch_memory_g_03

Cache memory is typically split into three levels. These levels have slightly
different characteristics and enable the processor to save frequently used
instructions.
▶ The levels have different access speeds. Number them in order from the
fastest (1) to access to the slowest (3).

□ Level 1
□ Level 2
□ Level 3
▶ The levels of cache also have different storage capacities. Number them
in order from the largest (1) to the smallest (3).

□ Level 1
□ Level 2
□ Level 3
6. MEMORY AND STORAGE 33

6.12 What to store in RAM


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/sys_arch_memory_g_01

▶ Random access memory (RAM) is used as “working memory” while a


program is executed. Which parts of a computer program are held in RAM
while it is processing?

⃝ Intermediate values from calculations


⃝ Instructions and data
⃝ Only the instructions
⃝ Only the data

6.13 Reasons for the cloud


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/sys_arch_storage_g_04

▶ In recent years, the use of cloud storage has greatly increased. Which three
of the following characteristics are important reasons to use cloud storage to
store files?

□ Sharing files
□ Expandable storage capacity
□ Safe back-ups
□ Speed of access
□ Cost

6.14 The largest memory


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/sys_arch_memory_g_02

▶ There are many types of main memory, used for a variety of purposes.
Which of the following is most often the highest capacity memory device
inside a computer?

⃝ Registers
⃝ RAM
⃝ Cache
⃝ ROM
34 6. MEMORY AND STORAGE

6.15 How to back up your archives


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/sys_arch_storage_g_01

Miguel works for a video production company and needs to clear up some
space on his computer.

He has hundreds of gigabytes of video clips and projects that need to be


backed up onto a storage device. The company does not want to spend too
much money. They also would like to store the files in the office, to keep
the files safe and easy to access. The new device does not need to be quick,
as the files would first be transferred to a fast device installed on Miguel’s
computer before he uses them.

▶ Which three characteristics of a storage device are most important to


Miguel and his company?

□ Speed of access

□ Portability

□ Reliability

□ Capacity

□ Cost

▶ Which type of storage would you recommend for Miguel?

⃝ Solid-state storage
⃝ Magnetic storage
⃝ Optical storage
⃝ Cloud storage
6. MEMORY AND STORAGE 35

6.16 Sharing a special moment


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/sys_arch_storage_g_02

Rosa has just graduated from university and her mother was there to capture
it on video.

Now Rosa’s family wants to see the video to celebrate with her. Many family
members have asked Rosa to send them a copy of the video so they can share
in her triumphant moment. However, Rosa has lots of relatives and not all of
them have access to an internet connection. They all have access to storage
connections such as a USB and CD drive. The video is only a few megabytes
in size.

▶ Which three characteristics are most important to Rosa for selecting a


storage device?

□ Speed of access

□ Portability

□ Reliability

□ Cost

□ Capacity

▶ Which type of storage would you recommend for Rosa?

⃝ Optical storage
⃝ Magnetic storage
⃝ Cloud storage
⃝ Solid-state storage
36 6. MEMORY AND STORAGE

6.17 Make it faster


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/sys_arch_storage_g_03

Mads works as a product designer for a fashion retail company.

He frequently uses an application to create 3D designs for clients, but he is


having issues with it. The application is slow to load and often takes minutes
to save his progress. One day after losing a file for the fourth time, Mads
decides he needs a new storage device to save his application on.

His company has offered to pay for a new storage device if it will help Mads
do his work, so money is no concern. The program is quite large and complex.

▶ Which three characteristics are most important to Mads for selecting a


storage device?

□ Speed of access

□ Capacity

□ Cost

□ Portability

□ Reliability

▶ Which type of storage would you recommend for Mads?

⃝ Optical storage
⃝ Solid-state storage
⃝ Cloud storage
⃝ Magnetic storage
7 Hardware
Hardware is the word used for the physical components of a computer
system. Hardware can refer to the internal parts of the computer (mother-
board, CPU, and RAM), or external devices, known collectively as peri-
pherals. Peripheral devices can be used to input data (keyboards, mi-
crophones, scanners), output data (monitors, printers, speakers), or to store
data (external hard drives, USB memory sticks).

7.1 PCBs
EDUQAS WJEC isaaccs.org/bq/sys_hard_g01

▶ Which of the following components would be considered to be a printed


circuit board (PCB)? Select one.

⃝ CPU

⃝ Graphics processing unit

⃝ Fan

⃝ Graphics card

7.2 Input devices


EDUQAS WJEC isaaccs.org/bq/sys_hard_g02

▶ Which of the following input devices would be most suitable to open an


app on a smartphone? Select one.

⃝ Keyboard

⃝ Mouse

⃝ Trackpad

⃝ Touchscreen

37
38 7. HARDWARE

7.3 Selecting a printer


EDUQAS WJEC isaaccs.org/bq/sys_hard_g03

▶ Aanya has recently set up her business as a professional photographer. She


needs a printer that will print her photographs in the best possible quality.
Which type of printer is the most suitable for Aanya? Select one.

⃝ 3D printer
⃝ Inkjet printer
⃝ Plotter
⃝ Laser printer

7.4 Input devices


EDUQAS WJEC isaaccs.org/bq/sys_hard_g04

▶ Which two of the following statements are true?

□ A mouse and a microphone are both input devices.

□ A mouse and a monitor are both input devices.

□ A touchscreen monitor can be both an input and output device.

□ A mouse and a printer are both input devices.

7.5 Mother, I'm bored!


EDUQAS WJEC isaaccs.org/bq/sys_hard_g10

▶ Which component on a motherboard carries data?

⃝ RAM
⃝ Bus
⃝ CPU
7. HARDWARE 39

7.6 Output devices


EDUQAS WJEC isaaccs.org/bq/sys_hard_g05

▶ Put the devices into the correct position in the table to match their pur-
pose.

Purpose Device
Uses one or more pens to draw an image. Pens are
lifted or applied to the paper as required to
produce very precise drawings.
Generates sound waves from data being received
from a sound card. Often built into a computer
system, but can also be connected as external
peripherals.
Allows for three-dimensional designs on a
computer to be printed in a solid form. The device
uses filament, usually in the form of plastic-based
resin, which is heated and printed layer by layer to
form a solid object.
Prints a whole page at a time and is typically
capable of printing hundreds of pages per minute.
This device uses powdered ink called toner.
Uses liquid ink to produce black-and-white or
coloured prints. Liquid ink produces rich colours,
meaning it is the most suitable for printing
photographs.

□ Laser printer

□ Plotter

□ 3D printer

□ Speaker

□ Inkjet printer
40 7. HARDWARE

7.7 RFID tags


EDEXCEL isaaccs.org/bq/sys_hard_g06

RFID tags are made up of an antenna — for receiving and transmitting the
radio frequency signals — and a chip, which processes the signals. Each
tag has a unique identifier and will often store some additional data in a
non-volatile memory cell.
▶ Read through the statements below and put the words provided into the
correct places to fill the gaps.

Passive devices do not contain a . Instead, the device

is powered by transmitted by the reader. The antenna

collects the energy from the transmitter to activate the .

Active systems have a small battery within the tag, and the device will

transmit its at regular intervals. Active RFID devices

are commonplace in shops, where tags are secured onto

items. The tags are deactivated or removed when the goods are paid for. A

is situated at the shop’s exit and an alarm is triggered

if it detects an activated tag when a customer leaves the shop.

□ power supply

□ radio energy

□ chip

□ identifier

□ battery-powered

□ reader
7. HARDWARE 41

7.8 So you think you are smart?


EDUQAS WJEC isaaccs.org/bq/sys_hard_g08

Below is an example of a smartphone:

▶ Using the table below, state whether each of these components of a smart-
phone is an input, output, or both:

Feature Input/Output/Both
Speaker
Microphone
Touchscreen
Camera

7.9 Accessible input


EDUQAS WJEC isaaccs.org/bq/sys_hard_g09

▶ Bryn has locked-in syndrome, a severe motor disability that means he


has no fine motor control and cannot use conventional input devices. Which
hardware device listed below would be the most appropriate in enabling
Bryn to interact with and use his computer?

⃝ Sip/puff switch
⃝ Keyboard
⃝ Touchscreen
42 7. HARDWARE

7.10 In, out, shake it all about


EDUQAS WJEC isaaccs.org/bq/sys_hard_g07

▶ Complete the table below by labelling each device as either input or out-
put.

Device Input or Output


Monitor
Printer
Keyboard
Mic
Speaker
8 Software
Software is the word used to describe the programs that provide the in-
structions to control the computer hardware components. There are several
broad categories of software: application software provides a tool for a
specific purpose (for example, a word processor), system software controls
the hardware (for example, an operating system) and utility software helps
configure and maintain the computer.

8.1 Categories of software


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/sys_os_software_defs_g01

▶ Which of the following categories of software would an operating system


be classed as?

⃝ Utility software
⃝ System software
⃝ Application software

8.2 Disk defragmentation


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/sys_os_software_utility_g01

▶ What processes does disk defragmentation follow? Number the statements


in the correct order.

□ Files are temporarily moved to a ”scratch” part of the hard drive


□ Related data is collected together
□ The empty spaces are collected together
□ Data is replaced on the main section of the hard disk

43
44 8. SOFTWARE

8.3 Apps for who?


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/sys_soft_g01

▶ Which one of these uses application software to perform tasks?

⃝ Operating system
⃝ System software
⃝ Utilities
⃝ Users

8.4 Sending files


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/sys_soft_g02

▶ Fill in the gap using one of the words provided.

The time required for users to download a file can be reduced by using

software on the file before it is uploaded.

□ encryption

□ compression

□ defragmentation

8.5 Dealing with corrupt files


EDEXCEL EDUQAS WJEC isaaccs.org/bq/sys_soft_g05

▶ Which one of these utilities should be run on a corrupt file?

⃝ Compression
⃝ Defragmentation
⃝ File repair
⃝ Encryption
8. SOFTWARE 45

8.6 Defrag all the things?


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/sys_soft_g04

▶ Which one of these is a reason why the performance of a solid-state drive


is not improved by running a defragmentation utility on it.

⃝ Files stored on a solid-state drive cannot be fragmented


⃝ Solid-state drives already have faster read times than magnetic drives
⃝ Utility software can only be used with magnetic media
⃝ Solid-state drives have no moving parts

8.7 Locked down


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/sys_soft_g06

▶ Complete this sentence by adding the missing word into the space provided.

An encryption algorithm, also called a is used to encrypt

plain text.

8.8 In case of emergency!


AQA EDEXCEL EDUQAS WJEC isaaccs.org/bq/sys_soft_g07

▶ Complete this sentence by adding the missing word into the space provided.

Computers use utilities so that data can be restored in

the case of a system failure.


46 8. SOFTWARE

8.9 Is your knowledge secure?


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/sys_soft_g08

▶ Which one of these is used by an anti-malware utility?

⃝ Encryption software
⃝ System cleanup tools
⃝ A directory of known viruses
⃝ Corrupt data

8.10 Order! Order!


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/sys_soft_g03

Two files (A and B) are stored on a hard disk.

Each file is split into two blocks.

▶ Rearrange the file blocks to show the arrangement after a defragmentation


utility runs.
9 Operating systems
The operating system is the most fundamental piece of system software;
it manages interactions between software and hardware. It takes respons-
ibility for a range of functions including managing processor time, memory
management, inputs/outputs, and security.
There are lots of different operating systems. Some are custom written for
a particular device, such as a games machine or the guidance system on
the International Space Station. Other operating systems are used across a
range of devices. The most popular and well-known operating systems are;
Microsoft Windows, Apple Mac OS, Linux and Google’s Android.

9.1 Roles of the operating system


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/sys_os_role_of_os_g01

▶ Which of the following tasks is not one of the roles of the operating
system?

⃝ Malware protection

⃝ Controlling input and output devices

⃝ Memory management

⃝ Processor management

9.2 Multi-tasking
AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/sys_os_role_of_os_g02

▶ Which of the following terms best describes multi-tasking?

⃝ Tasks being swapped in and out of the processor so that it appears to


the user that the computer is carrying out more than one task at the
same time.

⃝ The process of interrupting a task being carried out by the processor


so that a new task with a higher priority can be completed.

⃝ Multiple core processors carrying out tasks simultaneously

⃝ Tasks being swapped in and out of memory simultaneously

47
48 9. OPERATING SYSTEMS

9.3 Device Drivers


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/sys_os_role_of_os_g03

▶ Which of the following best describes the purpose of a device driver?

⃝ Hardware built into devices such as motor to enable movement


⃝ Software translates commands from the peripheral device into a form
that the operating system and other programs can understand
⃝ Hardware that receives commands from the operating system
⃝ Software included with office based applications to allow printing.

9.4 Peripheral software


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/sys_os_g06

An operating system (OS) is software that controls the computer’s hardware


and software resources. One role of the operating system is to communicate
with and manage peripherals such as printers.
▶ Identify the correct piece of software that allows the operating system to
interact with peripherals.
⃝ Device driver ⃝ Firewall
⃝ Disk defragmenter ⃝ Memory manager

9.5 All those tasks!


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/sys_os_g07

▶ Which four of the tasks below are carried out by the operating system?

□ Transfers data to a printer

□ Creates new folders

□ Provides an interface for the user to interact with the computer

□ Sets automatic backups for data

□ Uses a scheduler to swap tasks in and out of the processor

□ Deletes emails
9. OPERATING SYSTEMS 49

9.6 Operating system actions


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/sys_os_g05

The table below identifies actions of an operating system. Each action is


managed by a different function of an operating system: memory, processor,
or file.

▶ Complete the table by adding a tick to identify what actions are managed
by each function and a cross to identify what actions are not managed by
each function.

Action Memory Processor File


management management management
Delete a file
Load data from
secondary storage
into the main
memory
Determine which
portion of memory
should be available
for a process

9.7 Access levels


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/sys_os_g01

A student is considering training to become a teacher, so has offered to


volunteer at a local primary school to gain some experience.

They need access to the school’s computer system in order to see lesson
resources.

▶ What level of access would be appropriate for the school to give the
student?

⃝ Write
⃝ Modify
⃝ Read
50 9. OPERATING SYSTEMS

9.8 Gooey GUI!


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/sys_os_g02

▶ Below is an image of a graphical user interface (GUI) with some features


numbered.

Add the correct label into the corresponding position in the table:

Number Correct label


1
2
3
4

□ Windows □ Menus

□ Pointer □ Icons
9. OPERATING SYSTEMS 51

9.9 What interface?


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/sys_os_g04

To allow the user to interact with the computer, an operating system provides
a user interface (UI). There are various forms that a UI can take.
▶ Correctly match the UI to the image that represents it using the following
options; Command line interface (CLI), Natural language interface
and Graphical user interface (GUI).
52 9. OPERATING SYSTEMS

9.10 Stop interrupting me!


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/sys_os_g03

▶ The table below contains definitions of some basic functions of an operat-


ing system. Complete the table by matching the definition to the function.

Function Definition
Determines how much memory to allocate to
each process.
Allocates time to processes that are deemed
urgent.
Swaps tasks in and out of the processor so it
appears the computer is doing more than one
task at the same time.

□ Interrupt

□ Memory manager

□ Scheduler
10 High- and low-level languages
Most programming languages that you will have heard of are high-level lan-
guages. Python and C# are examples of high-level languages that are widely
used in education and in the workplace. A high-level language is one that
is user-oriented in that it has been designed to make it straightforward for
a programmer to convert an algorithm into program code.
A low-level language is machine-oriented. Low-level programs are ex-
pressed in terms of the machine operations that must be performed to carry
out a task. This makes writing programs more difficult, as the algorithm
must be specified in terms of the capabilities and specifications of the pro-
cessor. Low-level languages are named for the processor (or processor family)
that they are designed for, and are often referred to as assembly language
or machine code.

10.1 High-level characteristics


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/sys_proglang_g01

▶ Which three of the following are characteristics of a high-level program-


ming language?

□ Uses an assembler to convert to machine code

□ Uses syntax which is similar to human language

□ Instructions are written in assembly language

□ Hardware is independent so can be used on multiple devices

□ Instructions are written in source code

10.2 Difficult programming languages


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/sys_proglang_g06

▶ Which type of programming language is widely considered to be easier,


because of its use of common language commands and built-in libraries?

⃝ High-level language

⃝ Low-level language

53
54 10. HIGH- AND LOW-LEVEL LANGUAGES

10.3 High- or low-level?


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/sys_proglang_g02

▶ Label the statements below showing the characteristics of low- and high-
level programming languages by adding High level or Low level into the
last column.

Characteristic Label
Use syntax similar to human language
Require specific knowledge of a processor
and its operations
Must be compiled and converted into
machine code before they are run
Typically used to control specific hardware
Have built-in libraries that the
programmer can call upon
Are easier to learn and understand
Sometime use a set of mnemonics for key
commands

10.4 Why high-level?


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/sys_proglang_g03

▶ Blake is developing an app for their Computer Science school project and
the teacher has suggested they use a high-level language to do this. What
would be the three best reasons for this suggestion?

□ It is written in assembly language which Blake has recently learnt

□ It will include libraries that may be useful in developing the app

□ It will be easier to code and develop as a relative beginner

□ It is high-level so is complicated and will demonstrate their coding


capability

□ It will be portable and could be used on multiple devices


10. HIGH- AND LOW-LEVEL LANGUAGES 55

10.5 Identifying languages


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/sys_proglang_g04

▶ Below are some examples of programming languages. Identify the correct


classification (high- or low-level) to match each example.
first = input ()
second = input ()
result = first + second
print ( result )

INP
STA 99
INP
ADD 99
OUT
HLT

10010000001
00111100011
10010000001
00011100011
10010000010
00000000000
56 10. HIGH- AND LOW-LEVEL LANGUAGES

10.6 Which language to use?


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/sys_proglang_g05

▶ Below are some examples of programming tasks. Add the correct type of
language to use for the task (high- or low-level) into the table.

Example Classification
Creating a mobile app to track the amount of
water people are drinking
Writing a program for a embedded system
that measures the moisture in a greenhouse
Creating a device driver for your custom
keyboard
Creating a 3D video game for your friends
Creating a motion-controlled light with a
microcontroller

10.7 Compiler vs. interpreter


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/sys_proglang_g07

▶ When using high-level languages, it is necessary to convert code into ma-


chine language before it can be run. This can be done by either a compiler
or interpreter. Look at the statements below and decide which is the
correct definition for Compiler and Interpreter.

Converts the whole code into machine code before running it

Converts one statement of the program at a time into machine code


10. HIGH- AND LOW-LEVEL LANGUAGES 57

10.8 Low-level characteristics


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/sys_proglang_g08

▶ Which three of the following are characteristics of a low-level program-


ming language?

□ It has a 1:1 relationship with processor instructions

□ Allows for individual control of a processor’s components and registers

□ Instructions are written in assembly language or machine code

□ Uses syntax that is similar to human language

□ Hardware is independent so can be used on multiple devices

10.9 Is it high or low?


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/sys_proglang_g09

Programming languages are considered to be either high level or low level.


Using the names of the programming languages provided, add the language
into the correct position in the table to state whether it is high or low level.

High level Low level

□ Machine code

□ C Sharp

□ Assembly language

□ Python
58 10. HIGH- AND LOW-LEVEL LANGUAGES

10.10 Assembly language facts


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/sys_proglang_g10

▶ Below are some statements about assembly language. Use the words
provided to complete the sentences.

Assembly languages allow programmers to write using a

set of that represent the equivalent.

In assembly language, the mnemonics are an language

representation of the operation the machine will perform when executed.

Assembly language needs to be converted into machine code for it to run.

This is done by the source code into the machine code

equivalent of the assembly language program.

This process is called and is done by a program called

an assembler.

□ binary

□ English

□ machine code

□ assembling

□ translating

□ mnemonics
11 Translators
A translator is a piece of software that handles the translation of source
code into a form that can be executed by a processor. Interpreters, com-
pilers, and assemblers are all types of translator. Depending on the situ-
ation, you will need to use different types of translators. You will also explore
the multiple stages of translation between source code and object code.

11.1 Stages of compilation


EDUQAS WJEC isaaccs.org/bq/sys_trans_g01

▶ Put the following stages of compilation into the correct order.

□ Semantic analysis

□ Syntax analysis

□ Code optimisation

□ Create source code

□ Code generation

□ Lexical analysis

11.2 Which translator type?


EDUQAS WJEC isaaccs.org/bq/sys_trans_g02

▶ Select the type of translator represented by this description: ”Translates


code into a form that can be executed. However, it does not execute the
code.”

⃝ Compiler

⃝ Interpreter

⃝ Assembler

59
60 11. TRANSLATORS

11.3 Describing an interpreter


EDUQAS WJEC isaaccs.org/bq/sys_trans_g03

▶ Select the correct statement that describes an interpreter.

⃝ The translation process is a relatively simple one with this translator.


There is a one-to-one relationship between the code and the machine-
executable code.
⃝ This type of translator produces executable code in a form that cannot
be read by a human or readily reverse-engineered (i.e. converted back
into source code).
⃝ Following the syntax check, each line of source code is converted into
its machine code equivalent and executed. If a runtime error occurs,
the program crashes.

11.4 Translator drawbacks


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/sys_trans_g04

▶ Select the two statements that describe drawbacks of using a compiler.

□ You have to wait until the entire program is translated before receiving
any errors.
□ If you want to change something in the program, you have to translate
the whole program again.
□ The source code must be given to the user.
□ The source code is translated line by line while execution is underway,
so the program can run more slowly.

11.5 Which stage?


EDUQAS WJEC isaaccs.org/bq/sys_trans_g06

▶ Which stage of the compilation process ensures that the tokens follow the
rules of the programming language being used?

⃝ Lexical analysis
⃝ Syntax analysis
⃝ Semantic analysis
11. TRANSLATORS 61

11.6 Compiler or interpreter?


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/sys_trans_g05

High-level languages need to be translated. This can be done by either a


compiler or an interpreter.
▶ Select the three statements that are features of a compiler.

□ Any errors are reported at the end of the process.

□ All code is translated prior to being executed.

□ Only an executable file is given to the user, not the original source
code.

□ Errors are discovered line by line, so can be corrected as they are


detected.

□ Code is translated line by line while execution is underway.

□ The source code must be given to the user.

11.7 Compiler vs. interpreter


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/sys_trans_g07

▶ When using high-level languages it is necessary to convert code into ma-


chine language before it can be run. This can be done by either a compiler
or interpreter. Match the definitions below to either Compiler or Inter-
preter.

Converts the whole code into machine code before running it

Coverts one statement of the program at a time into machine code


12 Social engineering
Social engineering is the term used for a range of techniques employed
by cybercriminals to deceive users into giving away their IDs, passwords,
or other personal information. Criminals who are intent on getting access
to our data come up with new ways of tricking us every day. Techniques
that you may have heard of include phishing, shouldering, blagging, and
pharming.
Social engineering is different to other cybercrimes because it involves
humans trying to trick or manipulate other humans.
Technological solutions can be put in place to prevent unauthorised access
to data, but it is arguably human users that pose the most significant risk
to a computer system. For example, validation rules can be put in place to
specify that a password must be a certain length and include special symbols
and numbers, however, no IT system can prevent a user from accidentally
revealing their username and password to another person.
Fortunately, there are ways to avoid being caught out. Much of this relies
on general awareness, but there are also software solutions that can detect
and alert users to potential scams.

12.1 Banking fraud


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/cyb_social_techniques_g03

An online bank has the URL https://oceansavings.org.

One of their customers has recently had their login details stolen as they
accidentally entered their username and password into a fake website that
looked identical to the website of the real bank. By accident, they had
entered the following URL https://oceansavings.com.

▶ What is the name for this type of social engineering technique?

⃝ Phishing

⃝ Pharming

⃝ Blagging

⃝ DDoS attack

62
12. SOCIAL ENGINEERING 63

12.2 Gone phishing


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/cyb_social_techniques_g01

▶ From the list provided, select the two indicators of a phishing email:

□ Email sent at unexpected time of day (i.e. outside of the normal work-
ing day)

□ Email encourages the recipient to click on a suspicious looking hyper-


link

□ Email attempts to initiate a conversation with the recipient

□ Email does not address recipient by name

12.3 Social engineering attacks


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/cyb_social_techniques_g02

▶ The table below provides definitions for common social engineering tech-
niques. Choose from the words below to match the technique to the defini-
tion.

□ Phishing

□ Blagging

□ Pharming

□ Shouldering

Tech- Definition
nique
An attack in which the victim receives a message disguised to
look like it has come from a reputable source (for example, a
bank), in order to trick them into giving up personal
information.
An attack in which the perpetrator invents a scenario in
order to convince the victim to give them personal
information or money.
Deceiving users by sending them to a fake website that the
user believes is the real one, with the intention of tricking
them to submit personal data.
64 12. SOCIAL ENGINEERING

12.4 A flight to Dubai


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/cyb_social_techniques_g05

Michael is a successful engineer and works for a multinational company. His


laptop is full of sensitive information and confidential business operations.
During a business trip to Dubai, Michael noticed that the passenger next to
him was staring at his laptop screen as he started to enter his username and
password. Michael stopped typing his details and closed his computer.
▶ Based on the given scenario, select which type of cyberattack Michael
could have been a potential victim of?

⃝ Shouldering

⃝ Blagging

⃝ Pharming

⃝ Phishing

12.5 Open your eyes!


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/cyb_social_techniques_g06

Angela has joined a gardening group on a social media platform. A group


member asked Angela for her email and mobile number, so Angela passed
her details to her new friend, and conversations took place for over a month
on a daily basis.
One day the friend told Angela that they had been in a car accident and
needed to borrow money from her to pay for the hospital bill. Angela has
a big heart and quickly sent the money to a bank account provided by her
friend.
Angela didn’t receive anymore messages from her friend and did not get any
money back.
▶ Based on the given scenario, which type of cyberattack did Angela suffer?

⃝ Phishing

⃝ Pharming

⃝ Shouldering

⃝ Blagging
12. SOCIAL ENGINEERING 65

12.6 A taste of their own medicine


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/cyb_social_techniques_g07

The Department of Defence decided to use cyberattack techniques against


hackers. The cybersecurity team created an advertisement where the per-
petrators supposedly could be hired to perform cyberattacks.
By responding to the advertisement, the hackers had a Trojan Horse installed
on their computers. This virus/trojan then changed the computer’s host file
to direct traffic away from its intended target, and toward a fake website
instead. This operation was very successful, and many criminals were caught
and brought to justice.
▶ Based on the given scenario, which type of cyberattack did the Department
of Defence use to catch the hackers?

⃝ Blagging

⃝ Shouldering

⃝ Pharming

⃝ Phishing

12.7 It's too good to be true!


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/cyb_social_techniques_g08

Martha has received an email that appears to be from Amazon saying that
she has won a £500 Amazon gift card. To claim the voucher, she needs to
fill out a form with her name, address, date of birth, and Amazon account
username.
Martha is not good with computers but she does think this email could be
too good to be true. She shows the email to her daughter who advises her
to delete the email and block the email account.
▶ Based on the given scenario, which type of social engineering attack has
Martha been a potential victim of?

⃝ Shouldering

⃝ Pharming

⃝ Phishing

⃝ Blagging
66 12. SOCIAL ENGINEERING

12.8 Security techniques


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/cyb_social_techniques_g04

▶ Add the correct terms to complete the text below:

is a term used to describe a broad range of malicious

activities accomplished through human interactions. These techniques are

designed to deceive users into giving away personal information, passwords,

or user IDs.

In some cases, it is possible to prevent these attacks by taking some security

measures and using strong techniques.

Users need to be vigilant and aware of how to spot these forms of at-

tack. emails, for example, often have poor grammar

and spelling, and may not be addressed directly to the recipient.

□ authentication

□ Social engineering

□ Phishing
13 Malicious software
Malicious software (malware) is created with the intent to cause damage
to computer systems or steal data, and computer users must take steps to
lessen these threats. There are many different forms of malware, some of
which can be classified as viruses, trojans, and worms based on how they
behave. These are explained further in the sections below.
Different forms of malware have different purposes. Spyware, for example,
can be used to track your use of computer systems, and keyloggers can
capture and transmit any data that you enter into a computer system.
Ransomware, by contrast, prevents a user accessing their computer files.
Fortunately, for every threat, there is a form of defence. It is essential that
everyone who uses a computer recognises how their system can be exposed
to threats, and understands the importance of keeping software up to date
and regularly scanning for malware.

13.1 Which attack?


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/cyb_mal_g01

▶ Using the statements provided, match the form of attack to the correct
description.

Form of attack Description


Replicates and is designed to infect as many
systems as possible. Does not require a host
program.
Appears to be a legitimate file, but actually
performs malicious actions.
Replicates and attaches to other programs or
files to spread over computer systems.

□ Worm

□ Virus

□ Trojan

67
68 13. MALICIOUS SOFTWARE

13.2 Features of malware


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/cyb_mal_g02

▶ It is important to know the difference between the types of malicious


software and how they operate. Read the statements below and then fill in
the gaps using the words provided.

Malware is designed to gain access to a computer system with


intent. Viruses and worms are both , which means that
they can spread quickly across a computer system.

Unlike a ,a requires a host file, and


will activate when the program is run. A is a form of
malware that appears to be a legitimate file, but unbeknown to the user, it
also performs malicious actions such as data theft.

Spyware is a type of malicious software that leaks data back to the creator, a
is a type of spyware that records keys pressed to discover
passwords and confidential information.

□ trojan □ keylogger

□ worm □ self-replicating

□ malicious □ virus

13.3 Someone call security!


AQA EDEXCEL EDUQAS WJEC isaaccs.org/bq/cyb_mal_g03

▶ Identify two ways in which security flaws in software can be identified


and removed to prevent the impact of malware.

□ Acceptable use policies

□ Anti-malware software

□ Patching

□ Code review
13. MALICIOUS SOFTWARE 69

13.4 Payment due!


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/cyb_mal_g04

Farah was using her laptop to complete some online research for her home-
work when the following message popped up on the screen:

▶ What form of malware attack is this?

⃝ Virus
⃝ Ransomware
⃝ Spyware
⃝ Trojan

▶ What would be the two best methods to prevent this type of attack and
its impact?

□ Regular backups

□ Security patches

□ Acceptable use policies

□ Anti-malware software
14 Network security
Computer networks are a part of everyday life, and many of us connect to
some kind of network on a regular basis. You may keep much of your data
“in the cloud” or use online banking to manage your money. Several online
stores may have a record of your card payment details.
Networks contain so much valuable data and, unfortunately, there are many
criminals who would love to get their hands on it. If the network is connected
to the internet, criminals can hack accounts and launch cyberattacks from
anywhere in the world. This means that they can be hard to track down
and hard to prosecute.
Access to networks can be controlled by ensuring that users have strong pass-
words, and by setting appropriate access rights for authorised users. Codes
of conduct and acceptable use policies can be set to ensure that users follow
guidelines for keeping corporate data safe, and to hold them accountable if
they don’t. Backup systems and recovery procedures ensure that essential
data can be recovered if the worst happens.

14.1 Strong passwords


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/cyb_sec_g01

It is good practice to use strong passwords, i.e. ones that are difficult to
guess. A long password is usually strong because it would take more attempts
to guess the password. However, other factors are also important.

▶ Disregarding length, which of the following passwords is the strongest?

⃝ I*saacC£S9
⃝ The name of your favourite football team combined with your date of
birth
⃝ zxcvbnm
⃝ flibbertigibbet123

70
14. NETWORK SECURITY 71

14.2 Avoiding the queues


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/cyb_sec_g03

▶ Airports and airlines worldwide are investing in alternative means of suit-


ably identifying and checking the security status of passengers. Often, the
procedure consists of getting information validated in advance, which en-
ables passengers to pass through a checking point without ever showing
their passport or ticket. Which type of authentification can be used in this
case? Select the correct option.

⃝ Password protection
⃝ Two-factor authentication (2FA)
⃝ Biometric authentication
⃝ Physical security

14.3 Filtering it
AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/cyb_sec_g04

▶ Fill in the concept that correctly matches the description provided in the
table below.

Description Concept
Term used to describe the MAC addresses with
special rights or privileges.
Term used to specify the MAC addresses of
devices that are allowed to connect to the network.
Term used to specify the MAC addresses of devices
that are not allowed to connect to the network.
Security solution, although not very efficient, as it
is possible for a device to spoof an authorised
MAC address and gain access to the network
unnoticed.

□ Blocklist

□ Safelist

□ Whitelist

□ MAC filtering
72 14. NETWORK SECURITY

14.4 Symmetric vs asymmetric


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/cyb_sec_g05

▶ Complete the table below by using the numbered statements to show the
differences between the symmetric and asymmetric encryption techniques.

Differentiator Symmetric encryption Asymmetric encryption


Number of keys
Speed of execution
Security
Length of keys

1. The secret key is shared, so the risk of compromising is higher

2. The length of the keys used is larger, typically 2048 bits or higher

3. Faster because it uses simple mathematical operations

4. Uses the same key for both encryption and decryption

5. Slower, but allows the sender to be authenticated

6. The length of the keys used is typically 128 or 256 bits

7. The private key is not shared, and the overall process is more secure

8. Uses a related set of keys, one public and one private


14. NETWORK SECURITY 73

14.5 Working from the coffee shop


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/cyb_sec_g07

The company ‘Security Guru’ recently installed a Wi-Fi system to replace


their old wired network. The new network uses radio frequencies to transmit
data, and offers greater flexibility and a reduction of costs. James works
as a financial adviser at Security Guru and is required to log in to use
the company’s Wi-Fi, called security_guru, to connect to the internet.
The network is encrypted end-to-end and the Wi-Fi uses WPA3 technology,
which provides strong protection, such as individual traffic encryption and
protection against brute force attacks.

During his break, James crossed the street and went to the coffee shop to
have something to eat. As he was waiting for his order, he realised that he
had forgotten to send an important email to the accountancy department
with the company’s monthly financial balance. James tried to connect to the
internet using his mobile phone, but the company’s Wi-Fi security_guru
was out of range. However, the network secur1ty_guru_guests was
openly available, not requiring any type of authentication. So, James con-
nected to the network, finished writing the email with the financial balance
sheet attached, and sent it to the accountant’s office.

▶ Based on the scenario above, select all the options that represent what
James should or should not do to keep the company network safe from
cyberattacks.

□ James could connect to the network ‘secur1ty_guru_guests’ without


concerns as it is very secure as the new Wi-Fi system offers strong
protection against attacks.

□ James could connect to the network ‘secur1ty_guru_guests’, but only


to check his personal email and to log into his social media accounts.

□ James could connect to the network ‘secur1ty_guru_guests’, but he


needs to know that it does not protect against attacks.

□ James should not connect to the network ‘secur1ty_guru_guests’ to


send his business email or any important or sensitive information.
74 14. NETWORK SECURITY

14.6 Testing from inside out


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/cyb_sec_g08

The following describes some examples of how criminals explore human and
technical vulnerabilities to gain unauthorised access to data.

Human vulnerability

• Scanning social media for hobbies, interests, and home address

• Scanning for personal and work email addresses to identify friends and
colleagues

• Scanning for personal and work phone numbers to help identify linked
accounts and associates

• Scanning online activity to find usernames and passwords

• Scanning for work colleagues, their responsibilities, and hierarchy

Technical vulnerability

• Scanning the system to identify weak spots and open doors

• Gaining access to the system then expanding access once within it

• Extracting copies of data, documents, and/or information for future


analysis and exploitation

• Establishing a route to get back into the system easily in future should
this be required

• Covering tracks, so the means of access and activities carried out are
hard to determine even for an expert

▶ Which type of penetration test can be done to simulate or identify cyber-


attacks from an internal perspective, where the attacker already has know-
ledge about and access to the system and knows how the network topology
is designed?

⃝ Black-box penetration testing

⃝ White-box penetration testing

⃝ Grey-box penetration testing


14. NETWORK SECURITY 75

14.7 Let's get brutal


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/cyb_sec_g06

An automotive company has hired someone to conduct both manual and


automated penetration testing to make sure that the system is secure from
hackers and other malicious attacks. The tester‘s main role is to discover
any weaknesses or vulnerabilities in the company’s system that could be
exploited by unauthorised users attempting to access the system.

The tester decides to use brute force methods and starts by trying to exploit
all the well-known software vulnerabilities to get access to the system infra-
structure. This type of test adopts a trial-and-error approach as the tester
has no information about the internal workings of the application used by
the company, nor about its source code or software architecture. As a res-
ult, this particular type of test would take a very long time to complete,
so the tester uses automated processes to help uncover the weaknesses and
vulnerabilities.

▶ Based on the above scenario and the approaches used by the tester, which
type of penetration test was used?

⃝ White-box penetration testing


⃝ Black-box penetration testing
⃝ Grey-box penetration testing
15 Representation of numbers
Numbers in everyday life are usually represented using the digits 0 to 9,
but this is not the only way in which a number can be represented. There
are multiple number base systems, which determine which digits are used
to represent a number. The number system that we are most familiar with
is called denary or decimal (base-10), but binary (base-2) and hexa-
decimal (hex or base-16) are also used by computers. You can perform
arithmetic calculations on numbers written in other base notations, and even
convert numbers between bases.
At a more advanced level, you will learn that representing negative num-
bers and fractional numbers using binary is also possible. There are several
different methods, each with their own advantages and disadvantages.

15.1 Base-2 place values


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_numbases_binary_and_decimal_g01

▶ The table below has base-2 place values. What is the value of the missing
place value?

16 8 4 2 1

15.2 Converting between binary and denary


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_numbases_binary_and_decimal_g02

▶ Convert the binary value 01011111 into a denary value.

128 64 32 16 8 4 2 1
0 1 0 1 1 1 1 1

Answer:

76
15. REPRESENTATION OF NUMBERS 77

15.3 Converting between denary and binary


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_numbases_binary_and_decimal_g03

▶ Convert the following denary value into binary.

143

128 64 32 16 8 4 2 1

15.4 Denary to binary - show your workings


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_numbases_binary_and_denary_g04

▶ Convert the following denary value into binary.

53

128 64 32 16 8 4 2 1

15.5 Adding two 8-bit binary numbers


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_numbases_binary_arithmetic_g01

▶ Add the following two 8-bit binary numbers together and provide your
answer in binary.

0 1 1 0 0 1 1 0
+ 0 1 1 1 0 1 0 1
=
78 15. REPRESENTATION OF NUMBERS

15.6 Binary shifts


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_numbases_binary_arithmetic_g02

▶ Multiply the following 8-bit binary number by 8 and provide your answer
in binary.

000011012

15.7 The benefits of hexadecimals


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_numbases_hexadecimals_g01

▶ A friend of yours is learning web development and is interested to know


why the colours are written as hexadecimals. They’ve done some research
and think they have worked out why hexadecimals are used.

Help your friend identify which part of their research is not accurate.

⃝ Compared to binary, it is less likely that a digit will be written down


incorrectly

⃝ It’s quicker for the processor to interpret as it uses fewer digits

⃝ It uses fewer digits to represent the same value

⃝ It is easier to read and interpret


15. REPRESENTATION OF NUMBERS 79

15.8 Binary to hexadecimal conversion 1


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_numbases_hexadecimals_gcse_g01

▶ Convert the binary number 01100001 to hexadecimal.

8 4 2 1 8 4 2 1
0 1 1 0 0 0 0 1

⃝ 61

⃝ F1

⃝ A1

⃝ 6A

15.9 Converting hexadecimal to binary


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_numbases_hexadecimals_gcse_g02

▶ Convert the hexadecimal 9B to binary.

8 4 2 1 8 4 2 1

15.10 Hexadecimal to binary 2


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_numbases_hexadecimals_gcse_g04

▶ What is the binary equivalent of hexadecimal number F7?

⃝ 11110110

⃝ 11111110

⃝ 11110111
80 15. REPRESENTATION OF NUMBERS

15.11 Binary to hexadecimal conversion 2


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_numbases_hexadecimals_gcse_g03

Convert the binary number 10001111 to hexadecimal.


▶ Step 1. Split the data into two nibbles and add it to the table below.

8 4 2 1 8 4 2 1

▶ Step 2. Using the table above, state the hexadecimal value of the first
nibble.

▶ Step 3. Using the table above, state the hexadecimal value of the second
nibble.

15.12 Binary to hexadecimal 2


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_numbases_hexadecimals_gcse_g05

▶ What is the binary equivalent of hexadecimal number F7?

⃝ 11111110

⃝ 01111111

⃝ 11111111

⃝ 11110111
15. REPRESENTATION OF NUMBERS 81

15.13 A bit hexed?


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_numbases_hexadecimals_gcse_g06

▶ Complete the table below, hexadecimal is often used by people instead of


binary for the following reasons:

Reason True OR
False
It is easier to read and interpret
It uses more digits to represent the same value
Compared to binary, it is more likely that the digit will be
written down incorrectly

15.14 8-bit sign and magnitude representation


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_numbases_signed_unsigned_g01

▶ Using 8-bit sign and magnitude, convert −4010 into binary.

15.15 8-bit two's complement


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_numbases_signed_unsigned_g02

▶ Using 8-bit two’s complement representation, convert the following


binary number into denary.

100010102
82 15. REPRESENTATION OF NUMBERS

15.16 What colour is this?


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_data_03

Emily has picked her favourite colour for the background of her website. The
value of the colour in binary is 1010101011110000110100012 and it is too long
to remember! Help Emily by converting the number into hexadecimal.

▶ Convert the binary number into hexadecimal.

15.17 Zombies
AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_data_04

Maya is playing a video game involving zombie enemies. She wants to let
her team players know about a trap. Convert the following denary numbers
into hexadecimal and combine the answers to find out the secret message.

Secret message: 14110 23410 1310

▶ Convert the denary numbers into hexadecimal and enter the message as
one word, without any blank spaces.
15. REPRESENTATION OF NUMBERS 83

15.18 Putting base-two and base-two together


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_data_07

What is the result of the binary addition below?

0 1 1 0 1 1 1 1
+ 0 0 1 1 1 0 0 1

▶ Select the result of the binary addition.


⃝ 1000011002 ⃝ 001010012
⃝ 110101102 ⃝ 101010002

15.19 That's average


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_data_13

To calculate the arithmetic mean (average) value of a given set of numbers


you calculate the sum of values and divide it by the number of values. For
example: (10 + 12 + 14 + 16) / 4 = 13
The expression used above is written in denary, or base 10. The following
expression has been written using numbers from different number bases, the
subscript denotes the number base used. Convert each number to denary
and then calculate the mean:
▶ (100101102 + F516 + 7D16 + 101101002 ) / 4 = ?
Give the answer in denary.
84 15. REPRESENTATION OF NUMBERS

15.20 Count the ones


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_data_09

Which of the following base-10 and base-16 numbers has the most bits set
to 1 after the number is converted into binary?
▶ Convert the numbers into binary and select the number that has the most
1s.
⃝ 10010 ⃝ C516
⃝ 7910 ⃝ A216

15.21 Bonus time


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_data_16

Agneta has just received her latest monthly salary. She has done well this
month obtaining two bonus related payments and is putting the money to-
wards her holiday fund.
▶ The binary numbers below represent Agneta’s bonus payments. Can you
work out the total, in binary, of Agneta’s bonus?

Bonus 1 1 0 0 1 0 1 1
Bonus  2 + 1 0 1 0 1 0 0 1
—————————————-
Answer =

Pick the correct answer from the options provided.


⃝ 111101002 ⃝ 111001002
⃝ 111000102 ⃝ 111100102
▶ What is the total of Agneta’s bonus, in denary?
15. REPRESENTATION OF NUMBERS 85

15.22 Convert it 1
AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_data_20

▶ An unsigned binary integer can be used to represent a positive whole


number. Convert the 8-bit unsigned binary integer 01010101 to a denary
number.

15.23 Convert it 2
AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_data_21

▶ An unsigned binary integer can be used to represent a positive whole


number. Convert the 8-bit unsigned binary integer 10010011 to a denary
number.

15.24 Convert it 3
AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_data_22

▶ An unsigned binary integer can be used to represent a positive whole


number. Convert the 8-bit unsigned binary integer 00110000 to a denary
number.
86 15. REPRESENTATION OF NUMBERS

15.25 Convert it 4
AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_data_23

▶ An unsigned binary integer can be used to represent a positive whole


number. Convert the denary number 77 to binary.

15.26 Convert it 5
AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_data_24

▶ An unsigned binary integer can be used to represent a positive whole


number. Convert the denary number 100 to binary.

15.27 Convert it 6
AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_data_25

▶ An unsigned binary integer can be used to represent a positive whole


number. Convert the denary number 129 to binary.
15. REPRESENTATION OF NUMBERS 87

15.28 Warm colours


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_data_12

Colours on a web page are usually represented in binary by 24-bit codes,


i.e. combining 8 bits for a shade of red (R), 8 bits for a shade of green (G),
and 8 bits for a shade of blue (B). These long sequences of binary digits
can be hard to read, so lookup tables are created which use human-readable
descriptions of the colours to index their RGB values, making them more
user-friendly.
By way of example, the lookup table below shows four warm colour codes in
RGB, 24-bit code binary and hexadecimal. Warm colours generally contain
a significant amount of red, mimicking sunlight.
Red is defined by its RGB value of (255,0,0) and its 24-bit binary code value
is therefore represented in binary as 1111111100000000000000002
In hexadecimal, the same colour can be represented by only 6 hexadecimal
digits so the colour red is depicted as FF000016
▶ Three of the hexadecimal representations are missing from the warm col-
ours table below. Circle the correct list (Red has already been given, as
above) of colours in hexadecimal, from the options below, to complete the
Hexadecimal table column.

Colour Name RGB Binary Hexadecimal


Red (255,0,0) 1111111100000000000000002 FF000016
Deep Pink (255,20,147) 1111111100010100100100112 ?
Moccasin (255,228,181) 1111111111100100101101012 ?
Coral (255,127,80) 1111111101111111010100002 ?

FF000016 FF000016
FF149316 FF149316
Option A Option B
FF7F5016 FF7F5016
FFE4B516 FFE4B516

FF000016 FF000016
FF7F5016 FFE4B516
Option C Option D
FFE4B516 FF149316
FF149316 FF7F5016
88 15. REPRESENTATION OF NUMBERS

15.29 Adding two binary numbers


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_data_29

When you add two binary numbers, you can use the same method as denary
addition: working from the right (the least significant bit), add up the bits
in each column with the same place value and, if there is a carry, add it into
the next column to the left (that with a higher place value).

▶ Perform the following calculation and select the option that correctly
illustrates the method of adding the two binary numbers.

110101012 + 000101012

⃝ Option A

Carry 1 1 1 1 1 1
1 1 0 1 0 1 0 1

⃝ Option B

Carry 1 1 1
1 1 0 1 0 1 0 1

⃝ Option C

Carry 1 1
1 1 0 1 0 1 0 1

⃝ Option D

Carry 1 1 1
1 1 0 1 0 1 0 1
16 Representation of text
All data on a computer system is represented using binary patterns, which
are sequences of 1s and 0s. In order to represent text, each individual letter
or character must be represented by a unique binary pattern. In order
to consistently represent characters from many different languages, these
patterns must be agreed throughout the world, through standards such as
ASCII and Unicode. Once you know how a letter is represented, you can
calculate the size of a text file and work out how much storage space is
required.

16.1 Binary character codes


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_rep_text_g01

▶ The ASCII character code for p in binary is 01110000. Using this


information, work out the 8-bit character code in binary for the letter q.

16.2 Denary character codes


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_rep_text_g02

▶ The ASCII character code in denary (decimal) for 1 is 49, what would
the character code in denary be for the character 3?

89
90 16. REPRESENTATION OF TEXT

16.3 Decoding ASCII


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_rep_text_g03

▶ A word has been encoded with ASCII character codes in denary. De-
code each character to form a three-letter word.
Lower-case letters a–z are represented by the ASCII character codes 97 to
122.
Decode this word: 98 105 116

16.4 Bit-patterns
AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_rep_text_g04

▶ How many bit-patterns can be created with 4 bits?

16.5 ASCII count up


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_data_01

▶ The standard ASCII code for the character 3 is 5110 . What is the ASCII
code for 9 in binary?
⃝ 001110012
⃝ 001110102
⃝ 01011012
⃝ 000010012
⃝ 01110012
16. REPRESENTATION OF TEXT 91

16.6 ASCII
AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_rep_text_g05

▶ Which one of the following statements is not correct when discussing


the current ASCII character set? Choose the correct answer from the list of
three possible answers.

⃝ 8 bits are used to store each character in the ASCII character set.

⃝ The ASCII character set is used to represent text. Each individual


letter or character must be represented by a unique binary pattern.
These patterns must be agreed throughout the world.

⃝ 7 bits are used to represent characters, which allows for a maximum


of 128 (27 ) characters to be represented.

16.7 Bits and bit patterns


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_rep_text_g07

The number of bits used in a representation will affect the number of bit-
patterns available.
▶ Add the number of bit patterns into the table to correctly to show how
many bits are required to represent them.

2 3 4 5 6
Num-
ber of
bit pat-
terns

□ 16

□ 32

□ 8

□ 4

□ 64

□ 2
92 16. REPRESENTATION OF TEXT

16.8 Text representation


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_rep_text_g09

▶ Fill in the gaps using the options below.

To represent text digitally, each character needs to have its own .

are combinations of 1s and 0s used to represent data

inside of a computer. The bit-pattern used for each character becomes a

numeric .

A collection of characters and the bit-patterns used to represent them is

called a .

If you are using 4 bits, you can work out the number of bit-patterns by using

this formula:

4 bits: 24 = bit-patterns

You can also take a look at the binary place value headings.

The next place value heading after 3 bits is .

□ 8

□ Bit-patterns

□ character code

□ character set

□ unique bit-pattern

□ 16
16. REPRESENTATION OF TEXT 93

16.9 ASCII and Unicode differences


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_rep_text_g10

▶ Use the numbers below to fill in the gaps.

ASCII stands for ‘American Standard Code for Information Interchange’.

It started by using bits to represent characters, which

allowed for a maximum of 128 characters to be represented.

These days, bits are used to store each character in the

ASCII character set. The first codes in Unicode and

ASCII are used to represent the same characters.

Unicode is generally favoured over ASCII because:

• It can support languages with alphabet character sets larger than

• Uses up to 32 bits to represent each character and can be used to rep-

resent special symbols (e.g. mathematical operators, geometric shapes,

arrows, etc.

• Supports over billion possible codes

□ 128

□ 4

□ 26

□ 7

□ 8
94 16. REPRESENTATION OF TEXT

16.10 ASCII and Unicode


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_rep_text_g08

▶ Select the two statements that are correct.

□ ASCII is useful for representing characters from languages other than


English.

□ Standard ASCII uses 7 bits to represent each character.

□ There is a Unicode character set that uses only 8 bits per character.

□ Unicode can be used to represent up to 256 different characters.

□ Unicode does not include character codes for ideograms.

16.11 Characters
AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_rep_text_g06

▶ The bit pattern used for each character becomes a numeric character code.
Which of the following are characters?

□ Non-printing commands. For example: Enter, Delete, F1

□ Letters

□ Punctuation symbols. For example: ?/|\£\$


17 Representation of images
All data on a computer system is represented using binary patterns, which
are sequences of 1s and 0s. In order to represent an image, one method is to
store it as if it were a grid of coloured squares, with each colour represented
by a unique binary pattern. The image dimensions and the number of colours
used are factors that affect the size of the image file.
At a more advanced level, you will learn that images can also be stored
as mathematical equations describing shapes, which are then rendered back
into an image when viewed by the user. It is useful to know the benefits
and drawbacks of each image representation method in order to decide the
correct format in which to save a particular image.

17.1 Calculating colours


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_rep_bitmap_g01

A bitmapped graphic uses a colour depth of 2 bits and this allows 4


different colours to be used.
▶ How many bits would be required to represent the colours if a bitmap
image included 16 colours?

17.2 How many bytes?


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_data_02

▶ What is the minimum file size in bytes for a 16 x 32 bitmapped graphic


which uses 8 colours?

95
96 17. REPRESENTATION OF IMAGES

17.3 Game sprites


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_rep_bitmap_g02

▶ Mahira creates a bitmap graphic of a character for a game she is making.


The image is 8 pixels wide and 8 pixels tall. How many pixels does the
image have in total?

▶ Mahira’s bitmap graphic is made up of four different colours. To represent


four different colours, what is the colour depth needed? Give your answer
in bits.

▶ What is the total file size (excluding any metadata)? Give your answer
in bits.
17. REPRESENTATION OF IMAGES 97

17.4 Image files


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_rep_bitmap_g04

Fred is searching through the digital photographs he has taken whilst on


holiday. When creating a backup of the image files onto an external hard
drive, he realises that the file size of each photograph is larger than he
expected. This is because, in addition to the pixel data, the file must store
additional information so that the image can be reproduced accurately.
▶ What is the additional information that contains data about data called?

17.5 How many kilobytes?


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_sys_09

Calculate the storage capacity required for a bitmap image with the dimen-
sions 1024 x 768 pixels that has 256 different colours. Then, work out the
file size in kBs if the file metadata takes up 20% extra space. Present your
answer as a real number, including the values after the decimal point.
▶ What is the storage capacity required? Give your answer in kBs.

17.6 Extra colours


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_data_10

▶ A bitmapped graphic uses a colour depth of 3-bits and this allows for 8 dif-
ferent colours. If the number of different colours that need to be represented
increases to 30, what is the minimum new colour depth required?
98 17. REPRESENTATION OF IMAGES

17.7 A colourful problem


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_data_27

Naga has made an icon for a maze solving game she has created. The icon
has been created as a bitmapped graphic. It is 32 pixels wide and 32 pixels
high and uses 9 different colours.

▶ How many pixels does the image have in total?

▶ To represent 9 different colours, what is the minimum colour depth needed?


Give your answer in bits.

▶ What is the total file size (excluding any metadata)? Give your answer
in bits.

▶ What is the total file size (excluding any metadata) in bytes?


17. REPRESENTATION OF IMAGES 99

17.8 Too much data?


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_data_28

Image files contain metadata which can be described as “data about data”.
When Zoe looks at the properties of one of her photos, she sees the following
information that has been extracted from the file metadata:
Property Value
Manufacturer Canon
Model EOS 250D
Date and time 2021:04:06 14:31:00
Geolocation 53.61766, -2.1552
Pixel X dimension 2240
Pixel Y dimension 1680
Flash Flash did not fire
▶ Which of the items of metadata (from the list shown) is needed to accur-
ately display the image to someone who wants to view the photo? Select all
that apply.

□ Date and time


□ Model
□ Flash
□ Pixel X dimension
□ Pixel Y dimension
□ Manufacturer
□ Geolocation

17.9 Image resolution


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_image_bitmap_g03

▶ Image resolution can be expressed as which two of the following?

□ Pixels per inch


□ Bits per pixel
□ Number of pixels across the width and number of pixels in the height
□ The size of each pixel
18 Representation of sound
Sound is a vibration that travels through the air. For a computer to capture
sound waves, known as analogue sound, it needs to store the sound in a
digital format (sequences of 1s and 0s). It also needs to recreate and play
back the sound that has been captured. The most common technique used
to represent a sound is to take samples (sampling) of the sound at regular
intervals. The intervals in which sampling takes place (sample rate), the
duration, and the sample resolution (bit depth) all impact the sound quality
and size of a file processed by the computer.

18.1 The client's animation


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_sound_01_g

A graphic designer wants to use sound in her client’s animation. She has
composed a sound that is one minute in length and recorded in stereo sound.
The sound was sampled using a 16kHz sampling rate and an 8-bit sample
resolution.

▶ In bytes, what storage does this sound require?


⃝ 1,920,000 ⃝ 7,680,000
⃝ 15,360,000 ⃝ 960,000

18.2 Looking for whales and dolphins


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_sound_02_g

A researcher uses a sonar to look for whales and dolphins. The sonar emits a
sound signal that makes it possible to detect objects at a reasonable distance
underwater. The sonar system operates at a sampling rate of 400kHz, with
a sample resolution of 16 bits.

▶ What is the minimum storage required to store one hour of data received
by the sonar in its uncompressed form?
⃝ 3TB ⃝ 300MB
⃝ 300GB ⃝ 3GB

100
18. REPRESENTATION OF SOUND 101

18.3 A live performance


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_sound_03_g

▶ A sound engineer is recording a live performance and uses a sampling rate


of 8,000Hz and a sample resolution of 8 bits. What is the minimum file size
that will be created for a 30-second recording?

18.4 The event's playlist


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_sound_04_g

▶ A DJ has created a playlist for an event. She used a sampling rate of


2,000Hz and a sample resolution of 4 bits to record each audio file. What
is the minimum file size she will need to store a 15-second file recording?
102 18. REPRESENTATION OF SOUND

18.5 Annika's ringtone


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_sound_05_g

Annika wants to store a 10-second audio file on her smartphone to use as


a ringtone. The audio file was sampled using a 4kHz sampling rate and a
6-bit sample resolution.
▶ What is the minimum storage required to store Annika’s ringtone?

18.6 Jamal's CD
AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_sound_06_g

Jamal recorded a CD with a 44,100Hz sampling rate and a sample resolution


of 8 bits.
▶ How many bit patterns does he need to represent each sample?
18. REPRESENTATION OF SOUND 103

18.7 Measuring a sound wave


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_sound_07_g

▶ Shannon converted a sound wave by sampling it. Which of the following


terms is being measured when a sound wave passes through a point at certain
time intervals?
⃝ Bit rate ⃝ Hertz
⃝ Frequency ⃝ Amplitude

18.8 File size


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_sound_08_g

▶ During an exam, you are required to calculate the size of a 10-second mono
sound file with a sampling rate of 16,000 hertz and a sample resolution of 8
bits. What would be the size of the file?

18.9 Voice message


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_sound_9_g

▶ Chantelle recorded a 30-second voice message on her mobile phone to send


to a friend using a 16-bit sampling resolution and an 8,000Hz sample rate.
How many bytes does the recorded message have?
104 18. REPRESENTATION OF SOUND

18.10 What does Liu need to know?


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_sound_10_g

▶ Liu is recording a collection of mono audio files to use in his website.


He needs to know how much storage is needed to store the files. What
information does Liu need to calculate the size of each file? Select all the
answers that apply.

□ Sample intervals of the sound

□ Length of the sound

□ Sample resolution of the sound

□ Sampling rate of the sound

18.11 Giga for a gig


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_data_06_v2

▶ Bob wants to share a sound recording of his favourite gig with his friends.
If the performance lasted 1 hour and the recording was made with a sampling
rate (frequency) of 15,000 Hz and a sample resolution (size) of 16 bits, what
is the minimum size of the audio file in gigabytes (GB)?
18. REPRESENTATION OF SOUND 105

18.12 Double trouble


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_data_19

If a music track is recorded in stereo, there are two sets of data (one for each
of the left and right channels). A track is recorded in stereo that lasts 3
minutes. The sample resolution is 14 bits and a sampling rate of 55kHz has
been used.
▶ Calculate the minimum stereo storage requirements needed for this stereo
music file, in its uncompressed form. Type your answer in megabytes
(MB). Assume 1MB is 1,000,000 bytes.

18.13 How many megabytes?


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_sys_10

What is the storage capacity required for a song that is 5 minutes long and
was recorded using 20,000 samples per second and 8 bits per sample? The
file metadata takes up 10% extra space. Give your answer in MBs. Assume
1MB = 1,000,000 bytes.
▶ What is the storage capacity required? Give your answer in MBs.
19 Compression
Compression is a technique that reduces file size. Some compression tech-
niques are referred to as lossy, because they cause data to be lost dur-
ing the compression process. Other techniques are referred to as lossless,
because they allow the original data to be exactly reconstructed from the
compressed data. Different types of data lend themselves to different com-
pression methods. Popular compression methods include run length en-
coding, dictionary-based methods, and variable length (Huffman)
codes.

19.1 The maze game


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_compr_g02

A game developer is creating a maze game and has used the bitmap below
as a background. Let’s say that they used RLE to compress the image and
used B for black and W for white. Row 1 would be compressed as B5, W1,
B1, W1, B5.
▶ How would row 12 be compressed?

⃝ B1, W1, B1, W9, B1

⃝ B1, W9, B1, W1, B1

⃝ B1, W1, B1, W1, B5, W1, B3

106
19. COMPRESSION 107

19.2 Being smart


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_compr_g01

A designer is developing a CCTV system that will monitor the flow of traffic
and pedestrians at traffic lights throughout a city. The file size of the CCTV
video footage is large and needs to be compressed to save on storage space.

▶ Which compression technique would be most suitable? Take into consid-


eration that the designer needs to significantly reduce storage space and is
willing to accept reduced video quality.

□ Lossless compression

□ Lossy compression

19.3 Ultrasound machine


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_compr_g04

Ultrasound machines are used in the medical field for diagnosis. During a
medical examination, part of the sound captured by the ultrasound machine
was digitised and converted into the following binary pattern:

0000 0011 1111 1000 0000 0000 0111 1111

▶ This data is compressed using RLE. Which of the following options would
be the correct result of the compression?

⃝ 0 0100 0 0010 1 0010 1 0100 1 0001 0 0011 0 0100 0 0100 0 0001 1 0011
1 0100

⃝ 0 0110 1 0111 0 1100 1 0111


⃝ 0 010010 1 01110
108 19. COMPRESSION

19.4 The correct tree


AQA isaaccs.org/bq/data_compr_g03

During a test, a student was required to solve a question using Huffman


encoding based on this string, which is 20 characters in length:
AABCDADDCBBACDBADCCB
The student was also given this table, which shows the characters, the fre-
quency they appear in the string, and the binary pattern used to represent
each character during the compression.

Character Frequency Code


A 5 00
B 5 10
C 5 11
D 5 01

▶ Based on the information provided, which of the following options should


the student select to represent the correct Huffman tree for this string?

Option 1
19. COMPRESSION 109

Option 2

Option 3

Option 4

Answer:
110 19. COMPRESSION

19.5 RLE scramble


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_compr_g05

Black and white pixels are used in the below image to show a bitmap image
of a Space Invader.

Run length encoding (RLE) can be used to compress the image. ▶ Put the
encoded lines into the correct order so that they represent the RLE for the
image. White is represented with a W and black is represented with a B.

□ B1, W2, B2, W2, B1

□ W2, B1, W2, B1, W2

□ W1, B6, W1

□ B2, W1, B2, W1, B2

□ B8

□ B1, W6, B1

□ B1, W1, B1, W2, B1,


W1, B1

□ W1, B1, W4, B1, W1


20 Encryption
Encryption techniques are used to keep data and communications secret
from interceptors. Ciphers such as the Caesar cipher have been used for
centuries to encrypt and decrypt messages using a shared secret known
as a key. Other cipher techniques are asymmetric, which means that the
sender and recipient each use different keys to encrypt and decrypt their
messages. At a more advanced level, you can explore the Vernam cipher,
a theoretically perfect cipher in which each character is encrypted using its
own key.

20.1 Caesar cipher


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_encrypt_g01

You‘ve asked Caesar what he wants to drink, but he doesn’t want everyone
else to know what he wants. He has sent you the following reply as an
encrypted message, along with a key value of 2.

ycvgt

▶ What does Caesar want to drink?


⃝ uyrcp ⃝ water
⃝ qunyl ⃝ juice

20.2 Wrapped caesar cipher


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_encrypt_g04

Caesar has received an encrypted message from one of his soldiers. The
soldier has sent this message along with a key value of 8.

em vmml eizu cvqnwzua

▶ What does the soldier want?


⃝ mu duut mqhc kdyvehci ⃝ we will deal with the enemies
⃝ we need warm uniforms ⃝ we have been cautious

111
112 20. ENCRYPTION

20.3 Encryption
AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_encrypt_g02

▶ Use the correct key words below to complete the following sentence:

are used to encrypt the data from


into and the data from
to .

□ plain text □ decrypt

□ Algorithms □ cipher text

20.4 Symmetric encryption


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_encrypt_g03

▶ Use the correct key words below to complete the following sentence:

In a symmetric scheme, the is used


to encrypt and the data.

□ encryption
□ decrypt
□ same key

20.5 Symmetric encryption


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_encrypt_g07

▶ Read all the sentences below and select one sentence that best describes
the keys used for symmetric encryption.

⃝ All the keys that are used in symmetric encryption are private.

⃝ Three public keys are used when using symmetric encryption.

⃝ A symmetric encryption algorithm uses two public keys.


20. ENCRYPTION 113

20.6 Encrypt a Caesar cipher


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_encrypt_g05

A soldier wants to send this message to Caesar.

more food

The soldier has encrypted and sent this message along with a key value of 7.

▶ What is the encrypted message?

⃝ esaq erer ⃝ pokx fhhw


⃝ kssy lssd ⃝ tvyl mvvk

20.7 Asymmetric encryption


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/data_encrypt_g06

▶ Read all the sentences below and select one sentence that best describes
the keys used for asymmetric encryption.

⃝ All the keys that are used in asymmetric encryption are private.
⃝ An asymmetric encryption algorithm uses a pair of keys: a public key
and a private key.
⃝ Three public keys are used when using asymmetric encryption.
21 Database concepts
Data is fundamental to any computer system. With data comes the need
for a system that is able to store, sort, and search through it. Imagine
the amount of users a popular social media company has, then think about
storing every post they have made and the media that comes with it, such as
a video, image, or animated GIF. Without a database, you wouldn’t be able
to log in to access your posts, let alone be able to make connections with other
users and see their posts. In this section you will learn that databases can
be as simple as a single file, and as complex as a set of related tables, each
with fields and keys. It is important that data within a database is kept
up-to-date and consistent, and it is crucial to avoid storing the same data
in multiple places. At a more advanced level, you will learn that creating
an entity relationship model and designing a set of tables using the rules
of normalisation is important. Challenges arise when lots of users want
to access data simultaneously, and you will learn that transactions and
transaction processing are needed to ensure that the data does not get
out of sync.

21.1 Foreign keys


AQA OCR isaaccs.org/bq/data_dbs_concepts_g02

▶ Which of the following options provides the correct definition of a foreign


key?

⃝ A field that uniquely identifies a record in a table


⃝ A field that is used to link to another table through a matching value
in a primary key field
⃝ A term used to describe any field in a database table that does not
contain unique data.

114
21. DATABASE CONCEPTS 115

21.2 Sports database


AQA OCR isaaccs.org/bq/data_dbs_concepts_g01

A local sports league needs to keep a record of the name of players and which
team they play for. Their database currently has three tables:

• The table Player contains the following fields: PlayerID, FirstName,


Surname, DateOfBirth, Address, TelephoneNumber

• The table Team contains the following fields: TeamID, TeamName, KitColour
• The table Registrations contains the following fields: RegistrationID,
PlayerID, TeamID, RegistrationDate

▶ Which field in the Player table is a primary key?

⃝ Address
⃝ PlayerID
⃝ DateOfBirth
⃝ FirstName

▶ Which fields in the Registrations table are foreign keys?

⃝ PlayerID, TeamID
⃝ RegistrationID, RegistrationDate
⃝ RegistrationID, PlayerID, TeamID
116 21. DATABASE CONCEPTS

21.3 Flat file databases


AQA isaaccs.org/bq/data_dbs_concepts_g04

Amelie provides a dog walking service and keeps all of the details of her
customers in a flat file database. A sample of the data she holds is below:

Customer- Address TelephoneNum- Dog-


Name ber Name
Frank Zanetti 18 Gravel Lane, Banks 0778495743 Bobby
Bella Talbot 89 Carr Lane, Chorley 0782347512 Ant
Bella Talbot 89 Carr Lane, Chorley 0782347512 Dec
Jenna 10 St Johns Green, 0797748321 Bruno
Alexander Leyland
Jenna 10 St Johns Green, 0797748321 Alfie
Alexander Leyland
Jenna 10 St Johns Green, 0797748321 Rover
Alexander Leyland

▶ From the choices below, choose the term that best describes the problem
with the data in this flat file database.

⃝ Data inconsistency
⃝ Data integrity
⃝ Data redundancy
22 SQL
SQL is short for Structured Query Language; it’s a language that is
used for constructing statements called queries to perform operations on
the data within a database. SQL operations include:

• Searching and retrieving records


• Inserting new records into the database tables
• Deleting records and individual items of data from tables
• Updating existing data by replacing it with new data

22.1 Insert the download


AQA isaaccs.org/bq/data_dbs_dml_g01

Below is a table showing app downloads for a customer.


Table AppDownloads

DownloadID App PurchaseDate Price


187362 Monopoly Classic 2022-03-01 4.99
273340 Mini Football 2022-03-20 2.79
317333 Stardew Valley 2021-11-19 4.99
387737 Game Dev Tycoon 2021-04-28 4.99
622100 Alien Isolation 2022-02-12 12.99

▶ The customer has recently downloaded another app called Flow Free. Use
the options below to complete the following query that will insert the new
download into the table.

1 _______________ INTO _______________ (DownloadID , App ,


PurchaseDate , Price )
2 _______________ (931408 , _______________ , '2022 -14 -18 ' ,
0.00) _______________

□ INSERT
□ AppDownloads
□ VALUES
□ ‘Flow Free’
□ ;

117
118 22. SQL

22.2 Property price update


AQA isaaccs.org/bq/data_dbs_dml_g02

An estate agents in the north east of England has a database of properties


that are currently for sale. An extract from the Properties table is below.
The owner of the property at 8 New Elvet wants to change the list price of
their property.

Proper- Address City Proper- Bed- List-


tyID tyType rooms Price
Dur032 8 New Durham detached 3 350000
Elvet
Dur070 2 Durham terraced 2 200000
Sherburn
Rd
New635 6A Newcastle semi- 3 220000
Salters’ Upon Tyne detached
Rd
New388 29 Leazes Newcastle terraced 4 480000
Rd Upon Tyne
Sun112 2 Roker Sunderland detached 4 450000
Lane

▶ Complete the SQL query below using the words provided to update the
ListPrice of the property at 8 New Elvet, Durham to 330000.

_______________ Properties
<br >
_______________ ListPrice = 330000
<br >
_______________ PropertyID = 'Dur032 ';
<br >

□ UPDATE □ INSERT

□ WHERE □ SET
22. SQL 119

22.3 DELETE students


AQA isaaccs.org/bq/data_dbs_dml_g03

A local school PE department stores data in a database about students


taking part in sports day. Some of the students are no longer taking part.

An extract from the table Students is below.

FirstName LastName Team YearGroup


Charlie Heard Red 11
Amisha Patel Blue 11
Jenny Jackson Green 10
Viran Ahmed Green 9
Jaden Beckford Blue 10

▶ When the following SQL query is executed, how many records will be
deleted?

1 DELETE FROM Students


2 WHERE Team = 'Blue ' AND YearGroup = 11;

⃝ 3 records
⃝ 2 records
⃝ 1 record
120 22. SQL

22.4 Construct a select query


AQA OCR isaaccs.org/bq/data_dbs_dql_g01

A local school PE department stores data in a database about students


taking part in sports day.

An extract from the table Students is below:

FirstName LastName Team YearGroup


Charlie Heard Red 11
Amisha Patel Blue 11
Jenny Jackson Green 10
Viran Ahmed Green 9
Jaden Beckford Blue 10

A member of staff wants a list of all of the students’ FirstName, LastName,


and Team that are in the database table.

SELECT ______________ , ______________ , ______________

______________ Students______________

▶ Fill in the gaps above using the below options to complete the query:

□ *

□ ;

□ LastName

□ Team

□ YearGroup

□ FROM

□ WHERE

□ FirstName
22. SQL 121

22.5 SELECT, FROM, WHERE


AQA OCR isaaccs.org/bq/data_dbs_dql_g02

A local school PE department stores data in a database about students


taking part in sports day.

An extract from the table Students is below:

FirstName LastName Team YearGroup


Charlie Heard Red 11
Amisha Patel Blue 11
Jenny Jackson Green 10
Viran Ahmed Green 9
Jaden Beckford Blue 10

A member of staff needs to know which Year 11 students are taking part.
Tick one box in each of the sections below to identify the correct SQL
statement to select the names and team for all year 11 students.

▶ Section 1

⃝ SELECT FirstName, LastName, Team


⃝ SELECT FirstName AND LastName AND Team
⃝ SELECT *
⃝ SELECT FirstName, LastName, Team, YearGroup

▶ Section 2

⃝ FROM database
⃝ FROM students
⃝ FROM Students
⃝ FROM table Students

▶ Section 3

⃝ WHERE YearGroup = 11;


⃝ WHERE YearGroup = “Year 11”;
⃝ WHERE YearGroup == 11;
122 22. SQL

22.6 Top films


AQA isaaccs.org/bq/data_dbs_dql_03

Aleema has bookmarked the following films on a streaming service she sub-
scribes to.

FilmID Title Certific- Dura- Genre Rating


ate tion
1 Hamilton 12 160 History 8.9
2 Spirited Away PG 125 Anima- 8.6
tion
3 Back to the Future PG 116 Adven- 7.5
ture
4 Coco PG 105 Anima- 8.4
tion
5 Raiders of the Lost PG 115 Adven- 7.3
Arc ture
6 Toy Story U 81 Anima- 9.1
tion

SELECT Title , Certificate , Duration , Genre , Rating

FROM Films

ORDER BY ________________ ________________ ;

▶ Complete the SELECT query above so that the films are ordered from the
highest rating to the lowest and Aleema knows which film to watch first.

□ FilmID

□ DESC

□ Rating

□ ASC
22. SQL 123

22.7 App downloads


AQA OCR isaaccs.org/bq/data_dbs_dql_g04

Dana has been looking at her app purchases. She wants to redownload an
app that she thinks she downloaded in November 2021. An extract from the
Downloads table is below:

App PurchaseDate Price


Monopoly Classic 2022-03-01 4.99
Mini Football 2022-03-20 2.79
Stardew Valley 2021-11-19 4.99
Game Dev Tycoon 2021-04-28 4.99
Alien Isolation 2022-02-12 12.99

▶ Choose the option that would complete the query below to help Dana find
the game.

1 SELECT *
2 FROM Downloads
3 WHERE ______________ ;

⃝ PurchaseDate > ‘2021-11-01’ OR PurchaseDate < ‘2021-11-30’


⃝ PurchaseDate > ‘2021-11-01’ AND < ‘2021-11-30’
⃝ PurchaseDate > ‘2021-11-01’ AND PurchaseDate < ‘2021-11-30’
124 22. SQL

22.8 Location, location


AQA OCR isaaccs.org/bq/data_dbs_dql_g05

An estate agent in the north east of England has a database of properties


that are currently for sale. An extract from the Properties table is below:

Proper- Address City Proper- Bed- List-


tyID tyType rooms Price
Dur032 8 New Durham detached 3 350000
Elvet
Dur070 2 Durham terraced 2 200000
Sherburn
Rd
New635 6A Newcastle semi- 3 220000
Salters’ Upon Tyne detached
Rd
New388 29 Leazes Newcastle terraced 4 480000
Rd Upon Tyne
Sun112 2 Roker Sunderland detached 4 450000
Lane

A buyer is using the agents’ website to find all available properties in Sun-
derland.

▶ Use the lines of code below to construct a SQL query that would return
the following fields for the buyer:

Address, City, PropertyType, Bedrooms, ListPrice.

Not all lines of code provided are required to solve the problem

□ SELECT *

□ WHERE City = 'Sunderland';

□ FROM Properties

□ WHERE 'City' = 'Sunderland'

□ SELECT Address, City, PropertyType, Bedrooms, ListPrice

□ FROM table
22. SQL 125

▶ Using the table above, which of the properties in the list below would be
returned when the follow query is executed:

1 SELECT PropertyID
2 FROM Properties
3 WHERE ( Bedrooms = 3 OR Bedrooms = 4) AND ListPrice <= 350000;

⃝ D032, New388, Sun112


⃝ New635
⃝ D032, New635
23 Data structures
Almost all programs process data in some form. Data needs to be stored in
a way that means it can be easily manipulated by program code. Very basic
(primitive) data types, such as an integer (a whole number) or Boolean
(True or False), allow you to store a single value. It is possible to combine
these primitive data types to create compound data types (a record) or
to create more complex data structures (arrays and lists).
At a more advanced level, static and dynamic data structures are in-
troduced. Together with abstract data types, such as stacks and queues,
they allow the more sophisticated organisation and manipulation of data,
and provide methods for adding, removing, and traversing data.

23.1 Two-dimensional array


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/dsa_datastruct_g01

This two-dimensional array shows the data structure for storing words for
schoolchildren to learn their spellings.

Index 0 1 2 3
0 school pull where here
1 path floor sugar bread
2 accident answer eight critical

After the array has been created and saved as spelling_words in a program,
the following line of code is run:

PRINT(spelling_words[2,1])

▶ When the first index is the row number and the second index is the column
number, what will be the output on the screen?

⃝ answer

⃝ path

⃝ sugar

126
23. DATA STRUCTURES 127

23.2 Dictionary
AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/dsa_datastruct_g02

A dictionary is a structure that stores data using a


and value system. You can store any type of object in
a dictionary, and when presented with a , the dictionary
will return the value associated with that .

▶ Use the words below to complete the above paragraph.

□ key

□ value

□ data

23.3 Arrays
AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/dsa_datastruct_g03

An array is a data that holds a number of data


or elements of the data type. When you want to store
many pieces of data that are related, it is often better to use an array
of many variables.

▶ Use the words below to complete the above paragraph.

□ structure

□ items

□ same

□ instead
128 23. DATA STRUCTURES

23.4 Index numbers


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/dsa_datastruct_g04

This one-dimensional array stores different weather conditions:

Sunny Windy Cloudy Raining Snowy

▶ Assuming the array is indexed from 0, what weather condition is in index


position 2?

23.5 Static data


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/dsa_datastruct_g05

▶ When discussing static data structures, which one of the following state-
ments is incorrect?

⃝ Memory is not wasted. The size of the array is declared for the number
of data items that will be added when the program is run.
⃝ If insufficient memory space has been allocated, the program may crash
or not work properly.
⃝ Memory is not wasted, for example, the elements are only declared for
the same amount of data items when the program is run.

23.6 Dynamic data


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/dsa_datastruct_g06

▶ Is the following statement true or false?


Dynamic data structures are memory efficient. The memory capacity of a
dynamic data structure is not fixed, and the number of data items that it can
hold is constrained only by the overall memory allocation to the program.
A list is an example of a dynamic data structure.

⃝ True
⃝ False
23. DATA STRUCTURES 129

23.7 How many students?


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_prog_18

In a college, two groups of students were created, group1 and group2. Mr


Patel (the English teacher) asked Mrs Smith (the Computer Science teacher)
how many students are there in group 1 and 2 when the groups are added
together.

Mrs Smith loves to challenge people, so she gave the algorithm below as her
answer and told Mr Patel to use it to find the number of students.

• group1 is an array of students with indexes from 0 to 17


• group2 is an array of students with indexes from 0 to 19

Remember that the LEN() function will return the total number of items in
an array.

1 FUNCTION total_students (group1 , group2 )


2 total = LEN( group1 ) + LEN( group2 )
3 RETURN total
4 ENDFUNCTION

▶ What answer will be given by running the pseudocode provided by Mrs


Smith?
130 23. DATA STRUCTURES

23.8 That's not correct!


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/dsa_datastruct_g07

▶ Data structures can be static or dynamic. Which of the following state-


ments is incorrect?

⃝ A static array cannot be resized at runtime.

⃝ A dynamic data structure is a collection of data in memory that can


grow or shrink in size at runtime.

⃝ The elements of a dynamic linked list can be accessed directly by index.

⃝ A static array uses an allocation of contiguous (one after another)


locations in main memory.

23.9 One- and two-dimensional arrays


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/dsa_datastruct_g09

▶ Fill in the gaps using the options below.

A one-dimensional array is a data structure that contains a set of elements of

the same . To access an element in an array, you use an

. This specifies the position of the element in the array.

To access an element in a , you need to specify a column

number and a number. These are known as a column

index and a .

□ two-dimensional array

□ row index

□ index number

□ row

□ data type
23. DATA STRUCTURES 131

23.10 Describe lists and dictionaries


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/dsa_datastruct_g08

▶ Fill in the gaps using the options below.

A list is a collection of data items in some sort of order,

which means that each occupies a specific

in the list. A list is a ‘built-in’ data structure (or data type) in many pro-

gramming languages.

In the programming world, a dictionary is a data structure that is used to

store data using a key and value system, just like a paper copy of a dictionary.

The word you are looking for is the and the definition

is the . When a dictionary is presented with an obvi-

ous , the dictionary will return the

associated with that .

□ key

□ value

□ position

□ element

□ term

□ linear
24 Searching algorithms
Computers need to search through lists of data all the time; for example,
when trying to find a file with a particular name on your computer, or when
using a search engine to find websites on the internet that match certain
keywords.
When faced with the problem of searching for an item in a list of items,
you may have to deal with an unordered list. With an unordered list, the
only way to find a specific item is to look at every item in the list one after
another. This algorithm is called a linear search. If the list of items is
ordered, you can repeatedly split the list in half and check only the half in
which the item that you are searching for might be found. This algorithm
is called a binary search.
At a more advanced level, you will learn that these searching algorithms can
be implemented either iteratively or recursively. You will learn that a
binary search tree could also be used. You will also learn that the relative
complexity of each algorithm can be compared, to allow the best choice to
be made for a specific problem.

24.1 Why linear?


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/dsa_search_g10

▶ Identify three reasons why you may choose to perform a linear search
rather than a binary search on a list of data.

□ The list is unsorted

□ The list is very short

□ The list is very long

□ The list is sorted

□ The algorithm is simpler to implement

132
24. SEARCHING ALGORITHMS 133

24.2 Search for knitwear sales


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/dsa_search_binary_g02

Tom sells knitwear via his website. He has a list with the number of products
that he’s sold in the last ten days. He wants to find out if there is a day that
he sold 22 products.

products_sold
11 16 17 22 25 30 35 46 57 72

Tom is using the binary search algorithm to search through the list of sales.

The binary search implementation uses the formula midpoint = (first +


last)DIV 2 to calculate the midpoint position. Remember that integer or
floor division (DIV) is when any remainder of a division is discarded. For
example, 11 ÷ 5 = 2 remainder 1 and so 11 DIV 5 will return 2.

▶ Fill in the blanks with the values provided below to complete the steps
that a binary search will follow when searching for 22 in the products_sold
list.

Take the ordered list products_sold and the search item 22.

Initially, set the range of items where the search item might be found to be
the entire list.

Find the item at the midpoint position: .


Compare the item at the midpoint to the search item: the item at the
midpoint is greater than 22.

Change the range to focus on the items before the midpoint.

Find the item at the midpoint position: .

Compare the item at the midpoint to the search item: the item at the
midpoint is less than 22.

Change the range to focus on the items after the midpoint.

Find the item at the midpoint position: .

Compare the item at the midpoint to the search item: the item at the
midpoint is 22.
134 24. SEARCHING ALGORITHMS

Change the range to focus on the items the midpoint.

Find the item at the midpoint position: .

Compare the item at the midpoint to the search item: the item at the
midpoint is equal to 22.

The search item was found in the list, stop searching.

□ less than □ 22

□ greater than □ 25

□ before □ 30

□ after □ 35

□ 11 □ 46

□ 16 □ 57

□ 17 □ 72
Tom sells knitwear via his website. He has a list with the number of products
that he’s sold in the last ten days. He wants to find out if there is a day that
he sold 35 products.

products_sold
11 16 17 22 25 30 35 46 57 72

Tom is using the binary search algorithm to search through the list of sales.

The binary search implementation uses the formula midpoint = (first +


last)DIV 2 to calculate the midpoint position. Remember that integer or
floor division (DIV) rounds down the result of a calculation to the nearest
integer. For example, 11 DIV 5 will return 2.

▶ Fill in the blanks with the values provided below to complete the steps
that a binary search will follow when searching for 35 in the products_sold
list.

Take the ordered list products_sold and the search item 35.

Initially, set the range of items where the search item might be found to be
the entire list.
24. SEARCHING ALGORITHMS 135

Find the item at the midpoint position: .

Compare the item at the midpoint to the search item: the item at the
midpoint is less than 35.

Change the range to focus on the items after the midpoint.

Find the item at the midpoint position: .

Compare the item at the midpoint to the search item: the item at the
midpoint is 35.

Change the range to focus on the items the midpoint.

Find the item at the midpoint position: .

Compare the item at the midpoint to the search item: the item at the
midpoint is 35.

Change the range to focus on the items the midpoint.

Find the item at the midpoint position: .

Compare the item at the midpoint to the search item: the item at the
midpoint is equal to 35.

The search item was found in the list, stop searching.

□ less than □ 22

□ greater than □ 25

□ before □ 30

□ after □ 35

□ 11 □ 46

□ 16 □ 57

□ 17 □ 72
136 24. SEARCHING ALGORITHMS

24.3 Search for a book


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/dsa_search_binary_g03

Sally has a blog about children’s books. She has a list with the top seven
children’s books that were chosen by her readers. You can see the items of
the list below:

top7_books
Animal Black Elmer Heidi Robin- The Winnie-
Farm Beauty son Little The-
Crusoe Prince Pooh

Sally wants to find out if the book ‘Elmer’ is in the list. She is using the
binary search algorithm to search through the list of books.

The binary search implementation uses the formula midpoint = (first +


last)DIV 2 to calculate the midpoint position. Remember that integer or
floor division (DIV) is when any remainder of a division is discarded. For
example, 11 ÷ 5 = 2 remainder 1 and so 11 DIV 5 will return 2.

▶ Fill in the blanks with a suitable word from the ones provided below to
complete the steps that a binary search will follow when searching for Elmer
in the top7_books list.

Take the ordered list top7_books and the search item Elmer.

Initially, set the range of items where the search item might be found to be
the entire list.

Find the item at the midpoint position: is the midpoint


item.

Compare the item at the midpoint to the search item: the item at the
midpoint is greater than Elmer.

Change the range to focus on the items before the midpoint.

Find the item at the midpoint position: is the midpoint


item.

Compare the item at the midpoint to the search item: the item at the
midpoint is Elmer.
24. SEARCHING ALGORITHMS 137

Change the range to focus on the items the midpoint.

Find the item at the midpoint position: is the midpoint.

Compare the item at the midpoint to the search item: the item at the
midpoint is equal to Elmer.

The search item was found in the list, stop searching.

□ less than
□ Elmer
□ greater than
□ Heidi
□ before
□ Robinson Crusoe
□ after
□ The Little Prince
□ Animal Farm
□ Winnie-The-Pooh
□ Black Beauty
Sally has a blog about children’s books. She has a list with the top seven
children’s books that were chosen by her readers.

top7_books
Animal Black Elmer Heidi Robin- The Winnie-
Farm Beauty son Little The-
Crusoe Prince Pooh

▶ Sally is using the binary search algorithm to find out if the book Peter
Pan is in the list. How many comparisons will the binary search algorithm
perform before it finishes?
138 24. SEARCHING ALGORITHMS

24.4 Why not binary?


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/dsa_search_g04

You have been provided with some cards that are in the following order:

▶ Why could you not use a binary search for this data?

⃝ The data is not a list of numbers. ⃝ The data is not sorted in an as-
cending (low to high) or des-
⃝ There is not enough data. cending (high to low) order.

24.5 Binary or linear?


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/dsa_search_g05

You have been provided with some cards that are in the following order:

▶ You need to find out if the number 4 is in the list of cards. Which searching
algorithm would require the fewest number of comparisons to find the data?
⃝ Linear
⃝ Both would be the same
⃝ Binary
▶ You now need to find out if the number 9 is in the list of cards. Which
searching algorithm would require the fewest number of comparisons to find
the data?
⃝ Linear
⃝ Both would be the same
⃝ Binary
24. SEARCHING ALGORITHMS 139

24.6 Efficient searching


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/dsa_search_g06

▶ Which of these is the most efficient implementation of a linear search?


Option A
1 FUNCTION linear_search (items , search_item )
2
3 // Initialise the variable
4 found_index = -1
5
6 // Repeat until the end of the list is reached
7 FOR current = 0 TO LEN( items) - 1
8
9 // Compare the item at the current index to the
search item
10 IF items[ current ] == search_item THEN
11 // If the item has been found , store the current
index
12 found_index = current
13 ENDIF
14 NEXT current
15
16 // Return the index of the search_item or -1 if not found
17 RETURN found_index
18 ENDFUNCTION

Option B
1 FUNCTION linear_search (items , search_item )
2
3 // Initialise the variables
4 found_index = -1
5 current = 0
6 found = False
7
8 // Repeat while the end of the list has not been reached
9 // and the search item has not been found
10 WHILE current < LEN(items) AND found == False
11
12 // Compare the item at the current index to the
search item
13 IF items[ current ] == search_item THEN
14 // If the item has been found , store the current
index
15 found_index = current
140 24. SEARCHING ALGORITHMS

16 found = True // Raise the flag to stop the loop


17 ENDIF
18 current = current + 1 // Go to the next index in the
list
19 ENDWHILE
20
21 // Return the index of the search_item or -1 if not found
22 RETURN found_index
23
24 ENDFUNCTION

Answer:

24.7 Binary comparisons


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/dsa_search_g07

A local hockey club keeps a directory of players’ email addresses, which they
use to send out information about training and fixtures. It currently has
1,000 entries.

▶ What is the maximum number of comparisons a binary search would have


perform to find a specific player’s email address?
24. SEARCHING ALGORITHMS 141

24.8 Binary tracing


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/dsa_search_g09

The following list of items is stored in an array:

items
index 0 1 2 3 4 5 6
value 2 4 5 8 12 15 18

The following algorithm has been coded and will be used to search for the
number 12 as highlighted in the array.
1 FUNCTION binary_search (items , search_item )
2
3 // Initialise the variables
4 found = False
5 found_index = -1
6 first = 0
7 last = LEN( items) - 1
8
9 // Repeat while there are still items between first and
last
10 // and the search item has not been found
11 WHILE first <= last AND found == False
12
13 // Find the midpoint position (in the middle of the
range)
14 midpoint = (first + last) DIV 2
15
16 // Compare the item at the midpoint to the search
item
17 IF items[ midpoint ] == search_item THEN
18 // If the item has been found , store the
midpoint position
19 found_index = midpoint
20 found = True // Raise the flag to stop the loop
21
22 // Check if the item at the midpoint is less than
the search item
23 ELSEIF items [ midpoint ] < search_item THEN
24 // Focus on the items after the midpoint
25 first = midpoint + 1
26
27 // Otherwise the item at the midpoint is greater
than the search item
142 24. SEARCHING ALGORITHMS

28 ELSE
29 // Focus on the items before the midpoint
30 last = midpoint - 1
31 ENDIF
32 ENDWHILE
33
34 // Return the position of the search_item or -1 if not
found
35 RETURN found_index
36
37 ENDFUNCTION

▶ Complete the trace table for the algorithm by adding the options provided
into the correct positions.

found_ first last mid- items found return


index point [midpoint] value
-1 0 6 3 8 false
4
4 2
4
4 4 4 12

□ True

□ False

□ 3

□ 4

□ 5

□ 6

□ 8

□ 15
24. SEARCHING ALGORITHMS 143

24.9 Search for a basketball score


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/dsa_search_linear_g01

Amaia coaches a school basketball team. She keeps the scores that the team
got in the latest tournament in a list called basketball_finals. You can see
the items of the list below:

basketball_finals
120 250 101 150 80 95 147 165

Amaia is using the linear search algorithm to find out if the team scored 150
points in any of the games.
▶ Put in order the steps that the linear search algorithm will follow when
searching for the item 150 in the list basketball_finals.

□ Go to the next item in the


list: 250

□ Go to the next item in the


list: 150

□ Compare 120 to 150: 120 is


not equal to 150

□ Compare 250 to 150: 250 is


not equal to 150

□ Compare 150 to 150: 150 is


equal to 150

□ The item was found, stop


searching

□ Go to the next item in the


list: 101

□ Start from the first item in


the list: 120

□ Compare 101 to 150: 101 is


not equal to 150
144 24. SEARCHING ALGORITHMS

Amaia coaches a school basketball team. She keeps the scores that the team
got in the latest tournament in a list called basketball_finals. You can see
the items of the list below:

basketball_finals
120 250 101 150 80 95 147 165

▶ Amaia is using the linear search algorithm to find out if the team scored
200 points in any of the games. How many comparisons will the linear search
algorithm perform before it finishes?

24.10 Midpoint
AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/dsa_search_g08

You have been given a set of cards that are in the following order:

▶ A binary search is going to be used to search for an item in the list. Which
card is at the first midpoint calculated by the algorithm?
25 Sorting algorithms
Sorting data is an essential data management task. You may need to display
information in a specific order, or you may need to sort your data to make
it quicker to search for something within the data set. There are many
standard algorithms that can be used to sort data, such as bubble sort and
merge sort.
At a more advanced level, you will learn that these sorting algorithms can
be implemented in code in a variety of ways. You will also learn that the
relative complexity of each algorithm can be compared, to allow the best
choice to be made for a specific problem.

25.1 Sorting basketball scores


AQA EDUQAS OCR WJEC isaaccs.org/bq/dsa_sort_g01

Amaia coaches a school basketball team. She keeps the scores that the team
got in the latest tournament in a list called basketball_finals. You can see
the items of the list below:

basketball_finals
250 120 95 101 80

▶ Amaia wants to use the merge sort algorithm to sort the scores from lowest
to highest value. Fill in the gaps with the values to show the order of the
items after the first merge. Assume that the splitting stage has already
completed and each value is in a list of its own.

Final split
250 120 95 101 80
Merge 1

□ 80

□ 95

□ 101

□ 120

□ 250

145
146 25. SORTING ALGORITHMS

25.2 Inserting countries


EDEXCEL OCR isaaccs.org/bq/dsa_sort_g02

Geraint is using the insertion sort algorithm to put their list of top five
countries to visit into alphabetical order, from A to Z.

countries
Peru Laos Fiji Egypt Cuba

The insertion sort algorithm has been started on the list below. In the first
row, the first item is highlighted to show it is in the sorted sublist and the
unsorted sublist contains the remaining items.

In the second row, the first pass has completed and the sorted sublist now
contains two items, which are highlighted.

▶ Fill in the blanks to show the order of the countries at the end of each
pass when performing an insertion sort. Use a new row for each pass.

countries
Peru Laos Fiji Egypt Cuba
Laos Peru Fiji Egypt Cuba

□ Cuba

□ Egypt

□ Fiji

□ Laos

□ Peru
25. SORTING ALGORITHMS 147

25.3 Improving bubble sort


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/dsa_sort_g04

▶ A bubble sort algorithm is written in pseudocode below. Study the pseudo-


code and then select two changes that could be made to improve the effi-
ciency of the algorithm.
1 PROCEDURE bubble_sort (items )
2 num_items = LEN( items)
3 FOR pass_num = 1 TO num_items - 1
4 FOR index = 0 TO num_items - 2
5 IF (items [index ] > items[index + 1]) THEN
6 temp = items[index]
7 items [index ] = items[index + 1]
8 items [index + 1] = temp
9 ENDIF
10 NEXT index
11 NEXT pass_num
12 ENDPROCEDURE

□ The inner for loop could be changed so that the number of repetitions
is reduced by 1 after each pass

□ The inner for loop could be changed to a while loop that only swaps
items if they are out of order

□ The variable temp is not needed when swapping items in this way and
could be removed

□ The outer for loop could be changed so that the number of swaps made
is reduced by 1 after each pass

□ The outer for loop could be changed to a while loop that stops once
no swaps are made during a single pass
148 25. SORTING ALGORITHMS

25.4 Bubble sort puzzle


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/dsa_sort_g05

▶ Put the lines of code provided into the correct order to create a bubble
sort algorithm. Please note that you should use correct indentation in your
answer.

□ NEXT pass_num

□ FOR index = 0 to num_items -


2

□ IF (items[index] >
items[index + 1])THEN

□ num_items = LEN(items)

□ NEXT index

□ END IF

□ items[index] = items[index +
1]

□ items[index + 1] = temp

□ FOR pass_num = 1 TO
num_items - 1

□ temp = items[index]
25. SORTING ALGORITHMS 149

25.5 Where to start an insertion sort?


EDEXCEL OCR isaaccs.org/bq/dsa_sort_g08

You have been given some playing cards that have not been sorted:

▶ In an insertion sort, which would be the first card in the unsorted sublist
and therefore the first card to insert?


150 25. SORTING ALGORITHMS

25.6 Bubbling countries


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/dsa_sort_g03

Geraint is using the bubble sort algorithm to put their list of top five
countries to visit into alphabetical order, from A to Z.
▶ Using the countries list below, fill in the blanks to show the order of the
countries after each pass of the bubble sort algorithm, using a new row
for each pass. The algorithm will pass over the entire list four times.

countries
Laos Egypt Peru Fiji Cuba

□ Cuba

□ Egypt

□ Fiji

□ Laos

□ Peru
26 Legislation
Until the Computer Misuse Act 1990, there were no legal provisions in
UK law governing the use and misuse of computer systems. However, the use
of computers has become so widespread that further laws such as the Regu-
lation of Investigatory Powers Act 2000 have been enacted to take into
account technological growth and the widespread use of encryption. There
have also been recent changes to data protection law. The General Data
Protection Regulation (GDPR) in EU law creates a European standard
to protect individuals, and regulates how companies and organisations may
collect, hold, and use personal data. The Data Protection Act 2018 is
the UK’s implementation of the GDPR. Legislation also exists around the
use of copyrighted material through the Copyright, Designs and Patents
Act 1988.

26.1 Which licence type?


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/iot_legal_g01

▶ Select the type of licence that allows software code to be studied and
changed by anyone.

⃝ Multi-user
⃝ Open source
⃝ Proprietary

26.2 Breakin' the law!


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/iot_legal_g02

Jane breaches Data Protection legislation by leaving her laptop logged on


when she goes for a break at work. Amilyn uses Jane’s laptop to access
financial files she does not have permission to access.
▶ Select the piece of legislation that Amilyn has breached.

⃝ Telecommunications Regulations Act


⃝ Data Protection Act
⃝ Freedom of Information Act
⃝ Computer Misuse Act

151
152 26. LEGISLATION

26.3 Fact or impact? (Software licensing)


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/iot_legal_g04

Extended (long-form) questions require you to include knowledge and im-


pact in your responses. This allows you to demonstrate that you can think
about a concept more deeply than by only writing down points of knowledge
that you can recall.

▶ For each sentence in the response, indicate whether the sentence demon-
strates knowledge (e.g. of a fact/concept), or the impact of a fact/concept:

QUESTION: Discuss the impact of licensing on the spread of digital con-


tent.

RESPONSE: Some digital content creators use Creative Commons (CC)

licences . CC licences allow creators to make it clear

that their work can be shared and adapted, but also ensure that their work

is always attributed . This can result in creators hav-

ing their work seen by a wider audience and allows others to legally develop

solutions within a community . The least restrictive Cre-

ative Commons licence is the attribution licence . When

a no-derivatives licence is used it means there is no permission to modify the

content .

□ Knowledge

□ Impact
26. LEGISLATION 153

26.4 Fact or impact? (Copyright)


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/iot_legal_g05

Extended (long-form) questions require you to include knowledge and im-


pact in your responses. This allows you to demonstrate that you can think
about a concept more deeply than by only writing down points of knowledge
that you can recall.

▶ For each sentence in the response, indicate whether the sentence demon-
strates knowledge (e.g. of a fact/concept), or the impact of a fact/concept:

QUESTION: Discuss the impact of Copyright legislation on the spread of


digital content.

RESPONSE: Copyright legislation protects the rights of creators and dis-

tributors of digital content, including software . The

legislation acts as a deterrent to people who would create copies of software

without paying for it and means that creators are more likely to be remuner-

ated for their work . The law was enacted in 1988 in the

UK . Without this legal protection, there may be fewer

independent developers who can focus on creating software, as they would

need to find other, more financially secure employment .

This in turn might mean that creativity and innovation could be restricted,

causing less economic growth .

□ Knowledge

□ Impact
154 26. LEGISLATION

26.5 Fact or impact? (Computer Misuse Act)


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/iot_legal_g06

Extended (long-form) questions require you to include knowledge and im-


pact in your responses. This allows you to demonstrate that you can think
about a concept more deeply than by only writing down points of knowledge
that you can recall.

▶ For each sentence in the response, indicate whether the sentence demon-
strates knowledge (e.g. of a fact/concept), or the impact of a fact/concept:

QUESTION: Discuss the effectiveness of the Computer Misuse Act in deal-


ing with cybercrime.

RESPONSE: The Computer Misuse Act is a piece of legislation

. The sections of the Act are designed to deal with a

wide range of security threats . The sections of the

Act allow the police and prosecutors to take action against cybercrimin-

als . Passwords can be used to commit further offences

. The creation and spread of malware would violate Sec-

tion 3, as the program modifies the system it is installed on .

In this way, the Act provides a clear basis to convict those guilty of a vari-

ety of cybercrimes . Organisations are under pressure

to clearly warn potential offenders that they are not authorised to commit

certain actions and the consequences of those actions .

□ Knowledge

□ Impact
26. LEGISLATION 155

26.6 Impact of legislation


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/iot_legal_g03

▶ Complete the table by adding the correct piece of legislation to match the
relevant impact. Items can be selected more than once.

Impact Legislation
This gives the public the right to know what
public organisations spend their money on.
Actions that employers take using this legislation
can lead to the erosion of trust between employers
and employees.
Public debate can be better informed and more
productive because of this.

□ Computer Misuse Act

□ Copyright, Design and Patents Act

□ General Data Protection Regulations (GDPR)

□ Telecommunications Regulations Act

□ Data Protection Act

□ Freedom of Information Act


27 Impacts of technology
Technology impacts our lives in both positive and negative ways. Informa-
tion is easily accessible and can be exchanged on an almost immediate basis.
This has changed how much personal information is shared. It also means
that it is important to be considerate of all users’ needs, for example when
choosing colours for a company website. Identifying impacts allows us to
make better decisions as we develop and use new technologies. Awareness of
impact can help avoid introducing personal biases into systems, which could
affect users.
We must consider how our use of technology impacts the environment. As
an example, artificial intelligence (AI) can help us identify areas vulnerable
to deforestation. However, training and maintaining AI algorithms requires
a lot of power, which could have a negative environmental impact.

27.1 Machine learning


AQA EDEXCEL OCR isaaccs.org/bq/iot_impacts_g01

▶ Which one of these can lead to ethical issues when making use of machine
learning?

⃝ Syntax errors

⃝ Disposal of digital electronic equipment

⃝ Algorithmic bias

27.2 Artificial intelligence


AQA EDEXCEL OCR isaaccs.org/bq/iot_impacts_g02

▶ What one of these is an example of an application of artificial intelligence?

⃝ A pedestrian crossing

⃝ Speed cameras

⃝ Facial recognition

⃝ A pilot flying a helicopter

156
27. IMPACTS OF TECHNOLOGY 157

27.3 Impacts
AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/iot_impacts_g03

▶ Complete the table by adding the correct type of impact for each example.

Example Type of impact


Social media has enabled and encouraged people
from around the world to communicate with each
other. The technology has led to the introduction
of many new words and phrases, such as ‘emoji’,
‘selfie’, and ‘trolling’, which have now become
widely used in our day-to-day conversations, as
well as on social media.
In the workplace, it is reasonable for an employee
to be able to use their phone to check their social
media account. It is also reasonable for an
employer to monitor an employee’s use of the
internet.
Social media allows a wide range of voices to
engage in public debate. This allows us to be
better informed on matters that affect us.

□ Social

□ Environmental

□ Cultural

□ Economic

□ Moral

□ Ethical
28 Programming concepts
Almost all programs consist of the same basic ‘building blocks’, assembled
in different ways to achieve a particular goal. Variables, data types, se-
quence, selection, and iteration are examples of these basic concepts,
which all new programmers need to learn. In order to compare and manipu-
late data, and to make decisions in a program, programmers use a variety of
different logical, relational, and arithmetic operators. It is also useful
to be able to generate randomness in a program, for example selecting a
random number or a random item from a list.

28.1 Odd or even?


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_prog_05

Martin wrote a program a few weeks ago, but he has forgotten to comment
his code, so he can’t remember how it works.

1 end = 10
2 FOR i = 1 TO end
3 IF (i MOD 2) == 0 THEN
4 PRINT (" red ")
5 ELSE
6 PRINT (" blue ")
7 ENDIF
8 NEXT i

▶ What will be printed when i reaches 8 in the loop?

⃝ blue
⃝ red
⃝ 0
⃝ 8

158
28. PROGRAMMING CONCEPTS 159

28.2 List the coordinates


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_prog_02

Sian is writing a program for a game with a grid. Here is the grid she is
using:
Sian wants to write some code to
x \y 1 2 3
generate the grid positions of every
1
shaded square on her grid so that she
2 @
can check them. For example, the co-
3
ordinates of the square containing the
4 #
@ sign would be x=2 y=2.
▶ Which of these pieces of code generates all of the shaded grid positions?
Circle the correct answer.

OPTION A
1 x = 1
2 y = 1
3 WHILE x <= 4 AND y <= 3
4 PRINT ("x=" + STR(x) + " y=" + STR(y))
5 x = x + 1
6 y = y + 1
7 ENDWHILE

OPTION B
1 FOR x = 1 TO 4
2 FOR y = 1 TO 3
3 PRINT ("x=" + STR(x) + " y=" + STR(y))
4 NEXT y
5 NEXT x

OPTION C
1 FOR x = 1 TO 7
2 PRINT ("x=" + STR(x) + " y=" + STR(x - 1))
3 NEXT x

OPTION D
1 FOR x = 1 TO 3
2 FOR y = 1 TO 4
3 PRINT ("x=" + STR(x) + " y=" + STR(y))
4 NEXT y
5 NEXT x
160 28. PROGRAMMING CONCEPTS

28.3 Which code will execute?


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_prog_01

1 number = 5
2 triple = True
3
4 IF triple == True AND number >= 10 THEN
5 number = number * 3
6 ELSE
7 number = number + 5
8 ENDIF
▶ What is the value of the variable number once the code has finished ex-
ecuting?

28.4 Constants
AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_prog_08

A banking system uses a constant to store the current rate of VAT so that
it can be used in calculations.

1 VAT_RATE = 0.20

▶ Which of the following statements relating to constants is true?

⃝ A constant is the same as a variable.


⃝ The value of a constant can only change while the program is running.
⃝ You cannot change the value of a constant in the program source code.
⃝ A constant stores a value that does not change during the execution
of the program.
28. PROGRAMMING CONCEPTS 161

28.5 Not in stock?


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_prog_11

A fruit seller has created a program, shown in pseudocode below, to help


their customers check the level of fruit in stock.

1 PROCEDURE check_stock ()
2 fruit = INPUT (" What fruit would you like ?")
3 IF fruit == "Mango " THEN
4 level = "low"
5 ELSEIF fruit != " Banana " AND fruit != "Apple" THEN
6 level = "no"
7 ELSE
8 level = "good"
9 ENDIF
10 PRINT (" There is " + level + " stock ")
11 ENDPROCEDURE

▶ From the list of fruits that follows, select all the fruits which have a low
or good level of stock.

□ Peach
□ Banana
□ Apple
□ Mango
□ Orange

28.6 Modulo
isaaccs.org/bq/prog_concepts_arithmetic_operators_
AQA EDEXCEL EDUQAS OCR WJEC g02

▶ What would be the output from the following program?


1 result = 20 MOD 8
2 PRINT( result )
162 28. PROGRAMMING CONCEPTS

28.7 A trace table


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_prog_14

A student has designed an algorithm that is shown in pseudocode below.


The algorithm uses a condition-controlled loop.

1 PROCEDURE main ()
2 input_value = INPUT (" Enter a number : ")
3 num = INT( input_value )
4 count = 0
5 WHILE num < 500
6 num = num * 2
7 count = count + 1
8 ENDWHILE
9 PRINT (count - 1)
10 ENDPROCEDURE

The student traces the algorithm for a user input of 16.


▶ Which of the following options shows a trace table with the correct values?

Trace table
num count num < 500 OUTPUT
16 1 TRUE
32 2 TRUE
⃝ 64 3 TRUE
128 4 TRUE
256 5 TRUE
512 6 FALSE
5

Trace table
num count num < 500 OUTPUT
16 0 TRUE
32 1 TRUE
⃝ 64 2 TRUE
128 3 TRUE
256 4 TRUE
512 5 FALSE
4
28. PROGRAMMING CONCEPTS 163

Trace table
num count num < 500 OUTPUT
16 0 TRUE
32 1 TRUE

64 2 TRUE
128 3 TRUE
256 4 TRUE
FALSE 3

Trace table
num count num < 500 OUTPUT
16 0 TRUE
32 1 TRUE
⃝ 64 2 TRUE
128 3 TRUE
256 4 TRUE
512 5 FALSE
511

28.8 Spot the data type


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/prog_concepts_data_types_g01

Take a look at the data presented in the options below.

▶ Select the option that is most likely to be an example of the string data
type.
⃝ True ⃝ Five
⃝ 5.1 ⃝ 5

28.9 Spot the data type 2


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/prog_concepts_data_types_g02

Take a look at the data presented in the options below.

▶ Select the option that is most likely to be an example of the integer data
type.
⃝ 5.1 ⃝ False
⃝ Five ⃝ 5
164 28. PROGRAMMING CONCEPTS

28.10 Integer division


isaaccs.org/bq/prog_concepts_arithmetic_operators_
AQA EDEXCEL EDUQAS OCR WJEC g01

▶ What would be the output from the following program?


1 result = 20 DIV 8
2 PRINT ( result )

28.11 Predict the output


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/prog_concepts_data_types_g03

▶ What will be the output of line 5 when the code is executed if the user
enters 1 for the first number and 7 for the second number?
1 PRINT (" Enter a number ")
2 num1 = INPUT ()
3 PRINT (" Enter another number ")
4 num2 = INPUT ()
5 PRINT (num1 + num2)

⃝ 8 ⃝ 17

28.12 Accepting input in Python


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/prog_concepts_inputs_g01

▶ Which of the following instructions are carried out by an input function.


Choose three correct answers from the list of five possible answers.

□ It takes the value entered by the user

□ It returns the converted value as string

□ It checks the data type of the entered value

□ It returns the value using the specified data type

□ It converts the value into the string data type


28. PROGRAMMING CONCEPTS 165

28.13 Converting data types


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/prog_concepts_inputs_g02

▶ Which line of code in the program below contains a function that will
convert a string to an integer?
1 PRINT (" How old are you ?")
2 user_input = INPUT ()
3 age = INT( user_input )
4 months = age * 12
5 PRINT ("Wow , you have been alive for around " + STR( months ) +
" months !")

⃝ PRINT("Wow, you have been alive for around " + STR(months)+ " months!")

⃝ age = INT(user_input)

⃝ PRINT("How old are you?")

⃝ months = age * 12

⃝ user_input = INPUT()

28.14 User input


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/prog_concepts_inputs_g03

▶ The code below is executed. If the user enters the string zero when
prompted for a decimal number, what will happen?
1 PRINT (" Enter a decimal number ")
2 user_input = INPUT ()
3 num1 = FLOAT( user_input )
4 PRINT (" Your decimal number is: " + STR(num1))

⃝ It will remind the user to enter a number and prompt them to enter it
again

⃝ It will display Your decimal number is: zero

⃝ A value error will occur

⃝ It will convert the string zero to the decimal number 0.0


166 28. PROGRAMMING CONCEPTS

28.15 Step in time


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/prog_concepts_iteration_g01

▶ What will be the output of the following program when it is executed?


1 FOR i = 1 TO 9 STEP 3
2 PRINT (i)
3 NEXT i

⃝ 1,2,3

⃝ 4,7

⃝ 1,2,4,5,6,7,8,9

⃝ 1,4,7

28.16 Top of the league


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/prog_concepts_iteration_g02

Samir has created a program that keeps track of his team’s score for a local
table tennis league. Below is the program that he has written.
1 red_team = ["W","W","L","D"]
2 win = 4
3 draw = 2
4 loss = -1
5 total = 0
6
7 FOR EACH result IN red_team
8 IF result == "W" THEN
9 total = total + win
10 ELSEIF result == "D" THEN
11 total = total + draw
12 ELSE
13 total = total + loss
14 ENDIF
15 NEXT result
16 PRINT ( total )

▶ What will be the output of his program when it is executed?


⃝ 2 ⃝ 4
⃝ 11 ⃝ 9
28. PROGRAMMING CONCEPTS 167

28.17 Countdown
AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/prog_concepts_iteration_g03

▶ What will be the output of this program when it is executed?


1 timer = 3
2 WHILE timer > 0
3 PRINT (timer)
4 timer = timer - 1
5 ENDWHILE
6 PRINT (" Time is up")

⃝ 3,Time is up, 2,Time is up, 1,Time is up,

⃝ 3,2,1,Time is up

⃝ 3,2,1,0,Time is up

⃝ Time is up

28.18 Crazy weather


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/prog_concepts_iteration_g04

▶ What will be the output of this program when it is executed?


1 weather = "Sun"
2
3 FOR counter = 1 TO 3
4 PRINT ( weather )
5 weather = "Rain"
6 NEXT counter
7
8 IF weather == "Rain" THEN
9 PRINT ("It 's raining ")
10 ENDIF

⃝ Sun, It’s raining

⃝ Sun, Rain, Rain

⃝ Sun, Rain, Rain, It’s raining

⃝ Sun, Rain, It’s raining


168 28. PROGRAMMING CONCEPTS

28.19 Random ints


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/prog_concepts_random_numbers_g01

A learner wants to use a program to generate random numbers for a dice


rolling game. The code can be seen below:
1 dice_roll = RANDOM_INT (1 ,7)
2 PRINT ( dice_roll )

▶ What will happen when this program is executed? Choose one from the
list of four options.

⃝ Either 1, 2, 3, 4, 5, or 6 will be displayed as output on the screen

⃝ Either 1, 2, 3, 4, 5, 6, or 7 will be displayed as output on the screen

⃝ RANDOM_INT(1,7) will be displayed on screen

⃝ dice_roll will be displayed on the screen

28.20 IF/ELSE
AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/prog_concepts_selection_g02

▶ What will be the output of the following program when it is executed?


1 number = 15
2 IF number > 13 THEN
3 PRINT ( number + 3)
4 ELSE
5 PRINT ( number + 10)
6 ENDIF

⃝ 25

⃝ 18

⃝ 18, 25

⃝ 16
28. PROGRAMMING CONCEPTS 169

28.21 What IF you don't get enough sleep?


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/prog_concepts_selection_g01

Rose has designed an application that promotes healthy lifestyle choices.


She would like the app to do the following:

• Allow the user to input the number of hours they slept


• Provide a message to the user based on the number of hours that they
slept

▶ Put the blocks of code in the correct order to form a working segment of
code.

□ PRINT("Well done. 8+ hours is perfect! Keep up the good work")

□ PRINT("6+ hours. Not bad. It is recommended that you get 6 hours


sleep as a minimum")

□ hours_slept = INT(INPUT())

□ ELSE

□ IF hours_slept >= 8 THEN

□ PRINT("You should aim to get between 6 and 8 hours sleep")

□ ENDIF

□ ELSEIF hours_slept >=6 THEN


170 28. PROGRAMMING CONCEPTS

28.22 Is it morning?
AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/prog_concepts_selection_g03

▶ What will be the output of the following program when it is executed?


1 hour = 12
2 IF hour <= 12 THEN
3 PRINT (" Good morning ")
4 ENDIF
5
6 PRINT (" How are you ?")

⃝ Good morning, How are you

⃝ Good morning

⃝ How are you?

28.23 Greater or less than?


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/prog_concepts_selection_g04

▶ What will be the output of the following program when it is executed?


1 number_1 = 30
2 number_2 = 90
3
4 IF number_1 > 30 AND number_2 == 90 THEN
5 PRINT ("1")
6 ELSEIF number_1 > 30 OR number_2 == 90 THEN
7 PRINT ("2")
8 ELSEIF number_1 == 30 AND number_2 == 90 THEN
9 PRINT ("3")
10 ELSE
11 PRINT ("4")
12 ENDIF

⃝ 1

⃝ 4

⃝ 2

⃝ 2,3
28. PROGRAMMING CONCEPTS 171

28.24 Variable assignment 1


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/prog_concepts_variables_g01

▶ What will be the output of PRINT when this program is executed?


1 PRINT( player_name )
2 player_name = " BlueSky93 "

⃝ There is an error in the program


⃝ player_name
⃝ BlueSky93

28.25 Variable assignment 2


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/prog_concepts_variables_g02

▶ What will be the output of PRINT when this program is executed?


1 player_name = " BlueSky93 "
2 PRINT( player_name )

⃝ player_name
⃝ "BlueSky93"
⃝ There is an error in the program
⃝ BlueSky93

28.26 Variable assignment 3


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/prog_concepts_variables_g03

▶ What will be the output of PRINT when this program is executed?


1 player_name = " BlueSky93 "
2 player_name = " DinoFish40 "
3 PRINT( player_name )

⃝ BlueSky93
⃝ BlueSky93, DinoFish40
⃝ DinoFish40
⃝ player_name
29 String handling
A string is a sequence of characters (letters, numbers, spaces, or other
symbols). String handling techniques are used to check and manipulate
string data, for example to determine whether a password is sufficiently
long, or to remove or replace characters in a piece of text.
This topic uses a single version of pseudocode and versions of real program
code in Python and C#.

29.1 Number plate substrings


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_prog_03

Nitin owns a car showroom, and he has records of all of the cars he has in
stock. The records include the cars’ number plates. The number plates are
all in the following format, where L is a letter and N is a number:
LLNNLLL

Nitin has written a program to try to extract only the two numbers (NN)
from the number plate of every car, which represent the year in which it was
registered.
The documentation for the programming language said, “to obtain a sub-
string, you must specify the starting position (numbering starts at 0), the
ending position (inclusive), and the string itself”.
He isn’t sure whether the program he has written is correct. Here is his code:
numberplate = " ZX19CSV "
year = numberplate [2:5]
PRINT (year)

▶ What will Nitin’s program print out?

172
29. STRING HANDLING 173

29.2 Check the password


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/prog_string_g01

A web designer is developing an application where the user has to create a


password. The password has to be between 10 and 16 characters and must
not contain any blank spaces.
The pseudocode of the check_password function below is used to validate the
password created by the user.
1 FUNCTION check_password ( password )
2 is_valid = True
3 password_length = LEN( password )
4 IF password_length < 10 OR password_length >16 THEN
5 is_valid = False
6 ELSE
7 FOREACH character IN password
8 IF character == " " THEN
9 is_valid = False
10 NEXT character
11 ENDIF
12 RETURN is_valid
13 ENDFUNCTION

▶ Select the option that best describes why the check_password function
returns False when it is called with the argument “My Great Password”?

⃝ It returns False because the password length is three words


⃝ It returns False because the password has two space characters
⃝ It returns False because the password length is 17 characters
174 29. STRING HANDLING

29.3 STRIP a substring


EDUQAS isaaccs.org/bq/prog_string_g02

A programmer receives a file.


Each line of text in the file has an unwanted ‘*’ character at the start.
Here is part of the code the programmer writes to remove the unwanted
character from each line.
1 old_file = OPEN_READ (" old.txt ")
2 lines = old_file . READ_ALL ()
3 old_file . CLOSE ()
4
5 CREATE_FILE (" new.txt ")
6 new_file = OPEN_APPEND (" new.txt ")
7
8 FOREACH line IN lines
9 cleaned = *** missing code ***
10 new_file . WRITE_LINE ( cleaned )
11 NEXT line
12
13 new_file . CLOSE ()

▶ Select the line of code the programmer should use to remove the unwanted
character.

⃝ STRIP("*" from line)


⃝ STRIP("*" from EACH line)
⃝ STRIP(line, "*")
⃝ STRIP("*", line)
29. STRING HANDLING 175

29.4 Concatenating strings


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/prog_string_g03

▶ Using four of the lines of code supplied, create a program that uses
concatenation to produce this output:
Venus is the hottest planet.

□ string = name + text

□ print(string)

□ name = "Venus "

□ text = "is the hottest


planet."

□ print(Venus is the hottest


planet.)

29.5 What's in this string?


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/prog_string_g04

▶ Which one of these shows a variable that has been assigned an empty
string?

⃝ word = 0
⃝ word = "0"
⃝ word = " "
⃝ word = ""
176 29. STRING HANDLING

29.6 Indexing
AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/prog_string_g05

A variable named legend is assigned a string:


legend = "Lovelace"
▶ What is the character returned by legend[2]?

⃝ L

⃝ o

⃝ v

29.7 Getting the position


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/prog_string_g06

▶ What is output when this code runs?


1 position = INDEXOF (" Garlic ", "i")
2 PRINT ( position )

⃝ 4

⃝ 5

⃝ 6

29.8 A slice of "Pie"


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/prog_string_g07

▶ What substring is output when this code runs?


1 name = "Pie"
2 PRINT (name [: -1])

⃝ Pi

⃝ name[:-1]

⃝ ie

⃝ P
29. STRING HANDLING 177

29.9 Validation
AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/prog_string_g08

▶ Which one of these is the reason for using LOWER() when validating user
input to this prompt?
1 answer = "Would you like to continue ? Enter Y or N: "

⃝ To make sure the output data is correct


⃝ To check the line below if the user enters a character on the wrong line
⃝ To handle a string of more than one character entered by the user
⃝ To handle a string of an unexpected case entered by the user
30 Subroutines
A subroutine is a named section of code that can be called by writing the
subroutine’s name in a program statement. Subroutines can also be referred
to as procedures or functions. A procedure is a set of instructions
that will be executed when the procedure is called, whilst a function also
contains a set of instructions that will be executed when the function is
called and it will also return a value when it has finished executing.
Using subroutines makes the code more readable and reusable, as the code
is broken into smaller sections. Most programming languages come with a
standard library of built-in subroutines to perform common functions, but
also have the capability to allow the programmer to write their own custom
subroutines.

30.1 Global variables


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/prog_sub_g05

▶ From the sentences below select the one that best describes a global
variable.

⃝ A global variable refers to a variable that can only be accessed and


modified within the code block in which it is declared.

⃝ A global variable is declared in the main part of the program and


can be accessed globally by all subroutines.

⃝ A global variable is declared in the main part of the program but


cannot be accessed globally by all subroutines.

30.2 Using subroutines


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/prog_sub_g06

▶ Select the statement that is true.

⃝ Subroutines make programs easier to read and understand, because


they break program code into smaller sections.

⃝ Procedures allow values to be returned to the procedure call.

⃝ If a subroutine is defined, then it must be executed at some point in


the program.

178
30. SUBROUTINES 179

30.3 Fix the calculator


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_prog_10

George is writing a calculator program. The code he has written so far, is


shown in the following pseudocode:

1 PROCEDURE multiply (value_a , value_b )


2 PRINT ( value_a * value_b )
3 ENDPROCEDURE
4
5 PROCEDURE main ()
6 first = INPUT (" Enter the first number : ")
7 first = INT(first)
8 second = INPUT (" Enter the second number : ")
9 second = INT( second )
10 result = multiply (first , second )
11 PRINT (" The result is " + result )
12 ENDPROCEDURE

George tests his program by typing in the numbers 5 and 2, and this is what
he sees:

1 Enter the first number : 5


2 Enter the second number : 2
3 10
4 The result is null

▶ Why does the final line state that the result is null?

⃝ He didn’t call the subroutine correctly.


⃝ He forgot to save the return value from the subroutine into a variable.
⃝ He has not specified a return value from the subroutine.
⃝ The print statement on line 2 caused an error.
180 30. SUBROUTINES

30.4 Return a value


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_prog_13

The cube of a given number is that number multiplied by itself three times.
For example, the cube of 3 is 27.

Lucy has created a program (shown in pseudocode below) that uses a sub-
routine named cubed to carry out the calculation. When she runs the pro-
gram, Lucy is not getting the output that she was expecting.

1 FUNCTION cube(num)
2 cubed_value = num * num * num
3 RETURN cubed_value
4 ENDFUNCTION
5
6 PROCEDURE main ()
7 input_value = INPUT (" Enter a value to be cubed : ")
8 user_num = INT( input_value )
9 cube( user_num )
10 ENDPROCEDURE

Lucy realises that problem is with the final line of code.

▶ How should she amend it so that the cubed value is outputted correctly?

⃝ PRINT(cube(user_num))
⃝ PRINT(cubed_value)
⃝ PRINT(num)
⃝ PRINT(user_num)
30. SUBROUTINES 181

30.5 Parameters
AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/prog_sub_g01

Parameters are defined when a subroutine is , usually in-


side brackets after the name of the subroutine (the subroutine ).
The parameters are also given identifiers (names). A subroutine can have
one, more than one, or parameters.

▶ Use the words below to compete the above paragraph.

□ no

□ identifier

□ called

□ declared

30.6 Arguments
AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/prog_sub_g02

An argument is any item of data that is passed to a .


The subroutine must be called with the number of arguments defined by its
list of .

▶ Use the words below to compete the above paragraph.

□ subroutine

□ parameters

□ items

□ program
182 30. SUBROUTINES

30.7 Procedures
AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/prog_sub_g03

A student wants a subroutine that will add any two given numbers together
and to display the answer.
▶ Use the lines of code below to construct a display_sum procedure for them.

□ ENDPROCEDURE

□ PRINT (answer)

□ answer = num1 + num2

□ PROCEDURE
display_sum(num1,
num2)

30.8 Passing data


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/prog_sub_g08

▶ Rearrange the lines of code below to construct a function, then call the
function and pass data to it.

□ FUNCTION
calculate(num1, num2)

□ ENDFUNCTION

□ PRINT (answer)

□ answer = calculate(5,
10)

□ RETURN answer
30. SUBROUTINES 183

30.9 Functions
AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/prog_sub_g09

A is a named block of code that has the purpose of

a value. A can be called by another

part of the program but does not return a value.

▶ Use the words below to complete the paragraph above.

□ returning

□ value

□ procedure

□ function

30.10 Local variables


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/prog_sub_g04

▶ From the sentences below select the one that best describes a local vari-
able.

⃝ Local variables are variables that cannot be accessed and modified


within the code block in which they were declared.
⃝ Local variables are variables that can only be accessed and modified
within the code block in which they were declared.
⃝ Local variables are variables that can be accessed and modified from
anywhere in the program.
184 30. SUBROUTINES

30.11 Advantages of subroutines


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/prog_sub_g07

▶ Which one of the following statements describes an advantage of sub-


routines?

⃝ When creating very large programs, you can give different program-
mers different subroutines to write, and these can then be combined.
⃝ Subroutines are always defined by the user, and these cannot be com-
bined.
⃝ Procedures allow values to be returned to the procedure call.

30.12 Multiplication machine


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/prog_sub_g10

You have been tasked with creating a program that multiplies any two num-
bers together.

▶ Use the options below to complete the following program:

1 ____________________ multiply_two_numbers (number1 , number2 )


2 answer = number1 * number2
3 ____________________ answer
4 ____________________
5
6 result = multiply_two_numbers (5 ,5)
7 PRINT ( result )

□ ENDFUNCTION □ PROCEDURE

□ ENDPROCEDURE □ PRINT

□ RETURN □ FUNCTION
30. SUBROUTINES 185

30.13 Split the bill


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/gcse_prog_09

Maja has written a program that is supposed to display how much one person
should pay if a restaurant bill is split equally between the people present.

The program isn’t working correctly; when Maja runs it, the amount does
not appear on the screen.

1 FUNCTION split_the_bill (amount , number_of_people )


2 result = FLOAT ( amount ) / INT( number_of_people )
3 RETURN result
4 ENDFUNCTION
5
6 PROCEDURE main ()
7 bill_total = INPUT (" Enter the total bill amount ")
8 people = INPUT (" How many people were eating ?")
9 PRINT (" The amount you should pay is ...")
10 split_the_bill ( bill_total , people )
11 ENDPROCEDURE

▶ Why doesn’t the program print the amount?

⃝ She has got the bill calculation wrong.


⃝ She has called the subroutine correctly, but has not displayed the re-
turn value.
⃝ She has forgotten to call the subroutine.
⃝ She has put the arguments the wrong way round when calling the
subroutine.
31 File handling
Many computer applications use some form of persistent data. This is data
that is stored in secondary storage and will be available whenever the ap-
plication is used. All persistent data is stored in files. This can be a single
file, or for larger systems a collection of related files. Some applications use
databases. Databases are large complex file systems where all of the low
level file organisation and access is managed for you. However, databases
are not suitable for every application; sometimes a more simple file structure
is needed.

31.1 File mode


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/prog_files_g01

Natalia is a software developer for a clothes retailer. She has a csv file
named ‘stock.csv‘ that includes information on all of the clothing sold by
the retailer.

Task Mode
Add new new items of clothes to ‘stock.csv’
Search the file for a specific item of clothes
Create a new file named ‘search-results.csv‘.
Overwite contents of ‘search-results.csv‘ with the
results of each new search

▶ Look through the list of jobs above Natalia has to perform and decide
which file handling mode below would be most suitable for each task.

□ Write

□ Append

□ Read

186
31. FILE HANDLING 187

31.2 CSV Downloads


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/prog_files_g03

Below are the contents of a file named user_download_history.csv showing


app downloads for a customer.

DownloadID AppTitle PurchaseDate Price


187362 Monopoly Classic 2022-03-01 4.99
273340 Mini Football 2022-03-20 2.79
317333 Stardew Valley 2021-11-19 4.99
387737 Game Dev Tycoon 2021-04-28 4.99
622100 Alien Isolation 2022-02-12 12.99

The user wants a list of only the titles of all the apps they have purchased.
▶ Use the items below to complete the subroutine that will print a list of
titles for the customer. The field that contains the title is AppTitle.

1 SUBROUTINE read_csv ()
2 file_object =
____________________ (' user_download_history .csv ')
3 WHILE NOT file_object . END_OF_FILE ()
4 record = file_object . READ_LINE ()
5 app_data = ____________________ (record ,
'____________________ ')
6 app_title = movie_data [ ____________________ ]
7
8 PRINT ('App title : ' + ____________________ )
9 ENDWHILE
10 file_object .CLOSE ()
11 ENDSUBROUTINE

□ OPEN_READ □ SPLIT

□ 1 □ app_title

□ , □ AppTitle

□ 0 □ SEPARATE
188 31. FILE HANDLING

31.3 What's in the file?


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/prog_files_g02

Kasim has a file with the name test_data.csv. He needs to write code to be
able to open the file and to output the first line so that knows the headings
of each column.

▶ Reorder the code below so that Kasim has a working program that reads
and outputs only the first line of the file.

Note: Not all lines of code provided are needed to complete the program

□ file_object = OPEN_WRITE("bridge.txt")

□ PRINT(headings)

□ headings = file_object.READ_LINE()

□ file_object.CLOSE()

□ file_object = OPEN_READ("bridge.txt")
31. FILE HANDLING 189

31.4 Adding students to the list


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/prog_files_g04

A teacher uses this code to display a list of students’ names.


1 PROCEDURE read_names ()
2 file_object = OPEN_READ ('list.txt ')
3 list = file_object . READ_ALL ()
4 file_object . CLOSE ()
5 PRINT (list)
6 ENDPROCEDURE

New code is needed to add new students’ names to the list.

▶ Using the code options provided, add the lines of code into the correct
order to complete the new procedure. You do not have to use all the lines
of code provided.

1 PROCEDURE add_name ( new_name )

2 __________________________________________

3 __________________________________________

4 __________________________________________

5 ENDPROCEDURE

□ file_object = OPEN_APPEND(”list.txt”)

□ file_object.WRITE_LINE(new_name)

□ file_object.CLOSE()

□ file_object = OPEN_READ(”list.txt”)

□ file_object.READ_LINE()

□ file_object = OPEN_WRITE(”list.txt”)
190 31. FILE HANDLING

31.5 Missing movie


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/prog_files_g06

A file called movies.csv contains a list of movies.


This code has been developed to add details of new movies to the file.
▶ Add the code into the spaces to ensure the code successfully adds new
movies to the file. You do not have to use all the lines of code provided.

1 PROCEDURE main ()
2 title = INPUT ('Enter the movie title : ')
3 year = INPUT ('Enter the movie year: ')
4 duration = INPUT(' Enter the length of the movie (01:00) :
')
5 director = INPUT(' Enter the name of the movie 's
director : ')
6 rating = INPUT(' Enter the average movie rating (1 to 5):
')
7 price = INPUT ('Enter the price in pounds (£00 .00) :')
8 append_movie_optimised (title , year , duration , director ,
rating , price)
9 ENDPROCEDURE
10
11 PROCEDURE _________________ (title , year , duration , director ,
rating , price)
12 _________________ = title + ',' + year + ',' + duration
+ ',' + director + ',' + rating + ',' + price
13 file_object = _________________ (' movies .csv ')
14 _________________ ( new_movie )
15 file_object . _________________ ()
16 ENDPROCEDURE

□ append_movie_optimised □ ENDPROCEDURE

□ OPEN_WRITE □ CLOSE

□ OPEN_APPEND □ file_object.WRITE_LINE

□ new_movie □ OPEN_READ
31. FILE HANDLING 191

31.6 Outputting the contents of a file


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/prog_files_g05

▶ Which one of these options should be used to open a file to output its
contents?

⃝ OPEN.APPEND('food.txt')
⃝ OPEN.WRITE('food.txt')
⃝ OPEN('food.txt')
⃝ OPEN.READ('food.txt')

31.7 Is it true?
AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/prog_files_g08

▶ Select the three correct statements about file handling.

□ The append mode adds new data at the end of the file.

□ The use of write mode can overwrite the existing data of a file.

□ The append and write modes both allow a file to be read.

□ The read mode allows new data to be added to the end of the file.

□ Only read mode allows the file to be read.

31.8 End of the line!


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/prog_files_g10

▶ The file teams.csv contains the details of ten sports teams.


Which one of these options is a possible output from the code teams.END_OF_FILE()?

⃝ TRUE
⃝ .csv
⃝ The last line of data
192 31. FILE HANDLING

31.9 The charity shop system


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/prog_files_g07

▶ A charity shop needs a stock management system. The system should


allow staff members to add new items and see all current stock. The code
contains some gaps. Add the code into the spaces, so the code successfully
adds a new item of stock and can print a list of all stock.

1 PROCEDURE add_items ():


2 code = INPUT(' Enter Item Code ')
3 name = INPUT(' Enter Item Name ')
4 price = INPUT(' Enter Item Price ')
5 file = _______________ (' items_list .txt ')
6 file. WRITE_LINE (code +' - '+ name +' - '+ price)
7 file. _______________ ()
8 ENDPROCEDURE
9
10 PROCEDURE disp_items ():
11 file = OPEN_READ (' _______________ ')
12 items = file. _______________ ()
13 FOREACH item IN items :
14 PRINT(item)
15 END_______________
16
17 PROCEDURE read_menu ():
18 menu = '1'
19 WHILE menu != '3':
20 menu = INPUT ('1 - Add Item \n 2 - Display Item \n 3 -
Exit \n ')
21 IF menu == '1':
22 _______________ ()
23 ELIF menu == '2':
24 disp_items ()
25 ELSE:
26 PRINT(' Goodbye !')
27 ENDPROCEDURE

□ CLOSE □ PROCEDURE

□ OPEN_APPEND □ add_items

□ READ_LINE □ items_list.txt
31. FILE HANDLING 193

31.10 File writing


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/prog_files_g09

▶ A program should write a new customer’s details to a file called customers.txt.


A procedure has been started. Add the lines of code provided into the correct
order.

1 PROCEDURE add_new_customer (firstname , surname , address ,

tel_number )

2 ______________________________________________

3 ______________________________________________

4 ______________________________________________

5 ENDPROCEDURE

□ file = OPEN_APPEND("customers.txt")

□ file.WRITE_LINE(firstname, surname, address, tel_number)

□ file_object.CLOSE()
32 Integrated development environments
(IDEs)
An integrated development environment (IDE) is software that in-
cludes various features to help a programmer develop their program code.
Most IDEs will include facilities such as automatic formatting and debug-
ging tools such as break points. It is common for an IDE to allow code to
be executed from inside the environment, with the help of an interpreter
or compiler.

32.1 What is an IDE?


EDUQAS OCR WJEC isaaccs.org/bq/prog_softeng_ide_g01

Most programmers use an integrated development environment (IDE) when


working on program code.

▶ Which of the following statements most accurately describes an IDE?

⃝ Software that is designed with the sole purpose of debugging your


program.
⃝ Software that supports you to write code, to execute your program,
and to debug errors.
⃝ Software that includes a text editor but requires you to use additional
software with a runtime environment to execute the code.

32.2 Debugging
EDUQAS WJEC isaaccs.org/bq/prog_softeng_ide_g03

▶ Which two of the following software features commonly included with an


integrated development environment (IDE) would be useful when debugging
a logic error in your code?

□ Break point

□ Automatic formatting

□ Syntax checking

□ Threading

194
32. INTEGRATED DEVELOPMENT ENVIRONMENTS (IDES) 195

32.3 IDE features


EDUQAS OCR WJEC isaaccs.org/bq/prog_softeng_ide_g02

The table below provides definitions for some of the features of an integrated
development environment (IDE).

▶ Put the words into the spaces provided to match the feature to the defin-
ition.

Definition Feature
The window in your IDE that allows you to write
your code
Allows you to add a pause to your program to
stop the flow of execution, and step through the
following code line by line to trace the values of
the variables
Colour that is applied to key elements of code,
such as variables, functions, and data type
Uses a translator to execute your program code
Connects pre-compiled libraries to your program
so that they can be used together
A feature that spots problems in your code as you
write it, which would cause an error when the
program is executed

□ Linker

□ Text editor

□ Keyword highlighting

□ Break point

□ Syntax checker

□ Runtime environment
196 32. INTEGRATED DEVELOPMENT ENVIRONMENTS (IDES)

32.4 Benefits of an IDE


EDUQAS OCR WJEC isaaccs.org/bq/prog_ide_g02

▶ The following description highlights the features and benefits of using an


IDE. Fill in the gaps using the word provided below.

helps to your

by reducing typos and helping you to avoid common mistakes, such as for-

getting to close a bracket. Automatic formatting can improve efficiency be-

cause it makes sure your code matches the requirements of the programming

language. Languages such as Python strictly require code to be indented to

indicate the program .

Debugging tools make it easier to track down and fix errors in programs.

A break point adds a pause to the program to stop the flow of execution.

This allows you to through the code up to that point,

rather than the program. A memory inspector helps to

debug problems with memory allocation in the program. It can help you

to identify problems such as a memory leak: the program doesn’t release

from the memory when it is no longer in use.

□ flow

□ step

□ Autocomplete

□ productivity

□ whole

□ speed up

□ data
32. INTEGRATED DEVELOPMENT ENVIRONMENTS (IDES) 197

32.5 Loaders
EDUQAS WJEC isaaccs.org/bq/prog_ide_g01

▶ Which one of the following functionalities is carried out by a loader in


an IDE?

⃝ Provides libraries into the memory in preparation for the program to


be executed.
⃝ Displays the contents of memory so that you can see how it is being
used.
⃝ Connects libraries to the program so that they can be used together.
33 Procedural programming
The term programming paradigm is used to specify an overall approach to
writing program code. Procedural programming is a programming paradigm
that has its roots in structured programming.
In procedural programming, programs are made up of procedures, also
known as subroutines or functions. Each procedure contains a series of
computational steps that will be carried out when the procedure is called.
Some programming languages support only the procedural paradigm. Oth-
ers are purely object-oriented or functional. If you have used Python, a
popular programming language that supports all three of the paradigms
mentioned, you will probably have started your programming journey by
taking a procedural approach to program development.

33.1 Find the identifier


AQA isaaccs.org/bq/prog_pas_g01

The following subroutine, expressed in pseudocode, forms part of a struc-


tured program.

1 FUNCTION find_highest_number (number1 , number2 )


2 result = ""
3 IF number1 > number2 THEN
4 result = " number 1 is highest "
5 ELSEIF number2 > number1 THEN
6 result = " number 2 is highest "
7 ELSE
8 result = "both numbers are equal"
9 ENDIF
10 RETURN result
11 ENDFUNCTION

▶ What is the identifier of the subroutine?

▶ Give the identifier of a parameter for the subroutine shown.

198
33.2 Structured benefits
AQA isaaccs.org/bq/prog_pas_g02

▶ The structured approach to programming provides many benefits. From


the list below, select all of the statements that specify a benefit of using the
structured approach. From the list below select all of the statements that
specify a benefit of using the structured approach.

□ A structured program will execute more quickly than an unstructured


program.

□ Meaningful identifiers for subroutines help to make the program code


self-documenting.

□ It is quicker to develop applications because many subroutines can be


worked on at the same time by different members of the development
team.

□ Subroutines make use of parameters and return values to interface with


each other so that the use of global variables is reduced or eliminated.

□ Subroutines are easier to test because they perform a single task.

33.3 Find the exit


AQA isaaccs.org/bq/prog_pas_g03

The following function, expressed in pseudocode, converts an error code into


an error message.
1 FUNCTION convert_code ( error_code )
2 IF error_code == "400" THEN
3 RETURN "Bad request "
4 ELSEIF error_code == "404" THEN
5 RETURN "Not found"
6 ELSEIF error_code == "408" THEN
7 RETURN " Request Time -Out"
8 ELSE
9 RETURN " Error !"
10 ENDIF
11 ENDFUNCTION

▶ How many ‘exit points’ does the function have?

199
200 34. OBJECT-ORIENTED PROGRAMMING

34 Object-oriented programming
Object-oriented programming (OOP) is an approach to systems de-
velopment that focuses on objects and the way that they interact. Objects
surround us in the real world. Look around you. For example, I am a per-
son, and I have a desk, a computer, and a cup of water; these are all objects.
How do they interact? I sit at my desk, switch on the computer, and drink
some water.
The OOP method of programming (or paradigm) is different to the proced-
ural paradigm, which many programmers start out with on their learning
journey. In this topic you will learn about objects and how they can be
defined and worked with in a computer system.

34.1 Radio one


EDUQAS WJEC isaaccs.org/bq/prog_oop_g01

The following class has been defined using pseudocode.


1 CLASS Radio
2 PRIVATE volume : integer
3 PRIVATE station : string
4 PRIVATE on: Boolean
5
6 PUBLIC PROCEDURE Radio ( given_station )
7 station = given_station
8 volume = 3
9 on = False
10 ENDPROCEDURE
11
12 PUBLIC FUNCTION get_volume ()
13 RETURN volume
14 ENDFUNCTION
15
16 PUBLIC FUNCTION get_station ()
17 RETURN station
18 ENDFUNCTION
19
20 PUBLIC FUNCTION is_on ()
21 RETURN on
22 ENDFUNCTION
23
24 PUBLIC PROCEDURE set_volume ( new_volume )
25 volume = new_volume
34. OBJECT-ORIENTED PROGRAMMING 201

26 ENDPROCEDURE
27
28 PUBLIC PROCEDURE set_station ( new_station )
29 station = new_station
30 ENDPROCEDURE
31
32 PUBLIC PROCEDURE switch ()
33 IF on == True THEN
34 on = False
35 ELSE
36 on = True
37 ENDIF
38 ENDPROCEDURE
39 ENDCLASS

▶ Which of the following options (expressed in pseudocode) will correctly


create an instance of a radio object?

⃝ Radio = NEW radio1("Capital FM", 3, True)

⃝ Radio = NEW radio1("Capital FM")

⃝ radio1 = NEW Radio("Capital FM")

⃝ radio1 = NEW Radio("Capital FM", 3, True)

34.2 Radio two


EDUQAS WJEC isaaccs.org/bq/prog_oop_g02

The following class has been defined using pseudocode.


1 CLASS Radio
2 PRIVATE volume : integer
3 PRIVATE station : string
4 PRIVATE on: Boolean
5
6 PUBLIC PROCEDURE Radio( given_station )
7 station = given_station
8 volume = 3
9 on = False
10 ENDPROCEDURE
11
12 PUBLIC FUNCTION get_volume ()
13 RETURN volume
14 ENDFUNCTION
202 34. OBJECT-ORIENTED PROGRAMMING

15
16 PUBLIC FUNCTION get_station ()
17 RETURN station
18 ENDFUNCTION
19
20 PUBLIC FUNCTION is_on ()
21 RETURN on
22 ENDFUNCTION
23
24 PUBLIC PROCEDURE set_volume ( new_volume )
25 volume = new_volume
26 ENDPROCEDURE
27
28 PUBLIC PROCEDURE set_station ( new_station )
29 station = new_station
30 ENDPROCEDURE
31
32 PUBLIC PROCEDURE switch ()
33 IF on == True THEN
34 on = False
35 ELSE
36 on = True
37 ENDIF
38 ENDPROCEDURE
39
40 ENDCLASS

▶ An object has been created based on the class definition shown above
and assigned to a reference variable called my_radio. Which of the following
options (expressed in pseudocode) will set the volume of this radio object to
6?

⃝ my_radio.volume = 6
⃝ my_radio.set_volume()= 6
⃝ my_radio.set_volume(6)
34. OBJECT-ORIENTED PROGRAMMING 203

34.3 Radio three


EDUQAS WJEC isaaccs.org/bq/prog_oop_g03

The following class has been defined using pseudocode.


1 CLASS Radio
2 PRIVATE volume : integer
3 PRIVATE station : string
4 PRIVATE on: Boolean
5
6 PUBLIC PROCEDURE Radio( given_station )
7 station = given_station
8 volume = 3
9 on = False
10 ENDPROCEDURE
11
12 PUBLIC FUNCTION get_volume ()
13 RETURN volume
14 ENDFUNCTION
15
16 PUBLIC FUNCTION get_station ()
17 RETURN station
18 ENDFUNCTION
19
20 PUBLIC FUNCTION is_on ()
21 RETURN on
22 ENDFUNCTION
23
24 PUBLIC PROCEDURE set_volume ( new_volume )
25 volume = new_volume
26 ENDPROCEDURE
27
28 PUBLIC PROCEDURE set_station ( new_station )
29 station = new_station
30 ENDPROCEDURE
31
32 PUBLIC PROCEDURE switch ()
33 IF on == True THEN
34 on = False
35 ELSE
36 on = True
37 ENDIF
38 ENDPROCEDURE
39
40 ENDCLASS
204 34. OBJECT-ORIENTED PROGRAMMING

▶ In testing, it was found that the volume of the radio could be set to an
unsafe level. The set_volume method must be updated so that it does not
allow the volume to exceed a setting of 30. Order the given statements to
create an updated version of the method. You must use all of the statements
with correct indentation in your solution.

□ ENDPROCEDURE

□ IF new_volume > 30 THEN

□ ELSE

□ volume = 30

□ PUBLIC PROCEDURE set_volume(new_volume)

□ ENDIF

□ volume = new_volume
35 Design
Design is an essential part of application systems development.
Developers need to carefully plan and consider many different solutions be-
fore they even start typing code. Every part of a solution needs to be con-
sidered, including the interface and even the data that a program will be
working with. Large applications need to be broken down into modules,
and specific algorithms need to be designed for each important process.
Algorithms can be expressed in a variety of ways. A flowchart is a useful
visual technique to show the flow of logic through a program. Pseudocode
is useful when the design will be passed to a programmer who can convert
the pseudocode into real program code.

35.1 Match the statement


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/soft_design_g06

▶ Which of the following statements would you put into the flowchart symbol
above?

⃝ PRINT("Hello")

⃝ START

⃝ cost > 10?

⃝ cost = cost + 25

205
206 35. DESIGN

35.2 Signs of efficiency


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/soft_design_g02

There are often many different algorithms that can accomplish the same
task.

▶ Which of the following characteristics should you consider when comparing


the efficiency of two algorithms?

⃝ The number of comparisons

⃝ The number of subroutines

⃝ The number of constants

35.3 What's the output?


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/soft_design_g07

Read through the following pseudocode program:


1 vowels = ["a", "e", "i", "o", "u"]
2 word = "isaac"
3 count = 0
4
5 FOR EACH letter IN word
6 IF letter IN vowels THEN
7 count = count + 1
8 ENDIF
9 NEXT letter
10
11 PRINT ( count )

▶ What will be the output of the program?


35. DESIGN 207

35.4 Break it down


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/soft_design_g01

You have been asked to create a program to solve the following problem:

Rik owns a sweet factory, and wants a program to control the


temperature of his sweet preparation containers.

Inside each container is a heater. To create his sweets, the mix-


ture of ingredients needs to be heated to a specific ideal temper-
ature.

Rik has containers of different volumes, but it always takes one


minute for the heater to raise the temperature of a cubic metre
of mixture by one degree.

Rik would like the program to calculate how long the heater needs
to be on for to bring the container up to the right temperature.

The different mixtures have different optimum temperatures, so


you need to take both this fact and the size of the container into
consideration.

▶ The first step to solving this problem is to break it down into the inputs,
processes, and outputs. Use the words below to complete the following
decomposition of Rik’s problem.

The inputs for this system are the container’s temperat-


ure and , as well as the temperature
for the mixture inside. The output is the amount of the
heater should be on for. To work out the output, you will need to find the
between the two temperatures, then
the result by the volume of the container.

□ current □ difference

□ ideal □ multiply

□ time □ volume
208 35. DESIGN

35.5 Tracing a flowchart


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/soft_design_g04

Study the flowchart below that represents an algorithm.

▶ Trace the algorithm and determine the final output value.


35. DESIGN 209

35.6 The final output


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/soft_design_g03

Consider the following pseudocode program:


1 number = 4
2
3 FOR count = 1 TO 4
4 PRINT ( number * count )
5 NEXT count
▶ What will be the final value output by this program?
Use a trace table like this to help you:

number count OUTPUT

Answer:

35.7 Match the statement


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/soft_design_g05

▶ Which of the following statements could you put into the flowchart symbol
shown above?

⃝ PRINT("Hello")
⃝ cost = cost + 25
⃝ cost > 10?
⃝ START
210 35. DESIGN

35.8 Tracing with a table


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/soft_design_g08

Read through the following pseudocode program:


1 word = " computer "
2
3 FOR index = 0 TO LEN(word) -1 STEP 2
4 PRINT (word[index ])
5 NEXT index

▶ Fill in the trace table by putting the correct values from the options given.

index OUTPUT
0
c

□ 1
□ o
□ 2
□ m
□ 3
□ p
□ 4
□ u
□ 5
□ t
□ 6
□ e
□ 7
□ r
□ 8
35. DESIGN 211

35.9 Table tracing


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/soft_design_g09

Study the flowchart below that represents an algorithm:

▶ Trace the algorithm and fill in the trace table by using the correct values
from the options given.
212 35. DESIGN

number count OUTPUT

0
12

3
1.5
4

□ 3

□ 4

□ Error

□ 2

□ 6

□ 1

□ 24
36 Testing
Before a piece of software can be used, it needs to be tested. Some testing
is done by the programmer as the code is written. Other testing is more
structured and involves a test plan being written and the software being
tested with a variety of types of data to check that the outputs are as ex-
pected. When a problem with the software is identified, the cause will need
to be identified. This is called debugging.

36.1 What's the error?


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/soft_testing_g02

▶ The table below contains descriptions of the types of errors that can occur
during programming. Add the types of errors into the correct positions in
the table.

Description Type of error


When code runs correctly but the program does
not work as expected or produce the expected
output.
When an error occurs during the use of the
program. Common errors of this type include
trying to divide by 0 or access an item in an array
that does not exist.
When the translator does not recognise the
keywords or commands entered. Common errors of
this type include mistyping a keyword or missing
out brackets.

□ Syntax

□ Logic

□ Runtime

213
214 36. TESTING

36.2 On the boundary?


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/soft_testing_g01

The program below asks a user to enter a week number and validates their
input by checking that the week number entered is between 1 and 52.

1 user_input = INPUT (" Enter a week of the year: ")


2 week = INT( user_input )
3
4 IF week > 0 AND week <= 52 THEN
5 PRINT (" You have chosen week " + STR(week))
6 ELSE
7 PRINT (" The week must be between 1 and 52")
8 ENDIF

▶ Which of the options below would be boundary test data for this pro-
gram?

⃝ -10, -5, 60, and 99


⃝ 0, 1, 52, and 53
⃝ 0, 1, 25, and 52

36.3 Week checker


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/soft_testing_g04

The program below asks a user to enter a week number and validates their
input by checking that the week number entered is between 1 and 52.
1 user_input = INPUT (" Enter a week of the year: ")
2 week = INT( user_input )
3
4 IF week > 0 AND week <= 52 THEN
5 PRINT (" You have chosen week " + STR(week))
6 ELSE
7 PRINT (" The week must be between 1 and 52")
8 ENDIF
▶ Write a week number that could be used as a piece of normal or typical
test data for this program.
36.4 Fail to plan, plan to fail
AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/soft_testing_g03

▶ Below is a testing table that has been developed to test a program that
takes in students’ test scores and stores them in a database. The system
should allow the user to enter the student’s name and scores from three
separate tests ranging from 0 to 30 marks. Select the correct types of test
data from Boundary, Normal or Erroneous and place them in the correct
positions in the table. Note that the types of test data can be used more
than once.

Test ID Descrip- Test data Expected results Type of


tion test
data
01 Check First name: 1. A message
that a Billie appears confirming
student’s Surname: the scores have been
scores can Pierce Score added 2. The
be added 1: 25 Score 2: student’s scores are
20 Score 3: 10 added to the
database
02 Check First name: 1. An error message
that only Jamie appears asking the
scores Surname: user to enter a valid
between 0 Morton Score test score 2. No
and 30 1: 56 Score 2: scores are added to
can be 20 Score 3: 10 the database
added
03 Check First name: 1. A message
that only Praise appears confirming
scores Surname: the scores have been
between 0 Atwater Score added 2. The
and 30 1: 0 Score 2: student’s scores are
can be 29 Score 3: 30 added to the
added database
04 Check First name: 1. An error message
that all Chikere appears asking the
fields are Surname: user to enter a
required [leave blank] surname 2. No
fields Score 1: 28 scores are added to
Score 2: 29 the database
Score 3: 27

215
216 37. COMPUTATIONAL THINKING

37 Computational thinking
Computational thinking is the term used to describe some of the skills
required in computing, programming, and digital making. Before you can
use a computer to solve problems, you need to pick those problems apart
and decide how to approach them.
Computational thinking techniques and methods are essential when formu-
lating a problem and expressing a solution so that a computer can effectively
it carry out.
Computational thinking covers a broad range of knowledge and skills, in-
cluding but not limited to:

• Algorithmic thinking – developing an algorithm to solve a problem


• Abstraction – hiding unnecessary detail to reduce complexity
• Automation – taking a model and implementing a solution
• Decomposition – breaking a problem down into smaller parts
• Debugging – detecting and resolving problems in a program
• Logical reasoning – applying rules to solve a problem
• Pattern recognition – identifying the problem as an example of a class
of problems that have already been solved
• Problem solving – the way in which solutions are developed

At a more advanced level, you will learn about a wide range of abstrac-
tion techniques and computational methods that can be used to help solve
complex problems.
37. COMPUTATIONAL THINKING 217

37.1 Website woes


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/dsa_ctm_g01

Lottie is developing a website as part of a school project. The website is a


large project with multiple pages and she is finding it hard to know where
to start!

▶ Fill in the gaps in the sentence below to explain how Lottie could use
decomposition to tackle the problem.

The website project could be into ,

more manageable tasks that Lottie could approach one at a time. These

tasks are known as .

□ combined

□ smaller

□ broken down

□ sub-elements

□ larger

□ subtasks
218 37. COMPUTATIONAL THINKING

37.2 Which principle?


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/dsa_ctm_g02

Sami is creating a game. The game will allow the player to move a small
alien through a maze to return it safely to its spaceship.

▶ Sami has started to tackle the problem by hiding unnescessary details;


what computational thinking principle has Sami applied?

⃝ Pattern recognition
⃝ Algorithmic thinking
⃝ Abstraction
⃝ Decomposition

▶ What three pieces of information would be most useful to Sami when


developing the initial stages of the game?

At this stage, Sami is focusing on the main features of game play, such as
character movement and scoring.

□ What the background of the game will look like

□ What happens if the alien hits the sides of the maze

□ How the score would change if the alien reaches the end of the maze

□ What the next level will look like

□ How the alien will move in the game

□ What music will play during the game


37. COMPUTATIONAL THINKING 219

37.3 It is the principle!


AQA EDEXCEL EDUQAS OCR WJEC isaaccs.org/bq/dsa_ctm_g03

▶ Using the table below, choose the computational thinking principle so


that it matches the correct definition.

Definition Keyword
The process of breaking down large problems
into smaller, simpler, more manageable parts
The process of spotting similarities in smaller
problems to develop solutions to more complex
problems
The process of removing unnecessary detail from
a problem to aid development of the solution
The process of identifying the logical steps
required to solve a problem

□ Decomposition

□ Abstraction

□ Pattern recognition

□ Algorithmic thinking

You might also like