0% found this document useful (0 votes)
1 views

Computer Paper 2

This document is an examination paper for the Cambridge IGCSE Computer Science course, specifically for Paper 2 on Algorithms, Programming, and Logic. It includes instructions for answering the questions, information about the total marks, and various programming-related questions covering topics such as pseudocode, data types, algorithms, and logic expressions. The exam is set for May/June 2024 and consists of multiple sections requiring both theoretical and practical programming knowledge.

Uploaded by

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

Computer Paper 2

This document is an examination paper for the Cambridge IGCSE Computer Science course, specifically for Paper 2 on Algorithms, Programming, and Logic. It includes instructions for answering the questions, information about the total marks, and various programming-related questions covering topics such as pseudocode, data types, algorithms, and logic expressions. The exam is set for May/June 2024 and consists of multiple sections requiring both theoretical and practical programming knowledge.

Uploaded by

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

Cambridge IGCSE™

* 6 3 7 7 6 2 5 9 4 8 *

COMPUTER SCIENCE 0478/21


Paper 2 Algorithms, Programming and Logic May/June 2024

1 hour 45 minutes

You must answer on the question paper.

No additional materials are needed.

INSTRUCTIONS
● Answer all questions.
● Use a black or dark blue pen. You may use an HB pencil for any diagrams or graphs.
● Write your name, centre number and candidate number in the boxes at the top of the page.
● Write your answer to each question in the space provided.
● Do not use an erasable pen or correction fluid.
● Do not write on any bar codes.
● Calculators must not be used in this paper.

INFORMATION
● The total mark for this paper is 75.
● The number of marks for each question or part question is shown in brackets [ ].
● No marks will be awarded for using brand names of software packages or hardware.

This document has 16 pages. Any blank pages are indicated.

DC (PQ/CT) 329143/3
© UCLES 2024 [Turn over
2

1 Tick (ü) one box to complete this sentence.

A validation check to make sure that an email address contains an ‘@’ sign is a

A range check.

B visual check.

C presence check.

D format check.
[1]

2 Four descriptions of programming concepts and five programming concepts are shown.

(a) Draw one line to link each description to the most appropriate programming concept.

Not all programming concepts will be used.

Description Programming concept

function
a subroutine that may not return a value

procedure
a value that is declared and used within a
specific procedure
parameter
a value that a procedure expects you to
supply when it is called
global variable

a subroutine that will always return a value


local variable

[4]

(b) Write the pseudocode to use a procedure named Average that passes the values 25 and 50
to the procedure.

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

............................................................................................................................................. [2]

© UCLES 2024 0478/21/M/J/24


3

(c) Outline the role of procedures and functions in creating a program that is easier to maintain.

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

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

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

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

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

............................................................................................................................................. [3]

3 State what is meant by the data types integer and real.


Give an example of each.

Integer ..............................................................................................................................................

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

Example ...........................................................................................................................................

Real ..................................................................................................................................................

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

Example ...........................................................................................................................................
[4]

© UCLES 2024 0478/21/M/J/24 [Turn over


4

4 This pseudocode algorithm is intended to allow, at random, between 1 and 20 values to be entered
and totalled. The total and average of the entered values are output at the end of the algorithm.

01 DECLARE Loop : STRING


02 DECLARE Limit : INTEGER
03 DECLARE Value : REAL
04 DECLARE Total : REAL
05 Total 0
06 Limit ROUND(RANDOM() * 19,0) + 1
07 IF Loop 1 TO Limit
08 OUTPUT "Enter a number"
09 INPUT Loop
10 Total Total * Value
11 NEXT Loop
12 OUTPUT "The total of the numbers entered is ", Total
13 OUTPUT "The average of the numbers entered is ", Total / Limit

(a) Identify the line numbers of four errors in the pseudocode and suggest corrections.

Error 1 line number ...................................................................................................................

Correction .................................................................................................................................

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

Error 2 line number ...................................................................................................................

Correction .................................................................................................................................

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

Error 3 line number ...................................................................................................................

Correction .................................................................................................................................

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

Error 4 line number ...................................................................................................................

Correction .................................................................................................................................

...................................................................................................................................................
[4]

(b) Write the pseudocode statement that would output the average calculated in line 13 of the
algorithm rounded to one decimal place.

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

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

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

............................................................................................................................................. [2]

© UCLES 2024 0478/21/M/J/24


5

(c) Explain how you should alter the original corrected algorithm to make sure that all the
numbers entered are between 1 and 500 inclusive. If any numbers fall outside these limits, a
replacement value is requested and entered.

You do not need to re-write the algorithm.

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

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

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

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

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

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

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

............................................................................................................................................. [4]

5 Write the pseudocode statements to perform this task:


• accept the input of a whole number from 1 to 4 inclusive
• use a CASE statement to:
○ output the number (1 to 4 inclusive) that was entered
○ output the word “ERROR” if a 1 to 4 inclusive number was not entered.

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

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

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

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

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

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

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

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

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

.................................................................................................................................................... [5]

© UCLES 2024 0478/21/M/J/24 [Turn over


6

6 The flowchart represents an algorithm.

START

Result Limit DIV 2 + 1


INPUT
Limit
OUTPUT
Numbers[Result]
Count 1

INPUT
Numbers[Count]
STOP

Count Count + 1

No IS Count >
Limit?

IS Numbers[Count] > No
Yes
Numbers[Count + 1]?
Flag TRUE

Yes

Swap Numbers[Count]
IS Flag = No
TRUE?

Numbers[Count] Numbers[Count + 1]
Yes

Flag False Numbers[Count + 1] Swap


Count 1

Flag True

Yes IS Count > No


Limit – 1?

Count Count + 1

© UCLES 2024 0478/21/M/J/24


7

(a) Complete the trace table for the input data:

7, 47, 50, 52, 60, 80, 63, 70

Numbers

Limit Count [1] [2] [3] [4] [5] [6] [7] Flag Swap Result OUTPUT

[7]
© UCLES 2024 0478/21/M/J/24 [Turn over
8

(b) Outline the processes involved in the algorithm shown in the flowchart on page 6.

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

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

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

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

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

............................................................................................................................................. [3]

7 (a) Outline why it is useful to store data in a file.

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

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

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

............................................................................................................................................. [2]

(b) The function LENGTH(X) calculates the length of a string X

Write the pseudocode statements to:


• read the contents of the text file Quotation.txt into an appropriate string variable that
has been declared
• output the string in upper case and the length of the string.

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

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

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

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

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

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

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

............................................................................................................................................. [4]

© UCLES 2024 0478/21/M/J/24


9

8 Consider the logic expression:

Z = (R OR NOT T) XOR (NOT S AND T)

(a) Draw a logic circuit for this logic expression.

Each logic gate must have a maximum of two inputs.

Do not simplify this logic expression.

S Z

[5]

(b) Complete the truth table from the given logic expression.

Working space
R S T Z

0 0 0

0 0 1

0 1 0

0 1 1

1 0 0

1 0 1

1 1 0

1 1 1

[4]

© UCLES 2024 0478/21/M/J/24 [Turn over


10

9 A database table called SoftDrinks stores details of the soft drinks sold by a small shop.

Field Example data

Name Cola

Supplier Cambridge Beverages

Container Can

SizeCl 330

NumberInStock 30

ReorderLevel 15

Reordered Yes

(a) State whether any of the given fields would be suitable as a primary key and give a reason for
your answer.

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

............................................................................................................................................. [1]

(b) Complete the structured query language (SQL) statement to return the number of cans the
shop has in stock.

SELECT ....................................................... (.......................................................)

FROM .......................................................

WHERE ....................................................... = ....................................................... ;


[5]

© UCLES 2024 0478/21/M/J/24


12

10 The one-dimensional (1D) array Clubs[] is used to store the names of 12 cricket clubs in a local
sports league.

The two-dimensional (2D) array Statistics[] is used to store, for each cricket club, the number
of:
• matches won
• matches drawn
• matches lost.

The 1D array Points[] is used to store the total number of points each cricket club has been
awarded.

The position of any cricket club’s data is the same in all three arrays. For example, the data in
index 2 of Statistics[] and index 2 of Points[] belongs to the cricket club in index 2 of
Clubs[]

The variable Matches stores the number of matches played by each team. Each team plays the
same number of matches.

Points are awarded for:


• a win – 12 points
• a draw – 5 points
• a loss – 0 points.

Write a program that meets the following requirements:


• allows the number of matches played to be input and stored, with a maximum of 22 matches
• validates the number of matches played
• allows the names of the cricket clubs to be input and stored
• allows the number of matches won, drawn and lost to be input and stored for each team
• validates the number of matches won, drawn or lost against the number of matches played
• asks the user to re-enter the number of matches won, drawn or lost if the total does not match
the number of matches played
• calculates and stores the total number of points for each club
• finds the cricket club or clubs with the highest number of points
• outputs the name or names of the winning club or clubs, the number of wins and the total
number of points awarded.

You must use pseudocode or program code and add comments to explain how your code works.

You do not need to declare any arrays or variables; you may assume that this has already been
done.

All inputs and outputs must contain suitable messages.

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

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

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

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

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

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

© UCLES 2024 0478/21/M/J/24


13

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

..........................................................................................................................................................
© UCLES 2024 0478/21/M/J/24 [Turn over
14

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

.................................................................................................................................................. [15]
© UCLES 2024 0478/21/M/J/24
* 0019655533401 *

, ,

Cambridge IGCSE™

¬OŠ. 3mKo[‘U¢8¦6W
¬—™`I£0£]v†§¦Lb:V‚
¥U •5•¥5U•5¥ Eu5U
* 4 5 6 7 6 0 4 2 2 6 *

COMPUTER SCIENCE 0478/22


Paper 2 Algorithms, Programming and Logic May/June 2024

1 hour 45 minutes

You must answer on the question paper.

No additional materials are needed.

INSTRUCTIONS
● Answer all questions.
● Use a black or dark blue pen. You may use an HB pencil for any diagrams or graphs.
● Write your name, centre number and candidate number in the boxes at the top of the page.
● Write your answer to each question in the space provided.
● Do not use an erasable pen or correction fluid.
● Do not write on any bar codes.
● Calculators must not be used in this paper.

INFORMATION
● The total mark for this paper is 75.
● The number of marks for each question or part question is shown in brackets [ ].
● No marks will be awarded for using brand names of software packages or hardware.

This document has 16 pages. Any blank pages are indicated.

DC (LK/CB) 329121/3
© UCLES 2024 [Turn over
* 0019655533402 *

DO NOT WRITE IN THIS MARGIN


2
, ,

1 Tick (✓) one box to identify a method used to design and construct a solution to a computing
problem.

A analysis

B coding

C flowchart

D testing
[1]

DO NOT WRITE IN THIS MARGIN


2 Four logic functions and five standard symbols for logic gates are shown.

Draw one line to link each logic function to its standard symbol. Not all standard symbols will be
used.

Logic function Standard symbol

AND

DO NOT WRITE IN THIS MARGIN


XOR

NAND

OR

DO NOT WRITE IN THIS MARGIN


[4]

3 Identify three different tasks in the analysis stage of the program development life cycle.

1 .......................................................................................................................................................

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

2 .......................................................................................................................................................
DO NOT WRITE IN THIS MARGIN

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

3 .......................................................................................................................................................

..........................................................................................................................................................
[3]

ĬÍĊ®Ġ³íËïÛđÕ̵Ĩ¸Ď×
© UCLES 2024 ĬėěßÌħ¼ąÖċôČβĒĂÎĂ
ĥąĕĕõõåÕĥÕĥåąÅåµĕÕ
0478/22/M/J/24
* 0019655533403 *
DO NOT WRITE IN THIS MARGIN

3
, ,

4 A program needs to make sure the characters input for a product code meet these rules:

• The product code is six characters in length.


• The first two characters must be “PD”.
• The last four characters must be a number in the range 1000 to 9999 inclusive.

(a) Identify three validation checks and state how each check would make sure the product code
met one of these rules.

Check 1 ....................................................................................................................................
DO NOT WRITE IN THIS MARGIN

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

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

Check 2 ....................................................................................................................................

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

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

Check 3 ....................................................................................................................................
DO NOT WRITE IN THIS MARGIN

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

...................................................................................................................................................
[6]

(b) The program design will include a pseudocode algorithm. Assume that the product code is
stored in the variable Product

(i) Write the pseudocode to make sure that the product code is six characters in length.

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

...........................................................................................................................................
DO NOT WRITE IN THIS MARGIN

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

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

..................................................................................................................................... [2]

(ii) Write the pseudocode to make sure that the first two characters of the product code are
“PD”.

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

...........................................................................................................................................
DO NOT WRITE IN THIS MARGIN

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

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

..................................................................................................................................... [2]

ĬÏĊ®Ġ³íËïÛđÕ̵Ħ¸Ď×
© UCLES 2024 ĬėĜàÄġ¸õãíý½ĊÊÆĂÞĂ
ĥąĥÕµĕŵõåµåąåÅõąÕ
0478/22/M/J/24 [Turn over
* 0019655533404 *

DO NOT WRITE IN THIS MARGIN


4
, ,

5 A high-level programming language makes use of arithmetic, Boolean and logical operators.

State how each type of operator is used.


Give an example statement, in pseudocode, for each one.

Arithmetic .........................................................................................................................................

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

Example ...........................................................................................................................................

DO NOT WRITE IN THIS MARGIN


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

Boolean ............................................................................................................................................

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

Example ............................................................................................................................................

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

DO NOT WRITE IN THIS MARGIN


Logical ..............................................................................................................................................

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

Example ...........................................................................................................................................

..........................................................................................................................................................
[6]

DO NOT WRITE IN THIS MARGIN


DO NOT WRITE IN THIS MARGIN

ĬÍĊ®Ġ³íËïÛđÕĢ·Ĩ¸Đ×
© UCLES 2024 ĬėĜÝÄīÆôØóĆÆìĦĨĒÖĂ
ĥµµÕõĕÅĕĕąÅåÅåĥõĕÕ
0478/22/M/J/24
* 0019655533405 *
DO NOT WRITE IN THIS MARGIN

5
, ,

6 Totalling and counting are standard methods of solution.

Numbers are input. The number 9999.9 is the last number to be input and is ignored.

(a) Write an algorithm in pseudocode to total the numbers input and to output the total.
You do not need to validate the input.

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

...................................................................................................................................................
DO NOT WRITE IN THIS MARGIN

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

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

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

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

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

...................................................................................................................................................
DO NOT WRITE IN THIS MARGIN

............................................................................................................................................. [4]

(b) Write an algorithm in pseudocode to count and output the number of input values that are
greater than 100. You do not need to validate the input.

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

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

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

...................................................................................................................................................
DO NOT WRITE IN THIS MARGIN

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

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

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

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

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

............................................................................................................................................. [4]
DO NOT WRITE IN THIS MARGIN

ĬÏĊ®Ġ³íËïÛđÕĢ·Ħ¸Đ×
© UCLES 2024 ĬėěÞÌĝÊĄáąûăðĎ´ĒæĂ
ĥµÅĕµõåõąõĕåÅÅąµąÕ
0478/22/M/J/24 [Turn over
* 0019655533406 *

DO NOT WRITE IN THIS MARGIN


6
, ,

7 An algorithm has been written in pseudocode to find and display the maximum and minimum
values in an array of 1000 positive numbers. The array List[] starts at index 1

01 Max List[1]
02 Min List[1]
03 FOR Counter 2 TO 1000
04 IF List[Counter] < Max
05 THEN
06 Max List[Counter]
07 ENDIF
08 IF List[Count] ˂ Min

DO NOT WRITE IN THIS MARGIN


09 THEN
10 Min List[Counter]
11 ENDWHILE
12 NEXT Counter
13 OUTPUT "Maximum value is ", Max
14 OUTPUT "Minimum value is ", Min

(a) Give a line number for each of these types of statement:

Assignment statement ..............................................................................................................

Selection statement ..................................................................................................................

DO NOT WRITE IN THIS MARGIN


Iteration statement ....................................................................................................................
[3]

(b) Identify the line numbers of the three errors in the pseudocode and suggest a correction for
each error.

Error 1 line number ...................................................................................................................

Correction .................................................................................................................................

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

DO NOT WRITE IN THIS MARGIN


Error 2 line number ...................................................................................................................

Correction .................................................................................................................................

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

Error 3 line number ...................................................................................................................

Correction .................................................................................................................................

...................................................................................................................................................
[3]
DO NOT WRITE IN THIS MARGIN

ĬÑĊ®Ġ³íËïÛđÕ̶ĦµĎ×
© UCLES 2024 ĬėĜÞÇħâĊéĂĊúĐĦѺÖĂ
ĥĥĥĕµÕåÕÅĕµåąÅåõÕÕ
0478/22/M/J/24
* 0019655533407 *
DO NOT WRITE IN THIS MARGIN

7
, ,

8 A logic circuit is to be built to control the opening of a safe used to store money. There are two
keys, A and B, and a time switch C. The safe can only open if both keys are used and the time
switch is off.

not used 0
key A
used 1

not used 0
key B
DO NOT WRITE IN THIS MARGIN

used 1

switch off 0
time switch C
switch on 1

safe cannot open 0


safe X
safe can open 1

(a) Write the logic expression for this problem.

............................................................................................................................................. [3]
DO NOT WRITE IN THIS MARGIN

(b) Complete the truth table for this problem.

Working space
A B C X

0 0 0

0 0 1
DO NOT WRITE IN THIS MARGIN

0 1 0

0 1 1

1 0 0

1 0 1

1 1 0
DO NOT WRITE IN THIS MARGIN

1 1 1

[4]

ĬÓĊ®Ġ³íËïÛđÕ̶ĨµĎ×
© UCLES 2024 ĬėěÝ¿ġÞúÐø÷¯ÌĎąºæĂ
ĥĥĕÕõµÅµÕĥĥåąåŵÅÕ
0478/22/M/J/24 [Turn over
* 0019655533408 *

DO NOT WRITE IN THIS MARGIN


8
,  ,

9 This flowchart represents an algorithm.

START

A FALSE
B 1

DO NOT WRITE IN THIS MARGIN


IS List[B] > No
T List[B]
List[B + 1]?

Yes
List[B] List[B + 1]

List[B + 1] T

A TRUE

DO NOT WRITE IN THIS MARGIN


B B+1

No IS B =
5?

Yes

Yes IS A =
TRUE?

DO NOT WRITE IN THIS MARGIN


No

STOP

(a) The array List[1:5] used in the flowchart contains this data:

List[1] List[2] List[3] List[4] List[5]

15 17 20 5 9
DO NOT WRITE IN THIS MARGIN

ĬÑĊ®Ġ³íËïÛđÕ̏ĦµĐ×
© UCLES 2024 Ĭėěà¿īÐïëúð¸Ī²çêÎĂ
ĥÕÅÕµµÅĕµÅĕåÅåĥµÕÕ
0478/22/M/J/24
* 0019655533509 *
DO NOT WRITE IN THIS MARGIN

9
,  ,

Complete the trace table using the data given in the array.

A B List[1] List[2] List[3] List[4] List[5] T


15 17 20 5 9
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN

[5]

(b) Describe what the algorithm represented by the flowchart is doing.


DO NOT WRITE IN THIS MARGIN

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

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

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

............................................................................................................................................. [2]
ĬÓĉ¯Ġ³íËïÛđÕĢ·ĦµĐ×
© UCLES 2024 ĬėěÞÄĨßęÜûĄăÑòçĚæĂ
ĥĥĥĕµĕĥõÕŵåąĥĥõĥÕ
0478/22/M/J/24 [Turn over
* 0019655533510 *

DO NOT WRITE IN THIS MARGIN


10
, ,

10 A television subscription service has a new database table named Contract to store details of
their subscribers’ contracts. The table contains these fields:

• ContractNumber – the contract number, for example CT567


• Months – the length of the contract in months, for example 6
• EndDate – the date the contract finishes, for example 30 November 2024
• News – the news service, yes or no
• Movie – the movie service, yes or no
• Sport – the sports service, yes or no
• Junior – the children’s service, yes or no.

DO NOT WRITE IN THIS MARGIN


(a) Identify the field that will be the most appropriate primary key for this table.

............................................................................................................................................. [1]

(b) Complete the table to identify the most appropriate data type for these fields in Contract

Field Data type

ContractNumber

Months

DO NOT WRITE IN THIS MARGIN


EndDate

Sport

[2]

(c) Explain the purpose of these structured query language (SQL) statements.

Statement 1: SELECT SUM (Months) FROM Contract;

Statement 2: SELECT COUNT (News) FROM Contract WHERE News;

DO NOT WRITE IN THIS MARGIN


Statement 1 ..............................................................................................................................

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

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

Statement 2 ..............................................................................................................................

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

...................................................................................................................................................
[3]
DO NOT WRITE IN THIS MARGIN

ĬÑĉ¯Ġ³íËïÛđÕ̶Ĩ·Ď×
© UCLES 2024 ĬėęÝÁĤëïãĆöĠĩČėâÞĂ
ĥµõĕõõåĕĥąĥĥąåąµÅÕ
0478/22/M/J/24
* 0019655533511 *
DO NOT WRITE IN THIS MARGIN

11
, ,

(d) Complete this SQL statement to find the contract numbers of the subscribers that take both
the news and sports services.

SELECT .....................................................................................................................................

FROM Contract

WHERE .......................................................... AND ................................................................. ;


[2]
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN

ĬÓĉ¯Ġ³íËïÛđÕ̶Ħ·Ď×
© UCLES 2024 ĬėĚÞÉĦçÿÖôċé­ôÃâÎĂ
ĥµąÕµĕÅõõõµĥąÅĥõÕÕ
0478/22/M/J/24 [Turn over
* 0019655533512 *

DO NOT WRITE IN THIS MARGIN


12
, ,

11 A one-player game uses the two-dimensional (2D) array Grid[] to store the location of a secret
cell to be found by the player in 10 moves. Each row and column has 5 cells.

Start
Grid[1,1]

DO NOT WRITE IN THIS MARGIN


At the start of the game:

• The program places an ‘X’ in a random cell (not in Grid[1,1]) and empties all the other
cells in the grid.
• The player starts at the top left of the grid.
• The player has 10 moves.

During the game:

DO NOT WRITE IN THIS MARGIN


• The player can move left, right, up or down by one cell and the move must be within the grid.
• “You Win” is displayed if the player moves to the cell with ‘X’ and has played 10 moves or
less.
• “You Lose” is displayed if the player has made 10 moves without finding the ‘X’.

Write a program that meets these requirements.

You must use pseudocode or program code and add comments to explain how your code works.

You do not need to declare any arrays or variables; you may assume that this has already been
done.

DO NOT WRITE IN THIS MARGIN


All inputs and outputs must contain suitable messages.

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

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

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

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

..........................................................................................................................................................
DO NOT WRITE IN THIS MARGIN

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

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

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

..........................................................................................................................................................
ĬÑĉ¯Ġ³íËïÛđÕ̏Ĩ·Đ×
© UCLES 2024 ĬėĚßÉĠÕĊáîĄâďÐġ²æĂ
ĥąÕÕõĕÅÕĕÕÅĥÅÅÅõÅÕ
0478/22/M/J/24
* 0019655533513 *
DO NOT WRITE IN THIS MARGIN

13
, ,

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

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

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

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

..........................................................................................................................................................
DO NOT WRITE IN THIS MARGIN

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

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

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

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

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

..........................................................................................................................................................
DO NOT WRITE IN THIS MARGIN

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

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

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

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

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

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

..........................................................................................................................................................
DO NOT WRITE IN THIS MARGIN

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

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

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

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

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

..........................................................................................................................................................
DO NOT WRITE IN THIS MARGIN

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

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

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

..........................................................................................................................................................
ĬÓĉ¯Ġ³íËïÛđÕ̏Ħ·Đ×
© UCLES 2024 ĬėęàÁĪÙúØČíħËèµ²ÖĂ
ĥąåĕµõåµąåĕĥÅååµÕÕ
0478/22/M/J/24 [Turn over
* 0019655533514 *

DO NOT WRITE IN THIS MARGIN


14
, ,

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

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

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

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

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

DO NOT WRITE IN THIS MARGIN


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

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

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

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

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

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

DO NOT WRITE IN THIS MARGIN


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

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

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

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

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

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

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

DO NOT WRITE IN THIS MARGIN


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

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

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

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

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

..........................................................................................................................................................
DO NOT WRITE IN THIS MARGIN

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

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

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

.................................................................................................................................................. [15]
ĬÍĉ¯Ġ³íËïÛđÕĢ·ĥ¶Ē×
© UCLES 2024 ĬėĚÞÄĨæĂæþúÌħí±ĂÎĂ
ĥååÕõĕĥĕĥµĕåąĥąõąÕ
0478/22/M/J/24
Cambridge IGCSE™
* 5 2 9 6 2 2 3 7 5 6 *

COMPUTER SCIENCE 0478/23


Paper 2 Algorithms, Programming and Logic May/June 2024

1 hour 45 minutes

You must answer on the question paper.

No additional materials are needed.

INSTRUCTIONS
● Answer all questions.
● Use a black or dark blue pen. You may use an HB pencil for any diagrams or graphs.
● Write your name, centre number and candidate number in the boxes at the top of the page.
● Write your answer to each question in the space provided.
● Do not use an erasable pen or correction fluid.
● Do not write on any bar codes.
● Calculators must not be used in this paper.

INFORMATION
● The total mark for this paper is 75.
● The number of marks for each question or part question is shown in brackets [ ].
● No marks will be awarded for using brand names of software packages or hardware.

This document has 16 pages. Any blank pages are indicated.

DC (CE/CB) 329120/3
© UCLES 2024 [Turn over
2

1 Tick (3) one box to complete this sentence.

This flowchart symbol

A represents a subroutine.

B represents a decision.

C represents an input/output.

D represents a terminator.
[1]

2 (a) Four logic gate symbols and five logic functions are shown.

Draw one line to link each logic gate symbol to the appropriate logic function.

Not all logic functions will be used.

Logic gate symbol Logic function

AND

XOR

NOT

NAND

OR

[4]

© UCLES 2024 0478/23/M/J/24


3

(b) Complete the truth table for this logic circuit.

Working space
A B C Z

0 0 0

0 0 1

0 1 0

0 1 1

1 0 0

1 0 1

1 1 0

1 1 1

[4]

3 Describe the characteristics of the string and char data types and give an example of each.

String ................................................................................................................................................

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

Example ...........................................................................................................................................

Char .................................................................................................................................................

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

Example ...........................................................................................................................................
[4]

© UCLES 2024 0478/23/M/J/24 [Turn over


4

4 This pseudocode algorithm is intended to allow data for up to 50 people to be entered and stored
in a two-dimensional (2D) array. The data is their last name, first name and the city in which they
live.

01 DECLARE People : ARRAY[1:50, 1:3] OF REAL


02 DECLARE Count : INTEGER
03 DECLARE Response : CHAR
04 DECLARE Continue : BOOLEAN
05 FOR I 1 TO 50
06 FOR J 1 TO 3
07 People[I, J] ""
08 NEXT J
09 NEXT I
10 Count 100
11 Continue TRUE
12 CASE OF
13 OUTPUT "Enter the last name"
14 INPUT People[Count, 1]
15 OUTPUT "Enter the first name"
16 INPUT People[Count, 2]
17 OUTPUT "Enter the city"
18 INPUT People[Count, 3]
19 OUTPUT "Do you want to enter another name (Y or N)?"
20 INPUT Response
21 IF Response = 'N'
22 THEN
23 Continue FALSE
24 ELSE
25 Count Count + 1
26 ENDIF
27 UNTIL NOT Count

(a) Identify the line numbers of the four errors in the pseudocode and suggest corrections.

Error 1 line number ...................................................................................................................

Correction .................................................................................................................................

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

Error 2 line number ...................................................................................................................

Correction .................................................................................................................................

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

Error 3 line number ...................................................................................................................

Correction .................................................................................................................................

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

Error 4 line number ...................................................................................................................

Correction .................................................................................................................................

...................................................................................................................................................
[4]
© UCLES 2024 0478/23/M/J/24
5

(b) Write the pseudocode that you could add to the end of this algorithm to output the contents of
the array. Make sure that the output ends when the data in the array ends.

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

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

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

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

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

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

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

............................................................................................................................................. [4]

(c) Explain how you could alter the original corrected algorithm to make sure that the
number of elements being added to the array does not exceed the maximum size of the
array (50 elements).

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

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

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

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

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

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

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

............................................................................................................................................. [4]

© UCLES 2024 0478/23/M/J/24 [Turn over


6

5 The flowchart represents an algorithm.

START

L 0
S 10000
T 0
A 0

INPUT
Limit

Count 1

INPUT
Value

IS IS
No No
Value < S Value > L
? ?

Yes Yes

S Value L Value

T T + Value

IS
No
Count > Count Count + 1
Limit ?

Yes

A T / Limit

OUTPUT "L = ", L, " S = ",


S, " T = ", T, " A = ", A

STOP

© UCLES 2024 0478/23/M/J/24


7

(a) Complete the trace table for the input data:

10, 30, 18, 8, 25, 12, 17, 2, 50, 15, 5

L S T A Limit Count Value OUTPUT

[6]

(b) Outline the purpose of the algorithm.

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

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

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

............................................................................................................................................. [2]

© UCLES 2024 0478/23/M/J/24 [Turn over


8

(c) Explain why the identifiers L, S, T and A may not be appropriate to use as identifiers and how
they could be improved.

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

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

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

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

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

............................................................................................................................................. [3]

(d) State a more appropriate identifier for each of the variables L, S, T and A

Original identifier Improved identifier

A
[2]

6 A program is to be written that will accept integers that are between the values of 1 and 80
inclusive.

(a) Give examples of normal, abnormal and extreme test data that could be used to make sure
the program only accepts valid data.

Normal test data .......................................................................................................................

Abnormal test data ...................................................................................................................

Extreme test data .....................................................................................................................


[3]

(b) Describe what is meant by extreme test data.

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

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

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

............................................................................................................................................. [2]

© UCLES 2024 0478/23/M/J/24


9

7 (a) The string operation SUBSTRING(FullText, X, Y) returns a string from FullText


beginning at position X that is Y characters long. The first character in FullText is in
position 1.

Write the pseudocode statements to:

• store the string “IGCSE Computer Science at Cambridge” in FullText


• extract and display the words “Computer Science” from the string and store it in a suitable
variable
• output the original string in upper case.

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

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

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

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

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

............................................................................................................................................. [4]

(b) Write the pseudocode statements to:

• store the content of the variable you created in part (a) to a text file named
"Subjects.txt"
• close the text file at the end of the algorithm.

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

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

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

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

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

............................................................................................................................................. [3]

© UCLES 2024 0478/23/M/J/24 [Turn over


10

8 A database table called Hangar1 stores details of a collection of historic aircraft at a museum.

ID Make Model Year Engines Airworthy


JM1 Hawker Siddeley Nimrod 1966 4 Y
JM2 Douglas DC-10 1970 3 Y
JM3 Aérospatiale-BAC Concorde 1973 4 N
PB1 De Havilland DH-9 1918 1 Y
PB2 Hawker Fury 1935 1 Y
PB3 Hawker Nimrod 1934 1 Y
PM1 Fieseler Storch 1942 1 N
PM2 Hawker Hurricane 1942 1 Y
PM3 Supermarine Spitfire 1942 1 N
PM4 Douglas C-47 Dakota 1942 2 N
PS1 Boeing 314 Clipper 1936 4 N

(a) State the number of fields and records in the database table.

Fields ........................................................................................................................................

Records ....................................................................................................................................
[2]

(b) Give the output that would be produced by the structured query language (SQL) statement:

SELECT Model, Year, Engines


FROM Hangar1
WHERE Engines > 1
ORDER BY Year;

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

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

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

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

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

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

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

............................................................................................................................................. [4]

© UCLES 2024 0478/23/M/J/24


11

(c) Complete the SQL statement to display only the ID and model of all the aircraft that are
airworthy.

SELECT ID, ............................................................................................................................

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

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

................................................................................................................................................ ;
[4]

© UCLES 2024 0478/23/M/J/24 [Turn over


12

9 A one-dimensional (1D) array Teams[] contains the names of 10 football teams in a local league.
A two-dimensional (2D) array Results[] stores, for each team, the total number of:

• games won
• games drawn
• games lost
• points.

The position of any team’s data is the same in both arrays. For example the data in index 3 of
Results[] belongs to the team in index 3 of Teams[]

The array data will be used to find the current leader of the league.

The variable Played stores the number of games played by each team. Each team plays the
same number of games.

Write a program that meets the following requirements:

• allows the number of games played to be input and stored, with a maximum of 18 games
• allows the names of the teams to be input and stored
• allows the number of games won, drawn and lost to be input and stored for each team
• validates the number of games played and the number of games won, drawn or lost against
the number of games played
• calculates and stores the number of points for each team using three points for a win and one
point for a draw; there are no points for a loss
• sorts the array Results[] into descending order of number of points, ensuring the
corresponding parallel array Teams[] is kept in the same order
• determines how many teams have the highest number of points
• outputs the name(s) of the winning team(s) along with the number of points achieved.

You must use pseudocode or program code and add comments to explain how your code works.

You do not need to declare any arrays, variables or constants; you may assume that this has
already been done.

All inputs and outputs must contain suitable messages.

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

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

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

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

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

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

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

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

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

..........................................................................................................................................................
© UCLES 2024 0478/23/M/J/24
13

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

..........................................................................................................................................................
© UCLES 2024 0478/23/M/J/24 [Turn over
14

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

.................................................................................................................................................. [15]
© UCLES 2024 0478/23/M/J/24
Cambridge IGCSE™
* 5 6 2 6 6 1 3 3 2 9 *

COMPUTER SCIENCE 0478/21


Paper 2 Algorithms, Programming and Logic October/November 2023

1 hour 45 minutes

You must answer on the question paper.

No additional materials are needed.

INSTRUCTIONS
● Answer all questions.
● Use a black or dark blue pen. You may use an HB pencil for any diagrams or graphs.
● Write your name, centre number and candidate number in the boxes at the top of the page.
● Write your answer to each question in the space provided.
● Do not use an erasable pen or correction fluid.
● Do not write on any bar codes.
● Calculators must not be used in this paper.

INFORMATION
● The total mark for this paper is 75.
● The number of marks for each question or part question is shown in brackets [ ].
● No marks will be awarded for using brand names of software packages or hardware.

This document has 16 pages. Any blank pages are indicated.

DC (LK/SG) 314037/5
© UCLES 2023 [Turn over
2

1 Tick (3) one box to show which operator means less than or equal to.

A OR

B <

C <=

D >=
[1]

2 Tick (3) one box to show how a value can be passed to a procedure.

A function

B parameter

C return

D subroutine
[1]

3 Four descriptions of data and five data types are shown.

Draw one line to link each description to the most appropriate data type.
Not all data types will be used.

Description Data type

BOOLEAN
a whole number

CHAR
a single letter

INTEGER

a word or phrase
REAL

a number with two decimal places STRING

[4]

© UCLES 2023 0478/21/O/N/23


3

4 Circle the three words representing places where data may be stored.

array constant dimension input

output procedure variable


[3]

5 The first stage of the program development life cycle is analysis. Two of the tasks in analysis are
abstraction and decomposition.

(a) Describe what is meant by abstraction.

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

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

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

............................................................................................................................................. [2]

(b) Identify three of the component parts when a problem has been decomposed at the analysis
stage.

1 ................................................................................................................................................

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

3 ................................................................................................................................................
[3]

(c) Identify and describe one other stage of the program development life cycle.

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

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

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

............................................................................................................................................. [2]

© UCLES 2023 0478/21/O/N/23 [Turn over


4

6 An algorithm has been written in pseudocode.

01 DECLARE A[1:10] : STRING


02 DECLARE T : STRING
03 DECLARE C, L : INTEGER
04 L 10
05 FOR C 1 TO L
06 OUTPUT "Please enter name "
07 INPUT A[C]
08 NEXT C
09 FOR C 1 TO L
10 FOR L 1 TO 9
11 IF A[L] > A[L + 1]
12 THEN
13 T A[L]
14 A[L] A[L + 1]
15 A[L + 1] T
16 ENDIF
17 NEXT L
18 NEXT C
19 FOR C 1 TO L
20 OUTPUT "Name ", C, " is ", A[C]
21 NEXT C

(a) State the purpose of this pseudocode algorithm.

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

............................................................................................................................................. [1]

© UCLES 2023 0478/21/O/N/23


5

(b) State four processes in this algorithm.

1 ................................................................................................................................................

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

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

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

3 ................................................................................................................................................

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

4 ................................................................................................................................................

...................................................................................................................................................
[4]

(c) Meaningful identifiers have not been used in this algorithm.


Suggest suitable meaningful identifiers for:

The array:

A ................................................................................................................................................

The variables:

T ................................................................................................................................................

C ................................................................................................................................................

L ................................................................................................................................................
[3]

(d) State two other ways the algorithm can be made easier to understand and maintain.

1 ................................................................................................................................................

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

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

...................................................................................................................................................
[2]

© UCLES 2023 0478/21/O/N/23 [Turn over


6

7 Consider this logic circuit.

B X

(a) Write a logic expression for this logic circuit. Do not attempt to simplify this logic expression.

X = ............................................................................................................................................

...................................................................................................................................................
[4]

(b) Complete the truth table from the given logic circuit.

Working space
A B C X

0 0 0

0 0 1

0 1 0

0 1 1

1 0 0

1 0 1

1 1 0

1 1 1

[4]

© UCLES 2023 0478/21/O/N/23


8

8 A programmer is designing an algorithm to calculate the cost of a length of rope.


The program requirements are:
• input two values: the length of rope in metres Length and the cost of one metre Cost
• perform a validation check on the length to ensure that the value is between 0.5 and 6.0
inclusive
• calculate the price Price
• output the price rounded to two decimal places.

Use the variable names given.

(a) State the name of the validation check.

............................................................................................................................................. [1]

(b) Complete the flowchart for this algorithm.

START

STOP

[6]
© UCLES 2023 0478/21/O/N/23
9

(c) Give two different sets of test data for this algorithm and state the purpose of each set.

Set 1 .........................................................................................................................................

Purpose ....................................................................................................................................

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

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

Set 2 .........................................................................................................................................

Purpose ....................................................................................................................................

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

...................................................................................................................................................
[4]

(d) Complete the headings for the trace table to show a dry-run for this algorithm.
You do not need to trace the algorithm.

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

[3]

(e) Describe an improvement that should be made to the requirements for this algorithm.

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

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

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

............................................................................................................................................. [2]

© UCLES 2023 0478/21/O/N/23 [Turn over


10

9 A model shop wants to set up a database to help with stock control of the model figures available
for sale. The shop wants to store this information about the model figures:
Field 1 – catalogue number, for example MD1234
Field 2 – description, for example ‘small white dog’
Field 3 – number in stock, for example 5
Field 4 – the price of each model, for example 7.40
Field 5 – if the model has already been painted, yes or no.

(a) The shop needs five fields for each record.


Give a suitable name and data type for each field.

Field 1 name .............................................................................................................................

Data type ..................................................................................................................................

Field 2 name ..............................................................................................................................

Data type ..................................................................................................................................

Field 3 name .............................................................................................................................

Data type ..................................................................................................................................

Field 4 name .............................................................................................................................

Data type ..................................................................................................................................

Field 5 name .............................................................................................................................

Data type ..................................................................................................................................


[5]

(b) (i) Give the name of the field that should be used for the primary key.

..................................................................................................................................... [1]

(ii) State why this field is used as the primary key.

..................................................................................................................................... [1]

(c) Structured query language (SQL) is used to query data stored in this database.
State what these SQL commands are used for.

SELECT .....................................................................................................................................

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

FROM .........................................................................................................................................

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

WHERE .......................................................................................................................................

...................................................................................................................................................
[3]

© UCLES 2023 0478/21/O/N/23


12

10 Drama students put on a performance of a play for one evening. Seats in a small theatre can be
booked for this performance.

The theatre has 10 rows of 20 seats. The status of the seat bookings for the evening is held in the
two-dimensional (2D) Boolean array Evening[]

Each element contains FALSE if the seat is available and TRUE if the seat is booked.

Up to and including four seats can be booked at one time. Seats are allocated in order from those
available. A row or seat number cannot be requested.

The array Evening[] has already been set up and some data stored.

Write a program that meets the following requirements:


• counts and outputs the number of seats already booked for the evening
• allows the user to input the number of seats required
• validates the input
• checks if enough seats are available:
– if they are available
○ changes the status of the seats
○ outputs the row number and seat number for each seat booked
– if they are not available:
○ outputs a message giving the number of seats left or ‘House full’ if the theatre is fully
booked.

You must use pseudocode or program code and add comments to explain how your code works.
You do not need to declare any arrays or variables; you may assume that this has already been
done.
You do not need to initialise the data in the array Evening[]
All inputs and outputs must contain suitable messages.

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

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

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

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

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

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

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

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

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

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

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

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

© UCLES 2023 0478/21/O/N/23


13

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

..........................................................................................................................................................
© UCLES 2023 0478/21/O/N/23 [Turn over
14

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

.................................................................................................................................................. [15]

© UCLES 2023 0478/21/O/N/23


Cambridge IGCSE™
* 3 4 3 5 3 7 0 0 4 3 *

COMPUTER SCIENCE 0478/22


Paper 2 Algorithms, Programming and Logic October/November 2023

1 hour 45 minutes

You must answer on the question paper.

No additional materials are needed.

INSTRUCTIONS
● Answer all questions.
● Use a black or dark blue pen. You may use an HB pencil for any diagrams or graphs.
● Write your name, centre number and candidate number in the boxes at the top of the page.
● Write your answer to each question in the space provided.
● Do not use an erasable pen or correction fluid.
● Do not write on any bar codes.
● Calculators must not be used in this paper.

INFORMATION
● The total mark for this paper is 75.
● The number of marks for each question or part question is shown in brackets [ ].
● No marks will be awarded for using brand names of software packages or hardware.

This document has 16 pages. Any blank pages are indicated.

DC (RW/SG) 314039/4
© UCLES 2023 [Turn over
2

1 Tick (✓) one box to complete the sentence.

Verification is used to make sure that a value entered

A has not changed during input.

B is an integer.

C is correct.

D is not a string.
[1]

2 A type of validation check is a length check. Another type of validation check is used to make sure
that any date entered is in the dd/mm/yyyy style:
dd means day, mm means month and yyyy means year.

(a) State the type of validation check used.

............................................................................................................................................. [1]

(b) Give one example of normal test data and one example of abnormal test data you should
use to make sure the check in part (a) is working properly.

State a reason for each of your choices of test data.

Normal ......................................................................................................................................

Reason .....................................................................................................................................

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

Abnormal ..................................................................................................................................

Reason .....................................................................................................................................

...................................................................................................................................................
[4]

(c) Describe how a length check could be used with the date entered.

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

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

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

............................................................................................................................................. [2]

© UCLES 2023 0478/22/O/N/23


3

3 Four pseudocode statements and five pseudocode uses are shown.

(a) Draw one line to link each pseudocode statement to the most appropriate pseudocode use.

Not all pseudocode uses will be required.

Pseudocode statement Pseudocode use

CALL Colour(NewColour) counting

finding an average
Value (A1 + A2 + A3) / 3

totalling

Loop1 Loop1 + 1
using a conditional statement

IF Count > 7 THEN X1 0 using a procedure


[4]

(b) A one‑dimensional (1D) array called Temperatures[] has 25 elements beginning at


index 1. It holds values that range between –20 and 100 inclusive.

Write a pseudocode algorithm using a single loop to find the lowest value in this array and
output the result only once.

You do not need to declare or populate this array.

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

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

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

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

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

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

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

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

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

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

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

............................................................................................................................................. [4]
© UCLES 2023 0478/22/O/N/23 [Turn over
4

4 An algorithm has been written in pseudocode to allow the names of 50 cities and their countries to
be entered and stored in a two‑dimensional (2D) array. The contents of the array are then output.

01 DECLARE City ARRAY[1:50, 1:2] OF BOOLEAN


02 DECLARE Count : INTEGER
03 DECLARE Out : INTEGER
04 Count 1
05 IF
06 OUTPUT "Enter the name of the city"
07 INPUT City[Count, 2]
08 OUTPUT "Enter the name of the country"
09 INPUT City[Count, 2]
10 Count Count + 1
11 UNTIL Count = 50
12 FOR Out 1 TO 1
13 OUTPUT "The city ", City[Out, 1], " is in ", City[Out, 2]
14 NEXT Out

(a) Identify the four errors in the pseudocode and suggest corrections.

Error 1 .......................................................................................................................................

Correction .................................................................................................................................

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

Error 2 .......................................................................................................................................

Correction .................................................................................................................................

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

Error 3 .......................................................................................................................................

Correction .................................................................................................................................

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

Error 4 .......................................................................................................................................

Correction .................................................................................................................................

...................................................................................................................................................
[4]

© UCLES 2023 0478/22/O/N/23


5

(b) Describe the changes you should make to the corrected algorithm to allow the name of a
country to be input and to display only the stored cities from that country.

You do not need to rewrite the algorithm.

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

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

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

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

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

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

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

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

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

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

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

............................................................................................................................................. [5]

5 Explain how variables and constants should be used when creating and running a program.

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

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

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

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

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

.................................................................................................................................................... [3]

© UCLES 2023 0478/22/O/N/23 [Turn over


6

6 The flowchart represents an algorithm that performs a process on groups of values that are input.
The algorithm will fail if the first value of any group is 0.

An input of –1 will terminate the algorithm.

START

Total 0
OUTPUT
"Average is ",
Average
Count 0

INPUT OUTPUT
Value "Total is ",
Total

IS Yes
Value = Average Total / Count
0 ?

No

IS Yes
Value = STOP
–1 ?

No

Total Total + Value

Count Count + 1

© UCLES 2023 0478/22/O/N/23


7

(a) Complete the trace table for the input data:

25, 35, 3, 0, 57, 20, 25, 18, 0, –1, 307, 40, 0

Value Average Total Count OUTPUT

[5]

(b) Describe the purpose of the algorithm.

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

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

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

............................................................................................................................................. [2]

© UCLES 2023 0478/22/O/N/23 [Turn over


8

7 The string operation SUBSTRING(Quote, Start, Number) returns a string from Quote
beginning at position Start that is Number characters long. The first character in Quote is in
position 1.

Write pseudocode statements to:


• store the string "Learning Never Exhausts The Mind" in Quote
• extract and display the words "The Mind" from the string
• output the original string in lower case.

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

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

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

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

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

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

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

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

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

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

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

.................................................................................................................................................... [5]

8 Explain why a programmer would use procedures and parameters when writing a program.

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

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

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

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

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

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

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

.................................................................................................................................................... [4]

© UCLES 2023 0478/22/O/N/23


9

9 Consider the logic expression:

Z = (A NAND B) OR NOT (B XOR C)

(a) Draw a logic circuit for this logic expression.

Each logic gate must have a maximum of two inputs.

Do not simplify this logic expression.

B Z

[4]

(b) Complete the truth table from the given logic expression.

Working space
A B C Z

0 0 0

0 0 1

0 1 0

0 1 1

1 0 0

1 0 1

1 1 0

1 1 1
[4]

© UCLES 2023 0478/22/O/N/23 [Turn over


10

10 A database table called Horses stores details about the horses kept at a horse sanctuary.

Code Breed BreedOrigin Gender Age Arrived


H002 Arabian Saudi Arabia M 5 28/09/2022
H004 Percheron France M 5 30/10/2022
H010 Friesian Netherlands M 6 15/11/2022
H011 Fjord Norway F 4 17/11/2022
H012 Clydesdale Scotland M 10 18/11/2022
H015 Arabian Saudi Arabia F 5 15/12/2022
H016 Arabian Saudi Arabia F 5 15/12/2022
H017 Clydesdale Scotland F 4 16/01/2023
H019 Percheron France M 3 16/01/2023
H025 Percheron France M 7 16/01/2023
H026 Clydesdale Scotland F 9 20/01/2023
H030 Clydesdale Scotland M 12 20/01/2023
H032 Fjord Norway M 3 24/03/2023
H033 Arabian Saudi Arabia F 15 27/04/2023
H034 Clydesdale Scotland F 4 14/06/2023
H035 Fjord Norway M 7 15/06/2023
H036 Friesian Netherlands F 15 20/07/2023
H037 Friesian Netherlands M 12 20/07/2023

(a) State the number of records in this database table.

............................................................................................................................................. [1]

(b) Give the name of the field that is most suitable to be the primary key.

State the reason for this choice.

Field ..........................................................................................................................................

Reason .....................................................................................................................................

...................................................................................................................................................
[2]

© UCLES 2023 0478/22/O/N/23


11

(c) The database only allows the data types:


• Boolean
• character
• date/time
• integer
• real
• text.

Complete the table to show the most appropriate data type for each field.
Each data type must be different.

Field Data type


Breed

Gender

Age

Arrived
[2]

(d) Complete the structured query language (SQL) to return the code and breed of all the horses
whose breed originated in Scotland.

......................................... Code, Breed,

FROM .........................................

WHERE ......................................... = "Scotland";


[3]

© UCLES 2023 0478/22/O/N/23 [Turn over


12

11 A wood flooring company stores the names of up to 100 customers in a one‑dimensional (1D) array
Customers[]. A two‑dimensional (2D) array Quotations[] stores details of each customer’s
quotation:
• length of room (one decimal place)
• width of room (one decimal place)
• area of wood required (rounded up to next whole number)
• choice of wood index (whole number)
• price of wood required in dollars (two decimal places).

The floor measurements (room length and room width) are taken in metres. All floors are rectangles
and room measurements must be between 1.5 and 10.0 inclusive.

The index of any customer’s data is the same in both arrays. For example, a customer named in
index 4 of Customers[] corresponds to the data in index 4 of Quotations[]

The wood choices available are:

Index Wood type Price per square metre ($)


1 Laminate 29.99
2 Pine 39.99
3 Oak 54.99

The data are stored in two 1D arrays named WoodType[] and Price[]. The index of the wood
type and price in their arrays share the same index number.

Write a program that meets the following requirements:


• input a new customer’s name, room length and room width
• check that each measurement is valid
• output an error message and require the measurement to be re‑entered until it is valid
• calculate the area of the room by multiplying together the length of the room and the width of
the room
• input the choice of wood and find its price per square metre
• calculate the price of the wood needed
• store all data in the relevant array
• output the customer’s quotation to include: the name of the customer, the choice of wood and
the calculated price of the wood required
• continue to accept the next customer.

You must use pseudocode or program code and add comments to explain how your code works.
You do not need to declare any arrays or variables; you may assume that this has already been
done.

You will need to initialise WoodType[] and Price[]

All inputs and outputs must contain suitable messages.

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

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

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

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

..........................................................................................................................................................
© UCLES 2023 0478/22/O/N/23
13

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

..........................................................................................................................................................
© UCLES 2023 0478/22/O/N/23 [Turn over
14

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

.................................................................................................................................................. [15]

© UCLES 2023 0478/22/O/N/23


Cambridge IGCSE™
* 2 5 0 4 8 4 8 1 1 1 *

COMPUTER SCIENCE 0478/23


Paper 2 Algorithms, Programming and Logic October/November 2023

1 hour 45 minutes

You must answer on the question paper.

No additional materials are needed.

INSTRUCTIONS
● Answer all questions.
● Use a black or dark blue pen. You may use an HB pencil for any diagrams or graphs.
● Write your name, centre number and candidate number in the boxes at the top of the page.
● Write your answer to each question in the space provided.
● Do not use an erasable pen or correction fluid.
● Do not write on any bar codes.
● Calculators must not be used in this paper.

INFORMATION
● The total mark for this paper is 75.
● The number of marks for each question or part question is shown in brackets [ ].
● No marks will be awarded for using brand names of software packages or hardware.

This document has 16 pages. Any blank pages are indicated.

DC (CJ/CT) 313523/5
© UCLES 2023 [Turn over
2

1 Tick (3) one box to show which term is an example of a verification check.

A Double entry check

B Format check

C Length check

D Presence check
[1]

2 Tick (3) one box to show which library routine returns the remainder of a division.

A DIV

B MOD

C RANDOM

D ROUND
[1]

© UCLES 2023 0478/23/O/N/23


3

3 (a) Four pseudocode descriptions and five pseudocode keywords are shown.

Draw one line to link each pseudocode description to the most appropriate pseudocode
keyword. Not all pseudocode keywords will be used.

Pseudocode description Pseudocode keyword

stores data in a file OUTPUT

WRITE
retrieves data from a file

READ

displays data on a screen


OPEN

enters data from a keyboard INPUT

[4]

(b) Give two reasons for storing data in a file.

1 ................................................................................................................................................

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

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

...................................................................................................................................................
[2]

© UCLES 2023 0478/23/O/N/23 [Turn over


4

4 A programmer is writing a data entry program for booking theatre seats.


The programmer needs the program to accept only whole numbers that are greater than or equal
to one and less than or equal to six.

(a) Give the names of two validation checks that are required for this program.

1 ................................................................................................................................................

2 ................................................................................................................................................
[2]

(b) Complete this pseudocode to perform your two validation checks, using your answers given
in (a):

OUTPUT "Please enter the number of seats you want to book "

INPUT Seats

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

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

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

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

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

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

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

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

...................................................................................................................................................
[5]

(c) Give one item of test data to use when testing this program.
State the reason for your choice of test data.

Test data ...................................................................................................................................

Reason for choice .....................................................................................................................

...................................................................................................................................................
[2]

© UCLES 2023 0478/23/O/N/23


6

5 An algorithm has been written in pseudocode to check if a new password is in a list of previously
used passwords OldList[]
If the password is not found, the new password will be stored at the end of the list to replace
"XXXX" already stored there.

01 OUTPUT "Enter your new password "


02 INPUT NewPassword
03 Posn 1
04 Found FALSE
05 REPEAT
06 IF Password = OldList[Posn]
07 THEN
08 Found TRUE
09 ELSE Posn Posn + 1
10 ENDIF
11 UNTIL Found AND OldList[Posn] = "XXXX"
12 IF Found
13 THEN
14 OUTPUT "Password has been used before"
15 ELSE
16 INPUT "New password accepted"
17 OldList[Posn] NewPassword
18 ENDIF

(a) Identify the three errors in the pseudocode and suggest corrections.

Error 1 .......................................................................................................................................

Correction .................................................................................................................................

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

Error 2 .......................................................................................................................................

Correction .................................................................................................................................

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

Error 3 .......................................................................................................................................

Correction .................................................................................................................................

...................................................................................................................................................
[3]

© UCLES 2023 0478/23/O/N/23


7

(b) Complete this flowchart for the corrected algorithm:

START

STOP

[6]

© UCLES 2023 0478/23/O/N/23 [Turn over


8

6 There are three descriptions of logic gates. Each logic gate has two inputs A and B with one
output X.
Identify each logic gate.
Complete a truth table for each logic gate.

(a) The only time the output is 1 is when both inputs are 1.
A B X
Logic gate ...............................................
0 0
Complete the truth table for this description.
0 1

1 0

1 1

[2]

(b) The output is 1 when both inputs are different.


A B X
Logic gate ...............................................
0 0
Complete the truth table for this description.
0 1

1 0

1 1

[2]

(c) The only time the output is 1 is when both inputs are 0.
A B X
Logic gate ...............................................
0 0
Complete the truth table for this description.
0 1

1 0

1 1

[2]

© UCLES 2023 0478/23/O/N/23


9

(d) Consider this logic expression:

X = (NOT A OR NOT B) OR NOT C

Draw a logic circuit for this logic expression. Each logic gate must have a maximum of two
inputs. Do not attempt to simplify this logic expression.

B X

[5]

7 A program uses both local variables and global variables.

Describe two differences between local variables and global variables.

Difference 1 ......................................................................................................................................

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

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

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

Difference 2 ......................................................................................................................................

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

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

..........................................................................................................................................................
[4]

© UCLES 2023 0478/23/O/N/23 [Turn over


10

8 This is an algorithm to find if a batch of parts has been manufactured successfully.

START

Accept 0
Reject 0

INPUT PartOK

No
IS PartOK Reject Reject + 1
= 'Y'?
Yes

Accept Accept + 1

No IS Accept
= 10 ?

Yes

Yes
IS Reject Error Reject/Accept * 100
> 1?

No
OUTPUT
"Too many rejected ",
OUTPUT Error, "% error"
"Success"

STOP

© UCLES 2023 0478/23/O/N/23


11

(a) Complete the trace table using this data:


Y, Y, Y, N, Y, Y, Y, Y, N, Y, Y, Y, Y

Accept Reject PartOK Error OUTPUT

[5]

(b) Describe how the algorithm should be changed to accept ‘Y’ or ‘y’ for a successfully
manufactured part.

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

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

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

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

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

............................................................................................................................................. [3]

© UCLES 2023 0478/23/O/N/23 [Turn over


12

9 A sanctuary for pheasants has set up a new database table called PheasantList to store details
of the different species of bird at the sanctuary. Part of this table is given, showing: species,
description, number of birds at the sanctuary, if the birds are breeding or not, and number of
young born this year.

Species Description NumberBirds Breeding Young


Edwards blue-black with white tail 5 Yes 0
Japanese green dark green with pale grey tail 2 Yes 2
Reeves golden, white and red scaled plumage 4 Yes 1
Crawfords Kalij glossy blue-black plumage 4 No 0
Crested fireback blue-black with black tail 3 No 0
True silver white laced top half and black lower half 7 Yes 1
Siamese fireback grey plumage with crimson legs and feet 5 No 0
Mikado iridescent plumage with white striped wings 3 Yes 4
Red junglefowl many colours 2 Yes 0
Himalayan monal many colours with metallic green crest 3 Yes 2
White eared white with ear tufts 5 Yes 3
Brown eared brown with ear tufts 9 Yes 1
Ring necked long tail with white ring neck 2 Yes 2
Golden rainbow coloured 3 Yes 4

(a) State the number of records and fields in this part of the database table.

Records .....................................................................................................................................

Fields .........................................................................................................................................
[2]

(b) (i) Give the name of a field that could be used for the primary key.

..................................................................................................................................... [1]

(ii) Explain why the sanctuary might decide not to use the field in (b)(i) as the primary key.

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

..................................................................................................................................... [1]

(iii) A new field SpeciesID is added to the database table.


This field contains a six-character code, for example Ph0001.

Give a reason why this field would be a better primary key.

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

..................................................................................................................................... [1]

© UCLES 2023 0478/23/O/N/23


13

(c) Write the output that would be given by this structured query language (SQL) statement:

SELECT Species, Description

FROM PheasantList

WHERE NumberBirds > 6;

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

............................................................................................................................................. [2]

(d) Complete this SQL statement to display all the species of pheasant where the birds are
breeding and there were no young born this year:

SELECT ....................................................................................................................................

FROM ........................................................................................................................................

WHERE ......................................................................................................................................

.............................................................................................................................................. ;
[4]

© UCLES 2023 0478/23/O/N/23 [Turn over


14

10 A weather station takes temperature readings once an hour for a week. These temperatures are
stored in a two-dimensional (2D) array Temperatures[]
Each column contains 24 readings for a single day. The first temperature is recorded at 00:00 and
the final temperature at 23:00. There are seven columns, one for each day of the week, starting
with Monday and ending with Sunday.

The variables MaxDay, MinDay and AvDay are used to store the maximum, minimum, and
average temperatures for a day. The variables MaxWeek, MinWeek and AvWeek are used to store
the maximum, minimum, and average temperatures for the week.

The array has already been set up and the data stored.

Write a program that meets the following requirements:


• finds the maximum and minimum temperatures for each day
• calculates the average temperature for each day
• outputs for each day:
– name of the day, for example Monday
– maximum temperature
– minimum temperature
– average temperature
• finds the maximum and minimum temperatures for the week
• calculates the average temperature for the week
• outputs:
– maximum temperature for the week
– minimum temperature for the week
– average temperature for the week.

All temperatures output must be rounded to two decimal places.

You must use pseudocode or program code and add comments to explain how your code works.
All inputs and outputs must contain suitable messages.

You do not need to declare any arrays or variables; you may assume that this has already been
done.
You do not need to initialise the data in the array Temperatures[]

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

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

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

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

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

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

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

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

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

..........................................................................................................................................................
© UCLES 2023 0478/23/O/N/23
15

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

..........................................................................................................................................................
© UCLES 2023 0478/23/O/N/23 [Turn over
16

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

.................................................................................................................................................. [15]

Permission to reproduce items where third-party owned material protected by copyright is included has been sought and cleared where possible. Every
reasonable effort has been made by the publisher (UCLES) to trace copyright holders, but if any items requiring clearance have unwittingly been included, the
publisher will be pleased to make amends at the earliest possible opportunity.

To avoid the issue of disclosure of answer-related information to candidates, all copyright acknowledgements are reproduced online in the Cambridge
Assessment International Education Copyright Acknowledgements Booklet. This is produced for each series of examinations and is freely available to download
at www.cambridgeinternational.org after the live examination series.

Cambridge Assessment International Education is part of Cambridge Assessment. Cambridge Assessment is the brand name of the University of Cambridge
Local Examinations Syndicate (UCLES), which is a department of the University of Cambridge.

© UCLES 2023 0478/23/O/N/23

You might also like