Data types, records, arrays and abstract data types – A Level Computer Science (9618)

112 questions · page 1 of 8 · Clear filters

0 / 0Answer a question to start your score.
Quick quiz (10)Saved 0
Advertisement
1
9618/21/M/J/26 · Question 4May/June 2026Paper 214 marks
Loading question…
Question text

4
An algorithm is expressed as:
•
A user inputs a sequence of integer values.
•
The process will calculate the number of positive integers.
•
The user will input value 0 to indicate there are no more numbers to be input.
•
Output the number of positive integers after the terminating 0 is input.
Write a structured English description for this algorithm as a sequence of steps.
Do not include pseudocode statements in your description.
Your answer might not require all six steps shown.
step 1 …
…
step 2 …
…
step 3 …
…
step 4 …
…
step 5 …
…
step 6 …
…
[4]
© Cambridge University Press & Assessment 2026

2
9618/21/M/J/26 · Question 6May/June 2026Paper 2112 marks
Loading question…
Question text

6
Fence parts are manufactured by a number of similar machines. The length of the part must fall
within a certain range. Parts not within the length range are rejected.
The data for each rejected part forms a data packet made up of three data items, each separated
by the ‘/’ character delimiter. The format of a data packet is:
<length>/<machine ID>/<description of the fault>
•
The length is 3 digits (in millimetres).
•
The machine ID is a single character (‘A’, ‘B’, or ‘C’).
•
The description of the fault is a variable length string.
A pseudocode program will process the data for several data packets.
The program contains the statement:
"563/B/the fence length is too long"
DataPacket
(a) Complete the two pseudocode expressions which extract the appropriate data item.
…
PartLength
…
MachineID
[2]
(b) The program will create a module RejectDescription() to return the fault description.
Write the pseudocode for the module RejectDescription()
…
…
…
…
…
… [4]
© Cambridge University Press & Assessment 2026
,
,
(c) The data packets for all rejected parts are saved in this format in a text file Rejects.txt.
The file stores one data packet per line.
Write pseudocode to:
•
find all the rejected parts with a length greater than 560 millimetres and that were
produced on machine ‘B’ or machine ‘C’
•
output the description for each matching rejected part.
Your pseudocode will include a module call to RejectDescription() and the answers
given for 6(a).
…
…
…
…
…
…
…
…
…
…

3
9618/21/M/J/26 · Question 7May/June 2026Paper 2112 marks
Loading question…
Question text

7
Different data structures will be suitable for different computing applications.
(a) (i)
Identify a computing application where a queue data structure is suitable.
…
… [1]
(ii)
Justify why a queue is suitable for your application identified in 7(a)(i).
…
…
… [2]
(b) A programmer designs a circular queue.
•
The data items are stored in a 1D array, MyQueue
•
The queue is managed using two pointers.
The diagram shows the circular queue populated with four items.
MyQueue
"PIG"
Front
1
"DOG"
2
"RAT"
3
"SPIDER"
Rear
4
5
6
7
8
(i)
Write three pseudocode declaration statements to implement this circular queue.
1 …
2 …
3 …
[2]
© Cambridge University Press & Assessment 2026
,
,
(ii)
Two program modules are available to add and remove items to and from the queue.
module
description
EnQueue(<value>)
when <value> is added to the queue
DeQueue()
when an item is removed from the queue
Complete the state of MyQueue after the following sequence of changes:
•
DeQueue()
•
EnQueue("HORSE")
•
EnQueue("CAT")
MyQueue
1
2
3
4
5
6
7
8
[2]
© Cambridge University Press & Assessment 2026
,
,
(iii)
On a different occasion, the state of MyQueue is:
MyQueue
1
2
3
Front
"LION"
4
"GIRAFFE"
5
"TIGER"
6
"ANT"
Rear
7
8
Complete the state of MyQueue after the following sequence of changes:
•
EnQueue("GERBIL")
•
EnQueue("MONKEY")
•
EnQueue("SNAKE")
•
DeQueue()
MyQueue
1
2
3
4
5
6
7
8
[2]
© Cambridge University Press & Assessment 2026
,
,
(c) MyQueue will be initially empty.
Write a pseudocode procedure InitialiseQueue() to set up the empty MyQueue, using
a loop.
The initial array contents will be set to empty strings.
You are not required to repeat the declaration statements in 7(b)(i).
PROCEDURE InitialiseQueue()
…
…
…
…
…
…
…
ENDPROCEDURE
[3]
© Cambridge University Press & Assessment 2026
9618/2

Advertisement
4
9618/21/M/J/26 · Question 9May/June 2026Paper 2118 marks
Loading question…
Question text

9
A hotel has three floors numbered 0 to 2 (floor 0 is the ground floor). There are 15 rooms on
each floor.
The hotel gets many enquiries from customers to check if a room is available that day.
The availability data for that day is stored in a 2D array Version1
•
The first index is the floor number.
•
The second index is the room number.
•
On each of the three floors, the room numbers are 1 to 15.
Each cell of the array stores either:
•
‘A’ – the room is available
•
‘B’ – the room is already booked.
(a) Write the declaration statement for the 2D array Version1
… [2]
© Cambridge University Press & Assessment 2026
,
,
(b) An enquiry program will:
•
input a floor number
•
output all room numbers that are available on that floor
•
output the number of rooms that are available.
The output must be in the format shown in the two examples.
A wheelchair user makes an enquiry. She requires a room on the ground floor only.
Example program outputs:
Floor number: 0
0 room(s) available
There are no available rooms on
the ground floor.
Floor number: 0
Shows two rooms available on the
7
ground floor:
11
2 room(s) available
• rooms 7 and 11.
© Cambridge University Press & Assessment 2026
,
,
Write pseudocode for this enquiry program.
…
…
…
…
…
…
…
…
…
…
…
…
…
… [6]
© Cambridge University Press & Assessment 2026
,
,
(c) Customers are becoming more selective with their enquiries when searching for an
available room.
A new program design is required. It will create a record to define the data for a room.
Each room:
•
may have a sea view
•
is classified as: single room (‘S’), double room (‘D’) or family room (‘F’)
•
is either standard (‘ST’) or deluxe (‘DL’).
(i)
Complete the pseudocode.
TYPE RoomData
…

5
9618/22/M/J/26 · Question 3May/June 2026Paper 226 marks
Loading question…
Question text

3
A computer game uses a text file named WordList.txt containing 10 000 words, all in lower
case. Each word is unique and is stored on a separate line of the text file.
An efficient algorithm is needed to check that a word input by the user is stored in
WordList.txt. If the word is found, the line number where the word is stored must be output. If
the word is not found, the message "Not Found" must be output.
Complete the steps needed to describe the algorithm.
Do not include pseudocode statements in your answer.
The first three steps have been completed for you.
step 1: set line counter to 0
step 2: input a word
step 3: convert the word to lower case
…
…
…
…
…
…
…
…
…
…
…
[6]
© Cambridge University Press & Assessment 2026

6
9618/22/M/J/26 · Question 4May/June 2026Paper 229 marks
Loading question…
Question text

4
A desktop web browser stores the history of web addresses visited.
The web browser uses a back button and forward button to move between web pages
recently visited.
Two stacks are used when each of these buttons are clicked:
•
back stack
•
forward stack.
The back button is clicked to return to a previously visited web page.
The back button operates as follows:
•
The web address currently being displayed by the browser is pushed onto the forward stack.
•
The web address from the top of the back stack is popped.
•
The web address popped is loaded by the web browser.
The forward button is clicked to revisit a web page previously visited.
The forward button operates as follows:
•
The web address currently being displayed by the browser is pushed onto the back stack.
•
The web address from the top of the forward stack is popped.
•
The web address popped is loaded by the web browser.
The current state of the two stacks:
back stack
forward stack
TOS
www.333.corp
TOS
www.111.home
www.zzz.corp
www.aaa.home
www.999.corp
www.ccc.my
www.222.me
The top of stack pointer is represented by TOS.
The current web address being displayed by the web browser is: www.bbb.home
The browsing session continues; the buttons are clicked in sequence in the three groups:
group 1:
back button
group 2:
forward button
group 3:
forward button
forward button
forward button
© Cambridge University Press & Assessment 2026
,
,
(a) Complete the diagrams to show the state of both stacks after each group of operations has
been performed.
Note: you must include the top of stack pointer (TOS) and the current web address being
displayed for each group diagram.
after group 1
back stack
forward stack
Web address currently displayed in the web browser: …
after group 2
back stack
forward stack
Web address currently displayed in the web browser: …
after group 3
back stack
forward stack
Web address currently displayed in the web browser: …
[6]
© Cambridge University Press & Assessment 2026
,
,
(b) A stack is an Abstract Data Type (ADT)
Identify one other ADT and describe two features of the ADT.
ADT …
feature 1 …
…
feature 2 …
…
[3]

7
9618/22/M/J/26 · Question 5May/June 2026Paper 2210 marks
Loading question…
Question text

5
A programmer has defined a global 1D array Numbers of type INTEGER, which can store 1000
integers. The lower bound of the array Numbers is set to 1. Each element of the array has been
initialised with a random integer in the range 200 to 99 999.
The programmer has written a bubble sort algorithm to sort the array Numbers into
ascending order.
Study algorithm A.
Assume all the variables have been correctly declared.
algorithm A:
1 TO 999
//Outer Loop
FOR LoopCounter
1 TO 999
//Inner Loop
FOR Index
IF Numbers[Index] > Numbers[Index + 1] THEN
//Start of block to swap neighbouring elements in the array
Numbers[Index]
Temp
Numbers[Index + 1]
Numbers[Index]
Temp
Numbers[Index + 1]
//End of block to swap neighbouring elements in the array
ENDIF
NEXT Index
NEXT LoopCounter
(a) Describe the change that would have to be made to the bubble sort algorithm (algorithm A)
so that the Numbers array would be sorted into descending order.
…
… [1]
© Cambridge University Press & Assessment 2026
,
,
(b) The programmer rewrites the bubble sort algorithm to make it more efficient.
Study algorithm B.
Assume all the variables have been correctly declared.
algorithm B:
999
Boundary
REPEAT
//Outer Loop
TRUE
NoSwaps
1 TO Boundary
//Inner Loop
FOR Index
IF Numbers[Index] > Numbers[Index + 1] THEN
//Start of block to swap neighbouring elements in the array
Numbers[Index]
Temp
Numbers[Index + 1]
Numbers[Index]
Temp
Numbers[Index + 1]
//End of block to swap neighbouring elements in the array
FALSE
NoSwaps
ENDIF
NEXT Index
Boundary ‑ 1
Boundary
UNTIL NoSwaps = TRUE
(i)
Explain why the second bubble sort algorithm (algorithm B) is more efficient than the
first bubble sort algorithm (algorithm A). Your answer must refer to both inner and
outer loops.
…
…
…
…
…
…
…
…
… [4]
(ii)
State the situation that will result in the outer loop iterating for the minimum number of
times when the second bubble sort algorithm (algorithm B) is used.
…
… [1]
© Cambridge University Press & Assessment 2026
,
,
(c) The programmer has defined a new procedure:
PROCEDURE Swap(Num1 : INTEGER, Num2 : INTEGER)
DECLARE Temp : INTEGER
Num1
Temp
Num2
Num1
Temp
Num2
END

8
9618/23/M/J/26 · Question 4May/June 2026Paper 234 marks
Loading question…
Question text

4
An algorithm is expressed as:
•
A user inputs a sequence of integers.
•
The user will input value –1 to indicate there are no more integers to be input.
•
The program will calculate the total number of integers greater than 120.
•
Output the total number of integers greater than 120 after the –1 terminator is input.
Write a structured English description for this algorithm as a sequence of steps.
Do not include pseudocode statements in your description.
Your answer might not require all six steps shown.
step 1 …
…
step 2 …
…
step 3 …
…
step 4 …
…
step 5 …
…
step 6 …
…
[4]
© Cambridge University Press & Assessment 2026

Advertisement
9
9618/23/M/J/26 · Question 6May/June 2026Paper 2313 marks
Loading question…
Question text

6
A linked list is an example of an Abstract Data Type (ADT).
A linked list is implemented using:
•
a 1D array for the data items
•
a 1D array for the link pointers
•
a start pointer.
The linked list maintains the data items in alphabetical order.
(a) The state of the linked list after five data items have been added is:
start pointer:
5
ANT
BISON
2
DOG
3
1
LEOPARD
ZEBRA
4
0
Complete the diagram to show the StartPointer and the contents of the arrays Data
and Pointer
StartPointer …
Data
Pointer
1
1
2
2
3
3
4
4
5
5
6
6
19
19
20
20
[3]
© Cambridge University Press & Assessment 2026
,
,
(b) State what the pointer value 0 (null pointer) indicates.
… [1]
(c) To maintain the linked list, algorithms are required to:
•
insert a new data item into the linked list
•
delete a data item from the linked list.
(i)
The data item ‘DOG’ is to be deleted from the linked list given in 6(a).
Complete the diagram to show the new state of the linked list.
start pointer:
ANT
BISON
DOG
LEOPARD
ZEBRA
[1]
(ii)
To delete a data item, the algorithm will have special cases. One special case is the
linked list is empty.
Describe two other special cases which must be considered when deleting a data item.
1 …
…
2 …
…
[2]
© Cambridge University Press & Assessment 2026
,
,
(d) The linked list given in 6(a) is repeated here. Data item ‘BAT’ is to be added to the linked list.
start pointer:
5
ANT
BISON
2
DOG
3
1
LEOPARD
ZEBRA
4
0
Describe how the data item ‘BAT’ is added to the linked list.
Do not attempt to write pseudocode.
…
…
…
…
…
…
…
…
…
…
…
…

10
9618/23/M/J/26 · Question 8May/June 2026Paper 2319 marks
Loading question…
Question text

8
A warehouse stores stock in bins. A bin is a container which stores the stock items; each bin can
store many identical items. The warehouse is organised on three different levels – level 0 (ground
level), then level 1 and level 2. Each level has 120 bins, numbered 1 to 120.
A bin is identified by the level and a bin number. The data item stored for each bin is a Boolean
value; this indicates whether the bin is in use (contains stock items) or not in use (contains no
stock items).
(a) (i)
Complete the pseudocode to declare a 2D array Bins
DECLARE …
[2]
(ii)
A pseudocode module InactiveReport() will produce a report that will show:
•
a header for each level
•
the bin number for each bin that is not in use on that level
•
the total number of bins that are not in use on all levels.
The module is initially developed for only five bins on each level.
An example program output:
Level: ground floor
Shows:
Bin 1
Bin 3
• the header for each level
Level: 1
Bin 4
• a list of bin numbers for bins that are
not in use on that level
Level: 2
Bin 1
• the total number of bins not in use.
Bin 2
Bin 5
6 bins are not in use
© Cambridge University Press & Assessment 2026
,
,
Complete the pseudocode for the procedure InactiveReport()
Assume that the Bins array is a global variable and has already been populated
with data.
PROCEDURE InactiveReport()
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…

11
9618/21/O/N/25 · Question 1Oct/Nov 2025Paper 2110 marks
Loading question…
Question text

1
A program is being developed to meet a particular customer requirement.
(a) The program contains these variables:
Variable
Data type
MyChar
CHAR
MyString
STRING
MyInt
INTEGER
MyDOB
DATE
Complete the table by filling in the gaps using functions and/or operators from the insert.
Each expression must be valid.
Expression
MyString
'X' … MyString
MyChar
… ("ABCD", … , … )
MyString
… ( … (MyDOB))
MyInt
… ( … (MyString) / 2)
[4]
(b) Different test methods will be used at different stages of the program development.
Complete the table by identifying the test method that matches the test description.
The first row has been completed for you.
Test description
Test method
carried out as soon as a program module has been coded
alpha
carried out as program modules are being combined
completed by the developers without referring to the code
completed by the customer
[3]
ĬÕĊ®Ġ´íÈõÏĪÅĊßû¸þ×
,
,
(c) During the alpha testing stage, an Integrated Development Environment (IDE) is used to help
locate an error that has been identified. The IDE report window feature is used to examine
the values assigned to variables.
Explain how two other IDE features are used together with the report window feature to help
locate the error.
…
…
…
…
…
… [3]
Ĭ×Ċ®Ġ´íÈõÏĪÅĊßù¸þ×

12
9618/21/O/N/25 · Question 2Oct/Nov 2025Paper 215 marks
Loading question…
Question text

2
Data is a global 1D array containing 30 elements of type STRING
An algorithm will output:
•
all non-blank elements (elements that do not contain an empty string)
•
the final total of the number of elements output.
Complete the program flowchart to represent the algorithm:
START
END
[5]
ĬÕĊ®Ġ´íÈõÏĪÅĊÝû¸Ā×

13
9618/21/O/N/25 · Question 3Oct/Nov 2025Paper 219 marks
Loading question…
Question text

3
A program is needed to manage individual rentals in a car-hire business.
The data items for each rental will be held in a record structure of type RentalRecord
The programmer has started to define the items that will be needed:
Item
Example value
Comment
RentalID
"AB1234"
a unique alpha-numeric value
CarID
241
a numeric value used as an array index
DisCode
'S'
a letter indicating the type of discount offered
Start
13/06/2025
when the rental starts
Duration
7
the number of days of the rental
Completed
FALSE
TRUE when the car is returned and the rental charge paid
(a) (i)
Write pseudocode to declare the record structure for type RentalRecord
…
…
…
…
…
…
…
… [4]
(ii)
A 1D array Rental containing 500 elements is used to store the data for all rental records.
Write pseudocode to declare the Rental array.
…
… [2]
(b) State three benefits of using an array of records to store the data for all rentals.
1 …
…
2 …
…
3 …
…
[3]
Ĭ×Ċ®Ġ´íÈõÏĪÅĊÝù¸Ā×
[Turn
over

Advertisement
14
9618/21/O/N/25 · Question 4Oct/Nov 2025Paper 219 marks
Loading question…
Question text

4
A program contains a global 1D array Number consisting of 20 elements of type REAL
A procedure Store() will input a sequence of up to 20 real values, one value at a time. These
values will be assigned to elements of the array using four steps:
Step 1: store the first value in the sequence in the first element of the array
Step 2: check each subsequent value input. If this value is larger than the previous value input,
then assign the value to the next array element, otherwise go to step 4
Step 3: repeat from step 2 unless the array is full
Step 4: output the count of the number of values stored in the array together with a suitable
message.
(a) Complete the pseudocode for Store()
All variables used in the algorithm must be declared.
PROCEDURE Store()
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
ENDPROCEDURE
[6]
ĬÙĊ®Ġ´íÈõÏĪÅĊàùµþ×
,
,
(b) The requirements of the program change:
•
the number of values in the sequence is unknown, but may be higher than 20
•
the values will need to be accessed by another program as data.
The data will be stored in a text file instead of an array.
(i)
Give two benefits of using a text file instead of an array.
1 …
…

15
9618/21/O/N/25 · Question 6Oct/Nov 2025Paper 219 marks
Loading question…
Question text

6
Students are learning about a simple check digit method for data validation. In this method, a
single check digit is appended to the end of an original number to give a new number.
The students are studying a method which:
•
calculates the sum of all the digits in the original number
•
uses integer division to calculate the remainder when the sum is divided by 10
•
uses the remainder as the check digit
•
appends the check digit to the original number, creating the new number.
For example:
original number
4162
sum of all digits
4 + 1 + 6 + 2 = 13
remainder when the sum is divided by 10 using integer division
3
new number
41623
The method described can be used to detect single-digit errors. For example, if the new number
is incorrectly input as 41633, then the check digit does not match and the input will be rejected.
(a) An incorrect attempt was made to enter 41623. The first two digits were entered incorrectly;
the last three digits were entered correctly.
When this number was tested, the check digit was found to be correct and the input was
accepted.
Identify an example of the incorrect attempt to enter 41623 and explain why this number
would not be rejected.
Number …
Explanation …
…
[2]
ĬÙĊ®Ġ´íÈõÏĪÅĊßù·þ×
,
,
(b) A module Generate() will take an integer value representing an original number and return
an integer value representing a new number which includes the check digit.
The original number is always at least three digits in length.
Write pseudocode for the module Generate()
Assume that the parameter is valid.
…
…
…
…
…
…
…
…
…
…
…
…
…
…

Advertisement