Computer Science (0478) · Oct/Nov 2024 · Question paper 23
Cambridge Computer Science (0478) question paper for paper 23, Oct/Nov 2024 — 0478/23/O/N/24, file 0478_w24_qp_23.pdf.
Text of this paper
www.dynamicpapers.com
* 0000800000001 *
,
,
Cambridge IGCSE™
¬O. 4mHuOªE]y6W
¬cGyP¤|b¢A
¥ eu5¥Uee EEUEU
* 6 7 8 6 6 0 2 0 7 8 *
COMPUTER SCIENCE
Paper 2 Algorithms, Programming and Logic
0478/23
October/November 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 (DE/SW) 336229/3
© UCLES 2024
[Turn over
DO NOT WRITE IN THIS MARGIN
www.dynamicpapers.com
* 0000800000002 *
2
2
3
Tick (✓) one box to show which of the following is used to validate data on input.
A
checksum
B
double entry check
C
type check
D
visual check
[1]
DO NOT WRITE IN THIS MARGIN
1
,
Tick (✓) one box to show a method used to construct a solution to a problem.
A
abstraction
B
structure diagram
C
test data
D
variable
[1]
Four logic gates and five logic gate symbols are shown.
Draw one line to link each logic gate to its correct symbol. Not all logic gate symbols will be used.
Logic gate symbol
Logic gate
DO NOT WRITE IN THIS MARGIN
AND
DO NOT WRITE IN THIS MARGIN
,
NAND
XOR
© UCLES 2024
ĬÍĊ®Ġ´íÈõÏĪÅĊàû¸þ×
ĬãÅúÍĨĎĎÙíñó°ėÒùėĂ
ĥÕµĕµÕåµĕÕõÅÅÕåĕĥÕ
[4]
0478/23/O/N/24
DO NOT WRITE IN THIS MARGIN
NOR
www.dynamicpapers.com
DO NOT WRITE IN THIS MARGIN
* 0000800000003 *
3
,
4
,
Complete the paragraph about databases. Use terms from the list. You may need to use a term
more than once. Some of the terms in the list will not be used.
fields
table
comments
columns
constant
key
primary key
program
records
rows
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
scripts
database
validation
variable
Database tables consist of and .
Rows are .
are fields.
Structured query language (SQL) are used to query data.
A uniquely identifies a record.
5
[6]
One stage of the program development life cycle is the analysis stage.
Identify and describe two other stages of the program development life cycle.
Stage
Description
DO NOT WRITE IN THIS MARGIN
Stage
Description
DO NOT WRITE IN THIS MARGIN
[6]
© UCLES 2024
ĬÏĊ®Ġ´íÈõÏĪÅĊàù¸þ×
ĬãÆùÕĢĒĞàċ¶ĬğĆùħĂ
ĥÕÅÕõµÅÕąååÅŵÅÕõÕ
0478/23/O/N/24
[Turn over
4
,
6
,
An incomplete algorithm has been written in pseudocode to count the number of values stored in
an array and to find their average.
Values have been stored in the array starting at A[1]
All the values to be counted are non-zero.
A value of zero in the array indicates there are no more values stored.
01 DECLARE A : ARRAY[1:50] OF INTEGER
DO NOT WRITE IN THIS MARGIN
www.dynamicpapers.com
* 0000800000004 *
02 DECLARE C : INTEGER
0
06 C
07 WHILE A[C] <> 0
08
W
09
C
C + 1
10 ENDWHILE
11 X
(a) Complete the given pseudocode algorithm.
[3]
(b) Write pseudocode to display, with suitable messages:
•
•
the number of values stored in the array
the average of those values stored.
[3]
© UCLES 2024
ĬÍĊ®Ġ´íÈõÏĪÅĊÞû¸Ā×
ĬãÆüÕĬĤīÛąćÊÃèĩďĂ
ĥĥĕÕµµÅõĥąÕÅąµĥÕĥÕ
0478/23/O/N/24
DO NOT WRITE IN THIS MARGIN
05 W
DO NOT WRITE IN THIS MARGIN
04 DECLARE X : INTEGER
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
03 DECLARE W : INTEGER
www.dynamicpapers.com
DO NOT WRITE IN THIS MARGIN
* 0000800000005 *
5
,
,
(c) Meaningful identifiers have not been used in this algorithm.
Suggest suitable meaningful identifiers for:
The array
A
DO NOT WRITE IN THIS MARGIN
The variables
C
X
W
[3]
7
A programmer is testing a program that requires a positive value between 1 and 100 inclusive to
be entered. The range check in the program is to be tested.
DO NOT WRITE IN THIS MARGIN
Identify three different types of test data to be used.
For each type of test data, give an example of the value(s) to be used and the expected outcome.
Type 1
Example
Outcome
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
Type 2
Example
Outcome
Type 3
Example
Outcome
[9]
© UCLES 2024
ĬÏĊ®Ġ´íÈõÏĪÅĊÞù¸Ā×
ĬãÅûÍĞĠěÞóúüĎ»ôĩğĂ
ĥĥĥĕõÕåĕõõąÅąÕąĕõÕ
0478/23/O/N/24
[Turn over
6
air conditioning A
temperature T
heater H
window W
air conditioning off
0
air conditioning on
1
not too high
0
too high
1
heater off
0
heater on
1
window closed
0
window open
1
DO NOT WRITE IN THIS MARGIN
A logic circuit is to be built to control the automatic opening of a window. The window W opens if
the temperature T is too high, the heater H is off, and the air conditioning A is off.
Complete the truth table for this problem.
T
H
0
0
0
0
0
1
0
1
0
0
1
1
1
0
0
1
0
1
1
1
0
1
1
1
W
DO NOT WRITE IN THIS MARGIN
A
[4]
© UCLES 2024
ĬÑĊ®Ġ´íÈõÏĪÅĊßùµþ×
ĬãÆûÒĨĈđæøċāîÃđÁďĂ
ĥµÅĕõõåµµĕåÅÅÕåÕåÕ
0478/23/O/N/24
DO NOT WRITE IN THIS MARGIN
8
,
DO NOT WRITE IN THIS MARGIN
,
DO NOT WRITE IN THIS MARGIN
www.dynamicpapers.com
* 0000800000006 *
www.dynamicpapers.com
7
,
9
,
A flowchart checks that values stored in three variables are identical.
If they are different, the highest value is stored in all three variables.
START
Is A = B AND
B = C ?
No
STOP
Yes
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
* 0000800000007 *
Is A >= B OR
A >= C ?
Yes
B
C
A
A
A
C
B
B
No
Is B >= A AND
B >= C ?
Yes
DO NOT WRITE IN THIS MARGIN
No
A
B
C
C
Identify four errors in the flowchart and suggest a correction for each error. You may label each
error on the diagram with the corresponding error number.
Error 1
DO NOT WRITE IN THIS MARGIN
Correction
Error 2
Correction
Error 3
DO NOT WRITE IN THIS MARGIN
Correction
Error 4
Correction
[4]
© UCLES 2024
ĬÓĊ®Ġ´íÈõÏĪÅĊßûµþ×
ĬãÅüÚĢČġÓĂöÈê»ÅÁğĂ
ĥµµÕµĕÅÕåĥõÅŵÅĕµÕ
0478/23/O/N/24
[Turn over
,
10 An algorithm has been written in pseudocode to check that a password meets a set of rules.
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
OUTPUT "Please enter password "
INPUT Password
TRUE
Accept
IF LENGTH(Password) < 8 OR LENGTH(Password) > 20
THEN
FALSE
Accept
ENDIF
IF LCASE(Password) = Password OR UCASE(Password) = Password
THEN
FALSE
Accept
ENDIF
1
Index
FALSE
Found
WHILE NOT Found AND Accept AND Index < LENGTH(Password)
IF SUBSTRING(Password, Index, 1) = '!'
THEN
TRUE
Found
ENDIF
Index + 1
Index
ENDWHILE
IF NOT Found
THEN
FALSE
Accept
ENDIF
IF Accept
THEN
OUTPUT "Accepted"
ELSE
OUTPUT "Rejected"
ENDIF
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
8
,
DO NOT WRITE IN THIS MARGIN
www.dynamicpapers.com
* 0000800000008 *
Password
© UCLES 2024
Accept
ĬÑĊ®Ġ´íÈõÏĪÅĊÝùµĀ×
ĬãÅùÚĬúĨèĀí¿ČėħÑėĂ
ĥąĥÕõĕÅõÅÅąÅąµĥĕåÕ
Index
Found
0478/23/O/N/24
OUTPUT
DO NOT WRITE IN THIS MARGIN
Data: MYWORD
DO NOT WRITE IN THIS MARGIN
(a) Complete the three trace tables using the data shown for each one.
www.dynamicpapers.com
9
,
,
Data: M!word
Password
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
* 0000800000009 *
Accept
Index
Found
OUTPUT
Accept
Index
Found
OUTPUT
Data: My!Hidden
DO NOT WRITE IN THIS MARGIN
Password
DO NOT WRITE IN THIS MARGIN
[6]
(b)
State the rules that the password must meet.
DO NOT WRITE IN THIS MARGIN
[3]
© UCLES 2024
ĬÓĊ®Ġ´íÈõÏĪÅĊÝûµĀ×
ĬãÆúÒĞöĘÑúĄĊÐğ³ÑħĂ
ĥąĕĕµõåĕÕµÕÅąÕąÕµÕ
0478/23/O/N/24
[Turn over
Building materials are sold in bags. A new database table called BuildStock has been set up to
store details about the materials for sale. Part of this table is given.
MtNo
Name
InStock
WeightKg
PricePerBag
NumberBags
MT01
Builders sand
Yes
50
4.50
50
MT02
Sharp sand
Yes
25
3.50
21
MT03
Red sand
No
50
2.75
0
MT04
Cement
No
25
6.85
0
MT05
Chippings
Yes
50
35.00
50
MT06
Cobbles
No
75
67.35
0
MT07
Pebbles small
Yes
50
34.50
3
MT08
Pebbles medium
Yes
25
25.50
10
MT12
Pebbles large
Yes
75
62.75
20
MT15
Washed gravel
Yes
50
12.75
12
MT16
Pea gravel
Yes
100
15.95
24
(a) Write the output from this structured query language (SQL) statement.
SELECT MtNo, Name
FROM BuildStock
WHERE WeightKg = 75
ORDER BY PricePerBag;
DO NOT WRITE IN THIS MARGIN
11
,
DO NOT WRITE IN THIS MARGIN
10
,
DO NOT WRITE IN THIS MARGIN
www.dynamicpapers.com
* 0000800000010 *
Complete this SQL statement to display only the names of all the materials that are out
of stock.
SELECT
FROM
WHERE
[2]
(ii)
Explain how another SQL statement using a different field could be used to display the
same information.
[2]
© UCLES 2024
ĬÑĊ®Ġ´íÈõÏĪÅĊàù·þ×
ĬãÈùÓĪòòêćöĥĨĕăĩğĂ
ĥÕąĕõĕĥõĥõąąąĕĥĕĕÕ
0478/23/O/N/24
DO NOT WRITE IN THIS MARGIN
(b) (i)
DO NOT WRITE IN THIS MARGIN
[3]
www.dynamicpapers.com
11
,
,
BLANK PAGE
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
* 0000800000011 *
© UCLES 2024
ĬÓĊ®Ġ´íÈõÏĪÅĊàû·þ×
ĬãÇúÛĠîĂÏñċä´ĝ×ĩďĂ
ĥÕõÕµõąĕõąÕąąõąÕąÕ
0478/23/O/N/24
[Turn over
12 Members of a litter picking group complete a litter pick every month. Members’ names are stored
in one-dimensional (1D) array PickerName[]
Each member stores the weight of the litter they have picked in another one-dimensional (1D)
array PickedWeight[]
The weights are in kilograms with one decimal place, for example 8.4
The position of each member’s data in the two arrays is the same. For example, the member
stored at index 10 in PickerName[] and at index 10 in PickedWeight[] is the same.
Every month, there is a small prize awarded to the members of the group who have the two
heaviest weights. Certificates are awarded to all members with a pick weight of over three
kilograms.
Write a program that meets the following requirements:
•
•
•
•
•
allows the weight of members’ picks to be input and validated
sorts the arrays PickedWeight[] and PickerName[] in descending order of weight
outputs the member names and the pick weights of the members with the two heaviest picks
and identifies them as “Best in Group” and “Second best in Group”
stores the names of all the members who will receive a certificate in the array
PickerCertificate[]
outputs a message stating the number of certificates to be printed.
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.
You do not need to initialise the data in the array PickerName[]
DO NOT WRITE IN THIS MARGIN
,
DO NOT WRITE IN THIS MARGIN
12
,
DO NOT WRITE IN THIS MARGIN
www.dynamicpapers.com
* 0000800000012 *
DO NOT WRITE IN THIS MARGIN
© UCLES 2024
ĬÑĊ®Ġ´íÈõÏĪÅĊÞù·Ā×
ĬãÇûÛĦĀćìïĄëĒÁõùħĂ
ĥĥåÕõõąµĕååąÅõåÕĕÕ
0478/23/O/N/24
DO NOT WRITE IN THIS MARGIN
www.dynamicpapers.com
DO NOT WRITE IN THIS MARGIN
* 0000800000013 *
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/23/O/N/24
[Turn over
14
,
,
DO NOT WRITE IN THIS MARGIN
www.dynamicpapers.com
* 0000800000014 *
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
[15]
© UCLES 2024
ĬÍĊ®Ġ´íÈõÏĪÅĊÝü¶Ă×
ĬãÇúÒĞïÿßÿúÁĪĤåÉďĂ
ĥÅÕÕõõåõĥÅõÅąÕĥÕÕÕ
0478/23/O/N/24
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
www.dynamicpapers.com
15
,
,
BLANK PAGE
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
* 0000800000015 *
© UCLES 2024
ĬÏĊ®Ġ´íÈõÏĪÅĊÝú¶Ă×
ĬãÈùÚĬóïÚùćĈ®ĜñÉğĂ
ĥÅåĕµĕÅĕõµåÅąµąĕÅÕ
0478/23/O/N/24
16
,
,
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 2024
ĬÍĊ®Ġ´íÈõÏĪÅĊßü¶Ą×
ĬãÈüÚĢāúÝ÷ĀÿиÓÙėĂ
ĥõõĕõĕŵĕĕÕÅŵåĕÕÕ
0478/23/O/N/24
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
DO NOT WRITE IN THIS MARGIN
BLANK PAGE
DO NOT WRITE IN THIS MARGIN
www.dynamicpapers.com
* 0000800000016 *