GSCE
Computer Science
*9882595303*
H046/02: Algorithms and problem solving
AS Level
• Use black ink.
• Write your answer to each question in the space provided. If you need extra space use
the lined page at the end of this booklet. The question numbers must be clearly shown.
• Answer all the questions.
INFORMATION
• The total mark for this paper is 70.
• The marks for each question are shown in brackets [ ].
• Quality of extended response will be assessed in questions marked with an asterisk (*).
• This document has 16 pages.
ADVICE
• Read each question carefully before you start your answer.
, 2
© OCR 2025 [601/5030/0] OCR is an exempt Charity
DC (KS) 324952/8 Turn over
1 A gym owner would like a program for members to be able to book gym classes. Each class can
have a maximum of 20 members.
Members will enter their membership ID and then the date and time of the class they want to
attend. Validation rules will check these details meet set rules. If they do not meet the validation
rules then an error message will be displayed. A confirmation message will be displayed if the
class is not full. A bleeping sound will play if the class is full.
(a) Identify two inputs and two outputs for the program.
Input
1 ..............................................................................................................................................
Input
2 ..............................................................................................................................................
Output
1 ...........................................................................................................................................
Output
2 ...........................................................................................................................................
[4]
(b) The programmer is identifying any possible reusable components in the program design.
Explain why the programmer should create reusable program components.
.........................................................................................................................................................
.
.........................................................................................................................................................
.
.........................................................................................................................................................
.
.........................................................................................................................................................
.
.........................................................................................................................................................
.
© OCR 2025
, 3
.....................................................................................................................................................
[3] BLANK PAGE DO NOT WRITE ON THIS PAGE 2 Players in a computer game collect
items. Each item has a name, e.g. “Fruit” and a type,
© OCR 2025 Turn over
, 4
e.g. “Apple”. The items for player 1 are stored in a 2D array. The array is 0-indexed.
The pseudocode declaration for the array is:
array p1Items[10,2]
The first dimension stores the item name and the second dimension stores the type.
(a) One characteristic of the array is that it has 2 dimensions.
Identify two other characteristics of the given array.
1 .......................................................................................................................................................
.........................................................................................................................................................
.
2 .......................................................................................................................................................
.........................................................................................................................................................
.
[2]
(b) When the game starts, the pseudocode procedure initialiseArray will initialise each name
and type in the array to "empty".
01 procedure initialiseArray(p1Items:byRef)
02 counter = 0
03 while counter < 10
04 p1Items[counter, 0] = "empty"
05 p1Items[counter, 1] = "empty"
06 counter = counter + 1
07 endwhile
08 endprocedure
(i) State why empty is in speech marks on lines 04 and 05.
.........................................................................................................................................................
.
.....................................................................................................................................................
[1]
(ii) Rewrite the code in lines 02 to 07 to use a for loop instead of a while loop.
Write your answer using pseudocode or program code.
.........................................................................................................................................................
.
.........................................................................................................................................................
.
© OCR 2025