You are on page 1of 144

Cambridge IGCSETM

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

IGCSE CS WB prelims.indd 2 28/01/21 10:00 AM


© 2021 Marshall Cavendish Education Pte Ltd

Published by Marshall Cavendish Education


Times Centre, 1 New Industrial Road, Singapore 536196
Customer Service Hotline: (65) 6213 9688

fs h
E-mail: cs@mceducation.com
Website: www.mceducation.com

oo is
First published 2021

e Pr nd
All rights reserved.

No part of this publication may be reproduced, stored in a retrieval system


or transmitted, in any form or by any means, electronic, mechanical,

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

IGCSE CS WB prelims.indd 3 28/01/21 10:00 AM


How to use this book

fs h
For further learner support, alongside the Student’s Book, Chapter 3

the Workbook offers a range of exercises to reinforce and

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?

Computer Science exam.

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
.

They are intended to help build your subject literacy Fetch-decode


fo ec ll C
-execute cycle
A process calle
and boost your confidence in understanding and it, and then exe
d the fetch-deco
cutes it. The CPU
de-execute cycl
e is performed
uses several diffe by the CPU. This
rent components cycle fetches an
answering questions. 1 Where are
data and instruct
ions stored imm
ediately before
to do this. instruction into
the CPU, decode
s
they are fetched
into the CPU?

The exam-style questions also help you to be familiar


2
with the format of the questions in the exam. What is the purp
ose of a register
?
d
ot r a
N co sh

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

Fill in the missing


x
them. Each inde
al
is used to
pression algorithm
Revision checklist A com
patterns in the
text file and
text.
U a

it occurs in the
position where
along with the
This exercise is included at the end is stored in a
r

of each chapter to help you identify list


Revision check
M

Confident
knowledge gaps. It is designed for Need to revisit
Satisfactory

you to pause and reflect on your


learning experience by evaluating your and why compute
rs use binary to
represent all
I understand how
understanding of the concepts taught.
©

forms of data ems


al number syst
and hexadecim
denary, binary
I understand the and positive binary,
positive
den ary
een positive positive binary
I can convert betw hexadecimal and
adecimal, and
denary and hex a beneficial
cimal is used as
erst and how and why hexade
I und
of data repr esentation
n

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_

IGCSE CS WB prelims.indd 4 28/01/21 10:00 AM


Contents

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

2.3 Encryption  25 Chapter 9 Databases 


Chapter 3 Hardware
fo ec ll C
9.1 Databases  115

3.1 Computer architecture 27 Chapter 10 Boolean logic 


3.2 Input and output devices 32
10.1 Boolean logic 123
3.3 Data storage 34
d
ot r a

3.4 Network hardware 38

Chapter 4 Software
N co sh

4.1 Types of software and interrupts 42


4.2 Types of programming language,
translators and integrated
r

al
development environments (IDEs) 46
U a

Chapter 5 The internet and its uses


r
M

5.1 The internet and the world


wide web  50
5.2 Digital currency 53
©

5.3 Cyber security  53

Chapter 6
n

Automated and emerging


technologies
6.1 Automated systems 58
6.2 Robotics 61
6.3 Artificial intelligence 63

IGCSE CS WB prelims.indd 5 28/01/21 10:00 AM


©
M

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

1.1  Number systems


U a
r
M

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.
©

Exercise 1 Denary, binary, and hexadecimal


n

1 Is denary a base-2, base-10 or base-16 number system? Circle the correct answer.

Base-2 Base-10 Base-16

2 Is binary a base-2, base-10 or base-16 number system? Circle the correct answer.

Base-2 Base-10 Base-16

Computer systems 1

IGCSE_CS_WB_Ch 1.indd 1 28/01/21 10:46 AM


Chapter 1

3 Is hexadecimal a base-2, base-10 or base-16 number system? Circle the correct answer.

Base-2 Base-10 Base-16

fs h
oo is
Exercise 2 Converting denary values

e Pr nd
Denary values can be converted to binary values and vice-versa.

1 Convert the denary value 7 to a 4-bit binary value.

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

3 Convert the 4-bit binary value 0011 to denary.


M

4-bit binary Denary


0011
©

Working space
n

4 Convert the 4-bit binary value 1001 to denary.

4-bit binary Denary


1001

2 Computer systems

IGCSE_CS_WB_Ch 1.indd 2 28/01/21 10:46 AM


Chapter 1

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

7 Convert the denary value 200 to an 8-bit binary value.

Denary 8-bit binary


r

al

200
U a
r

Working space
M
©
n

8 Convert the 8-bit binary value 00011011 to denary.

8-bit binary Denary


00011011

Working space

Computer systems 3

IGCSE_CS_WB_Ch 1.indd 3 28/01/21 10:46 AM


Chapter 1

9 Convert the 8-bit binary value 10011111 to denary.

8-bit binary Denary


10011111

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

Denary 12-bit binary


2001
N co sh

Working space
r

al
U a
r
M

12 Convert the 12-bit binary value 100110011001 to denary.

12-bit binary Denary


©

100110011001

Working space
n

4 Computer systems

IGCSE_CS_WB_Ch 1.indd 4 28/01/21 10:46 AM


Chapter 1

13 Convert the denary value 1056 to a 16-bit binary value.

Denary 16-bit binary


1056

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

16-bit binary Denary


0001010111001100
N co sh

Working space
r

al
U a
r
M

Exercise 3 Converting hexadecimal values


©

Denary and binary values can also be converted to hexadecimal, and vice-versa.

1 Convert the 4-bit binary value 0011 to hexadecimal.


n

4-bit binary Hexadecimal


0011

Working space

Computer systems 5

IGCSE_CS_WB_Ch 1.indd 5 28/01/21 10:46 AM


Chapter 1

2 Convert the 4-bit binary value 1001 to hexadecimal.

4-bit binary Hexadecimal


1001

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

Hexadecimal 4-bit binary


4
N co sh

Working space
r

al
U a
r
M

5 Convert the hexadecimal value A to 4-bit binary.

Hexadecimal 4-bit binary


©

Working space
n

6 Computer systems

IGCSE_CS_WB_Ch 1.indd 6 28/01/21 10:46 AM


Chapter 1

6 Convert the hexadecimal value F to 4-bit binary.

Hexadecimal 4-bit binary


F

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

8-bit binary Hexadecimal


10110001
N co sh

Working space
r

al
U a
r
M

9 Convert the 8-bit binary value 11000000 to hexadecimal.

8-bit binary Hexadecimal


©

11000000

Working space
n

Computer systems 7

IGCSE_CS_WB_Ch 1.indd 7 28/01/21 10:46 AM


Chapter 1

10 Convert the hexadecimal value 4B to 8-bit binary.

Hexadecimal 8-bit binary


4B

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

Hexadecimal 12-bit binary


3B0
N co sh

Working space
r

al
U a
r
M

13 Convert the denary value 103 to hexadecimal.

Denary Hexadecimal
©

103

Working space
n

8 Computer systems

IGCSE_CS_WB_Ch 1.indd 8 28/01/21 10:46 AM


Chapter 1

14 Convert the hexadecimal value A3 to denary.

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

12-bit binary Hexadecimal


110100001111
N co sh

Working space
r

al
U a
r
M

17 Convert the hexadecimal value 04C to 12-bit binary.

Hexadecimal 12-bit binary


©

04C

Working space
n

Computer systems 9

IGCSE_CS_WB_Ch 1.indd 9 28/01/21 10:46 AM


Chapter 1

Exercise 4 Adding binary values

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

+ 0  1  1 0       + 0 0 1  0     

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

Exercise 5 Logical shifts


U a
r
M

Logical shifts can be performed on the binary contents of a register.

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

IGCSE_CS_WB_Ch 1.indd 10 28/01/21 10:46 AM


Chapter 1

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.

Denary Two’s complement 8-bit binary


47
d
ot r a

Working space
N co sh r

2 Convert the denary number -75 to two’s complement 8-bit binary.


al
U a
r

Denary Two’s complement 8-bit binary


M

-75

Working space
©
n

Computer systems 11

IGCSE_CS_WB_Ch 1.indd 11 28/01/21 10:46 AM


Chapter 1

3 Convert the two’s complement 8-bit binary value 01010110 to denary.

Two’s complement 8-bit binary Denary


01010110

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

1.2  Text, sound and images


M

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

Exercise 1 Character sets

When converting text to binary, a character set is used.

1 What is a character set?

12 Computer systems

IGCSE_CS_WB_Ch 1.indd 12 28/01/21 10:46 AM


Chapter 1

2 Tick (✔) to show whether each statement is true or false.

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

IGCSE_CS_WB_Ch 1.indd 13 28/01/21 10:46 AM


Chapter 1

Exercise 3 Converting images to binary

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

IGCSE_CS_WB_Ch 1.indd 14 28/01/21 10:46 AM


Chapter 1

1.3  Data storage and compression


Several data storage units can be used to identify the size of a file.

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.

Data storage unit Number


Byte

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

Exercise 2 File compression


N co sh

Sometimes, files are compressed before they are stored. There are two methods of compression: lossy and lossless.

1 Tick (✔) to show whether each statement is true or false.


r

al
True False
Statement
U a

(✔) (✔)
r

Compression reduces the size of the file


M

A compressed file will be transmitted slower


A compressed file uses less bandwidth when transmitted
A compressed file will take up less storage space
©

2 A student has several large images to send to a friend. They use lossy compression to
n

reduce the size of the images before sending them.


List two ways that lossy compression will reduce the size of the images.

Computer systems 15

IGCSE_CS_WB_Ch 1.indd 15 28/01/21 10:46 AM


Chapter 1

3 The paragraph below explains how lossless compression can be used to reduce the size of a text file.

Fill in the missing words.

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

Need to revisit Satisfactory Confident

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

I understand the concept of overflow and why it occurs in binary


addition
N co sh

I can perform a logical binary shift on a positive 8-bit binary integer


and understand the effect this has on the positive binary integer
I can use two’s complement to represent positive and negative 8-bit
r

binary integers
al
U a

I understand how and why a computer represents text and the use of
r

character sets, including ASCII and Unicode


M

I understand how and why a computer represents sound, including


the effects of the sample rate and sample resolution
I understand how and why a computer represents an image,
©

including the effects of the resolution and colour depth


I understand how data storage is measured
n

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

IGCSE_CS_WB_Ch 1.indd 16 28/01/21 10:46 AM


2
CHAPTER

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

• Understand how data is encrypted using symmetric and asymmetric encryption


N co sh

2.1  Types and methods of data transmission


r

al
U a
r

Exercise 1 Data packets


M

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
©

smaller unit of data.

1 Name the three different sections in the structure of a data packet.


n

2 In which section of the data packet would you normally find the destination address?

Data transmission 17

IGCSE_CS_WB_Ch 2.indd 17 26/01/21 9:52 PM


Chapter 2

3 What kind of address is the destination address normally?

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

Same route      Different route


N co sh

8 In packet switching, the data packets will always arrive in order.

Tick (✔) to show whether this statement is true or false.


r

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

IGCSE_CS_WB_Ch 2.indd 18 26/01/21 9:52 PM


Chapter 2

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

IGCSE_CS_WB_Ch 2.indd 19 26/01/21 9:52 PM


Chapter 2

Exercise 2 Data transmission

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.

Data transmission method Tick (✔)

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

Exercise 3 Transmission methods

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

One direction only      Both directions

2 Can you think of two applications where simple data transmission would be suitable?

20 Data transmission

IGCSE_CS_WB_Ch 2.indd 20 26/01/21 9:52 PM


Chapter 2

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

IGCSE_CS_WB_Ch 2.indd 21 26/01/21 9:52 PM


Chapter 2

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

IGCSE_CS_WB_Ch 2.indd 22 26/01/21 9:52 PM


Chapter 2

2.2  Methods of error detection


When data is transmitted from one device to another, there is a chance that errors can occur in the data. This could be because
packets of data go missing, or because of interference during transmission. Therefore, several error detection methods can be

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.

Parity check      Checksum      Echo check

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

Parity bit Byte


1 0 1 1 0 1 1
0 1 1 1 0 0 0
r

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

IGCSE_CS_WB_Ch 2.indd 23 26/01/21 9:52 PM


Chapter 2

Exercise 2 Check digit

1 How is a check digit used to detect errors in data entry?

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

IGCSE_CS_WB_Ch 2.indd 24 26/01/21 9:52 PM


Chapter 2

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?

2 Name the encryption algorithm that is used to encrypt the data.

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.

Keys used Tick (✔)


Same key
Different key
d
ot r a

The paragraph below explains how asymmetric encryption is used to encrypt data.
N co sh

Fill in the missing words.

The text is encrypted into text using


r

a key. The encrypted data is transmitted to the receiving device.


al
U a

The text is decrypted using a key.


r
M

5 Which encryption method is more secure? Why?


©
n

Data transmission 25

IGCSE_CS_WB_Ch 2.indd 25 26/01/21 9:52 PM


Chapter 2

Revision checklist

Need to revisit Satisfactory Confident

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

numbers and bar codes


I can describe how an automatic repeat request (ARQ) can be used to
establish that data is received without error
I understand the need for and purpose of encryption when
r

al
transmitting data
U a

I understand how data is encrypted using symmetric and asymmetric


r

encryption
M
©
n

26 Data transmission

IGCSE_CS_WB_Ch 2.indd 26 26/01/21 9:52 PM


3
CHAPTER

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

• Understand what is meant by secondary storage


• Describe the operation of magnetic, optical and solid-state (flash memory) storage and give examples of each
N co sh

• 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

• Understand that there are different types IP address


• Describe the role of a router in a network
©

3.1  Computer architecture


n

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

IGCSE_CS_WB_Ch 3.indd 27 26/01/21 9:53 PM


Chapter 3

Exercise 1 Embedded systems

1 What is the main purpose of the CPU?

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

Exercise 2 Fetch-decode-execute cycle


r

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

2 What is the purpose of a register?

28 Hardware

IGCSE_CS_WB_Ch 3.indd 28 26/01/21 9:53 PM


Chapter 3

3 Tick (✔) to show which of the following components are an example of a register.

Component Tick (✔)


Program counter

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

7 What is the purpose of the control unit?


M
©
n

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

IGCSE_CS_WB_Ch 3.indd 29 26/01/21 9:53 PM


Chapter 3

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
©

12 What is an instruction set?


n

30 Hardware

IGCSE_CS_WB_Ch 3.indd 30 26/01/21 9:53 PM


Chapter 3

Exercise 3 Components within the CPU

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 A student has a computer with the following specification:

2 GHz processor
r

●●
al
U a

●● Dual core processor


r

●● 32 kB cache
M

Describe two ways the performance of the computer can be improved. Why would this improve the performance?
©
n

Hardware 31

IGCSE_CS_WB_Ch 3.indd 31 26/01/21 9:53 PM


Chapter 3

3.2  Input and output devices

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.

Device Input (✔) Output (✔)

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

IGCSE_CS_WB_Ch 3.indd 32 26/01/21 9:53 PM


Chapter 3

5 Complete the crossword by identifying each of the sensors.

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

4. Measures the force that is directly applied to the sensor or


a device by a solid, liquid or gas. 5. Measures the level of moisture in the atmosphere.

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.

7. Measures how close an object is to the sensor.

Hardware 33

IGCSE_CS_WB_Ch 3.indd 33 26/01/21 9:53 PM


Chapter 3

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

v 3.3  Data storage


r S te a
fo ec ll C
Exercise 1 Types of storage
d
Computers use different types of storage, including primary and secondary storage. Primary storage is directly accessed by the
ot r a

CPU and secondary storage is not directly accessed by the CPU.

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

Hard disk drive (HDD)


U a

Random access memory (RAM)


r
M

Solid state drive (SSD)

2 Which storage examples are directly connected to the CPU?


©
n

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

IGCSE_CS_WB_Ch 3.indd 34 26/01/21 9:53 PM


Chapter 3

4 Does RAM or ROM store the BIOS?

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.

Is this statement true or false?

ve
r S te a 7 It is easy to upgrade the amount of RAM in a computer by just installing more.

Is this statement true or false?


fo ec ll C
8 Why does a computer system need both RAM and ROM?
d
ot r a
N co sh r

al
U a
r
M
©
n

Hardware 35

IGCSE_CS_WB_Ch 3.indd 35 26/01/21 9:53 PM


Chapter 3

9 Storage can be magnetic, optical, or solid state.

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

10 How does solid state storage operate to store data?

ve
r S te a
fo ec ll C
d
ot r a
N co sh r

al

11 How is data written to and read from a CD?


U a
r
M
©
n

36 Hardware

IGCSE_CS_WB_Ch 3.indd 36 26/01/21 9:53 PM


Chapter 3

Exercise 2 Virtual memory

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

IGCSE_CS_WB_Ch 3.indd 37 26/01/21 9:53 PM


Chapter 3

Exercise 3 Cloud storage

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

3 List two drawbacks of storing data in a cloud storage system.

1
d
ot r a


N co sh

al

U a
r
M

3.4  Network hardware


A network is two or more devices that have been connected using a wired or wireless connection. A range of hardware is
©

required to create a network.


n

Exercise 1 Components

1 (a)
What is the name of the component in a computer that connects the computer to a network?

38 Hardware

IGCSE_CS_WB_Ch 3.indd 38 26/01/21 9:53 PM


Chapter 3

(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

(i)  What is the purpose of an IP address?


N co sh

al

(ii)  Can you give three features of an IP address?


U a
r

1 
M

2 
n

3 

Hardware 39

IGCSE_CS_WB_Ch 3.indd 39 26/01/21 9:53 PM


Chapter 3

Revision checklist

Need to revisit Satisfactory Confident

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

I can input and output devices


I understand what is meant by an input device and why it
is required
d
ot r a

I understand what is meant by an output device and why it is


required
N co sh

I understand what is meant by a sensor and the purposes of sensors


I can 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
r

al
U a

I understand what is meant by primary storage


r

I understand what is meant by secondary storage


M

I can describe the operation of magnetic, optical and solid-state (flash


memory) storage and give examples of each

I can describe what is meant by virtual memory, how it is created,


©

used and why it is necessary

I understand what is meant by cloud storage


n

I can explain the advantages and disadvantages of storing data on


the cloud in comparison to storing it locally

I understand that a computer needs a network interface card (NIC) to


access a network

I understand what is meant by and the purpose of a Media Access


Control (MAC) address, including its structure

40 Hardware

IGCSE_CS_WB_Ch 3.indd 40 26/01/21 9:53 PM


Chapter 3

I understand what is meant by and the purpose of an Internet


Protocol (IP) address

I understand that there are different types IP address


I can describe the role of a router in a network

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

IGCSE_CS_WB_Ch 3.indd 41 26/01/21 9:53 PM


4
CHAPTER

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

4.1  Types of software and interrupts


N co sh

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

Exercise 1 System software and application software


M

1 Define what is meant by software.


©
n

42 Software

IGCSE_CS_WB_Ch 4.indd 42 26/01/21 8:06 PM


Chapter 4

2 What is the difference between system software and application 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

Presentation software Anti-malware Disk repair software

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

IGCSE_CS_WB_Ch 4.indd 43 26/01/21 8:06 PM


Chapter 4

Example 3

Example application

fs h

oo is
(b)
Memory management is another function that is performed by an operating system.

What does the operating system do to manage the memory?

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

IGCSE_CS_WB_Ch 4.indd 44 26/01/21 8:06 PM


Chapter 4

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

6 What are two examples of a hardware interrupt?


r

al
Example 1
U a
r
M

Example 2
©

7 What are two examples of a software interrupt?


n

Example 1

Example 2

Software 45

IGCSE_CS_WB_Ch 4.indd 45 26/01/21 8:06 PM


Chapter 4

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

Exercise 1 High-level and low-level languages


N co sh

1 Describe a high-level programming language.


r

al
U a

2 Describe a low-level programming language.


r
M
©

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

IGCSE_CS_WB_Ch 4.indd 46 26/01/21 8:06 PM


Chapter 4

4 Here are three example of programs. Can you identify whether they are an example of High-level language, assembly
language or machine code?

Example program Type of language or code


INP

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

IGCSE_CS_WB_Ch 4.indd 47 26/01/21 8:06 PM


Chapter 4

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

10 When creating a program, would it be better to use an interpreter or a compiler? Why?


©
n

48 Software

IGCSE_CS_WB_Ch 4.indd 48 26/01/21 8:06 PM


Chapter 4

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.

11 List four functions that can be included in an IDE.

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

Need to revisit Satisfactory Confident


d
ot r a
N co sh

I can describe the difference between system software and


application software and provide examples of each
I understand how hardware, firmware and an operating system are
r

required to run applications software


al
U a

I can describe the role and operation of interrupts


r

I can explain what is meant by a high-level language and a low-level


M

language, including the advantages and disadvantages of each


I 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


I can describe the operation of a compiler and an interpreter,
including how high-level language is translated by each and how
n

errors are reported


I can explain the advantages and disadvantages of a compiler and an
interpreter
I can explain the role of an integrated development environment in
writing program code and the common functions IDEs provide

Software 49

IGCSE_CS_WB_Ch 4.indd 49 26/01/21 8:06 PM


5
The internet and
CHAPTER

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

5.1  The internet and the world wide web


N co sh

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

Exercise 1 Internet terminology

1 Try and explain what is meant by the world wide web.


©
n

2 Label the three different parts of this URL:

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

     

50 The internet and its uses

IGCSE_CS_WB_Ch 5.indd 50 27/01/21 9:56 AM


Chapter 5

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?

The internet and its uses 51

IGCSE_CS_WB_Ch 5.indd 51 27/01/21 9:56 AM


Chapter 5

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

52 The internet and its uses

IGCSE_CS_WB_Ch 5.indd 52 27/01/21 9:56 AM


Chapter 5

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

1 What is a digital ledger and how is it used?


d
ot r a
N co sh r

al
U a
r
M
©

2 What is the name of the digital ledger process used in tracking cryptocurrency?
n

5.3  Cyber security


There are several cyber security issues you may encounter when using the intern. You need to know how they operate and what
solutions can help protect you.

The internet and its uses 53

IGCSE_CS_WB_Ch 5.indd 53 27/01/21 9:56 AM


Chapter 5

Exercise 1 Cyber security threats

1 Complete the missing terms and definitions of cyber security threats.

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

A user is encouraged to click a link or an attachment that downloads a malicious


d
ot r a

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

54 The internet and its uses

IGCSE_CS_WB_Ch 5.indd 54 27/01/21 9:56 AM


Chapter 5

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.
©

Name three ways to protect against hacking.


n

The internet and its uses 55

IGCSE_CS_WB_Ch 5.indd 55 27/01/21 9:56 AM


Chapter 5

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.

SSL Stages Order


Encrypted communications then begin between the web browser and the web server

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.

Statement True (✔) False (✔)


Firewalls can be hardware or software based
d
ot r a

Firewalls only monitor incoming traffic to a computer


A blacklist of websites can be set for the firewall to monitor
N co sh

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 given paragraph describe the operation of the firewall.


U a
r

Can you fill in the gaps?


M

A firewall monitors and traffic from a


computer.
©

The user can set and for the traffic.


n

The firewall will any traffic that the

criteria. This can help prevent and


entering the computer.

The user can also set a of websites. These will be the only websites that can be
accessed from the computer.

56 The internet and its uses

IGCSE_CS_WB_Ch 5.indd 56 27/01/21 9:56 AM


Chapter 5

Revision checklist

Need to revisit Satisfactory Confident

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

The internet and its uses 57

IGCSE_CS_WB_Ch 5.indd 57 27/01/21 9:56 AM


6
CHAPTER
Automated and emerging
technologies

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

Exercise 1 Sensors, microprocessors, and actuators


r

al

1 Define what is meant by a sensor.


U a
r
M
©
n

2 Is actuator is an example of an input device or an output device? Tick (✔) the correct answer.

Input device

Output device

58 Automated and emerging technologies

IGCSE_CS_WB_Ch 6.indd 58 28/01/21 9:29 AM


Chapter 6

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

Automated and emerging technologies 59

IGCSE_CS_WB_Ch 6.indd 59 28/01/21 9:29 AM


Chapter 6

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

Automated system task Sensor


Checking the solid wax is heated to 55 degrees Celsius
Checking the liquid wax is sent at the correct speed along the pipe
Checking the level of the liquid wax in each glass container is 250ml
r

al
U a

b.
List two drawbacks to using an automated system for this task.
r

Drawback 1
M
©
n

Drawback 2

60 Automated and emerging technologies

IGCSE_CS_WB_Ch 6.indd 60 28/01/21 9:29 AM


Chapter 6

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

Automated and emerging technologies 61

IGCSE_CS_WB_Ch 6.indd 61 28/01/21 9:29 AM


Chapter 6

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?

62 Automated and emerging technologies

IGCSE_CS_WB_Ch 6.indd 62 28/01/21 9:29 AM


Chapter 6

fs h
oo is
e Pr nd
e
v
r S te a
fo ec ll C
d
ot r a
N co sh

6.3  Artificial intelligence


r

Artificial intelligence (AI) is a rapidly developing branch of computer science.


al
U a
r

Exercise 1 Artificial intelligence


M

1 Explain what is meant by artificial intelligence.


©
n

Automated and emerging technologies 63

IGCSE_CS_WB_Ch 6.indd 63 28/01/21 9:29 AM


Chapter 6

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

64 Automated and emerging technologies

IGCSE_CS_WB_Ch 6.indd 64 28/01/21 9:29 AM


Chapter 6

b. Choose two of these parts and describe their roles.

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

I can describe how sensors, microprocessors and actuators can be


d
used in collaboration to create automated systems
ot r a

I can describe the advantages and disadvantages of an automated


system used for a given scenario
N co sh

I can understand what is meant by robotics


I can describe the characteristics of a robot
I understand the roles that robots can perform and describe the
r

al
advantages and disadvantages of their use
U a

I understand what is meant by artificial intelligence (AI)


r

I can describe the main characteristics of AI as the collection of


M

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
©

simulate intelligent behaviour


n

Automated and emerging technologies 65

IGCSE_CS_WB_Ch 6.indd 65 28/01/21 9:29 AM


Algorithm design and
7
CHAPTER

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

7.1  Algorithm design and problem solving


N co sh

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

equation, or the perform an experiment successfully.


r

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.
©

Exercise 1 The program development cycle


n

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?

66 Algorithm design and problem solving

IGCSE_CS_WB_Ch 7.indd 66 28/01/21 9:31 AM


Chapter 7

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

Player Navigation Update timer Update score


r

al
U a

Timer
Up Reset timer Reset score
r
M
©
n

Fruit

Algorithm design and problem solving 67

IGCSE_CS_WB_Ch 7.indd 67 28/01/21 9:31 AM


Chapter 7

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.

Draw a structured diagram for the security system

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

68 Algorithm design and problem solving

IGCSE_CS_WB_Ch 7.indd 68 28/01/21 9:31 AM


Chapter 7

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.

Draw a structured diagram for the vending machine system.

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

Algorithm design and problem solving 69

IGCSE_CS_WB_Ch 7.indd 69 28/01/21 9:31 AM


Chapter 7

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.

Exercise 3 Algorithm flowcharts

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

70 Algorithm design and problem solving

IGCSE_CS_WB_Ch 7.indd 70 28/01/21 9:31 AM


Chapter 7

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

Algorithm design and problem solving 71

IGCSE_CS_WB_Ch 7.indd 71 28/01/21 9:31 AM


Chapter 7

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.

Draw a flowchart to represent an algorithm for the parcel computer program.

ve
r S te a
fo ec ll C
d
ot r a
N co sh r

al
U a
r
M
©
n

72 Algorithm design and problem solving

IGCSE_CS_WB_Ch 7.indd 72 28/01/21 9:31 AM


Chapter 7

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.

Algorithm design and problem solving 73

IGCSE_CS_WB_Ch 7.indd 73 28/01/21 9:31 AM


Chapter 7

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.

Complete the pseudocode to represent the algorithm

e Pr nd
REPEAT

INPUT

e
INPUT num2

v
answer
r S te a
IF answer > 100

THEN
fo ec ll C
ENDIF

OUTPUT “Do you have any more numbers to enter?”


d
INPUT moreNumbers
ot r a

IF
N co sh

THEN

flag TRUE
r

ELSE
al
U a

flag
r
M

ENDIF

UNTIL flag = FALSE


©

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.

Write an algorithm in pseudocode to represent the computer program.

74 Algorithm design and problem solving

IGCSE_CS_WB_Ch 7.indd 74 28/01/21 9:31 AM


Chapter 7

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

Algorithm design and problem solving 75

IGCSE_CS_WB_Ch 7.indd 75 28/01/21 9:31 AM


Chapter 7

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
●●

●● A medium parcel weighs between 1kg and 2.5 kgs

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

76 Algorithm design and problem solving

IGCSE_CS_WB_Ch 7.indd 76 28/01/21 9:31 AM


Chapter 7

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

You will complete a range of programming activities in chapter 8 of this workbook.

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.

Algorithm design and problem solving 77

IGCSE_CS_WB_Ch 7.indd 77 28/01/21 9:31 AM


Chapter 7

Exercise 5 Testing

1 What is the difference between a syntax error and a logic error?

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.

78 Algorithm design and problem solving

IGCSE_CS_WB_Ch 7.indd 78 28/01/21 9:31 AM


Chapter 7

3 Consider the following algorithm represented as a flowchart:

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
©

avg = total / count


n

OUTPUT
“Average age is “ avg

Stop

Algorithm design and problem solving 79

IGCSE_CS_WB_Ch 7.indd 79 28/01/21 9:31 AM


Chapter 7

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

count total studentAge avg OUPUT

ve
r S te a
fo ec ll C
d
ot r a
N co sh r

al
U a
r
M
©
n

80 Algorithm design and problem solving

IGCSE_CS_WB_Ch 7.indd 80 28/01/21 9:31 AM


Chapter 7

4 Consider the following algorithm represented as pseudocode:

guessCorrect FALSE

INPUT player1Num

fs h
WHILE guessCorrect <> TRUE

oo is
INPUT player2Guess

e Pr nd
IF player1Num = player2Guess

THEN

OUTPUT “Your guess is correct”

e
guessCorrect TRUE

v
r S te a ELSE

IF player1Num > player2Guess


fo ec ll C
THEN

OUTPUT “Too high”

ELSE
d
ot r a

OUTPUT “Too low”


N co sh

ENDIF

ENDIF
r

al
ENDWHILE
U a

a.
r

Can you describe the purpose of the algorithm?


M
©
n

Algorithm design and problem solving 81

IGCSE_CS_WB_Ch 7.indd 81 28/01/21 9:31 AM


Chapter 7

b.
Complete the trace table for the algorithm.

Player 1 enters a number of 55.

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.

82 Algorithm design and problem solving

IGCSE_CS_WB_Ch 7.indd 82 28/01/21 9:31 AM


Chapter 7

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

Algorithm design and problem solving 83

IGCSE_CS_WB_Ch 7.indd 83 28/01/21 9:31 AM


Chapter 7

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:

1, 13, 25, 14, 18, 36, 21

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.

84 Algorithm design and problem solving

IGCSE_CS_WB_Ch 7.indd 84 28/01/21 9:31 AM


Chapter 7

Exercise 8 Identifying errors

1 Consider the algorithm:

fs h
count 0

oo is
WHILE count <=3

OUTPUT “Please enter a colour.”

e Pr nd
INPUT colour

IF colour = “Red” OR colour = “Blue” AND colour =

e
“Purple”

v
r S te a THEN

OUTPUT “That is one of my favourite colours.”


fo ec ll C
ELSE

INPUT “That is not one of my favourite colours, try again.”

ENDIF
d
ot r a

ENDWHILE
N co sh

count count + 1

The algorithm should:

• allow a user to input a colour


r

al

• check whether the colour is a favourite colour


U a

• outputs messages to say whether it is a favourite colour or to try again if not


r

• loop until the user has had three guesses.


M

The algorithm contains errors, can you identify these errors? When you have, rewrite the algorithm with the errors corrected.
©
n

Algorithm design and problem solving 85

IGCSE_CS_WB_Ch 7.indd 85 28/01/21 9:31 AM


Chapter 7

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

86 Algorithm design and problem solving

IGCSE_CS_WB_Ch 7.indd 86 28/01/21 9:31 AM


Chapter 7

2 Consider the algorithm:


flag FALSE

lowestScore 100

fs h
highestScore 0

oo is
totalScore 0

count 10

e Pr nd
WHILE flag = TRUE

OUTPUT “Please input the score.”

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

OUTPUT “Do you have any more scores to input, Y or N?”


r

al
INPUT answer
U a

IF answer = “N”
r
M

THEN

flag FALSE
©

ENDIF
n

ENDIF

count count + 1

ENDWHILE

totalScore totalScore + score

averageScore totalScore/count

OUTPUT lowestScore, highestScore, totalScore

Algorithm design and problem solving 87

IGCSE_CS_WB_Ch 7.indd 87 28/01/21 9:31 AM


Chapter 7

The algorithm should:


• allow the user to input a score
• checks whether the score input is the lowest score input. If it is, it records the new lowest score
• checks whether the score input is the highest score input. If it is, it records the new highest score

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

88 Algorithm design and problem solving

IGCSE_CS_WB_Ch 7.indd 88 28/01/21 9:31 AM


Chapter 7

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

Algorithm design and problem solving 89

IGCSE_CS_WB_Ch 7.indd 89 28/01/21 9:31 AM


Chapter 7

Revision checklist

Need to revisit Satisfactory Confident

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

I can identify errors in given algorithms and suggest ways of


correcting these errors
N co sh

I can write and amend algorithms for given problems or scenarios,


using: pseudocode, program code and flowcharts
r

al
U a
r
M
©
n

90 Algorithm design and problem solving

IGCSE_CS_WB_Ch 7.indd 90 28/01/21 9:31 AM


8
CHAPTER

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

• Understand and use library routines


• Understand how to create a maintainable Program
N co sh

• Declare and use one-dimensional (1D) and two-dimensional (2D) arrays


• Understand the use of arrays
• Write values into and read values from an array using iteration
• Understand the purpose of storing data in a file to be used by a program
r

al
• Open, close and use a file for reading and writing
U a
r
M

8.1  Programming concepts


©

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

IGCSE_CS_WB_Ch 8.indd 91 27/01/21 9:20 AM


Chapter 8

Exercise 1 Variables and constants

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

OUTPUT “Hello”, firstName


d
Can you identify which line or lines in the code use a variable?
ot r a
N co sh

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

Exercise 2 Data types


r
M

1 Can you draw a line to match the data type to its correct description?

Data type Description


©

String It is any character such as letters, numbers and symbols


n

Integer It is a single character

Real It is a whole number

Char It is a true or false value

Boolean It is a decimal number

92 Programming

IGCSE_CS_WB_Ch 8.indd 92 27/01/21 9:20 AM


Chapter 8

2 Consider the statement:

sport “Tennis”

What type of data will be stored?

fs h
oo is
3 Consider the statement:

e Pr nd
loop TRUE

What type of data will be stored?

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

5 Consider the statement:

price int(10.53)
N co sh

What do you think this statement will do?


r

al
U a

6 Consider the statements:


r
M

value 12345

valueOutput str(value)
©

What do you think these statements will do?


n

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

IGCSE_CS_WB_Ch 8.indd 93 27/01/21 9:20 AM


Chapter 8

Exercise 3 Data input and output

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

3 Write a program that will output the value 100.


N co sh r

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

Hello x your favourite colour is y.

The users name must replace the x and the users favourite colour must replace the y.

94 Programming

IGCSE_CS_WB_Ch 8.indd 94 27/01/21 9:20 AM


Chapter 8

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

2 What does the library routine ROUND do?


r

al
U a
r
M

3 What does the library routine RANDOM do?


©
n

4 Consider the two given programs:

num1 10 FOR x 1 TO 5

num2 20 y y + 1

x num1+num2 NEXT x

Programming 95

IGCSE_CS_WB_Ch 8.indd 95 27/01/21 9:20 AM


Chapter 8

Which of these programs is a method of totalling and which is a method of counting?

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

The order in which statements need to be placed in a


program to achieve a desired outcome.
d
ot r a

This determines which sections of code are run, based on


a condition.
N co sh

2 Consider the program:

num1 = INPUT “Please enter the first number”


r

al
U a

num2 = INPUT “Please enter the second number”


r

OUTPUT “The total is”, total


M

total num1 + num2


©

What is wrong with the sequence of this program?


n

96 Programming

IGCSE_CS_WB_Ch 8.indd 96 27/01/21 9:20 AM


Chapter 8

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

5 Consider the program:

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

IGCSE_CS_WB_Ch 8.indd 97 27/01/21 9:20 AM


Chapter 8

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:
©

• A score of <50 is given a Bronze award


¡¡ A score between 50 and 75 (inclusive) is given a Silver award
n

¡¡ A score of >75 is given a gold award

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

IGCSE_CS_WB_Ch 8.indd 98 27/01/21 9:20 AM


Chapter 8

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

7 Boolean operators can be used in selection, such as AND OR and NOT.


M

Write a program that:

• Allows a user to input their favourite food


©

• Outputs the message “That is the best food!” if the user inputs pizza, noodles or seafood
n

You must use an IF statement and a Boolean operator in your program.

Programming 99

IGCSE_CS_WB_Ch 8.indd 99 27/01/21 9:20 AM


Chapter 8

8 Write a program that:

• Allows a user to input their English test score


• Allows a user to input their Mathematics test score
• Outputs the message “Well done! You have passed both tests.” if both test scores are 75 or greater

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

IGCSE_CS_WB_Ch 8.indd 100 27/01/21 9:20 AM


Chapter 8

9 Write a program that:

• Allows player 1 to input a colour


• Allows player 2 to guess the colour input by player 1
• Checks whether the colour input by player 2 is the same as the one input by player 1

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

IGCSE_CS_WB_Ch 8.indd 101 27/01/21 9:20 AM


Chapter 8

Exercise 6 Subroutines

1 What is the difference between a procedure and a function?

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

IGCSE_CS_WB_Ch 8.indd 102 27/01/21 9:20 AM


Chapter 8

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

IGCSE_CS_WB_Ch 8.indd 103 27/01/21 9:20 AM


Chapter 8

Exercise 7 Extracting and manipulating strings

1 Consider the statement:

fs h
LENGTH(“Computer”)

oo is
What will this statement return?

e Pr nd
2 Consider the statement:

e
SUBSTRING(“Computer”, 1, 2)

What will this statement return?

v
r S te a
fo ec ll C
3 Consider the statement:

SUBSTRING(“Computer”, 2, 3)

What will this statement return?


d
ot r a
N co sh

4 Consider the statement:

UPPER(“Computer”)
r

al
What will this statement return?
U a
r
M

5 Consider the statement:


©

LOWER(“Computer”)
n

What will this statement return?

6 Write a program that:

• Allows the user to input a string


• Returns and outputs the length of the string
• Returns and outputs the first three characters of the string

104 Programming

IGCSE_CS_WB_Ch 8.indd 104 27/01/21 9:20 AM


Chapter 8

• Returns and outputs the string in uppercase


• Returns and outputs the string in lowercase

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

• returns the username


N co sh r

al
U a
r
M
©
n

Programming 105

IGCSE_CS_WB_Ch 8.indd 105 27/01/21 9:20 AM


Chapter 8

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

IGCSE_CS_WB_Ch 8.indd 106 27/01/21 9:20 AM


Chapter 8

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:

DECLARE sport : ARRAY [0:10] OF STRING

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

2 a. Consider the statement:

sport[1] “Football”
©

What does this statement do?


n

b.
Consider the statement:

sport1 sport[3]

Programming 107

IGCSE_CS_WB_Ch 8.indd 107 27/01/21 9:20 AM


Chapter 8

What does this statement do?

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:

DECLARE sport : ARRAY [“Tennis”,”Golf”,”Football”,”Hockey”] OF STRING


d
ot r a

OUTPUT sport[3]


N co sh

What does this program do?


r

al
U a
r
M

4 Write a program that:


• Allows a user to input 10 student first names
• Each student first name must be stored in the same array
©

When all student names are input, it must output the first and last student first name in the array.
n

108 Programming

IGCSE_CS_WB_Ch 8.indd 108 27/01/21 9:20 AM


Chapter 8

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

What is the data stored in scores[0,1]?


b.
r

al
U a
r

What is the data stored in scores[2,0]?


c.
M
©

d. Consider the statement:


n

scores [1,2] 34

What would this statement do?

Programming 109

IGCSE_CS_WB_Ch 8.indd 109 27/01/21 9:20 AM


Chapter 8

2 A computer games competition allows each player three attempts at achieving the highest score that they are able.

The manager running the competition wants a program that:

• Allows the scores of 10 players to be input and stored

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.

Write a program for the manager that meets the requirements.

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

IGCSE_CS_WB_Ch 8.indd 110 27/01/21 9:20 AM


Chapter 8

8.3  File handling


The final programming skill that you need to be able to use is file handling. This involves the storing and accessing of data that is
stored in a file. You need to be able to open a file, write data to a file, read data from a file and close a file.

fs h
oo is
Exercise 1 File handling methods

e Pr nd
1 a. Consider the statement:

OPENFILE names.txt FOR READ

What will this statement do?

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

2 a. Consider the statement:


N co sh

OPENFILE scores.txt FOR WRITE

What will this statement do?


r

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

3 a. Consider the program:

OPENFILE scores.txt FOR WRITE

WRITEFILE scores.txt, 50

CLOSEFILE scores.txt

Programming 111

IGCSE_CS_WB_Ch 8.indd 111 27/01/21 9:20 AM


Chapter 8

What will this program do?

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

4 Write a program that:


M

• Allows a user to input 10 colours


• Writes each colour input to a separate line in a file
©

Once all colours have been input and stored, it reads and outputs each colour stored in the file
n

112 Programming

IGCSE_CS_WB_Ch 8.indd 112 27/01/21 9:20 AM


Chapter 8

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

IGCSE_CS_WB_Ch 8.indd 113 27/01/21 9:20 AM


Chapter 8

Revision checklist

Need to revisit Satisfactory Confident

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 understand and use library routines


I understand how to create a maintainable Program
N co sh

I can declare and use one-dimensional (1D) and two-dimensional


(2D) arrays
I understand the use of arrays
r

I can write values into and read values from an array using iteration
al
U a

I understand the purpose of storing data in a file to be used by a


program
r
M

I can open, close and use a file for reading and writing
©
n

114 Programming

IGCSE_CS_WB_Ch 8.indd 114 27/01/21 9:20 AM


9
CHAPTER

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.

Title FirstName LastName MemberID Age EmailAddress TelephoneNumber FeePaid


r

Mr George Chang Mem001 25 gchang@mail.com +6562395537 Yes


al
U a

Mrs Sally Khan Mem002 18 skhan@mail.com +6523992854 No


Mrs Valerie Ong Mem003 16 vong@mail.com +6565436543 No
r
M

Mr Javier Tan Mem004 38 jtan@mail.com +6578667866 Yes


Miss Jasmine Lee Mem005 42 jlee@mail.com +6570107710 No
Mr George Ng Mem006 15 gng@mail.com +6554980022 Yes
©

1 Circle a field in the database.


n

2 Circle a record in the database.

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.

3 Which data type would be most suitable for the FirstName?

Databases 115

IGCSE_CS_WB_Ch 9.indd 115 26/01/21 8:22 PM


Chapter 9

4 Which data type would be most suitable for the MemberID?

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

The database normally has a primary key.

9 Which field in the database is the most suitable as the primary key? Why?
r

al
U a
r
M
©

Exercise 2 Database queries


n

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.

The given database is called Members.

116 Databases

IGCSE_CS_WB_Ch 9.indd 116 26/01/21 8:22 PM


Chapter 9

1 List the data that would be output by this SQL statement:

SELECT FirstName FROM Members

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

3 Write the data that would be output by the SQL statement:

SELECT Title, FirstName, LastName FROM Members


r

al
U a
r
M
©
n

4 List the data that be output by this SQL statement:

SELECT MemberID, FeePaid FROM Members

Databases 117

IGCSE_CS_WB_Ch 9.indd 117 26/01/21 8:22 PM


Chapter 9

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

8 Write the data that would be output by the SQL statement:

SELECT MemberID FROM Members WHERE Age = 42


r

al
U a
r
M
©
n

9 Write the data that would be output by the SQL statement:

SELECT FirstName FROM Members WHERE Age >18

118 Databases

IGCSE_CS_WB_Ch 9.indd 118 26/01/21 8:22 PM


Chapter 9

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

and has not paid their fee.

SELECT , FROM Members


r

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.

14 Write the data that would be output by the SQL statement:

SELECT FirstName FROM Members ORDER BY FirstName ASC

Databases 119

IGCSE_CS_WB_Ch 9.indd 119 26/01/21 8:22 PM


Chapter 9

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

fee, in alphabetical order of the membership ID.

SELECT Title, , FROM


©

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

IGCSE_CS_WB_Ch 9.indd 120 26/01/21 8:22 PM


Chapter 9

19 List the data that would be output by this SQL statement:

SELECT SUM (Age) FROM Members

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:

SELECT COUNT (MemberID) FROM members


fo ec ll C

22 List the data that would be output by this SQL statement:


d
ot r a

SELECT COUNT(FirstName) FROM Members WHERE FeePaid = “No”


N co sh r

al
23 Write an SQL statement that would count how many members are 18 or older.
U a
r
M
©
n

Databases 121

IGCSE_CS_WB_Ch 9.indd 121 26/01/21 8:22 PM


Chapter 9

Revision checklist

Need to revisit Satisfactory Confident

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

IGCSE_CS_WB_Ch 9.indd 122 26/01/21 8:22 PM


10
CHAPTER

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

Exercise 1 Logic gate symbols

1 What is the purpose of a logic gate in a computer system?


r

al
U a
r
M
©

2 Why do computer systems need logic gates?


n

Boolean logic 123

IGCSE_CS_WB_Ch 10.indd 123 28/01/21 11:35 AM


Chapter 10

3 Complete the table by drawing the missing logic gates symbol or completing the missing truth table.

Name of logic gate Logic gate symbol Truth table


NOT Input Output

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

XOR Input 1 Input 2 Output


0 0
©

0 1
1 0
n

1 1

4 Consider the description:

This logic gate reverses the input that it is given.

Write the correct logic gate for this description.

124 Boolean logic

IGCSE_CS_WB_Ch 10.indd 124 28/01/21 11:35 AM


Chapter 10

5 Consider the description:

The only time the output is 0 is when both inputs are 0.

Write the correct logic gate for this description.

fs h
oo is
6 Consider the description:

e Pr nd
The only time the output is 1 is when both inputs are 1.

Write the correct logic gate for this description.

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

Single logic gate:


al
U a
r
M
©
n

Boolean logic 125

IGCSE_CS_WB_Ch 10.indd 125 28/01/21 11:35 AM


Chapter 10

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.

126 Boolean logic

IGCSE_CS_WB_Ch 10.indd 126 28/01/21 11:35 AM


Chapter 10

Exercise 2 Logic circuits

1 Consider the logic expression:

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

Boolean logic 127

IGCSE_CS_WB_Ch 10.indd 127 28/01/21 11:35 AM


Chapter 10

2 Consider the logic expression:

X = (NOTA AND B) NOR C)

Draw a logic circuit to represent this logic expression.

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

3 Consider the logic expression:


N co sh

Z = (S OR T) AND NOT T) XOR (P NAND S)

a.
Draw a logic circuit to represent this logic expression.
r

al
U a
r
M

P
©
n

S Z

128 Boolean logic

IGCSE_CS_WB_Ch 10.indd 128 28/01/21 11:35 AM


Chapter 10

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

push their buzzer button.

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

Boolean logic 129

IGCSE_CS_WB_Ch 10.indd 129 28/01/21 11:35 AM


Chapter 10

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

2 Consider the problem statement:


U a

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:

Measurement Binary value Conditions


©

1 Temperature > 35 degrees Celsius


Temperature (H)
n

0 Temperature <= 35 degrees Celsius

1 Thickness is >= 80%


Thickness (T)
0 Thickness < 80%

1 Flow speed <= 0.5 cubic metres per second


Flow speed (F)
0 Flow speed is > 0.5 cubic metres per second

130 Boolean logic

IGCSE_CS_WB_Ch 10.indd 130 28/01/21 11:35 AM


Chapter 10

An alarm (X) will sound when:

Temperature <= 35 degrees Celsius and Thickness is >= 80%

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.

Boolean logic 131

IGCSE_CS_WB_Ch 10.indd 131 28/01/21 11:35 AM


Chapter 10

Exercise 4 Logic expressions

1 Consider the 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

Write a logic expression to represent this logic circuit.


r
M
©

3 Consider the logic circuit:


n

R
X

132 Boolean logic

IGCSE_CS_WB_Ch 10.indd 132 28/01/21 11:35 AM


Chapter 10

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.

Exercise 5 Truth tables


d
ot r a

1 Consider this truth table where X is the output:


N co sh

A B X
0 0 0
0 1 0
r

1 0 1
al
U a

1 1 0
r

Write a logic expression to represent this truth table.


©
n

2 Consider this truth table where X is the output:

A B X
0 0 0
0 1 0
1 0 1
1 1 1

Boolean logic 133

IGCSE_CS_WB_Ch 10.indd 133 28/01/21 11:35 AM


Chapter 10

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

3 Consider this truth table where Z is the output:

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

Write a logic expression to represent this truth table.

134 Boolean logic

IGCSE_CS_WB_Ch 10.indd 134 28/01/21 11:35 AM


Chapter 10

Revision checklist

Need to revisit Satisfactory Confident

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

Boolean logic 135

IGCSE_CS_WB_Ch 10.indd 135 28/01/21 11:35 AM


Revision notes

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

IGCSE_CS_WB_Ch 10.indd 136 28/01/21 11:35 AM


©
M

IGCSE_CS_WB_Ch 10.indd 137


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 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

assess their level of understanding of concepts.

Series architecture
r

This resource is endorsed by

WORKBOOK
al
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

You might also like