You are on page 1of 28

Please check the examination details below before entering your candidate information

Candidate surname Other names

Centre Number Candidate Number


Pearson Edexcel
International GCSE (9–1)

Time 2 hours
Paper
reference 4CP0/01
Computer Science
PAPER 1: Principles of Computer Science

You must have: Total Marks


Pseudocode command set (enclosed)

Instructions
• Use black ink or ball-point pen.
• Fill in the boxes at the top of this page with your name,
centre number and candidate number.
• Answer all questions.
• Answer the questions in the spaces provided
– there may be more space than you need.

Information
• The total mark for this paper is 80.
• – usemarks
The for each question are shown in brackets
this as a guide as to how much time to spend on each question.
• You are not allowed to use a calculator.
Advice
• Read each question carefully before you start to answer it.
• Try to answer every question.
• Check your answers if you have time at the end.
• Marks will not be awarded for using product or trade names in answers without
giving further explanation.
• Good luck with your examination.
Turn over

*P66489A0120*
P66489A
©2021 Pearson Education Ltd.

1/1/1/1/
Answer ALL questions. Write your answers in the spaces provided.

Some questions must be answered with a cross in a box . If you change your mind about an
answer, put a line through the box and then mark your new answer with a cross .

1 Binary digits (bits) are grouped together to represent different types of data.

(a) Hexadecimal notation is sometimes used to represent patterns of binary digits.

Identify one reason why programmers use hexadecimal notation.


(1)
A Easier for a computer to understand.

B Easier for humans to read.

C Takes up less computer memory.

D Quicker than binary to execute.

(b) Convert the bit pattern 0101 1010 to hexadecimal.


(2)

0101 = 5
1010 = 10 = A

Answer = 5A

(c) Identify the number of binary patterns that can be represented by 8 bits.
(1)
A 128

B 256

C 512

D 1024

2
*P66489A0220*
(d) Complete the table by adding these two 8-bit binary integers.
(2)

0 0 1 1 0 0 1 0

0 0 1 1 0 0 1 1

(e) Give the result of performing a logical left shift of 1 place on the binary integer 0100.
(1)
1000
............................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(f ) Give the number of bits per character used by standard ASCII.


(1)
7
............................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(g) Figure 1 shows a black and white bitmap image.


The pixels in row 5 are represented by the binary pattern 1001 1001

1
2
3
4
5
6
7
8
9

Figure 1

(i) State what is meant by the term pixel.


(1)
A pixel is the smallest unit of digital images. They tend to be a single color, and join up to make a larger
............................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
picture.

(ii) Construct an expression to show the number of pixels in the image.


(1)

8 x 9 = 72

3
*P66489A0320* Turn over
(iii) The image is changed so that any pixel can be one of 16 different colours.
State the minimum number of bits that would be needed to represent
one pixel.
(1)
4
................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(Total for Question 1 = 11 marks)

4
*P66489A0420*
2 Many organisations use networks.
(a) One reason for networking computers is to share access to the internet.
Give one other reason for connecting computers in a local area network.
(1)
Easier to share resources between computers.
............................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ........................................................................................................................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

............................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ........................................................................................................................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(b) State the purpose of network protocols.


(1)
It makes sure the data is sent to the correct recipients and cannot be accessed by
unauthorized beings.
............................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ........................................................................................................................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

............................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ........................................................................................................................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(c) Data is transmitted in packets.


(i) Identify the layer of the TCP/IP model that would add the File Transfer Protocol (FTP).
(1)
A Application

B Data

C Network

D Transport

(ii) Give one task carried out by the network layer.


(1)
Fragmentation
............................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ........................................................................................................................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

............................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ........................................................................................................................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(d) Complete the table by adding a tick () to match each item to its name.
(3)

Domain IP
Item URL
Name Address

https://www.pearson.com

216.33.251.195

pearson.com

5
*P66489A0520* Turn over
(e) Figure 2 shows a network topology.

Figure 2

(i) State the name of this network topology.


(1)
Bus topology
................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(ii) State one benefit of using this network topology.


(1)
If a component stops functioning, it does not affect the rest of the network.
................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(iii) State one drawback of using this network topology.


(1)
If main cable is damaged, whole network will shut down.
................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(f ) Files may be compressed using lossless or lossy algorithms.


(i) Music files are distributed over the internet.
Give two reasons why lossy compression is used when distributing music files
over the internet.
(2)
Reduces the file size.
1.............................. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

................................. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ........................... ................................................................................................................. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Increases the transfer speed.


2.............................. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

................................. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ........................... ................................................................................................................. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

6
*P66489A0620*
(ii) Identify which one of these file formats uses lossy compression.
(1)
A BMP

B DOC

C JPEG

D PNG

(iii) Here is a string of data.


CCCWWWCCWWWWWWCCC
Give the result of compressing the string using a run-length encoding algorithm.
(1)
C3W3C2W6C3
............................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

............................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(g) A video file is to be transmitted over the internet.


• The network transmission speed is 54 Mbps.
• The file size is 6 gigabytes (GB).
Construct an expression to show how the transmission time, in seconds, is calculated.
You do not have to do the calculation.
(4)

6 GB 6 x 1000 x 1000 x1000 x 8

54 MBPS 54 x 1000 x 1000

(Total for Question 2 = 18 marks)

7
*P66489A0720* Turn over
3 Zakir wants to buy a new laptop.
(a) He knows that a laptop has both hardware and software.
Explain why the laptop needs both hardware and software.
(2)
A laptop requires both hardware and software to function properly. Hardware consists of
................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
physical components like the CPU and memory, while software, including the operating
system and applications, provides instructions for tasks. Without both, the laptop won't work.
................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(b) Zakir needs to choose between a solid state drive and a hard disc drive.
(i) Give two reasons, other than cost and capacity, why Zakir may choose a
solid state drive rather than a hard disc drive.
(2)
Faster Speed: Solid state drives (SSDs) offer quicker read and write speeds compared to hard disk
1..............................
drives (HDDs), . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
resulting in faster overall system performance.

................................. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ........................... ................................................................................................................. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


Durability: SSDs have no moving parts, making them more resistant to physical shocks and
vibrations
2.............................. compared to HDDs, which have spinning disks and delicate mechanical components.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

................................. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ........................... ................................................................................................................. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(ii) Solid state drives store data on flash memory, which is similar to RAM.
Explain one difference between flash memory and RAM.
(2)
RAM is volatile, loses data on power-off. Flash memory is non-volatile, retains data without power.
................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(c) One of the laptops has 4 megabytes (MB) of cache memory.


Explain the purpose of cache memory.
(2)
Cache memory, such as 4MB in this laptop, is used to store frequently
................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
accessed data for the CPU, reducing retrieval time and improving overall
system performance.
................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

8
*P66489A0820*
(d) Zakir uses many devices.
Complete the table by adding one tick () in each row to show whether the
device is an input device, an output device or both.
(2)

Device Input Output Both

Headset

Mouse

Printer

Touch screen

(e) Zakir needs to protect his laptop against malware.


Give two types of anti-malware software he could install.
(2)
Anti Virus
1............................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ........................................................................................................................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2............................
Anti SPyware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ........................................................................................................................................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(Total for Question 3 = 12 marks)

9
*P66489A0920* Turn over
4 Scientists often use models and simulations.
(a) Give one reason, other than cost, why scientists use simulations.
(1)
Project may be too large to be carried out in real life.
................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(b) Explain one reason why a simulation may require a powerful processor.
(2)
A powerful processor is required for simulations because it can rapidly perform complex
calculations,
................................ . . . . . . . . . . .ensuring
. . . . . . . . . . . . . . . . . . . . . . . quick
. . . . . . . . . . . . . . . and
. . . . . . . . . . . efficient modeling of dynamic systems.
. . . . . . . . ............................................................................................................................................ ....................................

................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(c) A scientist uses Boolean logic in programs.


Complete the table to show the results of each operation.
(3)

R S W NOT S R AND W (NOT S) OR (R AND W)

0 0 0

0 0 1

0 1 0

0 1 1

1 0 0

1 0 1

1 1 0

1 1 1

10
*P66489A01020*
(d) Von Neumann developed the stored program concept.
(i) Describe the stored program concept.
(2)
The stored program concept by Von Neumann means storing
both instructions and data in a computer's memory, treating
............................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

them similarly.
............................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

............................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

............................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(ii) The fetch-decode-execute cycle is the cycle the central processing unit (CPU)
follows in order to process instructions.
Name two registers used in the cycle.
(2)
Memory Address Register
1............................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Memory Buffer register
2............................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(iii) Describe the role of the address bus and the data bus during the fetch part of
the cycle.
(2)
address bus will hold the address that is being accessed in
main memory the data bus will either transfer the data
...............................
contained . . . . . . . in
. . . . . . the
. . . . . . . . . .memory
. . . . . . . . . . . . . . . . . . . . . .address
. . . . . . . . . . . . . . . . . . . . . .to
. . ............................................................................................................................................
the processor, or will ....................................

transfer data from the processor to the memory address


............................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

............................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

............................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(iv) Complete the table to show the effect on a computer system of increasing the
width of a bus.
(2)

Change made Effect

Increasing the width of the AMount of data that can be transferred increases
data bus

Increasing the width of the


address bus Computer can use more memory.

(Total for Question 4 = 14 marks)

11
*P66489A01120* Turn over
5 Isaac is a program developer.
(a) Figure 3 shows an algorithm Isaac has written.

Start

Numbers[0] = 10
Numbers[1] = 6
Numbers[2] = 1
Numbers[3] = 9
Numbers[4] = 3

Count = 0

Length = 4

Midpoint = 2

Temp = 0

No
Stop Count < Midpoint?

Yes
Temp = Numbers[Count]

Numbers[Count] = Numbers[Length − Count]

Numbers[Length − Count] = Temp

Count = Count + 1

Figure 3

12
*P66489A01220*
(i) Complete the trace table. You may not need to use all of the rows.
(5)

Numbers array

Count Length Midpoint Temp [0] [1] [2] [3] [4]

0 4 2 0 10 6 1 9 3

1 10 4 10

2 6 6
3

(ii) Give the purpose of the algorithm.


(1)
Reverse contents of an array
............................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

............................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(iii) Explain why the variable Temp is needed.


(2)
Without temp, one of the values may be lost.
............................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

............................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

............................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

............................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

13
*P66489A01320* Turn over
(b) Figure 4 shows an algorithm Isaac has written using pseudocode.
The algorithm should display the average of the numbers that have been input.

1 SET total TO 0
2 SET number TO 0
3 SET count TO 0
4 WHILE number <> −1 DO
5   SEND 'Input a number or −1 to end the program' TO DISPLAY
6    RECEIVE number FROM (INTEGER) KEYBOARD
7    SET total TO total + number
8    SET count TO count + 1
9 END WHILE
10 SET average TO total / count
11 SEND 'The average is ' & average TO DISPLAY

Figure 4

Isaac uses the input 2, 3, 5, 2, −1 to test the algorithm. He discovers an error.

Expected result Actual result

The average is 2.75 The average is 2.2

(i) Explain why the Actual result is not the same as the Expected result.
(2)
The program enters a loop that continues until the user enters -1.
................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Inside the loop, the code increments the count and updates the total with the entered number.
The loop does not check if the entered number is -1 before updating the total and count.
................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(ii) Give the number of the line that contains the error.
(1)
7
................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(iii) Amend a single line of pseudocode to correct the error.


(1)
IF number <> -1 THEN
................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

14
*P66489A01420*
(c) Isaac is going to sell one of his programs and distribute it on a DVD.
Give two advantages of choosing a programming language that uses a compiler,
rather than an interpreter, for a program that will be distributed on a DVD.
(2)

1............................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Performance: Compiled languages usually run faster, optimizing the program's speed on the DVD.
............................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ........................... ................................................................................................................. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2............................
Executable . . . . . . . . . .Independence:
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Compiled programs on DVDs don't need the original code or . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . ............................................................................................................................................
interpreter, making them easier to distribute and run.
............................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ........................... ................................................................................................................. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(Total for Question 5 = 14 marks)

15
*P66489A01520* Turn over
6 (a) Two emerging technologies are DNA computing and quantum computing.
(i) Explain one difference between DNA computing and traditional computing.
(2)

................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(ii) Give a definition of the term superposition in quantum computing.


(1)

................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(b) Ethically, everyone should be able to access the benefits of technology.


Give two reasons why this may not be possible.
(2)

1..............................
Cost Barrier: Some people can't afford technology, creating inequality in access.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

................................. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ........................... ................................................................................................................. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2..............................
Infrastructure . . . . . . . . . . . . . . . . Gaps:
. . . . . . . . . . . . . . . . .Uneven
. . . . . . . . . . . . . . . . . . . . . availability of internet and resources limits tech benefits for some.
. . . . . . . . . . . . . ............................................................................................................................................ ....................................

................................. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ........................... ................................................................................................................. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

16
*P66489A01620*
(c) Widespread use of computer technology has a negative environmental impact.
Discuss the negative environmental impact of using computers and actions that
could be taken to reduce it.
(6)
Using computers a lot nowadays is causing some environmental
............................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
problems. One big issue is the growing amount of old computers we
throw away, called electronic waste. These old computers have stuff
............................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

like lead and mercury, which is bad for nature and people. The whole
process,
............................... . . . . . . .from
. . . . . . . . . . . . . . . . making
. . . . . . . . . . . . . . . . . . . . . . . . . .to
. . . . . . . .throwing away computers, also adds to air
. . . . . . . . . . . . ............................................................................................................................................ ....................................

pollution.
............................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

To fix this, we need to be smarter about how we handle old


computers. We can set up programs to recycle them properly and
............................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

make rules about how to throw them away. Also, we should


............................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
encourage making computers that use less energy and follow better
practices when building them. Doing these things will help make
............................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
using computers better for the environment.
............................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

............................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

............................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

............................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

............................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

............................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

............................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

............................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

............................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

............................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

............................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

............................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

............................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

............................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............................................................................................................................................ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(Total for Question 6 = 11 marks)

TOTAL FOR PAPER = 80 MARKS

17
*P66489A01720*
BLANK PAGE

18
*P66489A01820*
BLANK PAGE

19
*P66489A01920*
BLANK PAGE

20
*P66489A02020*
Pearson Edexcel International GCSE (9–1)
Paper
reference 4CP0/01
Computer Science
Component 1
Pseudocode command set

Resource Booklet
Do not return this resource booklet with the question paper.

Turn over

*P66489A*
P66489A
©2021 Pearson Education Ltd.

1/1/1/1/
Pseudocode command set
Questions in the written examination that involve code will use this pseudocode
for clarity and consistency. However, students may answer questions using any valid
method.
Data types
INTEGER
REAL
BOOLEAN
CHARACTER
Type coercion
Type coercion is automatic if indicated by context. For example 3 + 8.25 = 11.25
(integer + real = real)
Mixed mode arithmetic is coerced like this:

INTEGER REAL

INTEGER INTEGER REAL

REAL REAL REAL

Coercion can be made explicit. For example, RECEIVE age FROM (INTEGER) KEYBOARD
assumes that the input from the keyboard is interpreted as an INTEGER, not a STRING.
Constants
The value of constants can only ever be set once. They are identified by the keyword
CONST. Two examples of using a constant are shown.
CONST REAL PI
SET PI TO 3.14159
SET circumference TO radius * PI * 2
Data structures
ARRAY
STRING
Indices start at zero (0) for all data structures.
All data structures have an append operator, indicated by &.
Using & with a STRING and a non-STRING will coerce to STRING. For example, SEND ‘Fred’
& age TO DISPLAY, will display a single STRING of ‘Fred18’.

2
P66489A
Identifiers
Identifiers are sequences of letters, digits and ‘_’, starting with a letter, for example:
MyValue, myValue, My_Value, Counter2
Functions
LENGTH()
For data structures consisting of an array or string.
RANDOM(n)
This generates a random number from 0 to n.
Comments
Comments are indicated by the # symbol, followed by any text.
A comment can be on a line by itself or at the end of a line.
Devices
Use of KEYBOARD and DISPLAY are suitable for input and output.
Additional devices may be required, but their function will be obvious from the context.
For example, CARD_READER and MOTOR are two such devices.
Notes
In the pseudocode on the following pages, the < > indicates where expressions or values
need to be supplied. The < > symbols are not part of the pseudocode.

3
P66489A
Turn over
Variables and arrays

Syntax Explanation of syntax Example

SET Counter TO 0
SET Variable TO <value> Assigns a value to a variable.
SET MyString TO ‘Hello world’

Computes the value of an


SET Sum TO Score + 10
SET Variable TO <expression> expression and assigns to
SET Size to LENGTH(Word)
a variable.

Assigns a value to an element SET ArrayClass[1] TO ‘Ann’


SET Array[index] TO <value>
of a one-dimensional array. SET ArrayMarks[3]TO 56

Initialises a one-dimensional
SET Array TO [<value>, …] SET ArrayValues TO [1, 2, 3, 4, 5]
array with a set of values.

SET Array [RowIndex, Assigns a value to an element


SET ArrayClassMarks[2,4] TO 92
ColumnIndex] TO <value> of a two dimensional array.

Selection

Syntax Explanation of syntax Example

IF <expression> THEN IF Answer = 10 THEN


If <expression> is true then
<command> SET Score TO Score + 1
command is executed.
END IF END IF

IF <expression> THEN IF Answer = ‘correct’ THEN


If <expression> is true then first
<command> SEND ‘Well done’ TO DISPLAY
<command> is executed,
ELSE ELSE
otherwise second
<command> SEND ‘Try again’ TO DISPLAY
<command> is executed.
END IF END IF

4
P66489A
Repetition

Syntax Explanation of syntax Example

WHILE <condition> DO Pre-conditioned loop. Executes WHILE Flag = 0 DO


<command> <command> whilst SEND ‘All well’ TO DISPLAY
END WHILE <condition> is true. END WHILE
Post-conditioned loop.
REPEAT Executes REPEAT
<command> <command> until <condition> SET Go TO Go + 1
UNTIL <expression> is true. The loop must execute UNTIL Go = 10
at least once.
Count controlled loop. The
REPEAT <expression> TIMES REPEAT 100-Number TIMES
number of times <command>
<command> SEND ‘*’ TO DISPLAY
is executed is determined by
END REPEAT END REPEAT
the expression.
FOR <id> FROM <expression>
Count controlled loop. FOR Index FROM 1 TO 10 DO
TO
Executes SEND ArrayNumbers[Index]
<expression> DO
<command> a fixed number of TO DISPLAY
<command>
times. END FOR
END FOR
FOR <id> FROM <expression>
TO FOR Index FROM 1 TO 500 STEP
<expression> STEP Count controlled loop using 25 DO
<expression> DO a step. SEND Index TO DISPLAY
<command> END FOR
END FOR

SET WordsArray TO [‘The’, ‘Sky’,


‘is’, ‘grey’]
FOR EACH <id> FROM SET Sentence to “
Count controlled loop.
<expression> DO FOR EACH Word FROM
Executes for each element of
<command> WordsUArray DO
an array.
END FOREACH SET Sentence TO Sentence &
Word & ‘ ‘
END FOREACH

5
P66489A
Turn over
Input/output

Syntax Explanation of syntax Example

SEND ‘Have a good day.’ TO


SEND <expression> TO DISPLAY Sends output to the screen.
DISPLAY

RECEIVE Name FROM (STRING)


KEYBOARD
RECEIVE <identifier> FROM
RECEIVE LengthOfJourney
(type) Reads input of specified type.
FROM (INTEGER) CARD_READER
<device>
RECEIVE YesNo FROM
(CHARACTER) CARD_READER

File handling

Syntax Explanation of syntax Example

Reads in a record from a <file>


and assigns to a <variable>.
READ <File> <record> READ MyFile.doc Record
Each READ statement reads a
record from the file.
Writes a record to a file.
WRITE MyFile.doc Answer1,
WRITE <File> <record> Each WRITE statement writes a
Answer2, ‘xyz 01’
record to the file.

Subprograms

Syntax Explanation of syntax Example

PROCEDURE CalculateAverage
PROCEDURE <id>
(Mark1, Mark2, Mark3)
(<parameter>, …)
BEGIN PROCEDURE
BEGIN PROCEDURE Defines a procedure.
SET Avg to (Mark1 + Mark2 +
<command>
Mark3)/3
END PROCEDURE
END PROCEDURE
FUNCTION AddMarks (Mark1,
FUNCTION <id>
Mark2, Mark3)
(<parameter>, …)
BEGIN FUNCTION
BEGIN FUNCTION
Defines a function. SET Total to (Mark1 + Mark2 +
<command>
Mark3)/3
RETURN <expression>
RETURN Total
END FUNCTION
END FUNCTION
Calls a procedure or a
<id> (<parameter>, …) Add (FirstMark, SecondMark)
function.

6
P66489A
Arithmetic operators

Symbol Description

+ Add

- Subtract

/ Divide

* Multiply

^ Exponent

MOD Modulo

DIV Integer division

Relational operators

Symbol Description

= equal to

<> not equal to

> greater than

>= greater than or equal to

< less than

<= less than or equal to

Logical operators

Symbol Description

Returns true if both conditions


AND
are true.
Returns true if any of the
OR
conditions are true.
Reverses the outcome of the
NOT expression; true becomes false,
false becomes true.

7
P66489A
BLANK PAGE

8
P66489A

You might also like