2210 CS OL P2 Topicals 2023-24 A4
2210 CS OL P2 Topicals 2023-24 A4
2 PROGRAMMING 35
3 DATABASE 75
4 BOOLEAN LOGIC 87
PAGE 1
ALGORITHM
DESIGN
AND
PROBLEM
SOLVING
PAGE 2
PAGE 3
1 (a) Four descriptions of stages in the program development life cycle are shown.
Draw one line to link each description to its most appropriate program development life cycle
stage.
Program development life cycle description Program development life cycle stage
coding
1 ................................................................................................................................................
...................................................................................................................................................
2 ................................................................................................................................................
...................................................................................................................................................
3 ................................................................................................................................................
...................................................................................................................................................
[3]
2 Tick (9) one box to show the name of the data structure used to store a collection of data of the
same data type.
A Array
B Constant
C Function
D Variable
[1]
© UCLES 2023 2210/21/M/J/23
PAGE 4
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [2]
(b) A validation check is used to make sure that any value that is input is an integer between 30
and 200 inclusive.
Give one example of each type of test data to check that the validation check is working as
intended. Each example of test data must be different.
Reason .....................................................................................................................................
...................................................................................................................................................
Reason .....................................................................................................................................
...................................................................................................................................................
Reason .....................................................................................................................................
...................................................................................................................................................
[6]
DIV ...................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
ROUND ..............................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
[4]
© UCLES 2023 2210/21/M/J/23 [Turn over
PAGE 5
5 An algorithm has been written in pseudocode to allow some numbers to be input. All the positive
numbers that are input are totalled and this total is output at the end.
An input of 0 stops the algorithm.
01 Exit 1ĸ
02 WHILE Exit <> 0 DO
03 INPUT Number
04 IF Number < 0
05 THEN
06 Total ĸ
Total + Number
07 ELSE
08 IF Number = 0
09 THEN
10 Exit 1 ĸ
11 ENDIF
12 ENDIF
13 ENDIF
14 OUTPUT "The total value of your numbers is ", Number
(a) Identify the four errors in the pseudocode and suggest a correction for each error.
Error 1 .......................................................................................................................................
Correction .................................................................................................................................
...................................................................................................................................................
Error 2 .......................................................................................................................................
Correction .................................................................................................................................
...................................................................................................................................................
Error 3 .......................................................................................................................................
Correction .................................................................................................................................
...................................................................................................................................................
Error 4 .......................................................................................................................................
Correction .................................................................................................................................
...................................................................................................................................................
[4]
START
Pointer 1
INPUT
Letter
IS No
Word[Pointer, 1] Pointer Pointer + 1
= Letter ?
Yes
INPUT Choice
Yes IS No
Choice = STOP
'Y' ?
The table represents the two-dimensional (2D) array Word[] which stores the first half of the
phonetic alphabet used for radio transmission. For example, Word[10,1] is ‘J’.
Index 1 2
1 A Alpha
2 B Bravo
3 C Charlie
4 D Delta
5 E Echo
6 F Foxtrot
7 G Golf
8 H Hotel
9 I India
10 J Juliet
11 K Kilo
12 L Lima
13 M Mike
(a) Complete the trace table for the algorithm by using the input data: F, Y, D, N
[4]
...................................................................................................................................................
............................................................................................................................................. [1]
(c) Describe one problem that could occur with this algorithm if an invalid character was input.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [2]
1 Tick () one box to identify the first stage of the program development life cycle.
A Analysis
B Coding
C Design
D Testing
[1]
2 Four logic gates and five standard symbols for logic gates are shown.
Draw one line to link each logic gate to its standard symbol. Not all standard symbols will be used.
AND
OR
NAND
NOT
[4]
3 Identify three different ways that the design of a solution to a problem can be presented.
1 .......................................................................................................................................................
..........................................................................................................................................................
2 .......................................................................................................................................................
..........................................................................................................................................................
3 .......................................................................................................................................................
..........................................................................................................................................................
[3]
4 A program needs to make sure the value input for a measurement meets the following rules:
• the value is a positive number
• a value is always input
• the value is less than 1000.
(a) Describe the validation checks that the programmer would need to use.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [3]
(b) The program needs editing to include a double entry check for the value input.
...........................................................................................................................................
..................................................................................................................................... [1]
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
..................................................................................................................................... [3]
START
F 0
C 1
IS X[C] < No
T X[C]
X[C + 1]?
Yes
X[C] X[C + 1]
X[C + 1] T
F 1
C C + 1
No
IS C = 5?
Yes
No
IS F = 0?
Yes
STOP
(a) The array X[1:5] used in the flowchart contains this data:
10 1 5 7 11
Complete the trace table by using the data given in the array.
10 1 5 7 11
[5]
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [2]
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.
............................................................................................................................................. [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.
Normal ......................................................................................................................................
Reason .....................................................................................................................................
...................................................................................................................................................
Abnormal ..................................................................................................................................
Reason .....................................................................................................................................
...................................................................................................................................................
[4]
(c) Describe how a length check could be used with the date entered.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [2]
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.
(a) Identify the four errors in the pseudocode and suggest corrections.
Error 1 .......................................................................................................................................
Correction .................................................................................................................................
...................................................................................................................................................
Error 2 .......................................................................................................................................
Correction .................................................................................................................................
...................................................................................................................................................
Error 3 .......................................................................................................................................
Correction .................................................................................................................................
...................................................................................................................................................
Error 4 .......................................................................................................................................
Correction .................................................................................................................................
...................................................................................................................................................
[4]
(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.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [5]
5 Explain how variables and constants should be used when creating and running a program.
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
.................................................................................................................................................... [3]
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.
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
Count Count + 1
[5]
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [2]
1 Tick () one box to show which term is an example of a verification check.
B Format check
C Length check
D Presence check
[1]
2 Tick () one box to show which library routine returns the remainder of a division.
A DIV
B MOD
C RANDOM
D ROUND
[1]
(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.
...................................................................................................................................................
[2]
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.
(a) Identify the three errors in the pseudocode and suggest corrections.
Error 1 .......................................................................................................................................
Correction .................................................................................................................................
...................................................................................................................................................
Error 2 .......................................................................................................................................
Correction .................................................................................................................................
...................................................................................................................................................
Error 3 .......................................................................................................................................
Correction .................................................................................................................................
...................................................................................................................................................
[3]
START
STOP
[6]
10
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
11
[5]
(b) Describe how the algorithm should be changed to accept ‘Y’ or ‘y’ for a successfully
manufactured part.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [3]
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.
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
[4]
(b) Write the pseudocode to use a procedure named Average that passes the values 25 and 50
to the procedure.
...................................................................................................................................................
............................................................................................................................................. [2]
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.
(a) Identify the line numbers of four errors in the pseudocode and suggest corrections.
Correction .................................................................................................................................
...................................................................................................................................................
Correction .................................................................................................................................
...................................................................................................................................................
Correction .................................................................................................................................
...................................................................................................................................................
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]
(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.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [4]
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
.................................................................................................................................................... [5]
START
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 True
Count Count + 1
Numbers
Limit Count [1] [2] [3] [4] [5] [6] [7] Flag Swap Result OUTPUT
[7]
© UCLES 2024 2210/21/M/J/24 [Turn over
PAGE 29
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]
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.
AND
XOR
NAND
OR
[4]
3 Identify three different tasks in the analysis stage of the program development life cycle.
1 .......................................................................................................................................................
..........................................................................................................................................................
2 .......................................................................................................................................................
..........................................................................................................................................................
3 .......................................................................................................................................................
..........................................................................................................................................................
[3]
4 A program needs to make sure the characters input for a product code meet these rules:
(a) Identify three validation checks and state how each check would make sure the product code
met one of these rules.
Check 1 ....................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
Check 2 ....................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
Check 3 ....................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
[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.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
..................................................................................................................................... [2]
(ii) Write the pseudocode to make sure that the first two characters of the product code are
“PD”.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
..................................................................................................................................... [2]
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
,)/LVW>&RXQW@ޗ0LQ
09 THEN
10 Min List[Counter]
11 ENDWHILE
12 NEXT Counter
13 OUTPUT "Maximum value is ", Max
14 OUTPUT "Minimum value is ", Min
(b) Identify the line numbers of the three errors in the pseudocode and suggest a correction for
each error.
Correction .................................................................................................................................
...................................................................................................................................................
Correction .................................................................................................................................
...................................................................................................................................................
Correction .................................................................................................................................
...................................................................................................................................................
[3]
START
A FALSE
B 1
IS List[B] > No
T List[B]
List[B + 1]?
Yes
List[B] List[B + 1]
List[B + 1] T
A TRUE
B B+1
No IS B =
5?
Yes
Yes IS A =
TRUE?
No
STOP
(a) The array List[1:5] used in the flowchart contains this data:
15 17 20 5 9
Complete the trace table using the data given in the array.
[5]
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [2]
© UCLES 2024 2210/22/M/J/24 [Turn over
PAGE 34
PAGE 35
PROGRAMMING
PAGE 36
PAGE 37
1 (a) Four descriptions of stages in the program development life cycle are shown.
Draw one line to link each description to its most appropriate program development life cycle
stage.
Program development life cycle description Program development life cycle stage
coding
1 ................................................................................................................................................
...................................................................................................................................................
2 ................................................................................................................................................
...................................................................................................................................................
3 ................................................................................................................................................
...................................................................................................................................................
[3]
2 Tick (9) one box to show the name of the data structure used to store a collection of data of the
same data type.
A Array
B Constant
C Function
D Variable
[1]
© UCLES 2023 2210/21/M/J/23
PAGE 38
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [2]
(b) A validation check is used to make sure that any value that is input is an integer between 30
and 200 inclusive.
Give one example of each type of test data to check that the validation check is working as
intended. Each example of test data must be different.
Reason .....................................................................................................................................
...................................................................................................................................................
Reason .....................................................................................................................................
...................................................................................................................................................
Reason .....................................................................................................................................
...................................................................................................................................................
[6]
DIV ...................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
ROUND ..............................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
[4]
© UCLES 2023 2210/21/M/J/23 [Turn over
PAGE 39
5 An algorithm has been written in pseudocode to allow some numbers to be input. All the positive
numbers that are input are totalled and this total is output at the end.
An input of 0 stops the algorithm.
01 Exit 1ĸ
02 WHILE Exit <> 0 DO
03 INPUT Number
04 IF Number < 0
05 THEN
06 Total ĸ
Total + Number
07 ELSE
08 IF Number = 0
09 THEN
10 Exit 1 ĸ
11 ENDIF
12 ENDIF
13 ENDIF
14 OUTPUT "The total value of your numbers is ", Number
(a) Identify the four errors in the pseudocode and suggest a correction for each error.
Error 1 .......................................................................................................................................
Correction .................................................................................................................................
...................................................................................................................................................
Error 2 .......................................................................................................................................
Correction .................................................................................................................................
...................................................................................................................................................
Error 3 .......................................................................................................................................
Correction .................................................................................................................................
...................................................................................................................................................
Error 4 .......................................................................................................................................
Correction .................................................................................................................................
...................................................................................................................................................
[4]
10
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [3]
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [2]
14
11 A one-dimensional (1D) array Days[] contains the names of the days of the week. A
two-dimensional (2D) array Readings[] is used to store 24 temperature readings, taken once
an hour, for each of the seven days of the week. A 1D array AverageTemp[] is used to store the
average temperature for each day of the week.
The position of any day’s data is the same in all three arrays. For example, if Wednesday is
in index 4 of Days[], Wednesday’s temperature readings are in index 4 of Readings[] and
Wednesday’s average temperature is in index 4 of AverageTemp[]
The temperature readings are in Celsius to one decimal place. Temperatures can only be from
–20.0 °C to +50.0 °C inclusive.
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.
You will need to initialise and populate the array Days[] at the start of the program.
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
© UCLES 2023 2210/21/M/J/23
PAGE 42
15
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
© UCLES 2023 2210/21/M/J/23 [Turn over
PAGE 43
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.
6 State three different features of a high-level programming language that a programmer could use
to make sure that their program will be easier to understand by another programmer.
Give an example for each feature.
Feature 1 ..........................................................................................................................................
..........................................................................................................................................................
Example ...........................................................................................................................................
..........................................................................................................................................................
Feature 2 ..........................................................................................................................................
..........................................................................................................................................................
Example ...........................................................................................................................................
..........................................................................................................................................................
Feature 3 ..........................................................................................................................................
..........................................................................................................................................................
Example ...........................................................................................................................................
..........................................................................................................................................................
[6]
7 An algorithm has been written in pseudocode to calculate a check digit for a four-digit number.
The algorithm then outputs the five-digit number including the check digit.
The algorithm stops when –1 is input as the fourth digit.
01 Flag FALSE
02 REPEAT
03 Total 0
04 FOR Counter 1 TO 4
05 OUTPUT "Enter a digit ", Counter
06 INPUT Number[Counter]
07 Total Total + Number * Counter
08 IF Number[Counter] = 0
09 THEN
10 Flag TRUE
11 ENDIF
12 NEXT Counter
13 IF NOT Flag
14 THEN
15 Number[5] MOD(Total, 10)
16 FOR Counter 0 TO 5
17 OUTPUT Number[Counter]
18 NEXT
19 ENDIF
20 UNTIL Flag
Totalling ....................................................................................................................................
(b) Identify the three errors in the pseudocode and suggest a correction for each error.
Error 1 .......................................................................................................................................
Correction .................................................................................................................................
...................................................................................................................................................
Error 2 .......................................................................................................................................
Correction .................................................................................................................................
...................................................................................................................................................
Error 3 .......................................................................................................................................
Correction .................................................................................................................................
...................................................................................................................................................
[3]
(c) The algorithm does not check that each input is a single digit.
Identify the place in the algorithm where this check should occur.
Write pseudocode for this check.
Your pseudocode must make sure that the input is a single digit and checks for –1
Pseudocode ..............................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
[4]
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]
11
11 The variables P and Q are used to store data in a program. P stores a string. Q stores a character.
(a) Write pseudocode statements to declare the variables P and Q, store "The world" in P and
store 'W' in Q
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [2]
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [4]
(c) Give the value of Position after the algorithm has been executed with the data in
question 11(a).
...................................................................................................................................................
............................................................................................................................................. [1]
12
12 A two-dimensional (2D) array Account[] contains account holders’ names and passwords for a
banking program.
The amount of money in a bank account can be negative (overdrawn) but not by more than the
overdraft limit.
For example, an account with an overdraft limit of 100.00 must have a balance that is greater than
or equal to –100.00
Suitable error messages must be displayed if a withdrawal cannot take place, for example if the
overdraft limit or the size of withdrawal is exceeded.
The bank account ID gives the index of each account holder’s data held in the two arrays.
For example, account ID 20’s details would be held in:
Account[20,1] and Account[20,2]
AccDetails[20,1] AccDetails[20,2] and AccDetails[20,3]
The arrays and variable Size have already been set up and the data stored.
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 only need to declare any local arrays and local variables that you use.
You do not need to declare and initialise the data in the global arrays Account[] and
AccDetails[] and the variable Size
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
© UCLES 2023 2210/22/M/J/23
PAGE 49
13
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
© UCLES 2023 2210/22/M/J/23 [Turn over
PAGE 50
14
..........................................................................................................................................................
.........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
.................................................................................................................................................. [15]
© UCLES 2023 2210/22/M/J/23
PAGE 51
(a) Draw one line to link each pseudocode statement to the most appropriate pseudocode use.
finding an average
Value (A1 + A2 + A3) / 3
totalling
Loop1 Loop1 + 1
using a conditional statement
Write a pseudocode algorithm using a single loop to find the lowest value in this array and
output the result only once.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [4]
© UCLES 2023 2210/22/O/N/23 [Turn over
PAGE 52
(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.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [5]
5 Explain how variables and constants should be used when creating and running a program.
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
.................................................................................................................................................... [3]
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.
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
.................................................................................................................................................... [5]
8 Explain why a programmer would use procedures and parameters when writing a program.
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
.................................................................................................................................................... [4]
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 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.
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.
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
© UCLES 2023 2210/22/O/N/23
PAGE 55
13
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
© UCLES 2023 2210/22/O/N/23 [Turn over
PAGE 56
14
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
.................................................................................................................................................. [15]
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.
WRITE
retrieves data from a file
READ
[4]
1 ................................................................................................................................................
...................................................................................................................................................
2 ................................................................................................................................................
...................................................................................................................................................
[2]
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]
Difference 1 ......................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
Difference 2 ......................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
[4]
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.
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 2210/23/O/N/23
PAGE 60
15
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
© UCLES 2023 2210/23/O/N/23 [Turn over
PAGE 61
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.
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.
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
[4]
(b) Write the pseudocode to use a procedure named Average that passes the values 25 and 50
to the procedure.
...................................................................................................................................................
............................................................................................................................................. [2]
(c) Outline the role of procedures and functions in creating a program that is easier to maintain.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [3]
Integer ..............................................................................................................................................
..........................................................................................................................................................
Example ...........................................................................................................................................
Real ..................................................................................................................................................
..........................................................................................................................................................
Example ...........................................................................................................................................
[4]
(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.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [4]
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
.................................................................................................................................................... [5]
(b) Outline the processes involved in the algorithm shown in the flowchart on page 6.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [3]
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [2]
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [4]
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.
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.
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
13
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
© UCLES 2024 2210/21/M/J/24 [Turn over
PAGE 68
14
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
.................................................................................................................................................. [15]
© UCLES 2024 2210/21/M/J/24
PAGE 69
5 A high-level programming language makes use of arithmetic, Boolean and logical operators.
Arithmetic .........................................................................................................................................
..........................................................................................................................................................
Example ...........................................................................................................................................
..........................................................................................................................................................
Boolean ............................................................................................................................................
..........................................................................................................................................................
Example ............................................................................................................................................
..........................................................................................................................................................
Logical ..............................................................................................................................................
..........................................................................................................................................................
Example ...........................................................................................................................................
..........................................................................................................................................................
[6]
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.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [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.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [4]
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]
• 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.
• 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’.
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.
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
13
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
© UCLES 2024 2210/22/M/J/24 [Turn over
PAGE 73
14
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
.................................................................................................................................................. [15]
© UCLES 2024 2210/22/M/J/24
PAGE 74
PAGE 75
DATABASE
PAGE 76
PAGE 77
12
10 A database table called TVRange shows the main features and prices of a range of televisions.
(a) Give the name of the field that is most suitable to be the primary key.
Field ..........................................................................................................................................
Reason .....................................................................................................................................
...................................................................................................................................................
[2]
13
Complete the table to show the most appropriate data type for each field.
Each data type must be different.
(c) Complete the structured query language (SQL) query to return the television (TV) code,
screen size and price of all Smart TVs in the database table.
....................................................... TVRange
10
10 A music streaming service has a new database table named Songs to store details of songs
available for streaming. The table contains the fields:
• SongNumber – the catalogue number, for example AG123
• Title – the title of the song
• Author – the name of the song writer(s)
• Singer – the name of the singer(s)
• Genre – the type of music, for example rock
• Minutes – the length of the song in minutes, for example 3.75
• Recorded – the date the song was recorded.
(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 the fields in Songs
SongNumber
Title
Recorded
Minutes
[2]
(c) Explain the purpose of the structured query language (SQL) statements.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [3]
10
10 A database table called Horses stores details about the horses kept at a horse sanctuary.
............................................................................................................................................. [1]
(b) Give the name of the field that is most suitable to be the primary key.
Field ..........................................................................................................................................
Reason .....................................................................................................................................
...................................................................................................................................................
[2]
11
Complete the table to show the most appropriate data type for each field.
Each data type must be different.
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.
FROM .........................................
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.
(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]
...........................................................................................................................................
..................................................................................................................................... [1]
13
(c) Write the output that would be given by this structured query language (SQL) statement:
FROM PheasantList
...................................................................................................................................................
............................................................................................................................................. [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]
10
9 A database table called SoftDrinks stores details of the soft drinks sold by a small shop.
Name Cola
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.
FROM .......................................................
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:
(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
ContractNumber
Months
EndDate
Sport
[2]
(c) Explain the purpose of these structured query language (SQL) statements.
Statement 1 ..............................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
Statement 2 ..............................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
[3]
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
BOOLEAN
LOGIC
PAGE 88
PAGE 89
11
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]
1 Tick () one box to identify the first stage of the program development life cycle.
A Analysis
B Coding
C Design
D Testing
[1]
2 Four logic gates and five standard symbols for logic gates are shown.
Draw one line to link each logic gate to its standard symbol. Not all standard symbols will be used.
AND
OR
NAND
NOT
[4]
3 Identify three different ways that the design of a solution to a problem can be presented.
1 .......................................................................................................................................................
..........................................................................................................................................................
2 .......................................................................................................................................................
..........................................................................................................................................................
3 .......................................................................................................................................................
..........................................................................................................................................................
[3]
(c) The algorithm does not check that each input is a single digit.
Identify the place in the algorithm where this check should occur.
Write pseudocode for this check.
Your pseudocode must make sure that the input is a single digit and checks for –1
Pseudocode ..............................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
[4]
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]
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]
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]
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]
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]
Difference 1 ......................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
Difference 2 ......................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
[4]
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]
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]
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.
AND
XOR
NAND
OR
[4]
3 Identify three different tasks in the analysis stage of the program development life cycle.
1 .......................................................................................................................................................
..........................................................................................................................................................
2 .......................................................................................................................................................
..........................................................................................................................................................
3 .......................................................................................................................................................
..........................................................................................................................................................
[3]
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
used 1
switch off 0
time switch C
switch on 1
............................................................................................................................................. [3]
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]