Past paper – O Level Computer Science (2210)

Cambridge O Level · 2210

Computer Science · Paper 22

Oct/Nov 2024 · 2210/22/O/N/24

Questions12
Marks75
TypeWritten

Answer on paper, open each mark scheme and give yourself marks, then open the Summary.

0 / 0Answer a question to start your score.
Saved 0
Advertisement
1
2210/22/O/N/24 · Question 1Oct/Nov 2024Paper 221 marks
Loading question…
Question text

1
Tick (✓) one box to complete this sentence.
A solution to a problem may be represented using pseudocode, flowcharts or
A
procedures.
B
processes.
C
structure diagrams.
D
sub-systems.
[1]

2
2210/22/O/N/24 · Question 2Oct/Nov 2024Paper 221 marks
Loading question…
Question text

2
Tick (✓) one box to complete this sentence.
A pseudocode example of a selection statement is
A
CALL Sorting(Value1, Value2)
B
DECLARE Count : INTEGER
C
IF X = 7 THEN Y
21 ENDIF
D
WHILE X <> -1 DO
[1]

3
2210/22/O/N/24 · Question 3Oct/Nov 2024Paper 2210 marks
Loading question…
Question text

3
Four flowchart symbols and five purposes are shown.
(a) Draw one line to link each flowchart symbol to its correct purpose.
Not all purposes will be used.
Flowchart symbol
Purpose
subroutine
process
flow
decision
terminator
[4]
ĬÍĊ®Ġ´íÈõÏĪÅĊÞû·þ×
,
,
(b) An algorithm needs to total 50 numbers between 1 and 100 inclusive.
Draw a flowchart that:
•
uses a count-controlled loop from 1 to 50
•
uses an appropriate prompt to ask for a number between 1 and 100
•
totals the numbers as they are entered
•
outputs the total after the loop has completed with an appropriate message.
[6]
ĬÏĊ®Ġ´íÈõÏĪÅĊÞù·þ×

Advertisement
4
2210/22/O/N/24 · Question 4Oct/Nov 2024Paper 228 marks
Loading question…
Question text

4
This pseudocode algorithm is intended to sort a pre-populated one-dimensional (1D) array named
ItemList into alphabetical order using a bubble sort.
01
DECLARE ItemList : ARRAY[1:100] OF STRING
02
DECLARE Counter : STRING
03
DECLARE Limit : INTEGER
04
DECLARE Pass : INTEGER
05
DECLARE Swapped : BOOLEAN
06
DECLARE Temp : STRING
100
07
Limit
1
08
Pass
TRUE
09
Temp
10
WHILE Swapped = TRUE OR Pass <= Limit - 1 DO
FALSE
11
Swapped
1 TO Limit – Pass
12
FOR Counter
13
IF ItemList[Counter] > ItemList[Counter + 1]
14
THEN
ItemList[Counter]
15
Temp
ItemList[Counter + 1]
16
ItemList[Counter]
Temp
17
ItemList[Counter]
TRUE
18
Swapped
19
ENDCASE
Pass + 1
20
Pass
21
NEXT Counter
22
ENDWHILE
(a) Identify the line numbers of five errors in the pseudocode and suggest a correction for each
error.
Error 1 line number …
Correction …
…
Error 2 line number …
Correction …
…
Error 3 line number …
Correction …
…
Error 4 line number …
Correction …
…
ĬÍĊ®Ġ´íÈõÏĪÅĊàû·Ā×
,
,
Error 5 line number …
Correction …
…
[5]
(b) A bubble sort algorithm can be written to include features that make it more efficient.
Explain why the corrected bubble sort algorithm is efficient.
…
…
…
…
…
… [3]

5
2210/22/O/N/24 · Question 5Oct/Nov 2024Paper 224 marks
Loading question…
Question text

5
Analysis is one stage in the program development life cycle.
(a) State one other stage in the program development life cycle.
… [1]
(b) Describe the analysis stage of the program development life cycle.
…
…
…
…
…
… [3]

6
2210/22/O/N/24 · Question 6Oct/Nov 2024Paper 222 marks
Loading question…
Question text

6
Outline one type of verification check that could be used when inputting data.
…
…
…
… [2]
ĬÏĊ®Ġ´íÈõÏĪÅĊàù·Ā×

7
2210/22/O/N/24 · Question 7Oct/Nov 2024Paper 228 marks
Loading question…
Question text

7
This pseudocode represents an algorithm.
An input of –1 will terminate the algorithm.
DECLARE Count : INTEGER
DECLARE Answer : INTEGER
DECLARE Value : INTEGER
REPEAT
INPUT Value
IF Value <> -1
THEN
Value
Answer
Value - 1 TO 1 STEP -1
FOR Count
Answer * Count
Answer
NEXT Count
OUTPUT Answer
ENDIF
UNTIL Value = -1
(a) Complete the trace table for the input data:
5, 6, –1, 20, 9, 4
Value
Count
Answer
OUTPUT
[5]
ĬÑĊ®Ġ´íÈõÏĪÅĊÝù¶þ×
,
,
(b) State the purpose of this algorithm.
…
… [1]
(c) Describe the problem that would be caused in this algorithm if a Value of 1, 0 or less than –1
was input.
…
…
…
… [2]

8
2210/22/O/N/24 · Question 8Oct/Nov 2024Paper 224 marks
Loading question…
Question text

8
Different types of test data are used during program development to make sure a program works
as intended. A program being developed takes as input whole numbers that are not greater than
80.
Identify two items of test data to test the whole number limit of 80.
Explain the reason for your choice of the data in each case.
Test data 1 …
Reason for choice …
…
Test data 2 …
Reason for choice …
…
[4]
ĬÓĊ®Ġ´íÈõÏĪÅĊÝû¶þ×

Advertisement
9
2210/22/O/N/24 · Question 9Oct/Nov 2024Paper 228 marks
Loading question…
Question text

9
Consider the logic expression:
X = (NOT P OR Q) NAND (Q XOR R)
(a) Draw a logic circuit for this logic expression.
Each logic gate must have a maximum of two inputs.
Do not simplify the logic expression.
P
Q
X
R
[4]
(b) Complete the truth table for the given logic expression.
Working space
P
Q
R
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]
ĬÑĊ®Ġ´íÈõÏĪÅĊßù¶Ā×

10
2210/22/O/N/24 · Question 10Oct/Nov 2024Paper 226 marks
Loading question…
Question text

10 The function LENGTH(X) calculates the length of a string X
Write the pseudocode statements to:
•
allow a line of text to be input to an appropriate variable
•
store this line of text in a text file called Main.txt
•
calculate the length of the line of text and output the text in lower case along with its length
•
store the lower-case line of text in a text file called Lowercase.txt
Make sure that any variables used are declared and that both text files are closed after they have
been used.
…
…
…
…
…
…
…
…
…
…
…
…
…
… [6]
ĬÓĊ®Ġ´íÈõÏĪÅĊßû¶Ā×

11
2210/22/O/N/24 · Question 11Oct/Nov 2024Paper 228 marks
Loading question…
Question text

11
A database table called Booking28 stores details of hotel rooms and bookings for the week
beginning Monday 7 July 2025.
RoomNo
Type
Guests
Rate$
Mon
Tue
Wed
Thu
Fri
Sat
Sun
101D
Double
2
99.99
T
T
T
T
F
T
T
102D
Double
2
99.99
T
T
T
F
T
T
T
103F
Family
4
150.00
T
T
T
T
T
T
T
104S
Single
1
72.50
F
T
T
F
T
T
T
105S
Single
1
72.50
F
T
T
F
T
T
T
106T
Twin
2
120.00
T
T
T
T
F
T
T
201F
Family
4
160.00
F
F
T
T
T
T
T
202D
Double
2
120.00
T
F
T
T
T
T
T
203T
Twin
2
120.00
T
F
T
T
T
T
T
204T
Twin
2
125.00
T
F
T
F
T
T
T
205S
Single
1
79.99
T
F
T
T
F
T
T
301D
Double
2
200.00
F
T
T
F
F
T
T
302T
Twin
2
200.00
T
T
T
T
F
T
T
303P
Suite
4
500.00
T
T
T
T
F
T
T
304P
Suite
6
700.00
F
F
F
F
T
T
T
(a) State the number of fields and records in this database table.
Fields …
Records …
[2]
(b) State the reason why the Type field would not be suitable as a primary key.
…
… [1]
ĬÑĊ®Ġ´íÈõÏĪÅĊÞù¸þ×
,
,
(c) The database uses only the data types:
•
alphanumeric
•
character
•
Boolean
•
integer
•
real
•
date/time.
Complete the table to show the fields that could have the given data types.
Only one field name is required in each box and each field name must be different.
Field
Data type
alphanumeric
Boolean
real
integer
[2]
(d) Give the output that would be produced by the structured query language (SQL) statement:
SELECT RoomNo, Type, Guests, Rate$
FROM Booking28
WHERE Mon <> T;
…
…
…
…
…
… [3]
ĬÓĊ®Ġ´íÈõÏĪÅĊÞû¸þ×

12
2210/22/O/N/24 · Question 12Oct/Nov 2024Paper 2215 marks
Loading question…
Question text

12 A one-dimensional (1D) array Rooms[] contains the names of up to 20 rooms in a house.
A two-dimensional (2D) array Dimensions[] is used to store the length, width and area of each
room.
The position of any room’s data is the same in both arrays. For example, the data in index 5 of
Dimensions[] belongs to the room in index 5 of Rooms[]
The variable Number stores the number of rooms for which data is to be input. There must be at
least 3 rooms but no more than 20.
Write a program that meets the following requirements:
•
allows the number of rooms for which data is required to be input, stored and validated
•
allows the name of the room and the length and width of the room, in metres, to be entered
and stored
•
allows the area of each room to be calculated as length multiplied by width and stored as
square metres rounded to two decimal places
•
calculates the average size of all the rooms by area, in square metres, rounded to two decimal
places
•
finds the largest room and smallest room by area
•
outputs the names of all rooms with their dimensions and area
•
outputs the names of the largest room and smallest room by area
•
outputs the total area of the house and the average size of all the rooms by area.
You must use pseudocode or program code and add comments to explain how your code works.
You do not need to declare any arrays or variables; you may assume that this has already been
done.
All inputs and outputs must contain suitable messages.
…
…
…
…
…
…
…
…
…
…
…
…
…
ĬÑĊ®Ġ´íÈõÏĪÅĊàù¸Ā×
,
,
…
…
…
…

Advertisement