Professional Documents
Culture Documents
of sh
For over 60 years Marshall Cavendish Education has been
Cambridge
ro di
empowering educators and students in over 80 countries with
high-quality, research-based, Pre-K-12 educational solutions.
n
We nurture world-ready global citizens by equipping students
s
Computer Science
IGCSE
al d P ve
with crucial 21st century skills through our resources for schools
and education centres worldwide, including Cambridge schools, TM
catering to national and international curricula.
r S te a
Computer Science
The Marshall Cavendish Education Cambridge IGCSETM Computer Science series
fo ec ll C
is designed for students preparing for the 0478/0984 syllabus. The series
focuses on developing important computer science skills relevant to
real world applications.
WB The Workbook follows the same flow and structure as the Student’s Book and provides supplementary
ot r a
exercises to reinforce concepts learnt during lessons. Exam style questions are also included for students
to familiarise themselves with the syllabus requirements. A revision checklist at the end helps students
N co rsh
assess their level of understanding of concepts.
e
This resource is endorsed by Series architecture
WORKBOOK
Cambridge Assessment International Education • Student’s Book
U a
✓ Provides learners support for the Cambridge • Workbook
r
IGCSE and IGCSE (9–1) Computer Science syllabuses
M
• Teacher’s Guide
(0478/0984) for examination from 2023.
• e-book
✓ H as passed Cambridge International’s rigorous
quality-assurance process
©
✓ Developed by subject experts
n
✓ For Cambridge schools worldwide
WORKBOOK
Kay Summers
ISBN 978-981-4941-60-0
9 789814 941600
Cambridge
fs h
oo is
IGCSE TM
e Pr nd
Computer Science
ve
r S te a
fo ec ll C
Sarah Lawrey
d
ot r a
N co sh r
al
U a
WORKBOOK
r
M
©
n
fs h
E-mail: cs@mceducation.com
Website: www.mceducation.com
oo is
First published 2021
e Pr nd
All rights reserved.
e
photocopying, recording or otherwise, without the prior permission of the
copyright owner. Any requests for permission should be addressed to
v
the Publisher.
r S te a Marshall Cavendish is a registered trademark of Times Publishing Limited.
fo ec ll C
ISBN 978-981-4941-60-0
Questions and answers in this book have been written by the authors.
Printed in Singapore
d
ot r a
N co sh r
al
U a
r
M
©
n
iii
fs h
For further learner support, alongside the Student’s Book, Chapter 3
oo is
Exercise 1
consolidate key terms and concepts learnt from each chapter. Embedded sys
tems
1 What is the mai
n purpose of the
CPU?
This Workbook is part of the Marshall Cavendish Education
suite of resources that will support you as you follow the
e Pr nd
0478/0984 syllabuses and prepare for the Cambridge IGCSE 2 What is a micropr
ocessor?
3 A washing mac
hine is an exam
e
ple of an embedd
ed system. List
four more emb
edded systems
.
v
Formative Exercises 4 A personal com
puter (PC) is one
example of a gen
eral purpose com
puter. List two
These exercises are meant to evaluate how well you other examples
r S te a are learning each section in a chapter.
Exercise 2
.
28
Hardware
IGCSE_CS_WB_
Chapter 1
Ch 3.indd 28
text file.
ce the size of a
be used to redu
lossless compression can
w explains how
3 The paragraph belo 26/01/21 9:53
looks for PM
words. file. The algorithm
the size of the
r
it occurs in the
position where
along with the
This exercise is included at the end is stored in a
r
Confident
knowledge gaps. It is designed for Need to revisit
Satisfactory
method
integers
itive 8-bit binary
I can add two pos it occurs in bina
ry
rflow and why
concept of ove
I understand the
ition bina ry inte ger
add 8-bit
t on a positive
logical binary shif binary integer
I can perform a on the positive
und erst and the effect this has neg ativ e 8-bit
and and
represent positive
complement to
I can use two’s
binary inte gers and the use of
ts text
puter represen
and why a com
I understand how Unicode
er sets , incl uding ASCII and incl udin g
charact ts sound,
puter represen
and why a com
I understand how ple resolution
cts of the sam ple rate and sam
the effe ts an ima ge,
puter represen
and why a com depth
I understand how of the resolution and colour
cts
including the effe sure d
is mea
how data storage g
I und erst and a sound file, usin
image file and
the file size of an
I can calculate
rma tion give n sion
info pres
need for data com
purpose of and
I understand the and lossless
sed using lossy
files are compres
I understand how
hods
compression met
tems
Computer sys
16 28/01/21 9:26
AM
iv
Ch 1.indd 16
IGCSE_CS_WB_
fs h
Chapter 1 Computer systems Chapter 7
Algorithm design and
oo is
1.1 Number systems 1
problem solving
e Pr nd
1.2 Text, sound and images 12 7.1 Algorithm design and problem
solving66
1.3 Data storage and compression 15
Chapter 8 Programming
Chapter 2 Data transmission
e
8.1 Programming concepts 91
2.1 Types and methods of data
transmission 17 8.2 Arrays 107
v
r S te a 2.2 Methods of error detection 23 8.3 File handling 111
Chapter 4 Software
N co sh
al
development environments (IDEs) 46
U a
Chapter 6
n
IGCSE CS WB prelims.indd 6
U a
n
N co sh r
ot r a
r
fo ec ll C
r S te a
al d ve
e Pr nd
oo is
fs h
28/01/21 10:00 AM
1
CHAPTER
Computer systems
fs h
oo is
e Pr nd
At the end of this chapter, you will be able to:
• Understand how and why computers use binary to represent all forms of data
• Understand the denary, binary and hexadecimal number systems
• Convert between positive denary and positive binary, positive denary and hexadecimal, and hexadecimal and
e
positive binary
• Understand how and why hexadecimal is used as a beneficial method of data representation
v
• Add two positive 8-bit binary integers
• Understand the concept of overflow and why it occurs in binary addition
r S te a • Perform a logical binary shift on a positive 8-bit binary integer and understand the effect this has on the positive
binary integer
fo ec ll C
• Use two’s complement to represent positive and negative 8-bit binary integers
• Understand how and why a computer represents text and the use of character sets, including ASCII and Unicode
• Understand how and why a computer represents sound, including the effects of the sample rate and sample resolution
• Understand how and why a computer represents an image, including the effects of the resolution and colour depth
d
• Understand how data storage is measured
ot r a
• Calculate the file size of an image file and a sound file, using information given
• Understand the purpose of and need for data compression
N co sh
• Understand how files are compressed using lossy and lossless compression methods
r
al
A number system is a method for representing values based on a particular set of units. There are three number systems that you
will use here: denary, binary and hexadecimal.
©
1 Is denary a base-2, base-10 or base-16 number system? Circle the correct answer.
2 Is binary a base-2, base-10 or base-16 number system? Circle the correct answer.
Computer systems 1
3 Is hexadecimal a base-2, base-10 or base-16 number system? Circle the correct answer.
fs h
oo is
Exercise 2 Converting denary values
e Pr nd
Denary values can be converted to binary values and vice-versa.
e
Denary 4-bit binary
7
v
r S te a Working space
fo ec ll C
2 Convert the denary value 10 to a 4-bit binary value.
d
Denary 4-bit binary
ot r a
10
N co sh
Working space
r
al
U a
r
Working space
n
2 Computer systems
Working space
fs h
5 Convert the denary value 24 to an 8-bit binary value.
oo is
Denary 8-bit binary
e Pr nd
24
Working space
ve
r S te a 6 Convert the denary value 101 to an 8-bit binary value.
fo ec ll C
Denary 8-bit binary
101
Working space
d
ot r a
N co sh
al
200
U a
r
Working space
M
©
n
Working space
Computer systems 3
fs h
Working space
oo is
e Pr nd
10 Convert the denary value 555 to a 12-bit binary value.
e
Denary 12-bit binary
555
v
r S te a Working space
fo ec ll C
11 Convert the denary value 2001 to a 12-bit binary value
d
ot r a
Working space
r
al
U a
r
M
100110011001
Working space
n
4 Computer systems
fs h
Working space
oo is
e Pr nd
14 Convert the denary value 5000 to a 16-bit binary value.
e
Denary 16-bit binary
5000
v
r S te a Working space
fo ec ll C
15 Convert the 16-bit binary value 0011010111001100 to denary.
d
ot r a
Working space
r
al
U a
r
M
Denary and binary values can also be converted to hexadecimal, and vice-versa.
Working space
Computer systems 5
fs h
Working space
oo is
e Pr nd
3 Convert the 4-bit binary value 1110 to hexadecimal.
e
4-bit binary Hexadecimal
1110
v
r S te a Working space
fo ec ll C
4 Convert the hexadecimal value 4 to 4-bit binary.
d
ot r a
Working space
r
al
U a
r
M
Working space
n
6 Computer systems
fs h
Working space
oo is
e Pr nd
7 Convert the 8-bit binary value 00001000 to hexadecimal.
e
8-bit binary Hexadecimal
00001000
v
r S te a Working space
fo ec ll C
8 Convert the 8-bit binary value 10110001 to hexadecimal.
d
ot r a
Working space
r
al
U a
r
M
11000000
Working space
n
Computer systems 7
fs h
Working space
oo is
e Pr nd
11 Convert the hexadecimal value CD to 8-bit binary.
e
Hexadecimal 8-bit binary
CD
v
r S te a Working space
fo ec ll C
12 Convert the hexadecimal value 3B0 to 12-bit binary.
d
ot r a
Working space
r
al
U a
r
M
Denary Hexadecimal
©
103
Working space
n
8 Computer systems
Hexadecimal Denary
A3
fs h
Working space
oo is
e Pr nd
15 Convert the hexadecimal value 2E to denary.
e
Hexadecimal Denary
2E
v
r S te a Working space
fo ec ll C
16 Convert the 12-bit binary value 110100001111 to hexadecimal.
d
ot r a
Working space
r
al
U a
r
M
04C
Working space
n
Computer systems 9
Binary values can be added together. Make sure that you show your working when adding the binary values.
fs h
1 Add the 4-bit binary values 0001 and 0110. 2 Add the 4-bit binary values 0101 and 0010.
oo is
0 0 0 1 0 1 0 1
e Pr nd
3 Add the 8-bit binary values 00101000 and 01100011. 4 Add the 8-bit binary values 10101010 and 01110111.
e
0 0 1 0 1 0 0 0 1 0 1 0 1 0 1 0
+ 0 1 1 0 0 0 1 1 + 0 1 1 1 0 1 1 1
v
r S te a 5 Name the error caused by this binary addition.
fo ec ll C
6 Why does this type of error happen?
d
ot r a
N co sh r
al
1 Perform a logical binary shift one place to the left on this binary value.
©
0 1 0 0 1 1 1 1
n
What effect did the logical shift have on the binary value?
10 Computer systems
2 Perform a logical binary shift two places to the right on this binary value.
0 0 1 1 0 1 0 0
fs h
oo is
e Pr nd
What effect did the logical shift have on the binary value?
ve
r S te a Exercise 6 Two’s complement
Two’s complement is another method of representing binary values. It is often used to represent negative binary values.
fo ec ll C
1 Convert the denary number 47 to two’s complement 8-bit binary.
Working space
N co sh r
-75
Working space
©
n
Computer systems 11
fs h
Working space
oo is
e Pr nd
4 Convert the two’s complement 8-bit binary value 10001011 to denary.
e
Two’s complement 8-bit binary Denary
10001011
v
r S te a Working space
fo ec ll C
5 What is the largest number that can be stored in 8 bits using two’s complement?
d
ot r a
N co sh
6 What is the smallest number that can be stored in 8 bits using two’s complement?
r
al
U a
r
In computing, text, sound and images are all converted to binary then processed by the computer. Various methods are used to
obtain these binary values.
©
n
12 Computer systems
True False
Statement
(✔) (✔)
Both Unicode and ASCII are examples of a character set
fs h
Unicode requires more bits per character
oo is
ASCII can represent a greater range of symbols and emojis
Unicode can represent a greater range of different languages
e Pr nd
Exercise 2 Sound waves
e
When converting sound to binary, sound waves are sampled.
1 What is the difference between the sample rate and the sample resolution?
v
r S te a
fo ec ll C
2 How can you increase the accuracy of a sound file to make it sound more like the original?
d
ot r a
N co sh r
al
3 A 10 second sound clip has a sample rate of 1000Hz and a sample resolution of 8 bits.
U a
Calculate the file size of the sound clip in kibibytes (KiB). Remember to show all your working.
r
M
©
n
Answer: KiB
Computer systems 13
When converting an image to binary, the resolution and colour depth are set.
fs h
1 Draw a line from each term to its correct definition.
oo is
Colour depth The number of pixels in an image
e Pr nd
The number of bits used to represent
Resolution
e
each colour in an image
v
r S te a Pixels
The small squares of colour that make
up an image
fo ec ll C
2 What will be the effect on an image if the colour depth is reduced?
d
ot r a
3 A student has five images. Each image has a resolution of 1000 pixels wide by 800 pixels high. Each image has a colour
depth of 16 bits.
N co sh
Calculate the file size needed to store the images in mebibytes (MiB). Remember to show all your working.
r
al
U a
r
M
Answer: MiB
©
n
14 Computer systems
fs h
Exercise 1 Data storage units
oo is
1 Number the data storage units from 1 (smallest) to 9 (largest).
e Pr nd
The first one has been done for you.
e
Kibibyte (KiB)
Gibibyte (GiB)
v
r S te a Nibble
Exbibyte (EiB)
Mebibyte (MiB)
fo ec ll C
Tebibyte (TiB)
Bit 1
Pebibyte (PiB)
d
ot r a
Sometimes, files are compressed before they are stored. There are two methods of compression: lossy and lossless.
al
True False
Statement
U a
(✔) (✔)
r
2 A student has several large images to send to a friend. They use lossy compression to
n
Computer systems 15
3 The paragraph below explains how lossless compression can be used to reduce the size of a text file.
A compression algorithm is used to the size of the file. The algorithm looks for
fs h
patterns in the text file and them. Each index
oo is
is stored in a along with the position where it occurs in the text.
e Pr nd
Revision checklist
ve
I understand how and why computers use binary to represent all
r S te a forms of data
I understand the denary, binary and hexadecimal number systems
fo ec ll C
I can convert between positive denary and positive binary, positive
denary and hexadecimal, and hexadecimal and positive binary
I understand how and why hexadecimal is used as a beneficial
method of data representation
d
I can add two positive 8-bit binary integers
ot r a
binary integers
al
U a
I understand how and why a computer represents text and the use of
r
I can calculate the file size of an image file and a sound file, using
information given
I understand the purpose of and need for data compression
I understand how files are compressed using lossy and lossless
compression methods
16 Computer systems
Data transmission
fs h
oo is
e Pr nd
At the end of this chapter, you will be able to:
• Understand that data are broken down into packets to be transmitted
• Describe the structure of a packet
• Describe the process of packet switching
e
• Describe how data is transmitted from one device to another using different methods of data transmission
• Explain the suitability of each method of data transmission, for a given scenario
v
• Understand the universal serial bus (USB) interface and explain how it is used to transmit data
• Methods of error detection
r S te a • Understand the need to check for errors after data transmission and how these errors can occur
•
fo ec ll C
Describe the processes involved in each of the following error detection methods for detecting errors in data after
transmission: parity check (odd and even), checksum and echo check
• Describe how a check digit is used to detect errors in data entry and identify examples of when a check digit is used,
including ISBN numbers and bar codes
• Describe how an automatic repeat request (ARQ) can be used to establish that data is received without error
d
• Understand the need for and purpose of encryption when transmitting data
ot r a
al
U a
r
A document is too large a section of data to be transmitted from one device to another. There is no infrastructure capacity
to transmit such a large amount of data at once. Therefore, it needs to be broken down into packets, which are a much
©
2 In which section of the data packet would you normally find the destination address?
Data transmission 17
fs h
4 In which section of the data packet would you find the main content of the data being sent?
oo is
e Pr nd
5 In which section of the data packet would you normally find the packet number?
e
6 What kind of data might you find in the trailer of a data packet?
v
r S te a
fo ec ll C
7 In packet switching, does each packet take the same route or can they take a different route? Circle the answer.
d
ot r a
Tick (✔)
al
U a
True
r
False
M
9 What is the name of the network device that chooses the route a data packet will take?
©
n
10 In packet switching, when are the data packets reordered after transmission?
18 Data transmission
11 Draw a diagram to represent how data is transmitted across a network using packet switching. Your diagram should include
a minimum of two devices and four routers.
fs h
oo is
e Pr nd
e
v
r S te a
fo ec ll C
d
ot r a
N co sh r
al
U a
r
M
©
n
Data transmission 19
Data is transmitted from one device to another using the serial or parallel method.
fs h
1 Tick (✔) to show which method transmits data one bit at a time.
oo is
Number of wires Tick (✔)
Single wire
e Pr nd
Multiple wires
2 Tick (✔) to show how many wires are used in parallel data transmission.
e
Serial
v
Parallel
3 Describe the benefit of using parallel data transmission, instead of serial data transmission.
r S te a
fo ec ll C
4 List two benefits of using serial data transmission, instead of parallel data transmission.
d
ot r a
N co sh r
al
U a
r
M
Data is also transmitted from one device to another using the simplex, half-duplex or full-duplex methods.
©
1 Does simplex data transmission happen in one direction only or in both directions? Circle the answer.
n
2 Can you think of two applications where simple data transmission would be suitable?
20 Data transmission
3 Draw a diagram to show how data is transmitted using half-duplex data transmission.
fs h
oo is
e Pr nd
4 Can you describe how data is sent using full-duplex data transmission?
ve
r S te a
fo ec ll C
5 A website designer has a web server beside their desk. They need to be able to send data to and receive data from the web
server at the same time, and may also need to make quick changes to the data on the web server, so data transmission to
the web server is time critical.
Which data transmission methods should be used to send data from the website designer’s computer to the web server? Why?
d
ot r a
N co sh r
al
U a
r
M
©
6 An office manager creates a back-up of the data stored on her computer at the end of each day. The file server that stores
the back-up is located in a building 1 km from her office. It is very important the data is stored without error on the file
n
server. She only needs to send data to the back-up, and does not receive data from the file server.
Which data transmission methods should be used to send data from the office manager’s computer to the file server? Why?
Data transmission 21
fs h
oo is
Exercise 4 USB Interface
e Pr nd
An interface called USB can be used to connect one device to another.
1 Tick (✔) to show which type of data transmission is used in a USB connection.
e
Data transmission method Tick (✔)
v
Serial
r S te a Parallel
2 List three benefits of using a USB interface to connect a mobile phone to a computer.
fo ec ll C
d
ot r a
N co sh r
al
U a
r
M
3 What are two drawbacks of connecting a server to a computer using a USB interface?
©
n
22 Data transmission
fs h
used to find any errors.
oo is
Exercise 1 Error dectection
e Pr nd
1 Which error detection method adds an 8th bit to 7 bits of data, to make each byte meet an odd or even check?
Circle the answer.
Parity check Checksum Echo check
e
2 In which error detection method does the receiver send data back to the sender, to compare the two versions of the data?
v
Circle the answer.
Parity check Checksum Echo check
r S te a
3 Which error detection method uses an algorithm to calculate a value from the data?This value is transmitted with the data
fo ec ll C
to the receiver. Circle the answer.
4 The following four bytes of data have been transmitted from one computer to another. Each byte was transmitted using an
d
ot r a
even parity check. All the bytes have arrived correctly. Write the parity bit that was added to each byte for it to be correct for
an even parity check.
N co sh
1 0 1 0 1 1 0
al
U a
0 0 0 0 1 1 1
r
M
5 Can you think of a reason why an error that has occurred in the transmission of data from one device to another is not
detected by a parity check?
©
n
Errors can also occur when data is entered into a device. The data entry could be manual (being typed into a device),
or automatic, (such as scanning a barcode). Therefore, there is also an error detection method for data entry, which is
called a check digit.
Data transmission 23
fs h
oo is
e Pr nd
e
v
r S te a
fo ec ll C
Exercise 3 Automatic repeat request
d
ot r a
Sometimes errors are found in data after transmission. So, systems need a way to request that the data is resent. One method for
this is an automatic repeat request (ARQ).
N co sh
1 During an ARQ process, data is transferred from the sending device to the receiving device. The sending device then
starts a timer. The receiving device checks the data for errors, using one of the error detection methods you have
studied. What happens next in the ARQ process?
r
al
U a
r
M
©
n
24 Data transmission
2.3 Encryption
Data is very valuable and we should always make sure that it is stored and transmitted in a secure way. Encryption is one way
that data can be kept secure.
fs h
oo is
Exercise 1 Encryption
e Pr nd
1 What is the name given to the data before encryption?
ve
r S te a 3 What is the name given to the data after encryption?
fo ec ll C
4 Tick (✔) to show whether same key or different keys are used to encrypt and decrypt data in symmetric encryption.
The paragraph below explains how asymmetric encryption is used to encrypt data.
N co sh
Data transmission 25
Revision checklist
fs h
oo is
I understand that data are broken down into packets to be
transmitted
e Pr nd
I can describe the structure of a packet
I can describe the process of packet switching
I can describe how data is transmitted from one device to another
using different methods of data transmission
e
I can explain the suitability of each method of data transmission, for a
given scenario
v
I understand the universal serial bus (USB) interface and explain how
r S te a
it is used to transmit data
Methods of error detection
fo ec ll C
I understand the need to check for errors after data transmission and
how these errors can occur
I can describe the processes involved in each of the following error
detection methods for detecting errors in data after transmission:
parity check (odd and even), checksum and echo check
d
ot r a
I can describe how a check digit is used to detect errors in data entry
and identify examples of when a check digit is used, including ISBN
N co sh
al
transmitting data
U a
encryption
M
©
n
26 Data transmission
Hardware
fs h
oo is
e Pr nd
At the end of this chapter, you will be able to:
• Understand the role of the central processing unit (CPU) in a computer
• Understand what is meant by a microprocessor
• Understand the purpose of the components in a CPU, in a computer that has a Von Neumann architecture
e
• Describe the process of the fetch-decode-execute cycle including the role of each component in the process
• Understand what is meant by a core, cache and clock in a CPU and explain how they can affect the performance of a CPU
v
• Understand the purpose and use of an instruction set for a CPU
• Describe the purpose and characteristics of an embedded system and identify devices in which they are commonly used
r S te a • Input and output devices
• Understand what is meant by an input device and why it is required
fo ec ll C
• Understand what is meant by an output device and why it is required
• Understand what is meant by a sensor and the purposes of sensors
• Identify the type of data captured by each sensor and understand when each sensor would be used, including
selecting the most suitable sensor for a given context
d
• Understand what is meant by primary storage
ot r a
• Describe what is meant by virtual memory, how it is created, used and why it is necessary
• Understand what is meant by cloud storage
• Explain the advantages and disadvantages of storing data on the cloud in comparison to storing it locally
r
• Understand that a computer needs a network interface card (NIC) to access a network
al
U a
• Understand what is meant by and the purpose of a Media Access Control (MAC) address, including its structure
•
r
Understand what is meant by and the purpose of an Internet Protocol (IP) address
M
A computer has many components that are needed for it to operate, but one of the most important is the CPU.
This component allows the computer to process all the data that is input into it, to create an output for the user.
Some systems have a smaller version of a CPU, because they don’t need to be as powerful. This smaller version of a CPU is
called a microprocessor. It is a type of integrated circuit that is built into a single chip.
A system that uses a microprocessor is normally called an embedded system. This is a particular type of system is designed to
perform a dedicated single function or a very small set of functions. This is different to a general purpose computer that will
perform many different functions.
Hardware 27
fs h
oo is
e Pr nd
2 What is a microprocessor?
ve
3 A washing machine is an example of an embedded system. List four more embedded systems.
r S te a
fo ec ll C
d
4 A personal computer (PC) is one example of a general purpose computer. List two other examples.
ot r a
N co sh
al
U a
r
A process called the fetch-decode-execute cycle is performed by the CPU. This cycle fetches an instruction into the CPU, decodes
M
it, and then executes it. The CPU uses several different components to do this.
1 Where are data and instructions stored immediately before they are fetched into the CPU?
©
n
28 Hardware
3 Tick (✔) to show which of the following components are an example of a register.
fs h
Address bus
Memory address register
oo is
Data bus
Memory data register
e Pr nd
Control bus
Arithmetic logic unit
Control unit
e
Current instruction register
v
Accumulator
4 Which register stores the address of the next instruction to be fetched into the CPU?
r S te a
fo ec ll C
5 What is the purpose of the memory address register (MAR)?
d
ot r a
N co sh
6 When an instruction is fetched into the CPU, which component is it sent to first?
r
al
U a
r
8 The arithmetic logic unit (ALU) is used to execute an instruction. It has a built-in register. What is the name and purpose of
this register?
Hardware 29
9 Data and signals are transmitted between the different components of the CPU using buses. Can you name the three buses
used for this?
fs h
oo is
10 Can you describe what happens at the fetch stage of the fetch-decode-execute cycle?
e Pr nd
e
v
r S te a
fo ec ll C
d
ot r a
11 Can you describe what happens at the decode stage of the fetch-decode-execute cycle?
N co sh r
al
U a
r
M
©
30 Hardware
Certain factors can affect the performance of the CPU, including the number of cores, the size of the cache, and the speed
of the clock.
fs h
1 Draw a line from a component to its correct definition.
oo is
Component Definition
e Pr nd
The component within the CPU responsible for
Clock
performing a single fetch-decode-execute cycle
ve
r S te a Core
The component that regulates the timing and
speed of a computer
fo ec ll C
d
The component that stores frequently used
ot r a
Cache
data and instructions
N co sh
2 GHz processor
r
●●
al
U a
●● 32 kB cache
M
Describe two ways the performance of the computer can be improved. Why would this improve the performance?
©
n
Hardware 31
fs h
An input device allows data to be entered into a system to allow it to be processed. An output device allows the user to obtain
the output of the processing of the data. This often involves being able to see or hear the results.
oo is
Exercise 1 Types of input/output device
e Pr nd
1 Tick (✔) to show whether each device is an example of an input device or an output device.
e
Keyboard
v
Speaker
3D printer
r S te a Barcode scanner
fo ec ll C
Mouse
Monitor
Actuator
Sensor
d
ot r a
2 Which input device would be most suitable to enter a password into a computer?
N co sh
3 Which input device would be most suitable to convert a hard copy of a document into a digital copy?
r
al
U a
r
M
4 Which output device would be most suitable to allow shoppers to listen to an announcement in a supermarket?
©
n
32 Hardware
1. 1.
fs h
oo is
2. 3.
3. 4.
e Pr nd
5.
4.
ve
5.
r S te a 6.
fo ec ll C
6.
d
ot r a
7.
N co sh
Clues
r
al
Across Down
U a
r
1. Captures static forces such as the continual force of gravity 1. Can be used to measure whether a substance, such as
M
and dynamic forces such as those created by vibrations. fuel in a car, falls below a certain point.
2. Can be used in agriculture and farming to make sure that 2. Measures the presence of a magnetic force that can be
the produce has the correct level of watering for growing. emitted by an object.
©
3. Can be used in people homes to measure the level of 3. Measures how hot or cold a substance is.
carbon dioxide.
4. Measures the level of sound in a certain environment.
n
5. Measures the ambient illumination in a certain environment. 6. Can measure how much liquid is running through a pipe
in a factory,
6. Can be used in a security system to capture a type of
radiation emitted by an intruder. 7. Can measure whether soil is acidic or alkali.
Hardware 33
Sensors are used to capture data from their immediate environment. This data can then be processed by a computer system
to allow monitoring and control systems to operate.
6 One benefit of sensors is that they can operate 24 hours a day, 7 days a week.
List three other ways sensors can be useful.
fs h
1
oo is
e Pr nd
2
1 Tick (✔) to show whether each example is primary storage or secondary storage.
N co sh
Primary Secondary
Storage example
storage (✔) storage (✔)
Read only memory (ROM)
r
al
3 Can you name three storage examples that are described as non-volatile because they do not lose the data they store when
power is turned off?
34 Hardware
fs h
5 Does RAM or ROM store the programs that are currently in use?
oo is
e Pr nd
6 The data stored in ROM is fixed as does not normally change.
ve
r S te a 7 It is easy to upgrade the amount of RAM in a computer by just installing more.
al
U a
r
M
©
n
Hardware 35
Tick (✔) to show whether the statement about magnetic storage is true or false.
fs h
Magnetic storage True (✔) False (✔)
oo is
Uses lasers to create pits and lands on the surface of a disk
Data is stored on platters that are divided into tracks and sectors
An HDD is a type of magnetic storage
e Pr nd
Uses transistors and control gates and floating gates
Has a read/write head that is moved across circular plates to read/write data
ve
r S te a
fo ec ll C
d
ot r a
N co sh r
al
36 Hardware
Computers sometimes use a type of memory called virtual memory. This allows the computer to continue processing data
when the RAM is full.
fs h
1 Draw a diagram that shows how virtual memory operates.
oo is
e Pr nd
e
v
r S te a
fo ec ll C
d
ot r a
N co sh r
al
U a
r
M
©
n
2 What would happen if RAM was full and a computer didn’t have virtual memory that could be used?
Hardware 37
Cloud storage is another way to store data. Physical servers and storage devices are still used to store data in the cloud, but these
belong to a third party, rather than the individual or company that owns the data.
fs h
1 In a cloud storage system is data stored locally or remotely?
oo is
e Pr nd
2 List two benefits to storing data in a cloud storage system.
v
2
r S te a
fo ec ll C
1
d
ot r a
N co sh
al
U a
r
M
Exercise 1 Components
1 (a)
What is the name of the component in a computer that connects the computer to a network?
38 Hardware
(b)
What is the name of the address given to this component at the manufacturing stage?
fs h
2 Is a MAC address usually written in binary, hexadecimal or denary?
oo is
e Pr nd
3 How is a MAC address usually created?
ve
r S te a 4 (a)
What is the name of the network component that reads data packets and forwards them to the correct destination?
fo ec ll C
(b)
This component uses an internet protocol (IP) address to forward the data packets to the correct destination.
d
ot r a
N co sh
al
1
M
2
n
3
Hardware 39
Revision checklist
fs h
oo is
I understand the role of the central processing unit (CPU) in a
computer
e Pr nd
I understand what is meant by a microprocessor
I understand the purpose of the components in a CPU, in a computer
that has a Von Neumann architecture
e
I can describe the process of the fetch-decode-execute cycle
including the role of each component in the process
v
I understand what is meant by a core, cache and clock in a CPU and
explain how they can affect the performance of a CPU
r S te a
I understand the purpose and use of an instruction set for a CPU
fo ec ll C
I can describe the purpose and characteristics of an embedded
system and identify devices in which they are commonly used
al
U a
40 Hardware
fs h
oo is
e Pr nd
e
v
r S te a
fo ec ll C
d
ot r a
N co sh r
al
U a
r
M
©
n
Hardware 41
Software
fs h
oo is
e Pr nd
At the end of this chapter, you will be able to:
• Describe the difference between system software and application software and provide examples of each
• Understand how hardware, firmware and an operating system are required to run applications software
• Describe the role and operation of interrupts
e
• Explain what is meant by a high-level language and a low-level language, including the advantages and
disadvantages of each
v
• Understand that assembly language is a form of low-level language that uses mnemonics, and that an assembler is
needed to translate an assembly language program into machine code
r S te a • Describe the operation of a compiler and an interpreter, including how high-level language is translated by each and
how errors are reported
fo ec ll C
• Explain the advantages and disadvantages of a compiler and an interpreter
• Explain the role of an integrated development environment in writing program code and the common functions IDEs
provide
d
ot r a
Software is run on the hardware of a computer system. It plays a vital part in the many tasks for which we use a computer. There
are two main types of software: system software and application software.
There are two categories of system software: utility software and the operating system.
r
al
U a
r
42 Software
fs h
oo is
e Pr nd
3 Circle all the examples of applications software.
e
Word processor Anti-virus Web browser
v
r S te a
Database Disk Defragmenter Spreadsheet
fo ec ll C
Compression software Back-up software Graphics editing software
d
ot r a
N co sh
4 One function of the operating system is providing the user with an interface.
r
al
U a
(a)
Can you give three examples of different types of interface that an operating system can provide?
r
M
Can you give an example application of where each type of interface could be used?
Example 1
©
Example application
Example 2
Example application
Software 43
Example 3
Example application
fs h
oo is
(b)
Memory management is another function that is performed by an operating system.
e Pr nd
r S te a
fo ec ll C
(c)
What are four other functions that can be performed by an operating system?
Function 1
d
ot r a
Function 2
N co sh
Function 3
r
al
U a
r
Function 4
M
©
n
44 Software
5 Complete the diagram to show the hierarchy in which these are run (e.g. part A is run on part B) so that the computer can
be fully operational.
Key parts within a computer are the hardware, the applications software, the operating system and the firmware. These are
required for the computer to be fully operational.
fs h
oo is
e Pr nd
e
v
r S te a
fo ec ll C
d
ot r a
An interrupt is a type of signal that tells the CPU something requires its attention. Each interrupt has a priority level that tells
N co sh
the CPU how important it is. Interrupts are generated and handled constantly within a computer system, and there can be
hardware or software interrupts
al
Example 1
U a
r
M
Example 2
©
Example 1
Example 2
Software 45
8 Here are the stages that occur when an interrupt is serviced by the CPU. Order the stages. The first one has been done for you.
Stage Order
number
The CPU checks the priority of the next interrupt to see if it has a higher priority
fs h
than the current task being processed.
If the priority is lower, it leaves the interrupt in the interrupt queue and carries on
oo is
processing. If it is higher, the CPU stops and stores the current task being processed
and fetches the interrupt into the CPU to be processed.
e Pr nd
When the CPU completes its current fetch-decode-execute cycle, it checks the
1
interrupt at the front of the interrupt queue.
The interrupt service routine (ISR) is called to handle the interrupt
When the interrupt is serviced, the CPU either fetches the task it stored back into
the CPU to be processed, or services another interrupt from the queue if it has a
e
higher priority.
The CPU checks the source of the interrupt.
v
r S te a 4.2 Types of programming language, translators and
fo ec ll C
integrated development environments (IDEs)
Different types of programming language can be categorised as high-level or low-level languages.
d
ot r a
al
U a
3 Tick (✔) to show whether each statement applies to a high-level or low-level language.
n
High-level Low-level
Statement language language
(✔) (✔)
Programs written in this type of language are portable.
Assembly language is an example of this type of language.
This type of language can be used to directly manipulate the hardware.
This type of language is normally easier for humans to understand.
One statement in this type of language can be used to perform several instructions.
Translators convert the different types of languages into machine code. This allows the program to be processed by the
computer, as the computer can only process binary data.
46 Software
4 Here are three example of programs. Can you identify whether they are an example of High-level language, assembly
language or machine code?
fs h
ADD 5
oo is
OUT
01100000
e Pr nd
11001100
11111111
number = input(“Please enter the number
e
you want to search for:“
v
print (“You want to search for number“
r S te a + number)
5 What are three reasons why a programmer may choose to use a high-level language, rather than a low-level language to
write a computer program?
fo ec ll C
Reason 1
d
ot r a
N co sh
Reason 2
r
al
U a
Reason 3
r
M
©
6 What are two reasons why a programmer may choose to use a low-level language, rather than a high-level language to
write a computer program?
n
Reason 1
Reason 2
Software 47
7 Translators convert the different types of languages into machine code. This allows the program to be processed by the
computer, as the computer can only process binary data. What is the name of the translator used to convert assembly
language into machine code?
fs h
8 Tick (✔) to show whether each statement about interpreters is true or false.
oo is
Statement True (✔) False (✔)
Translate a line of code at a time then execute it.
e Pr nd
Stop executing the code when an error occurs.
Report all syntax errors at the same time in a report.
Will not run the program at all until all errors are corrected.
Produce an executable file.
e
9 How does a compiler operate?
v
r S te a
fo ec ll C
d
ot r a
N co sh r
al
U a
r
M
48 Software
When writing program code, a programmer will often use an IDE. An IDE can provide a programmer with useful functions
that help when writing the code.
fs h
Function 1
oo is
Function 2
e Pr nd
Function 3
ve
r S te a Function 4
fo ec ll C
Revision checklist
Software 49
its uses
fs h
oo is
e Pr nd
At the end of this chapter, you will be able to:
• Understand the difference between the internet and the world wide web
• Understand what is meant by a uniform resource locator (URL)
• Describe the purpose and operation of hypertext transfer protocol (HTTP) and
e
hypertext transfer protocol secure (HTTPS)
• Explain the purpose and functions of a web Browser
v
• Describe how web pages are located, retrieved and displayed on a device when a user enters a URL
• Explain what is meant by cookies and how they are used, including session cookies and persistent cookies
r S te a • Understand the concept of a digital currency and how digital currencies are used
• Understand the process of blockchain and how it is used to track digital currency transactions
fo ec ll C
• Describe the processes involved in, and the aim of carrying out, a range of cyber security threats
• Explain how a range of solutions are used to help keep data safe from security threats
d
ot r a
Many people think that the internet and the world wide web are the same thing. This is because the terms are often used
interchangeably, but they actually refer to different things.
The internet is the infrastructure that allows you to access the world wide web. By infrastructure, we mean all the components
r
and cables that are used to send the data across the large network that is the internet.
al
U a
r
M
A URL is a text-based address for a website. It is entered into the address bar in a web browser to access the website.
https://www.bbc.co.uk/news
3 HTTP is a protocol used to transmit the data for webpages across the internet. A protocol is a set of rules that must be
followed when completing a task. So, the HTTP makes sure that data is transmitted from device to device following the
set rules. What is the difference between HTTP and HTTPS?
fs h
oo is
e Pr nd
e
Exercise 2 Web browsers
v
1 A web browser is used to view web pages that are sent using the internet. Its main function is to display these web
r S te a pages, and it does this by rendering the HTML files and other program code used to create the website. Name three other
functions of a web browser.
fo ec ll C
Function 1
d
ot r a
Function 2
N co sh r
al
U a
Function 3
r
M
©
A web browser allows a user to enter a URL. A domain name server (DNS) stores a list of all websites and the matching
IP address. A web server stores the web pages that make up a website.
n
2 How do the web browser, the DNS, and the web server work together to allow a web page to be located, retrieved and
displayed?
fs h
oo is
e Pr nd
e
v
r S te a
fo ec ll C
d
ot r a
3 Cookies are small text files that store data. They are often used by companies on their websites. Can you give two examples
of data that might be stored in a cookie?
N co sh
Example 1
r
al
U a
Example 2
r
M
4 There are two types of cookie: session cookies and persistent cookies. Explain the difference.
©
n
5 Why might a user have a problem with a company using cookies on their website?
fs h
oo is
e Pr nd
5.2 Digital currency
e
A digital currency is one that exists electronically. It is a method of payment, but rather than exchanging physical coins and bank
v
notes, the payment is made electronically. Bitcoin is a particular type of digital currency known as cryptocurrency. Payments made
using this cryptocurrency are encrypted. It also operates using what is known as a decentralised system. This means that there are
r S te a no central banks to keep track of payments, instead a system known as a digital ledger is used for cryptocurrency.
fo ec ll C
Exercise 1 Cryptocurrency
al
U a
r
M
©
2 What is the name of the digital ledger process used in tracking cryptocurrency?
n
fs h
Term Definition
oo is
Packets of data are intercepted as they are sent across a network, often using a
packet sniffer.
A collective name for different types of malicious code that is downloaded onto a
e Pr nd
user’s computer.
Brute-force attack
ve
An email is sent to a user to encourage them to follow a link to a legitimate looking
r S te a website. The website is designed to get the user to enter personal details so they
can be stolen.
Social engineering
fo ec ll C
code onto their hard drive, without their knowledge. The code redirects the user
to a legitimate-looking website when they type in an address for a real website.
The website is designed to get the user to enter personal details so they can be stolen.
N co sh
Hacking
r
al
U a
r
2 A distributed denial of service attack (DDoS) is a type of cyber security threat. How is a DDoS attack carried out?
M
©
n
3 What security measure can be put in place to help prevent the attack reaching the web server?
fs h
oo is
4 Levels of access are one security measure that can be used to help protect data and keep it secure.
How do access level keep data secure?
e Pr nd
e
v
r S te a
5 Viruses are another type of cyber security threat. Anti-virus software help protect against these viruses.
fo ec ll C
Try and explain how anti-virus software operates.
d
ot r a
N co sh r
al
U a
r
M
6 Hackers are a serious cyber security issue. Companies and individuals spend a lot of time keep their data secure to
prevent it being hacked. There are solutions that they can put in place to help keep the data secure from a hacker.
©
7 Phishing is a form of social engineering. How can you help keep yourself safe from phishing?
fs h
oo is
8 Secure socket layer (SSL) is a security protocol used to keep data secure when it is transmitted over the internet.
e Pr nd
The table contains the stages that occur during the process of using SSL to secure and transmit data for an online
purchase over the internet. Put these stages in order, starting from 1.
e
The web server sends its digital certificate to the web browser
v
The web browser authenticates the digital certificate
r S te a If the certificate is legitimate, the data to be sent is encrypted
The web browser sends a request to the web server asking it to identify itself
fo ec ll C
9 Firewalls are a common security measure that can help prevent against the use of several cyber security threats.
Tick (✔) to show whether each statement about a firewall is true or false.
A user can set criteria and rules for the traffic passing through the firewall
Firewalls will automatically block all malicious traffic coming into the computer
10 A school has a firewall as a security measure to protect students and their data.
r
al
The user can also set a of websites. These will be the only websites that can be
accessed from the computer.
Revision checklist
fs h
oo is
I understand the difference between the internet and the world
wide web
e Pr nd
I understand what is meant by a uniform resource locator (URL)
I can describe the purpose and operation of hypertext transfer
protocol (HTTP) and hypertext transfer protocol secure (HTTPS)
I can explain the purpose and functions of a web Browser
e
I can describe how web pages are located, retrieved and displayed
on a device when a user enters a URL
v
r S te a I can explain what is meant by cookies and how they are used,
including session cookies and persistent cookies
I understand the concept of a digital currency and how digital
fo ec ll C
currencies are used
I understand the process of blockchain and how it is used to track
digital currency transactions
I can describe the processes involved in, and the aim of carrying out,
a range of cyber security threats
d
ot r a
I can explain how a range of solutions are used to help keep data safe
from security threats
N co sh r
al
U a
r
M
©
n
fs h
oo is
e Pr nd
At the end of this chapter, you will be able to:
• Describe how sensors, microprocessors and actuators can be used in collaboration to create automated systems
• Describe the advantages and disadvantages of an automated system used for a given scenario
• Understand what is meant by robotics
e
• Describe the characteristics of a robot
• Understand the roles that robots can perform and describe the advantages and disadvantages of their use
v
• Understand what is meant by artificial intelligence (AI)
• Describe the main characteristics of AI as the collection of data and the rules for using that data, the ability to reason,
r S te a and can include the ability to learn and adapt
• Explain the basic operation and components of AI systems to simulate intelligent behaviour
fo ec ll C
6.1 Automated systems
d
ot r a
An automated system performs actions without the need for human interaction, for example in traffic lights, air conditioning
systems and washing machines. Sensors, microprocessors and actuators work together to create these automated systems.
N co sh
al
2 Is actuator is an example of an input device or an output device? Tick (✔) the correct answer.
Input device
Output device
3 An office building has an automated lighting system. When an employee walks into their office, the light will automatically
switch on. If no movement is detected in the office for a period of 5 minutes, the light is automatically switched off.
a.
What type of sensor could be used in this automated lighting system?
fs h
oo is
b.
The data captured by the sensor is analogue data. What happens to this analogue data?
e Pr nd
e
v
c.
The data from the sensor is sent to the microprocessor. How does the microprocessor process this data and what actions
r S te a may this cause?
fo ec ll C
d
ot r a
N co sh r
al
U a
r
M
4 A traffic monitoring system counts the number of cars in a day that use a certain bridge. The count is output on a screen in
an office. It is important that the data is accurate and that the number of cars is correctly counted.
©
a.
Tick (✔) to show the most appropriate sensor that could be used in this traffic monitoring system.
n
Acoustic
Magnetic field
Light
Flow
b.
Describe three benefits of using an automated system for this task.
Benefit 1
fs h
oo is
Benefit 2
e Pr nd
e
Benefit 3
v
r S te a
fo ec ll C
5 A factory has an automated system to manufacture candles. The solid candle wax is heated to 55 degrees Celsius to turn it
to liquid. The liquid wax is then sent along a pipe at the correct speed to be distributed into glass containers that are then
filled to a level of 250ml.
d
a.
ot r a
Complete the table with the most appropriate sensor for each part of the automated system.
N co sh
al
U a
b.
List two drawbacks to using an automated system for this task.
r
Drawback 1
M
©
n
Drawback 2
6.2 Robotics
Robotics is a branch of science that involves designing, building and using robots. A robot is a machine that is designed to
replicate the actions of a human. A robot has three main characteristics.
fs h
oo is
Exercise 1 Robots
e Pr nd
1 What are the three main characteristics of a robot?
Characteristic 1
ve
r S te a Characteristic 2
fo ec ll C
Characteristic 3
d
ot r a
2 Can you think of three ways that robots can be used in medicine?
N co sh
1
r
al
U a
r
M
©
2
n
fs h
oo is
3 The introduction of robots into the transport industry may soon mean that we have access to self-driving cars.
e Pr nd
What issues could there be with self-driving cars?
ve
r S te a
fo ec ll C
d
ot r a
N co sh r
al
U a
r
M
©
n
4 Robots are often used in the manufacturing industry. Why do you think this is?
fs h
oo is
e Pr nd
e
v
r S te a
fo ec ll C
d
ot r a
N co sh
2 Can you give three examples of artificial intelligence that you may find in a home?
Example 1
fs h
Example 2
oo is
e Pr nd
Example 3
e
3 Tick (✔) to show which of these statements are characteristics of artificial intelligence.
v
Statement Tick (✔)
r S te a AI needs to collect data
AI can learn an adapt
AI needs moving parts and a mechanical framework
fo ec ll C
AI has a set of programmed rules
AI can invent creations from scratch
AI has the ability to reason
4 What term is used to describe a program that has the ability to automatically adapt to its own processes and data?
d
ot r a
N co sh
5 An expert system is a type of artificial intelligence that is able to provide a level of expertise about a certain subject, similar
to that of a professional such as a doctor or an engineer.
r
al
a. Can you name the four main parts of an expert system?
U a
Part 1
r
M
Part 2
©
Part 3
Part 4
1
fs h
oo is
2
e Pr nd
e
v
Revision checklist
r S te a
fo ec ll C
Need to revisit Satisfactory Confident
al
advantages and disadvantages of their use
U a
data and the rules for using that data, the ability to reason, and can
include the ability to learn and adapt
I can explain the basic operation and components of AI systems to
©
problem solving
fs h
oo is
e Pr nd
At the end of this chapter, you will be able to:
• Understand the program development life cycle, limited to: analysis, design, coding and testing
• Understand that every computer system is made up of sub-systems, which are made up of further sub-systems
• Understand how a problem can be decomposed into its component parts
e
• Use different methods to design and construct a solution to a problem
• Explain the purpose of a given algorithm
v
• Understand standard methods of solution
• Understand the need for validation checks to be made on input data and the different types of validation check
r S te a • Understand the need for verification checks to be made on input data and the different types of verification check
•
fo ec ll C
Suggest and apply suitable test data
• Complete a trace table to document a dry-run of an algorithm
• Identify errors in given algorithms and suggest ways of correcting these errors
• Write and amend algorithms for given problems or scenarios, using: pseudocode, program code and flowcharts
d
ot r a
An algorithm is a set of instructions that are to be followed to solve a problem or achieve an outcome. You will use many
algorithms on a daily basis that you don’t even know you are following, to complete everyday tasks. For example, you use an
r
algorithm when crossing the road, look both ways, can you see any cars coming? Cross only when there are no cars coming
al
or the cars have stopped. You use algorithms all the time in subjects like maths and science to get the correct answer to an
U a
Computer programs are just algorithms, sometimes very complex algorithms. When a new computer program is created, or an
M
existing computer program is developed, a process called the program development life cycle is often used. This is a series are
stages that are performed to make sure that all aspects of a program are properly and thoroughly thought out and created.
©
1 Analysis and design are two stages of the program development cycle. Can you name the other two stages?
2 Can you name two tasks that are performed at the analysis stage of the program development cycle?
There are three main methods that can be used to design an algorithm, these are structured diagrams, flowcharts and pseudocode.
fs h
A structured diagram is a hierarchical diagram that shows how a program can be decomposed into different subprograms.
oo is
Exercise 2 Algorithm design
e Pr nd
1 A game allows a user to move up, down, left or right around the screen. The aim of the game is to eat the different fruits
that appear. An orange scores 1 point, an apple scores 2 points and a banana scores 3 points. The user has 60 seconds to
score as many points as they can before the game is over and the users score is output onto the screen.
e
Complete the structured diagram for the game.
v
Game
r S te a
fo ec ll C
Input Process Output
d
ot r a
N co sh
al
U a
Timer
Up Reset timer Reset score
r
M
©
n
Fruit
2 A security system on a door allows a user to type a code into a keypad to enter the room. If an incorrect code is input, an
error message is shown and a short alarm sound is played.
fs h
oo is
e Pr nd
e
v
r S te a
fo ec ll C
d
ot r a
N co sh r
al
U a
r
M
©
n
3 A vending machine allows a user to choose a product to purchase, input money for a product and receive any monetary
change that is not used when purchasing a product.
fs h
oo is
e Pr nd
e
v
r S te a
fo ec ll C
d
ot r a
N co sh r
al
U a
r
M
©
n
A flowchart is a diagram that shows the input, processes, output and storage of data, in the order in which they occur to
solve a problem. It is a diagram that represents an algorithm.
fs h
oo is
1 Write the name of each flowchart symbol in the symbol shape.
e Pr nd
e
2 A computer program allows a user to input two numbers. It multiplies the numbers together and if the answer is larger than
100 it outputs the message “Greater than 100”. The program loops until the user does not want to input any more numbers.
v
r S te a Complete the flowchart that represents an algorithm for the computer program.
Start
fo ec ll C
d
ot r a
Input num2
N co sh r
al
U a
r
M
Is answer >100
©
Input
n
3 A tennis club has a computer program that allows a user to input a players age. The program will then tell the user if they
should be out into the Junior, Senior or Veterans category for a tennis competition. Junior players are age 16 and under.
Senior players are between 17 and 35. Veteran players are over 35 years old. The program loops until no more players need to
be input.
fs h
Draw a flowchart to represent an algorithm for the tennis club computer program.
oo is
e Pr nd
e
v
r S te a
fo ec ll C
d
ot r a
N co sh r
al
U a
r
M
©
n
4 A computer program allows a user to enter the weight in Kgs for a parcel. The program outputs whether the parcel is a
small parcel, a medium parcel or a large parcel.
●● A small parcel weighs less than 1kg
●● A medium parcel weighs between 1kg and 2.5 kgs
fs h
●● A large parcel weighs more than 2.5kgs
oo is
The cost to send a small parcel is $1.5, a medium parcel is $2.75 and a large parcel is $4. The program has 3 1D arrays. These
are a small parcels array, a medium parcels array and a large parcels array. Each time a parcel is input, the weight of the
parcel is added to the correct array.
e Pr nd
The program loops until no more parcels need to be input. When all parcels have been input, a total cost for all the parcels
is displayed. The contents of each array are also output.
ve
r S te a
fo ec ll C
d
ot r a
N co sh r
al
U a
r
M
©
n
fs h
oo is
e Pr nd
e
v
r S te a
fo ec ll C
d
ot r a
N co sh r
al
U a
r
M
©
n
Pseudocode is a term that is used for any code that is not written in a particular programming language. There isn’t a set
standard for pseudocode, but Cambridge provide a standard that they use to write their exam questions. You should make
yourself familiar with this standard. Pseudocode can also be used to present an algorithm, but in written form rather than as
a diagram.
Exercise 4 Pseudocode
fs h
1 Look at the earlier description given in question 2 of exercise 3. This is a reminder of the program description:
A computer program allows a user to input two numbers. It multiplies the numbers together and if the answer is larger than
oo is
100 it outputs the message “Greater than 100”. The program loops until the user does not want to input any more numbers.
e Pr nd
REPEAT
INPUT
e
INPUT num2
v
answer
r S te a
IF answer > 100
THEN
fo ec ll C
ENDIF
IF
N co sh
THEN
flag TRUE
r
ELSE
al
U a
flag
r
M
ENDIF
2 Look at the earlier description given in question 3 of exercise 3. This is a reminder of the program description:
A tennis club has a computer program that allows a user to input a players age. The program will then tell the user if they
n
should be out into the Junior, Senior or Veterans category for a tennis competition. Junior players are age 16 and under.
Senior players are between 17 and 35. Veteran players are over 35 years old. The program loops until no more players need to
be input.
fs h
oo is
e Pr nd
e
v
r S te a
fo ec ll C
d
ot r a
N co sh r
al
U a
r
M
©
n
3 Look at the earlier description given in question 4 of exercise 3. This is a reminder of the program description:
A computer program allows a user to enter the weight in Kgs for a parcel. The program outputs whether the parcel is a
small parcel, a medium parcel or a large parcel.
A small parcel weighs less than 1kg
fs h
●●
oo is
●● A large parcel weighs more than 2.5kgs
The cost to send a small parcel is $1.5, a medium parcel is $2.75 and a large parcel is $4. The program has 3 1D arrays. These
e Pr nd
are a small parcels array, a medium parcels array and a large parcels array. Each time a parcel is input, the weight of the
parcel is added to the correct array.
The program loops until no more parcels need to be input. When all parcels have been input, a total cost for all the parcels
is displayed. The contents of each array are also output.
e
Write an algorithm in pseudocode to represent the computer program.
v
r S te a
fo ec ll C
d
ot r a
N co sh r
al
U a
r
M
©
n
fs h
oo is
e Pr nd
e
v
r S te a
fo ec ll C
d
ot r a
N co sh r
al
U a
Once you have decomposed a problem and designed an algorithm to solve it, you will need to code your algorithm. This
M
is what happens in the coding stage of the program development cycle. This is where you will start writing the computer
program for the algorithm in a high-level programming language.
4 Which high level programming language will you use to code your program?
©
n
Once you have created a computer program you need to test it to make sure that is works correctly, that it does not have
any errors in the syntax or the logic of the program. You will also need to check that is meets all the requirements need in
solving the problem. This is what happens in the testing phase of the program development cycle.
Once you have written down your program in the space given in this workbook, you should use a programming
IDE to test each of your programs to see if they work. It is good practice for you to be able to write program code
as you will have to do this in the exam. It is also good practice for you to create the program in an IDE as the skill of
programming is one of the fundamental skills you will learn in this IGCSE.
Exercise 5 Testing
fs h
oo is
e Pr nd
2 There are four different types of test data that can be used to test a computer program.
Consider a program that will only allow numbers between 1 and 50 (inclusive) to be input.
e
Complete the table with a description for each type of test data, along with example test data for the program.
v
Type of test data Description of test data Example test data
r S te a
fo ec ll C
Normal
d
ot r a
N co sh
Abnormal
r
al
U a
r
M
Extreme
©
n
Boundary
One tool that can be used as a dry-run to test an algorithm is called a trace table. A dry-run of an algorithm is where
the inputs, processes, outputs and storage of an algorithm are tested on paper, rather than used an electronic
computer program.
Start
fs h
oo is
count 0
total 0
e Pr nd
e
INPUT studentAge
v
r S te a
total total + studentAge
fo ec ll C
d
count count + 1
ot r a
N co sh
No
r
Is count = 10?
al
U a
r
M
Yes
©
OUTPUT
“Average age is “ avg
Stop
a.
Can you describe the purpose of the algorithm?
fs h
oo is
b.
Complete the trace table for the algorithm, using the data set of students ages given.
e Pr nd
12, 14, 16, 9, 5, 17, 13, 12, 15, 8
ve
r S te a
fo ec ll C
d
ot r a
N co sh r
al
U a
r
M
©
n
guessCorrect FALSE
INPUT player1Num
fs h
WHILE guessCorrect <> TRUE
oo is
INPUT player2Guess
e Pr nd
IF player1Num = player2Guess
THEN
e
guessCorrect TRUE
v
r S te a ELSE
ELSE
d
ot r a
ENDIF
ENDIF
r
al
ENDWHILE
U a
a.
r
b.
Complete the trace table for the algorithm.
Player 2 enters the data set 10, 25, 65, 50, 58, 54, 57, 55
fs h
guessCorrect player1Num player2Guess OUPUT
oo is
e Pr nd
e
v
r S te a
fo ec ll C
d
ot r a
N co sh r
al
U a
r
M
©
n
When writing computer programs, you may want the data input by a user to follow certain rules. You can set rules for
the data input and this is done using validation. There are several types of validation check.
Exercise 6 Validation
1 Complete the table with a description and an example for each type of validation. The first one has been done for you:
fs h
Type of validation Description of validation Example
oo is
e Pr nd
A range check looks whether the data input is
Range check The number must be between 1 and 100.
within a given range of values.
ve
Length check
r S te a
fo ec ll C
d
Type check
ot r a
N co sh r
al
Presence check
U a
r
M
©
Format check
n
Check digit
2 You can also perform a visual check on data, or have a user enter the same data twice, known as a double entry check.
These two checks are not types of validation, what are they types of?
fs h
oo is
There are certain standard algorithms that you need to know the purpose of and how they operate, these are a linear search
and a bubble sort.
e Pr nd
Exercise 7 Linear search and bubble sort
e
1 Consider the data set:
v
a.
Explain how a linear will find the value 36 in the data set.
r S te a
fo ec ll C
d
ot r a
b.
Explain how a bubble sort will sort the data set into order, from lowest to highest.
N co sh r
al
U a
r
M
©
n
One important skill when creating algorithms is the ability to identify errors in a computer program. You may not always
write a program perfect first time, so you need to be able to identify where you may have gone wrong.
fs h
count 0
oo is
WHILE count <=3
e Pr nd
INPUT colour
e
“Purple”
v
r S te a THEN
ENDIF
d
ot r a
ENDWHILE
N co sh
count count + 1
al
The algorithm contains errors, can you identify these errors? When you have, rewrite the algorithm with the errors corrected.
©
n
fs h
oo is
e Pr nd
e
v
r S te a
fo ec ll C
d
ot r a
N co sh r
al
U a
r
M
©
n
lowestScore 100
fs h
highestScore 0
oo is
totalScore 0
count 10
e Pr nd
WHILE flag = TRUE
e
INPUT score
v
IF score < lowestScore
r S te a THEN
lowestScore score
fo ec ll C
ENDIF
IF score != highestScore
d
THEN
ot r a
highestScore score
N co sh
ELSE
al
INPUT answer
U a
IF answer = “N”
r
M
THEN
flag FALSE
©
ENDIF
n
ENDIF
count count + 1
ENDWHILE
averageScore totalScore/count
fs h
• loops until the user has now more scores to input
• calculates the average score input
oo is
• when all scores have been input, it outputs the lowest score, the highest score and the average score
The algorithm contains errors, can you identify these errors? When you have, rewrite the algorithm with the errors corrected.
e Pr nd
e
v
r S te a
fo ec ll C
d
ot r a
N co sh r
al
U a
r
M
©
n
fs h
oo is
e Pr nd
e
v
r S te a
fo ec ll C
d
ot r a
N co sh r
al
U a
r
M
©
n
Revision checklist
fs h
oo is
I understand the program development life cycle, limited to: analysis,
design, coding and testing
e Pr nd
I understand that every computer system is made up of sub-systems,
which are made up of further sub-systems
I understand how a problem can be decomposed into its component
parts
e
I can use different methods to design and construct a solution to a
problem
v
I can explain the purpose of a given algorithm
r S te a
I understand standard methods of solution
I understand the need for validation checks to be made on input data
fo ec ll C
and the different types of validation check
I understand the need for verification checks to be made on input
data and the different types of verification check
I can suggest and apply suitable test data
d
I can complete a trace table to document a dry-run of an algorithm
ot r a
al
U a
r
M
©
n
Programming
fs h
oo is
e Pr nd
At the end of this chapter, you will be able to:
• Declare and use variables and constants
• Understand and use the basic data types
• Understand and use input and output
e
• Understand and use the concept of sequence
• Understand and use the concept of selection
v
• Understand and use the concept of iteration
• Understand and use the concepts of totalling and counting
r S te a • Understand and use the concept of string Handling
•
fo ec ll C
Understand and use arithmetic, logical and Boolean operators
• Understand and use nested statements
• Understand what is meant by procedures, functions and parameters
• Define and use procedures and functions, with or without parameters
• Understand and use local and global variables
d
ot r a
al
• Open, close and use a file for reading and writing
U a
r
M
Writing programmes in a high-level language can be fun and challenging. It can also be a very useful skill to have, as it can be
used in many different careers.
n
You will learn to program several useful aspects of programming, including sequence, selection iteration, the use of arrays and
file handling.
Once you have written down your program in the space given in this workbook, you should use a programming IDE to test each
of your programs to see if they work. It is good practice for you to be able to write program code as you will have to do this in
the exam. It is also good practice for you to create the program in an IDE as the skill of programming is one of the fundamental
skills you will learn in this IGCSE.
Programming 91
1 When you write a program, you will normally need to store data. Two ways that data can be stored in a program is in a
variable or a constant.
fs h
Can you describe the difference between a variable and a constant?
oo is
e Pr nd
e
v
2 Consider the program:
r S te a
OUTPUT “What is your first name?”
fo ec ll C
INPUT firstName
When you write a computer program, you will often need to assign a data type to different parts of the program.
r
al
U a
1 Can you draw a line to match the data type to its correct description?
92 Programming
sport “Tennis”
fs h
oo is
3 Consider the statement:
e Pr nd
loop TRUE
ve
r S te a 4 Consider the statement:
cost 2.50
fo ec ll C
d What type of data will be stored?
ot r a
price int(10.53)
N co sh
al
U a
value 12345
valueOutput str(value)
©
To write a program, you will need to be able to input data into the program and may need to output data from the
program. You should write all programming statements requested in the tasks in your programming language of choice.
The programming languages that you can use are Python, Java and VB.NET. Remember, all identifier names, such as variable
names, in your program should be meaningful. It is also best practice that they do not contain spaces.
Programming 93
fs h
1 Write a program that will allow a user to input their first name, their last name and their age.
oo is
e Pr nd
e
v
2 Write a program that requires a user to input their age as an integer and their height as a real number.
r S te a
fo ec ll C
d
ot r a
al
U a
r
M
©
4 Write a program that will allow a user to input their first name and the favourite colour. The program must then output
the message:
n
The users name must replace the x and the users favourite colour must replace the y.
94 Programming
fs h
oo is
To write certain programs, you may need to use several mathematical operators. Some of these you will have used in
mathematics previously, such as +, -, / and *. You need to know how to use the library routines MOD, DIV, ROUND and
e Pr nd
RANDOM. You also need to understand how to create totalling and counting methods in a program. These are all common
elements to the programs that you will create and are very useful skills to have.
e
Exercise 4 Library routines
v
r S te a 1 Can you describe the difference between MOD and DIV?
fo ec ll C
d
ot r a
N co sh
al
U a
r
M
num1 10 FOR x 1 TO 5
num2 20 y y + 1
x num1+num2 NEXT x
Programming 95
fs h
oo is
e Pr nd
The three main programming concepts that you will use when writing programs are sequence selection and iteration. You
should write all programming statements requested in the tasks in your programming language of choice
e
Exercise 5 Sequence selection and iteration
v
r S te a 1 Write the correct term for each description to show whether is it for sequence, selection or iteration.
Term Description
fo ec ll C
A section of code is repeatedly run either a set number of
times or until a condition is met/no longer met
al
U a
96 Programming
3 A loop is a way of creating iteration in a program. You can have count-controlled loops and condition-controlled loops.
Can you describe the difference between a count-controlled loop and a condition-controlled loop?
fs h
oo is
e Pr nd
4 Consider the program:
e
number 0
v
r S te a FOR i 1 TO 10
OUTPUT number
fo ec ll C
NEXT i
This is a count-controlled loop. Try and rewrite this loop as a condition-controlled loop.
d
ot r a
N co sh r
al
U a
r
M
count 10
©
WHILE count != 0 DO
n
OUTPUT count
count count – 1
ENDWHILE
This is a condition-controlled loop. Try and rewrite this loop as a count-controlled loop.
Programming 97
fs h
oo is
e Pr nd
6 IF statements and CASE statements are method of creating selection in a program.
a.
Write a program that:
e
• Allows player 1 to input a number
• Allows player 2 to try and guess the number input by player 1
v
• Outputs whether player 2’s guess was correct
You must use an IF statement in your program.
r S te a
fo ec ll C
d
ot r a
N co sh r
al
U a
r
M
b.
Write a program that:
• Allows a user to input their score
• Outputs the award given to the user, based on their score:
©
You must use a CASE statement in your program. If you are writing your code in python you will need to write
pseudocode for this task as python does not have a CASE command.
98 Programming
fs h
oo is
e Pr nd
e
c.
IF statements can also be nested. Rewrite the program from task (b) using a nested IF statement instead of a CASE
statement.
v
r S te a
fo ec ll C
d
ot r a
N co sh r
al
U a
r
• Outputs the message “That is the best food!” if the user inputs pizza, noodles or seafood
n
Programming 99
fs h
• Outputs the message “You need to try again with the English test.” if the English test score is less than 75, but the
Mathematics test score is 75 or greater
oo is
• Outputs the message “You need to try again with the Mathematics test.” if the Mathematics test score is less than 75,
but the English test score is 75 or greater
• Outputs the message “You need to try again with both tests.” if both test scores are less than 75
e Pr nd
You must use a nested IF statement and Boolean operator in your program.
ve
r S te a
fo ec ll C
d
ot r a
N co sh r
al
U a
r
M
©
n
100 Programming
fs h
• Loops until player 2 has had 5 guesses or makes a correct guess
• Outputs ‘game over’ when player 2 has had 5 incorrect guesses
oo is
• Outputs a message to say the guess is correct and how many guesses it took player 2, when player 2 makes a correct guess
e Pr nd
e
v
r S te a
fo ec ll C
d
ot r a
N co sh r
al
U a
r
M
©
n
You can create subroutines in your programs by using procedures and functions. Subroutines are helpful as they allow you
to reuse that section of code repeatedly in your program. It also means that if you want to change what happens in the
subroutine, or change the data it uses, you only need to do this in one place in your code, rather than lots of individual places.
Programming 101
Exercise 6 Subroutines
fs h
oo is
e Pr nd
2 Write a procedure that counts down from 10 to 1. The count must be output. You must also write the line of code needed to
call your procedure.
ve
r S te a
fo ec ll C
d
ot r a
N co sh r
al
U a
3 Write a procedure that takes two values as parameters and finds the remainder of value 1 divided by value 2. You must also
r
write the main program to allow input of the values and the line of code needed to call your procedure.
M
©
n
102 Programming
fs h
oo is
e Pr nd
e
v
4 Write the program you created in task 3 as a function instead of a procedure. When you call the function, store the value
r S te a returned in a variable.
fo ec ll C
d
ot r a
N co sh r
al
U a
r
M
©
n
A string can be a single word or a sentence of text. It can contain characters, numbers and symbols. One useful
programming skill to have is to be able to extract and manipulate strings.
Programming 103
fs h
LENGTH(“Computer”)
oo is
What will this statement return?
e Pr nd
2 Consider the statement:
e
SUBSTRING(“Computer”, 1, 2)
v
r S te a
fo ec ll C
3 Consider the statement:
SUBSTRING(“Computer”, 2, 3)
UPPER(“Computer”)
r
al
What will this statement return?
U a
r
M
LOWER(“Computer”)
n
104 Programming
fs h
oo is
e Pr nd
e
v
r S te a 7 Write a function that:
fo ec ll C
• Takes as a parameter the users first name
• Takes as a parameter the users last name
• Extracts the first two characters of the users first name
• Extracts the first three characters of the users last name
d
• Concatenates the two extractions along with the value 01 (first extract then second extract then 01) as a username
ot r a
al
U a
r
M
©
n
Programming 105
fs h
When you write a computer program, you should always make sure that your program is maintainable. One way of making
oo is
a program maintainable is by using meaningful identifier name for data that is stored.
e Pr nd
Exercise 8 Maintainable programmes
1 A program asks a user to input their favourite hobby. It stores this input using the identifier ‘x’
e
Can you explain whether ‘x’ is a good identifier name to use? Why?
v
r S te a
fo ec ll C
2 A program has a function that returns the total of two values.
d
Can you suggest a suitable identifier name for the function?
ot r a
N co sh
3 What are two other ways that you can make sure that your program is maintainable?
r
al
U a
r
M
©
n
106 Programming
8.2 Arrays
An array is a type of data structure. Whereas a variable allows you to store one piece of data using an identifier as a label, an array
allows you to store multiple pieces of data using a single identifier label. However, all the data stored in an array must be of the
fs h
same data type. Each piece of data that is stored in an array has an index. This is a value that is its position within the array. The
first index in the array is normally 0. This index is for the first piece of data stored in the array.
oo is
Exercise 1 1D arrays
e Pr nd
1 Consider the statement:
e
a.
What does this statement do?
v
r S te a
fo ec ll C
b.
How many items of data will this array store?
d
ot r a
c.
Write a statement that will declare an array with the identifier ‘values’ that can store 15 items of data. If you are using
N co sh
Python as your language, you will need to insert the correct number of placeholder values into your array. 0 is often used
as a value for this.
r
al
U a
r
M
sport[1] “Football”
©
b.
Consider the statement:
sport1 sport[3]
Programming 107
fs h
oo is
c.
Write a program that will:
e Pr nd
• Write the string ‘Cricket’ to position 3 in an array with the identifier of ‘sport’
• Store the data from position 2 in the array into a variable with the identifier ‘sport2’
ve
r S te a
fo ec ll C
3 Consider the program:
OUTPUT sport[3]
N co sh
al
U a
r
M
When all student names are input, it must output the first and last student first name in the array.
n
108 Programming
fs h
oo is
e Pr nd
So far, you have been using 1D arrays. A 2D array is one that has two index values that give the position of the data in an
array. It is like have a row and a column index if you think about the data being stored in a table.
e
Exercise 2 2D arrays
v
1 Consider the given array scores, displayed as a table of data:
r S te a
Index 0 1 2 3
fo ec ll C
0 50 48 37 45
1 50 45 32 39
2 45 50 43 33
d
Write a statement that would declare the 2D variable scores.
a.
ot r a
N co sh
al
U a
r
scores [1,2] 34
Programming 109
2 A computer games competition allows each player three attempts at achieving the highest score that they are able.
fs h
• Stores the scores in a 2D array
• Outputs a players score based on the input of the score requested by the user e.g. it outputs player 1s second score
oo is
attempt.
e Pr nd
e
v
r S te a
fo ec ll C
d
ot r a
N co sh r
al
U a
r
M
©
n
110 Programming
fs h
oo is
Exercise 1 File handling methods
e Pr nd
1 a. Consider the statement:
ve
r S te a
fo ec ll C
b.
Write a statement that will open a text file called ‘numbers’ to allow data to be read from the file.
d
ot r a
al
U a
r
M
b.
Write a statement that will open a text file called ‘numbers’ to allow data to be written to the file.
©
n
WRITEFILE scores.txt, 50
CLOSEFILE scores.txt
Programming 111
fs h
oo is
e Pr nd
b.
Write a program that will open a text file called ‘numbers’, allow the value 100 to be stored in the file. The file is then
closed.
ve
r S te a
fo ec ll C
c.
Write a program that will open a text file called ‘numbers’, allow the values stored in the file to be read from the file. The
file is then closed.
d
ot r a
N co sh r
al
U a
r
Once all colours have been input and stored, it reads and outputs each colour stored in the file
n
112 Programming
fs h
oo is
e Pr nd
e
v
r S te a
fo ec ll C
d
ot r a
N co sh r
al
U a
r
M
©
n
Programming 113
Revision checklist
fs h
oo is
I can declare and use variables and constants
I understand and use the basic data types
e Pr nd
I understand and use input and output
I understand and use the concept of sequence
I understand and use the concept of selection
e
I understand and use the concept of iteration
I understand and use the concepts of totalling and counting
v
I understand and use the concept of string Handling
r S te a
I understand and use arithmetic, logical and Boolean operators
I understand and use nested statements
fo ec ll C
I understand what is meant by procedures, functions and parameters
I can define and use procedures and functions, with or without
parameters
I understand and use local and global variables
d
ot r a
I can write values into and read values from an array using iteration
al
U a
I can open, close and use a file for reading and writing
©
n
114 Programming
Databases
fs h
oo is
e Pr nd
At the end of this chapter, you will be able to:
• Define a single-table database from given data storage requirements
• Suggest suitable basic data types
• Understand the purpose of a primary key and identify a suitable primary key for a given database table
e
• Read, understand and complete structured query language (SQL) scripts to query data stored in a single database table
v
r S te a 9.1 Databases
fo ec ll C
A database is a collection of data that is related and has been setup in a logical and structured way. Most databases are now
electronic and stored on computers. Databases have three main structural features: a table, fields, and records.
d
Exercise 1 Databases
ot r a
N co sh
This database has one table – a collection of data about a single topic. The database contains the membership details for a
tennis club.
A data type should be given to each field in a database. This indicates what type of data is stored in that field and any format
that data may need for the data type.
Databases 115
fs h
5 Which data type would be most suitable for the EmailAddress field?
oo is
e Pr nd
6 Which data type would be most suitable for the FeePaid field?
e
7 Which data type would be most suitable for the Age field?
v
r S te a
fo ec ll C
8 Why should the data types integer or real not be assigned to the TelephoneNumber? Which data type should be used instead?
d
ot r a
N co sh
9 Which field in the database is the most suitable as the primary key? Why?
r
al
U a
r
M
©
SQL is the language used to query a database, which means to search the database for certain data using a set of criteria. The
criteria is defined using SQL. SQL can also be used to edit the data in a database, although you will not use it for this purpose.
The first SQL commands you need to know are SELECT … FROM. These commands allow you to create a statement that selects a
field or multiple fields from a table. All the data for each field will be output in the results.
116 Databases
fs h
oo is
e Pr nd
e
2 Write the data that would be output by the SQL statement:
v
r S te a SELECT FirstName FROM Members
fo ec ll C
d
ot r a
N co sh
al
U a
r
M
©
n
Databases 117
fs h
5 Write an SQL statement that would output the email address for each member.
oo is
e Pr nd
6 Write an SQL statement that would output the first name then the age for each member.
ve
r S te a
7 Write an SQL statement that would output the member ID, the first name, and the telephone number for each member.
fo ec ll C
d
ot r a
The next SQL command you need to know is WHERE. This command is used to provide a condition for the data you want to
select. This allows you to select more specific data.
N co sh
al
U a
r
M
©
n
118 Databases
fs h
10 List the data that would be output by this SQL statement:
oo is
SELECT FirstName, LastName, FeePaid FROM Members WHERE FeePaid = “Yes”
e Pr nd
e
v
r S te a
fo ec ll C
d 11 Write an SQL statement that would output the first name and last name for each member that is called George.
ot r a
12 Complete the SQL statement that would output the first name and fee paid status for each member who is younger than 25
N co sh
WHERE AND
al
U a
13 Write an SQL statement that would output the first name and age of all the members with the title Miss or Mrs.
r
M
©
The next SQL command you need to know is ORDER BY. This is used to order the results that are output in either ascending
n
or descending order. The ASC command is used for ascending and the DESC command is used for descending.
Databases 119
fs h
15 List the data that would be output by this SQL statement:
oo is
SELECT Title, LastName, EmailAddress FROM Members ORDER BY LastName ASC
e Pr nd
e
v
r S te a
fo ec ll C
16 Write an SQL statement that would output the first name of each member in reverse alphabetical order.
d
ot r a
17 Write an SQL statement that would output the first name and age of each member, starting with the oldest member to the
N co sh
youngest member.
r
al
U a
r
18 Complete this SQL statement to output the title, first name and last name of member older than 18 who have not paid their
M
WHERE
n
ORDER BY
The next SQL command you need to know is SUM. This allows you to total all the data that is in a field.
120 Databases
fs h
oo is
20 Write an SQL statement that would total the age of all members that have paid their fee.
e Pr nd
e
The final SQL command that you need to know is COUNT. This allows you to count how many records meet given criteria
for a field.
v
r S te a 21 List the data that would be output by this SQL statement:
al
23 Write an SQL statement that would count how many members are 18 or older.
U a
r
M
©
n
Databases 121
Revision checklist
fs h
oo is
I can define a single-table database from given data storage
requirements
e Pr nd
I can suggest suitable basic data types
I understand the purpose of a primary key and identify a suitable
primary key for a given database table
I can read, understand and complete structured query language
e
(SQL) scripts to query data stored in a single database table
v
r S te a
fo ec ll C
d
ot r a
N co sh r
al
U a
r
M
©
n
122 Databases
Boolean logic
fs h
oo is
e Pr nd
At the end of this chapter, you will be able to:
• Identify and use the standard symbols for logic gates
• Define and understand the functions of the logic gates
• Use logic gates to create given logic circuits from a: (i) problem statement (ii) logic expression (iii) truth table
e
• Complete a truth table from a: (i) problem statement (ii) logic expression (iii) logic circuit
• Write a logic expression from a: (i) problem statement (ii) logic circuit (iii) truth table
v
r S te a
10.1 Boolean logic
fo ec ll C
Logic gates are used to control the flow of electricity in a computer. They can change the current from high (1) to low (0) and vice
versa. They do this based on different conditions set for each logic gate.
The logic gates that you need to know and understand the function of are NOT, AND, OR, NAND, NOR and XOR(EOR). The NOT
d
logic gate is limited to one input. All the other logic gate that you need to know are limited to two inputs.
ot r a
N co sh
al
U a
r
M
©
3 Complete the table by drawing the missing logic gates symbol or completing the missing truth table.
fs h
0 1
1 0
oo is
e Pr nd
AND Input 1 Input 2 Output
0 0
0 1
e
1 0
1 1
v
r S te a OR Input 1 Input 2 Output
0 0 0
0 1 1
fo ec ll C
1 0 1
1 1 1
NAND Input 1 Input 2 Output
0 0 1
d
ot r a
0 1 1
1 0 1
N co sh
1 1 0
NOR Input 1 Input 2 Output
0 0
r
al
0 1
U a
1 0
r
1 1
M
0 1
1 0
n
1 1
fs h
oo is
6 Consider the description:
e Pr nd
The only time the output is 1 is when both inputs are 1.
ve
7 Consider the description:
r S te a The output is only ever 1 when both inputs are different.
fo ec ll C
d Write the correct logic gate for this description.
ot r a
8 Draw the single logic gate that can be used to replace the two logic gates. It must provide the same outcome.
N co sh r
9 Draw the single logic gate that can be used to replace the two logic gates. It must provide the same outcome.
fs h
oo is
Single logic gate:
e Pr nd
e
v
r S te a
fo ec ll C
d
ot r a
N co sh r
Logic circuits can be created using logic gates. They can be created from problem statements, logic expressions and truth tables.
al
U a
Logic expressions are a mathematical method of writing down the logic of system. They show the inputs to the system, the
logic gates used and the output. Logic circuits and truth tables can also be complete from a logic expressions.
r
M
In a logic expression, you will normally start with the output value e.g. X, then an equals sign, then the input values and any
logic gates that are used. It is also important to use brackets correctly in a logic expression, as they show the order in which
the logic of the expression should occur.
©
Truth tables are a way of showing possible input combinations to the logic circuit and all the possible outcomes of the
different input combinations. When you have three inputs shown on a truth table, you should recognise that the binary
values for each row increment from the denary value 0 up to 7.
n
You should make sure that you draw your logic gates very clearly and accurately. It should be very easy to tell which logic
gate you are drawing. For example, make sure that all AND gates have a straight line for their back part and that OR gates
have an obvious curved line for their back part. This way the two gates cannot be confused. Make sure you also clearly draw
the small circle needed on a NOT, NAND and NOR gate. Do not be tempted to colour this circle in, it should be left unfilled.
fs h
X = (A OR B) OR C)
oo is
a.
Draw a logic circuit to represent this logic expression.
e Pr nd
e
A
v
r S te a
fo ec ll C
B X
d
ot r a
C
N co sh r
al
U a
b.
Complete the truth table to represent this logic expression.
r
M
You are given working space in the truth table to use if you need to do any working out.
A B C Working space X
©
0 0 0
0 0 1
n
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
fs h
oo is
e Pr nd
A
e
B X
v
r S te a
C
fo ec ll C
d
ot r a
a.
Draw a logic circuit to represent this logic expression.
r
al
U a
r
M
P
©
n
S Z
b.
Complete the truth table to represent this logic expression.
P S T Working space Z
0 0 0
fs h
0 0 1
0 1 0
oo is
0 1 1
1 0 0
1 0 1
e Pr nd
1 1 0
1 1 1
A problem statement is a method of writing out the details of a problem as a description. Logic expressions, logic circuits
e
and truth tables can be created from a problem statement.
v
Exercise 3 Problem statements
r S te a
fo ec ll C
1 Consider the problem statement:
A singing competition has three judges who each have a buzzer button they can press. The first judge (A) is the head judge.
The second two judges are judge B and judge C.
To get through to the next round (output X) in the competition, a singer must have the head judge and one other judge
d
ot r a
Note that the problem statement has three inputs (A, B and C) and one output (X).
N co sh
a.
Write a logic expression to represent this problem statement.
NOTE: remember to include brackets and use them to section off the correct parts of the logic expression.
r
al
U a
r
M
©
n
b.
Draw a logic circuit to represent this problem statement.
fs h
A
oo is
e Pr nd
B X
e
C
v
r S te a
c.
Complete the truth table to represent this problem statement.
fo ec ll C
A B C Working space X
0 0 0
0 0 1
d
0 1 0
ot r a
0 1 1
1 0 0
N co sh
1 0 1
1 1 0
1 1 1
r
al
A factory makes chocolate bars. The chocolate is transported through the factory in liquid form, using pipes. To make sure
M
the chocolate is transported correctly, the temperature, thickness and flow speed of the chocolate is measured:
Or
fs h
Temperature > 35 degrees and Flow speed is > 0.5 cubic metres per second
a.
Write a logic expression to represent this problem statement.
oo is
e Pr nd
b.
Draw a logic circuit to represent this problem statement.
ve
r S te a H
fo ec ll C
T X
d
ot r a
N co sh
F
r
al
U a
r
M
c.
Complete the truth table to represent this problem statement.
A B C Working space X
©
0 0 0
0 0 1
n
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
A logic circuit is a diagrammatic method of representing the logic of a system. A logic statement and a truth table can be
created from a logic circuit.
fs h
A
oo is
X
e Pr nd
B
e
C
v
Write a logic expression to represent this logic circuit.
r S te a
fo ec ll C
2 Consider the logic circuit:
d
W
ot r a
N co sh
X Z
Y
r
al
U a
R
X
a.
Write a logic expression to represent this logic circuit.
fs h
oo is
b.
Complete the truth table to represent this logic circuit.
P R S Working space X
e Pr nd
0 0 0
0 0 1
0 1 0
0 1 1
e
1 0 0
1 0 1
v
r S te a 1 1 0
1 1 1
A truth table is a tabular representation of the logic of a system. It shows all the possible outcomes for each input. A logic
fo ec ll C
expression and a logic circuit can be created from a truth table.
A B X
0 0 0
0 1 0
r
1 0 1
al
U a
1 1 0
r
A B X
0 0 0
0 1 0
1 0 1
1 1 1
a.
Write a logic expression to represent this truth table.
fs h
oo is
b.
Draw a logic circuit to represent this truth table.
e Pr nd
e
A
v
X
r S te a
fo ec ll C
B
d
ot r a
N co sh
A B C Z
0 0 0 0
r
al
0 0 1 1
U a
0 1 0 0
r
0 1 1 0
M
1 0 0 0
1 0 1 0
©
1 1 0 1
1 1 1 1
n
Revision checklist
fs h
oo is
I can identify and use the standard symbols for logic gates
I can define and understand the functions of the logic gates
e Pr nd
I can use logic gates to create given logic circuits from a: (i) problem
statement (ii) logic expression (iii) truth table
I can complete a truth table from a: (i) problem statement (ii) logic
expression (iii) logic circuit
e
I can write a logic expression from a: (i) problem statement (ii) logic
circuit (iii) truth table
v
r S te a
fo ec ll C
d
ot r a
N co sh r
al
U a
r
M
©
n
fs h
oo is
e Pr nd
e
v
r S te a
fo ec ll C
d
ot r a
N co sh r
al
U a
r
M
©
n
136
28/01/21 11:35 AM
Cambridge IGCSETM
fs h
oo is
For over 60 years Marshall Cavendish Education has been
Cambridge
e Pr nd
empowering educators and students in over 80 countries with
high-quality, research-based, Pre-K-12 educational solutions.
We nurture world-ready global citizens by equipping students
Computer Science
IGCSE
e
with crucial 21st century skills through our resources for schools
and education centres worldwide, including Cambridge schools, TM
v
catering to national and international curricula.
r S te a
Computer Science
The Marshall Cavendish Education Cambridge IGCSETM Computer Science series
fo ec ll C
is designed for students preparing for the 0478/0984 syllabus. The series
focuses on developing important computer science skills relevant to
real world applications.
d
WB The Workbook follows the same flow and structure as the Student’s Book and provides supplementary
ot r a
exercises to reinforce concepts learnt during lessons. Exam style questions are also included for students
to familiarise themselves with the syllabus requirements. A revision checklist at the end helps students
N co sh
Series architecture
r
WORKBOOK
al
Cambridge Assessment International Education • Student’s Book
U a
IGCSE and IGCSE (9–1) Computer Science syllabuses
M
• Teacher’s Guide
(0478/0984) for examination from 2023.
• e-book
✓ H as passed Cambridge International’s rigorous
quality-assurance process
©
9 789814 941600