0% found this document useful (0 votes)
45 views105 pages

OCR Drones Pilot Code Algorithm Guide

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views105 pages

OCR Drones Pilot Code Algorithm Guide

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

1. OCR Drones flies goods around the country using drones.

A pilot code is automatically generated when a new pilot joins the company.

This algorithm generates a code for each pilot:

01 a = input("Enter first letter of first name")


02 b = input("Enter first letter of second name")
03 c = random(1,100)
04 while c < 100
05 c = c * 10
06 endwhile
07 pilotCode = a + b + str(c)
08 print(pilotCode)

Complete the trace table for the given algorithm.

Lines 01 to 03 have already been completed.

You may not need to use all rows in the trace table.

Line number a b c pilotCode Output

01 H

02 K

03 9
[4]

2. Read the following pseudocode algorithm:

01 start = 3

02 do

03 print(start)

04 start = start - 1

05 until start == -1

06 print("Finished")

Complete the following trace table for the given algorithm.

Line number start Output


[3]

3. Each member of staff that works in a restaurant is given a Staff ID. This is calculated using the following
algorithm.

01 surname = input(“Enter surname”)

© OCR 2025. You may photocopy this


Page 1 of 105 Created in ExamBuilder
page.
02 year = input(“Enter starting year”)

03 staffID = surname + str(year)

04 while [Link] < 10

05 staffID = staffID + “x”

06 endwhile

07 print(“ID ” + staffID)
i. Define the term casting and give the line number where casting has been used in the algorithm.

Definition

Line number

[2]
ii. Complete the following trace table for the given algorithm when the surname “Kofi” and the year 2021 are
entered.

You may not need to use all rows in the table.

Line number surname year staffID Output

01 Kofi

02 2021

[4]

4. The following program uses a condition-controlled loop.

x = 15
y = 0
while x > 0

y = y + 1
x = x – y

endwhile
print(y)

Complete the trace table to test this program.

© OCR 2025. You may photocopy this


Page 2 of 105 Created in ExamBuilder
page.
x y output

[4]

5. An algorithm stores the position of a character on a straight line as an integer. A user can move the character
left or right.

The following algorithm:

• generates one random number between 1 and 512 (inclusive) to store as the position
• prompts the user to input a direction to move (left or right)
• takes a direction as input until a valid direction is input.

p = random(1, 512)

print("The position is ", p)

a = ""

while a != "left" and a != "right"

a = input("Enter direction, left or right")

endwhile

If the character moves left, 5 is subtracted from the position.


If the character moves right, 5 is added to the position.

The position of the character can only be between 1 and 512 inclusive.

The function moveCharacter():

• takes the direction (left or right) and current position as parameters


• changes position based on direction
• sets position to 1 if the new position is less than 1
• sets position to 512 if the new position is greater than 512
• returns the new position.

Complete the function moveCharacter()

function moveCharacter(direction, position)

© OCR 2025. You may photocopy this


Page 3 of 105 Created in ExamBuilder
page.
endfunction
[6]

6. Write an algorithm to play a game with the following rules.

• the player is asked 3 addition questions


• each question asks the player to add together two random whole numbers between 1 and 10 inclusive
• if the player gets the correct answer, 1 is added to their score
• at the end of the game their score is displayed.

© OCR 2025. You may photocopy this


Page 4 of 105 Created in ExamBuilder
page.
[6]

7(a). An alarm has an algorithm that decides whether to sound the alarm by checking the data that is stored in
the following three variables.

• SystemArmed
• DoorSensorActive
• WindowSensorActive

The alarm will only sound when the alarm has been activated and one or both of the door and window sensors
are activated. When the system needs to sound the alarm it calls the pre-written procedure SoundAlarm()

Write a program that checks the data in the variables and calls SoundAlarm() when appropriate.

You must use either:

• OCR Exam Reference Language, or


• A high-level programming language that you have studied.

© OCR 2025. You may photocopy this


Page 5 of 105 Created in ExamBuilder
page.
[4]

(b). A program written in a high-level language is used to access the data from a database.
This program has a procedure, SaveLogs(), that stores the data to an external text file.

The procedure SaveLogs():

• takes the string of data to be stored to the text file as a parameter


• takes the filename of the text file as a parameter
• stores the string of data to the text file.

Write the procedure SaveLogs()

You must use either:

• OCR Exam Reference Language, or


• A high-level programming language that you have studied.

[6]

(c). OCR Security Services need to identify the total number of seconds the sensors have been activated on a
specific date.
© OCR 2025. You may photocopy this
Page 6 of 105 Created in ExamBuilder
page.
The data from the database table events is imported into the program written in a highlevel programming
language.

The program stores the data in a two-dimensional (2D) string array with the identifier arrayEvents

The data to be stored is shown in the table.

Date SensorID SensorType Length


05/02/2023 WS2 Window 38
05/02/2023 MS1 Motion 2
06/02/2023 DS3 Door 1
06/02/2023 MS2 Motion 3
06/02/2023 MS1 Motion 2
07/02/2023 WS1 Window 24
07/02/2023 DS1 Door 1

In this table, the value of events[1, 1] contains "MS1".


i. An array can only store data of one data type. Any non-string data must be converted to a string before
storing in the array.

Identify the process that converts integer data to string data.


[1]
ii. Write a program that:

• asks the user to input a date


• totals the number of seconds sensors have been activated on the date input
outputs the calculated total in an appropriate message including the date, for example:
• Sensors were activated for 40 seconds on 05/02/2023

You must use either:

• OCR Exam Reference Language, or


• A high-level programming language that you have studied.

© OCR 2025. You may photocopy this


Page 7 of 105 Created in ExamBuilder
page.
[6]

8(a). A fast food restaurant offers half-price meals if the customer is a student or has a discount card. The offer is
not valid on Saturdays.

The restaurant needs an algorithm designing to help employees work out if a customer can have a half price meal
or not. It should:

• input required data


• decide if the customer is entitled to a discount
• output the result of the calculation.

Design the algorithm using a flowchart.

© OCR 2025. You may photocopy this


Page 8 of 105 Created in ExamBuilder
page.
[5]

(b). The restaurant adds a service charge to the cost of a meal depending on the number of people at a table. If
there are more than five people 5% is added to the total cost of each meal.

Customers can also choose to leave a tip, this is optional and the customer can choose between a percentage of
the cost, or a set amount.

Identify all the additional inputs that will be required for this change to the algorithm.

[2]

9. Jack is writing a program to add up some numbers. His first attempt at the program is shown.

a = input(“Enter a number”)

b = input(“Enter a number”)

© OCR 2025. You may photocopy this


Page 9 of 105 Created in ExamBuilder
page.
c = input(“Enter a number”)

d = input(“Enter a number”)

e = input(“Enter a number”)

f = (a + b + c + d + e)

print(f)

Jack decides to improve his program. He wants to be able to input how many numbers to add together each time
the algorithm runs, and also wants it to calculate and display the average of these numbers.

Write an algorithm to:

• ask the user to input the quantity of numbers they want to enter and read this value as input
• repeatedly take a number as input, until the quantity of numbers the user input has been entered
• calculate and output the total of these numbers
• calculate and output the average of these numbers.

© OCR 2025. You may photocopy this


Page 10 of 105 Created in ExamBuilder
page.
[6]

10(a). Customers at a hotel can stay between 1 and 5 (inclusive) nights and can choose between a basic room or
a premium room.

When a new booking is recorded, the details are entered into a program to validate the values. The following
criteria are checked:

• firstName and surname are not empty


• room is either “basic” or “premium”
• nights is between 1 and 5 (inclusive).

If any invalid data is found “NOT ALLOWED” is displayed.


If all data is valid “ALLOWED” is displayed.
i. Complete the following program to validate the inputs.

You must use either:

• OCR Exam Reference Language, or


• a high-level programming language that you have studied.

firstName = input(“Enter a first name”)

surname = input(“Enter a surname”)

room = input(“Enter basic or premium”)

nights = input(“Enter between 1 and 5 nights”)

stayComplete = False

© OCR 2025. You may photocopy this


Page 11 of 105 Created in ExamBuilder
page.
[5]
ii. Complete the following test plan to check whether the number of nights is validated correctly.

Test data
Type of test Expected output
(number of nights)
2 ALLOWED
Boundary ALLOWED
Erroneous / Invalid NOT ALLOWED

© OCR 2025. You may photocopy this


Page 12 of 105 Created in ExamBuilder
page.
[3]

(b). A Basic room costs £60 each night. A Premium room costs £80 each night.
i. Create a function, newPrice(), that takes the number of nights and the type of room as parameters,
calculates and returns the price to pay.

You do not have to validate these parameters.

You must use either:

• OCR Exam Reference Language, or


• a high-level programming language that you have studied.

[4]
ii. Write program code, that uses newPrice(), to output the price of staying in a Premium room for 5
nights.

You must use either:

• OCR Exam Reference Language, or


• a high-level programming language that you have studied

© OCR 2025. You may photocopy this


Page 13 of 105 Created in ExamBuilder
page.
[3]

(c). A hotel car park charges £4 per hour. If the car is electric, this price is halved to £2 per hour.

Write an algorithm to:

• take as input the number of hours the user has parked and whether their car is electric or not
• calculate and output the total price
• repeat continually until the user enters 0 hours.

You must use either:

• OCR Exam Reference Language, or


• a high level programming language that you have studied.

© OCR 2025. You may photocopy this


Page 14 of 105 Created in ExamBuilder
page.
[6]

11(a). OCRBlocks is a game played on a 5 × 5 grid. Players take it in turns to place blocks on the board.
The board is stored as a two-dimensional (2D) array with the identifier gamegrid

Fig. 6.1 shows that players A and B have placed three blocks each so far.

Fig. 6.1

The function checkblock() checks whether a square on the board has been filled. When checkblock(4,2)
is called, the value "A" is returned.

function checkblock(r,c)
if gamegrid[r,c] == "A" or gamegrid[r,c] == "B" then
outcome = gamegrid[r,c]
else
outcome = "FREE"
endif
return outcome
endfunction

Write an algorithm to allow player A to select a position for their next block on the game board.

The algorithm must:

• ask the player for the position of their block on the board
• use the checkblock() function to check if this position is free
• if the position is free, add the letter "A" to the position chosen in the gamegrid array
• if the position is not free, repeat the above steps until a free position is chosen.

© OCR 2025. You may photocopy this


Page 15 of 105 Created in ExamBuilder
page.
[6]

(b). When checkblock(-1,6) is called, an error is produced.


i. State why this function call will produce an error.

[1]
ii. Describe how validation could be added in to the checkblock() function to stop this error from
occurring.

© OCR 2025. You may photocopy this


Page 16 of 105 Created in ExamBuilder
page.
[3]

(c). Give the returned value when the following statements are called.

Function call Returned value


checkblock(2,1)

checkblock(3,0)

checkblock(2,3)
[3]

12(a). Taylor is writing an algorithm to record the results of an experiment.

Taylor needs to be able to enter a numeric value which is added to a total which initially starts at 0.

Every time she enters a value, the total is output.

The algorithm repeats until the total is over 100.

Write an algorithm to implement Taylor’s requirements.

[6]

(b). For the next part of the experiment, Taylor needs to be able to enter 10 values and count how many of the
values are over 50, outputting this value once all values have been entered.
i. Complete the following flowchart to implement this algorithm.

© OCR 2025. You may photocopy this


Page 17 of 105 Created in ExamBuilder
page.
[5]
ii. Write a pseudocode algorithm that uses iteration to allow Taylor to:

• enter 10 values
• count how many values are over 50
• output the count of values over 50 after all 10 values are entered.

© OCR 2025. You may photocopy this


Page 18 of 105 Created in ExamBuilder
page.
[5]

13. A program is being created to convert the data capacity of a storage device into a different measure.

The function, calculate(), takes the measurement (e.g. gigabytes) and the number (e.g. 2) as two
parameters. It then returns the value in bits. The function returns –1 if an invalid measurement was entered.

Complete the function calculate

function calculate(.................................................., number)

if measurement = = "gigabytes" then

value = number * 1024 * 1024 * 1024 * 8

elseif measurement = = ".................................................." then

value = number * 1024 * 1024 * 8

elseif measurement = = ".................................................." then

value = number * 1024 * 8

elseif measure = = "bytes" then

value = number * ..................................................

else

..................................................

endif

return ..................................................

endfunction

[6]

14. The following names of students are stored in an array with the identifier studentnames.

studentnames = ["Rob", "Anna", "Huw", "Emma", "Patrice", "Iqbal"]

A school uses the array to call an attendance register every morning.

© OCR 2025. You may photocopy this


Page 19 of 105 Created in ExamBuilder
page.
Write an algorithm using iteration to:

• display the name of each student one at a time from studentnames


• take as input whether that student is present or absent
display the total number of present students and number of absent students in a suitable message,

after all student names have been displayed.

[6]

15. Ali’s tablet computer has an operating system.

Ali’s computer uses virtual memory. Ali has written two procedures to help himself understand how virtual
memory works.

storeData() describes how data is stored in RAM.


accessData() describes how data is read from RAM.

Write the letter of the missing statements from the table in the correct place to complete the algorithms. Not all
statements are used, and some statements might be used more than once.

procedure storeData()

if RAM is ......................... then

move data from RAM to .........................

endif

© OCR 2025. You may photocopy this


Page 20 of 105 Created in ExamBuilder
page.
store data in next free space in .........................

.........................

procedure accessData()

if ......................... (data required is in RAM) then

if RAM is full then

move unneeded data from RAM to HDD

endif

move required data from HD to RAM

endif

read data from .........................

endprocedure

Letter Statement

A Secondary storage

B NOT

C Full

D endfunction

E Empty

F endprocedure

G AND

H RAM
[6]

16(a). A program creates usernames for a school. The first design of the program is shown in the flowchart in Fig.
2.

© OCR 2025. You may photocopy this


Page 21 of 105 Created in ExamBuilder
page.
Fig. 2

For example, using the process in Fig. 2, Tom Ward’s username would be TomWa.

State, using the process in Fig. 2, the username for Rebecca Ellis.
[1]

(b). The program design is updated to create usernames as follows:

If the person is a teacher, their username is the last 3 letters of their surname and then the first 2

letters of their first name.
If the person is a student, their username is the first 3 letters of their first name and then the first 2

letters of their surname.
i. What would be the username for a teacher called Fred Biscuit using the updated process?
[1]
ii. Write an algorithm for the updated program design shown in (i).

© OCR 2025. You may photocopy this


Page 22 of 105 Created in ExamBuilder
page.
[6]

17(a). A car dealership uses a computer system to record details of the cars that it has for sale. Each car has a
make, model, age and number of miles driven.

The car dealership only sells cars that have fewer than 10 000 miles and are 5 years old or less.
i. Write an algorithm that will:

• ask the user to enter the number of miles and the age of a car
• validate the input to check that only sensible values that are in the given range are entered
• output True if valid data has been entered or False if invalid data has been entered.

[5]

© OCR 2025. You may photocopy this


Page 23 of 105 Created in ExamBuilder
page.
ii. The validation routine from part (i) must be tested with normal, erroneous and boundary test data.

Identify suitable test data for each type of test.

Miles Age

Normal

Erroneous

Boundary

[3]
iii. Identify when iterative testing is performed.

[1]

(b). The car dealership sells electric cars, which require charging before they can be driven. Charging the battery
by 1% takes 10 minutes.

For example, a battery has 80% charge. It would take 200 minutes, or 3 hours and 20 minutes to charge to
100%.

Write an algorithm that:

• asks the user for the current battery charge percentage


• outputs "full" for a battery currently at 100%

• calculates how long this battery would take to charge


• outputs this in hours and minutes.

© OCR 2025. You may photocopy this


Page 24 of 105 Created in ExamBuilder
page.
[6]

18. A teacher researches the length of time students spend playing computer games each day.

The teacher asks students how long they spend completing homework. Students answer in minutes and hours
(for example 2 hours 15 minutes).

The teacher would like to create an algorithm that will display students’ inputs in minutes only.
i. Identify the input and output required from this algorithm.

Input

Output

[2]
ii. A program is created to convert hours and minutes into a total number of minutes.

The teacher wants to create a sub program to perform the calculation.

The program has been started but is not complete.

Complete the design for the program.

© OCR 2025. You may photocopy this


Page 25 of 105 Created in ExamBuilder
page.
hours = input("Please enter number of hours played")
minutes = input("Please enter number of minutes played")
finalTotal = .................................................................................
print(finalTotal)

function ................................................................................
................................................................................
................................................................................
................................................................................
................................................................................

endfunction

[4]
iii. The following flowchart outputs a message depending on how long each person has spent playing
computer games.

Rewrite the flowchart as a program.


You must use either:

• OCR Exam Reference Language, or


• a high-level programming language that you have studied.

© OCR 2025. You may photocopy this


Page 26 of 105 Created in ExamBuilder
page.
[4]

19(a). OCR Land is a theme park aimed at children and adults. Entrance tickets are sold online. An adult ticket to
OCR Land costs £19.99, with a child ticket costing £8.99. A booking fee of £2.50 is added to all orders.

A function, ticketprice(), takes the number of adult tickets and the number of child tickets as parameters. It
calculates and returns the total price to be paid.
i. Use pseudocode to create an algorithm for the function ticketprice().

© OCR 2025. You may photocopy this


Page 27 of 105 Created in ExamBuilder
page.
[6]
ii. Tick (✓) one box to identify the data type of the value returned from the function ticketprice(),
justifying your choice.

Data type of returned value Tick (✓) one box


Integer

Real

Boolean

String

Justification

[2]

(b). OCR Land keeps track of the size of queues on its rides by storing them in an array with the identifier
queuesize. It uses the following bubble sort algorithm to put these queue sizes into ascending numerical order.

01 swaps = True
02 while swaps
03 swaps = False
04 for p = 0 to [Link]-2
05 if queuesize[p] > queuesize[p+1] then
06 temp = queuesize[p]
07 queuesize[p] = queuesize[p+1]
08 queuesize[p+1] = temp
09 swaps = True
10 endif

© OCR 2025. You may photocopy this


Page 28 of 105 Created in ExamBuilder
page.
11 next p
12 endwhile
i. Explain the purpose of the Boolean variable swaps in this bubble sort algorithm.

[2]
ii. Explain the purpose of lines 06 to 08 in this bubble sort algorithm.

[2]
iii. Describe one way that the maintainability of this algorithm could be improved.

[2]
iv. Give the names of two other sorting algorithms that could be used instead of bubble sort.

© OCR 2025. You may photocopy this


Page 29 of 105 Created in ExamBuilder
page.
[2]

(c). One ride in OCR Land has a minimum height of 140 cm to ride alone or 120 cm to ride with an adult.

Create an algorithm that:

• asks the user to input the height of the rider, in centimetres


• if needed, asks if they are riding with an adult
• outputs whether or not they are allowed to ride
• repeats this process until 8 people have been allowed to ride.

© OCR 2025. You may photocopy this


Page 30 of 105 Created in ExamBuilder
page.
© OCR 2025. You may photocopy this
Page 31 of 105 Created in ExamBuilder
page.
[8]

20(a). A programmer creates an algorithm using a flow chart.

Complete the table to give the output when each of the following set of values are input into the algorithm as X
and Y.

Input value of X Input value of Y Output


15 10
6 5
2 3
12 2

© OCR 2025. You may photocopy this


Page 32 of 105 Created in ExamBuilder
page.
[4]

(b). Write this algorithm using pseudocode.

[6]

21. William is creating a film for a school project using a digital video camera.

William transfers the videos to a computer for editing.


i. The computer has 1GB of storage free.

Calculate the number of videos that could be stored on the computer if each video was 100MB in size.

Show your working.

[2]
ii. A program needs to calculate the size of files in bytes. The program must:

○ Ask the user to input a file size in megabytes


calculate and output the number of bytes this represents in a user friendly format

(e.g. "There are 5242880 bytes in 5MB").

Write an algorithm using pseudocode to calculate the number of bytes in a given number of megabytes.
© OCR 2025. You may photocopy this
Page 33 of 105 Created in ExamBuilder
page.
[6]

22(a). A library gives each book a code made from the first three letters of the book title in upper case, followed
by the last two digits of the year the book was published.

For example, “Poetry from the War”, published in 2012 would be given the code POE12.

i. Complete the following pseudocode for a function definition that will take in the book title and year as
parameters and return the book code.

01 function librarycode (title, ………………………………………………)


02 parta = [Link] (0, ………………………………………………)
03 partb = [Link] (2, 2)
04 ……………………………………………… [Link] + partb
05 endfunction

[3]

© OCR 2025. You may photocopy this


Page 34 of 105 Created in ExamBuilder
page.
ii. Use pseudocode to write an algorithm that does the following :

• Inputs the title and year of a book from the user.


• Uses the librarycode function above to work out the book code.
• Permanently stores the new book code to the text file [Link]

© OCR 2025. You may photocopy this


Page 35 of 105 Created in ExamBuilder
page.
[6]

(b). The library sorts their books based on the book code.
i. Show the steps that a merge sort would take to put the following list of book codes into ascending
alphabetical order (from A to Z).

POE12 , BAC97 , FLY77 , JAV16 , TAL86 , AND18 , ZAR09 , HOP86

© OCR 2025. You may photocopy this


Page 36 of 105 Created in ExamBuilder
page.
[4]
ii. Explain one advantage of a merge sort compared to a bubble sort.

[2]

23. OCR town are holding an election with three candidates (A, B and C). An electronic voting booth will be used
to allow people to vote.

Write an algorithm that:

• Allows voters to enter either A, B or C.


• Keeps track of how many times each candidate has been voted for.
• As soon as one person has finished voting, allows the next person to vote.
At any point allows the official to type in “END”, which will print out the number of votes for each

candidate and the total number of votes overall.

© OCR 2025. You may photocopy this


Page 37 of 105 Created in ExamBuilder
page.
[6]

© OCR 2025. You may photocopy this


Page 38 of 105 Created in ExamBuilder
page.
24. A memory game is played where:
 three players (A, B and C) have to choose a number between 0 and 100
 if the number has already been chosen, a message is displayed that says “taken”
 if the number has not already been chosen, the playerws letter is placed next to it
 the quantity of numbers that have not yet been chosen is displayed.

The winner is the player who has chosen the most unique numbers by the end of the game.

The numbers are stored in an array; numbers(). A number that has not yet been chosen is stored as an empty
string “”. The players are represented by “A”, “B” and “C”.

Fig. 5 shows an extract from the array:

Fig. 5

You have been asked to program part of the game.

Write an algorithm for player A's turn, which;


 takes as an input the number that player A chooses
 if it has not already been chosen, stores an “A” in that array element
 if it has already been chosen, outputs “taken“
 counts and outputs the quantity of numbers left that have not been chosen.
[6]

© OCR 2025. You may photocopy this


Page 39 of 105 Created in ExamBuilder
page.
© OCR 2025. You may photocopy this
Page 40 of 105 Created in ExamBuilder
page.
25(a). A game on a computer shows six players around a table on seats. They are numbered 1 to 6 as shown
below.

The names of the players are stored in an array with six elements called PlayerName. The index position of the
array is used to indicate the seat number.
For example, the value of PlayerName(1) is “Helen”.

State the value of PlayerName(3).


[1]

(b). Describe what will happen if the code for the game includes an instruction to print the value of
PlayerName(7).

[2]

(c). During the game, each player sometimes moves clockwise by a given number of places.

For example, if the number of places is 2, Helen will move to seat 3, Priya will move to seat 1 etc.

Write an algorithm that will update the contents of the array PlayerName after a move has occurred. Your
algorithm should:
 allow the number of places to move to be input
 use iteration
 ensure that all of the existing players' names are moved to the correct position in the array.

© OCR 2025. You may photocopy this


Page 41 of 105 Created in ExamBuilder
page.
[6]

26. An isosceles triangle is a triangle that has at least two equal sides. The diagram below shows examples of
isosceles triangles. In each diagram the marked sides are equal.

Write an algorithm for a computer program that determines whether a triangle is an isosceles triangle.
 The user inputs the lengths of the three sides as Length1, Length2 and Length3
 If any two sides have the same length the program outputs “Isosceles”
 Otherwise the program outputs “Not Isosceles”

© OCR 2025. You may photocopy this


Page 42 of 105 Created in ExamBuilder
page.
[5]

27. * A free drinks machine in an office provides 20 different drinks.

The machine has a small keypad with keys 0 to 9, OK and CANCEL. It also has a small LCD screen, which can
display a short message.

To get a drink, users select an item number between 1 and 20 with the keypad and confirm their choice by
pressing OK. If they make a mistake they can press the CANCEL button and start again. If the selection is valid
and the drink is available it dispenses the drink. The display screen is used to show suitable short messages
throughout the process.

Write an algorithm for the process described above.

The quality of written communication will be assessed in your answer.

© OCR 2025. You may photocopy this


Page 43 of 105 Created in ExamBuilder
page.
[6]

28(a). Heath is researching how long, to the nearest minute, each student in his class spends playing computer
games in one week (Monday to Friday). He is storing the data in a 2D array.

Fig. 2 shows part of the array, with 4 students.

© OCR 2025. You may photocopy this


Page 44 of 105 Created in ExamBuilder
page.
For example, student 1, on Monday (day 0), played 30 minutes of computer games.

Heath wants to output the number of minutes student 3 played computer games on Wednesday (day 2). He
writes the code:
print (hoursPlayed[3,2])

The output is 20.


i. Write the code to output the number of minutes student 0 played computer games on Wednesday.

[
ii. State the output if Heath runs the code:
print (hoursPlayed[2,1])

[
iii. State the output if Heath runs the code:
print (hoursPlayed[3,1] + hoursPlayed[3,2])

[
iv. Write an algorithm to output the total number of minutes student 0 played computer games from Monday
(day 0) to Friday (day 4).

© OCR 2025. You may photocopy this


Page 45 of 105 Created in ExamBuilder
page.
(b). Heath needs to work out the average number of minutes spent playing computer games each day for the
class, which contains 30 students. Write an algorithm to output the average number of minutes the whole class
spends playing computer games each day.

© OCR 2025. You may photocopy this


Page 46 of 105 Created in ExamBuilder
page.
[8]

29. Jim is writing a program to calculate the wages of workers in a teddy bear factory.

The wages earned by a worker is either £2 for every teddy bear they have made or £5 for every hour they have
worked, whichever is larger.

Write an algorithm that:


 allows the user to input the number of teddy bears made and the number of hours worked
 calculates the wages for the number of teddy bears made
 calculates the wages for the number of hours worked
 outputs the larger of the two results.

© OCR 2025. You may photocopy this


Page 47 of 105 Created in ExamBuilder
page.
[6]

30. A computer program calculates the correct dose in grams of a type of medicine.

The algorithm used is shown by the flow diagram below.

Use the flow diagram to calculate the correct dose of medicine for a pregnant female aged 19.
You must show your working.

© OCR 2025. You may photocopy this


Page 48 of 105 Created in ExamBuilder
page.
[4]

END OF QUESTION PAPER

© OCR 2025. You may photocopy this


Page 49 of 105 Created in ExamBuilder
page.
Mark scheme
Questi Mark
Answer/Indicative content Guidance
on s

Ignore additional lines that do not affect outcome.


FT for missing or incorrect line numbers.
FT for output based on incorrect tracing of loop.

Line number a b c pilotCode Output


1 mark per row
 c = 90 on line 05 01 H

 c = 900 on line 05 4
02 K
1  pilotCode = HK900 (AO3
on line 07 1) 03 9
 HK900 output on
line 08 05 90

05 900

07 HK900

08 HK900

Total 4

2 1 mark each: 3 Ignore lines 02 and 05 in answer unless these change or


 Start is set to 3 on (AO3 output any values.
line 01 and 3 is 2c)
output on line 03. Candidate may repeat start value when unchanged, this is
 2, 1 and 0 are output acceptable.
on next 3 iterations
with start updated to Penalise incorrect or missing line numbers or additional
2, 1, 0, -1 on correct output once only then FT. This includes where variable
line numbers. change and output appear on the same line.
 Finished is output
on line 06 -1 must not be output for BP2

Penalise missing or incorrect output once only for BP1


and FT for missing or incorrect output for BP2.

Finished may be with or without quotes. Ignore case or


minor spelling error.

Max 2 marks if any incorrect output or changes to start.

Do not accept calculated values of start (e.g. 3–1)

Examiner’s Comments

This question assessed candidates’ ability to trace


through and understand the steps taken by an algorithm.
This also tested their understanding of condition-

© OCR 2025. You may photocopy this


Page 50 of 105 Created in ExamBuilder
page.
controlled loops. Many responses were very successful
with this and achieved full marks.

Mistakes tended to be with identifying the line number


where each change occurred or outputting values that
were not actually output (e.g. -1).

Examiners were instructed to only penalise a


misunderstanding once. Where (for example) line
numbers were incorrect, this would still have allowed 2 out
of 3 marks to be achieved.

Total 3

Do not accept "change to string” - this is the use in this


example but not a definition.

Examiner’s Comments
2
Many candidates correctly defined casting as changing
 Convert/change one (AO1
data from one data type to another. Some candidates
3 i data type to another 1b)
defined this term as changing a variable from an integer to
 Line 03 / 3 / three (AO2
a string, which is only one example of what can be done
2b)
and not a definition.

The majority of candidates then gave the correct line


number (line 03) for there this was shown the example
code given.

ii  Kofi2021 as staffID 4 Max 2 if incorrect order. Ignore misspelling of Kofi


on line 03 (AO3
 Kofi2021x as staffID 2c) Penalise lack of / errors with line numbers once then FT.
on line 05 Ignore capitalisation. Ignore additional lines unless
 Kofi2021xx as outcome impacted.
staffID on line 05
 ID Kofi2021xx staffID does not have space in. Output does have a
output on line 07 as space in. Penalise spaces once then FT. Do not penalise
first and only output unless obvious.

Quotes around answer is OK, but do not allow quotes


around partial answers, e.g. “ID” Kofi2021xx is
incorrect.

Line
surname year staffID Output
number

01 Kofi

02 2021

03 Kofi2021

05 Kofi2021x

05 Kofi2021xx

07 ID Kofi2021xx

© OCR 2025. You may photocopy this


Page 51 of 105 Created in ExamBuilder
page.
Examiner’s Comments

This question asked candidates to trace through a given


algorithm to show the value of three variables at various
points in the algorithm.

The algorithm itself was relatively simple. It used


condition-controlled iteration to repeat while the length of
the username was less than 10 characters.

Most candidates gained the first 2 marks for the initial


changes to staffID. However few candidates were able
to trace through the iteration and conclude that the final
username should end up as ID Kofi2021xx.

Marking this question considered the spaces within the


username at various points. The algorithm results in one
space only, in between ID and Kofi2021xx. Where extra
spaces appeared or were missed, this was penalised.
However, examiners were instructed to give clear benefit
of doubt, and to only do this if the space was clearly
present/missing.

It is important to understand that “ab” and “a b” are two


strings that are not the same. This level of precision
should be encouraged within GCSE Computer Science.
Experience of practical programming will help reinforce the
impact of spaces within programming and algorithms.

Total 6

one mark for first row

4 one mark for row 2 and 3


4 (AO3
2c) one mark for rows 4, 5, and 6

one mark for the correct output (the only value in the
output column, in any position)

Total 4

5 1 mark each to max 6 6 Allow else for BP3/4 (validated in question 8a)
 Appropriate use of (AO3)
both parameters Allow <=, >= and equivalents (e.g. <= 0) for BP5.
and no additional
inputs / incorrect Do not award BP5 if before BP3 and 4 (otherwise will alter
overwrites that position value)

© OCR 2025. You may photocopy this


Page 52 of 105 Created in ExamBuilder
page.
affect outcome of
algorithm BP6 only to be given if attempt made at calculating new
 Attempt at position. Calculation can be partial/incorrect.
selection…
 …correctly checking Ignore repeat of function header / end.
if direction is
"left" and Accept flowchart / structured English but must not just
subtracting 5 from repeat the question.
position (or
equivalent) If response uses loop to incorrectly change position
 …correctly checking multiple times, do not award BP1 (incorrect overwrite)
if direction is
"right" and adding 5 For minor syntax errors (e.g. missing quotation marks or
to position (or == for assignment, spaces in variable names) penalise
equivalent) once then FT.
 Ensuring position (or
equivalent) is Examiner’s Comments
between 1 and 512
inclusive This question was an excellent discriminator in terms of
 Returning the candidate achievement. In particular, correct use of the
updated position given parameters (direction and position) was only
Example seen from the most successful candidates. Many
if direction == candidates instead started their response by asking for
"left" then input from the user and therefore overwriting the
position = position parameters, losing crucial marks in the process.
- 5
elseif direction == As on previous papers, this question provided one mark
"right" then for any attempt made at a section of the requirement, in
position = position this case selection. Candidates who attempted to use an
+ 5 if or select case statement, even incorrectly or in the
endif wrong context were able to achieve at least this mark;
centres should therefore continue to encourage all
if position < 1 then candidates to attempt each and every question and not
position = 1 leave responses blank.
elseif position >
512 then It was challenging to achieve full marks, but many
position = 512 candidates did because of their excellent levels of
endif practical programming experience in school.

return position Exemplar 2

This candidate achieved full marks. The given parameters


(direction and position) are both used and not overwritten
by inputs before the position is modified depending on the

© OCR 2025. You may photocopy this


Page 53 of 105 Created in ExamBuilder
page.
direction given. The position is then validated to make
sure that it is between 1 and 512 before being returned.

Note the use of position +=5 to add 5 to the position.


This is an entirely acceptable alternative to position =
position + 5

Total 6

6 1 mark each to max 6 6 No need to cast data to string/integer.


 Initialise / declare (AO3
score (to zero) 2b) If random numbers chosen, BP3 must use these. If no
before use, outside random numbers chosen, allow manually setting values
of any loop
 Generates 2 random BP6 can be awarded for either a loop repeating 3 times or
numbers between 1 the same code written out 3 times
and 10
 Inputs answer from BP5 can be given FT if sensible attempt at BP4
user displaying
suitable numbers Do not award BP6 if same numbers used for every
 Checks if input is question. Must pick new values each time.
correct answer…
 … if correct adds 1 Do not penalise potential off by 1 errors for looping
to score (Python) or random number generation
 Repeats BP2 to 5
three times (for Example answer
bullet points
attempted) score = 0
 Outputs score after for count = 1 to 3
reasonable attempt num1 = random(1, 10)
at counting num2 = random(1, 10)
ans = input("What is” +num1 + " + " + num2
+ "?")
if ans = num1 + num2 then
score = score + 1
end if
next count
print("You scored " + score)

Examiner’s Comments

As this question appears in Section A, candidates are free


to respond in any suitable way, including using flowcharts,
structured English, pseudocode or a high-level language.

The majority of high scoring responses used a high-level


language consistently.

Where flowcharts or structured English were used,


responses needed to clearly show the steps to be taken
and not simply repeat the question to achieve marks.

The given question is already decomposed for candidates


and many were able to use these bullet points to build a

© OCR 2025. You may photocopy this


Page 54 of 105 Created in ExamBuilder
page.
solution that achieved the majority of marks available.

Many responses used random number generation and


iteration to create an elegant response that met all mark
points. This was pleasing to see and it is extremely
encouraging that candidates can use techniques such as
these where appropriate without being prompted.

Other responses manually repeated asking the required


questions; on this occasion, these were also credited and
could have achieved full marks.

Where a mistake was made in one section (such as with


iteration), examiners were instructed to use FT (follow
through) where possible. This allowed candidates to score
marks in later sections if their responses were logically
constructed. This is to be fair to candidates so that
mistakes are only penalised once in any given question.

A significant number of responses did not access many


marks in this question. This would suggest that more
practical programming time in lessons would be beneficial.

Total 6

7 a 1 mark each: 4 Selection could be done using IF statement, case


 Attempt at using (AO3 statement or any other sensible valid method.
selection / condition 2b)
controlled loop Allow reference to AlarmActivated or equivalent
 Checking if system instead of SystemArmed
armed / while
system armed Ignore any inputs or modification of variables.
 If Door Sensor
active OR Window Allow True / False as strings. Allow checking against
Sensor active (both strings (e.g. if SystemArmed == “active”)
checks required)
 calling SoundAlarm Allow checking armed/disarmed for BP2 and BP3
correctly
Only award BP4 if SoundAlarm correctly called / not called
in every situation. If issues on previous lines (e.g. lack of
brackets where needed) means this is not the case, do
not award BP4.

Checking could be done by evaluating variable directly


(if SystemArmed) or by comparison (if
SystemArmed == True)

Example answer 1

if SystemArmed then
if DoorSensorActive then
SoundAlarm()
else if WindowSensorActive then

© OCR 2025. You may photocopy this


Page 55 of 105 Created in ExamBuilder
page.
SoundAlarm()
endif
endif

Example answer 2

while SystemArmed then


if DoorSensorActive then
SoundAlarm()
else if WindowSensorActive then
SoundAlarm()
endif
endif

Example answer 3

if SystemArmed and (DoorSensorArmed or


WindowSensor) then
SoundAlarm()
endif

Note – above example needs brackets,

if SystemArmed and DoorSensorArmed or


WindowSensor then

is not logically valid for this scenario (will sound alarm


when not armed if window sensor is active)

Example answer 4

if SystemArmed and DoorSensorArmed


SoundAlarm()
else if SystemArmed and WindowSensorArmed
SoundAlarm()
endif

Examiner’s Comments

Many responses achieved highly on this question. The


question asks for a simple program to be written that
checks the given variables and calls the given procedure
when necessary.

Examiners were instructed to be generous with the first


mark, crediting any use of selection or condition-controlled
iteration. Responses may therefore have been rewarded
for an attempt at this question even if their solution was
not fully functional.

Centres should encourage candidates to attempt each


question for precisely this reason; it is typical that a small
number of marks are allocated to attempting a solution on
many programming questions for J277/02.
© OCR 2025. You may photocopy this
Page 56 of 105 Created in ExamBuilder
page.
A significant number of responses were given 3 out of 4
marks as they misunderstood the role of operator
precedence in their solution; this is detailed in the
"misconception" box below.

Misconception

Where multiple conditions are used in selection, these


have an order of precedence very much like BIDMAS
does in mathematics; an AND operator will always take
precedence over an OR operator. A NOT operator (not
used in this question) would have even higher
precedence.

This can cause problems in candidate responses. A


common candidate response was:

if SystemArmed AND DoorSensorActive OR


WindowSensorActive then SoundAlarm()

However, because the AND operator takes precedence,


the first check done here is if the system is armed and the
door sensor is active. The result of this is then evaluated
with an OR operator to check if the window sensor is
active.

This results in the alarm sounding if the window sensor is


active, even if the system is not armed. This was clearly
not the candidate's intention.

To fix this, candidates could have either:


 put brackets/parentheses around the Door OR
Window section of their response
 written the response as separate checks. This
could have been done in multiple ways, including
nested if statements or repeated checks.

Exemplar 1

Exemplar 1 shows one way that full marks are achieved


on this question. The candidate has used nested if
statements to check if the system is armed, and if true,
then checking if either sensor has been activated. The
SoundAlarm() procedure is only called if both if
© OCR 2025. You may photocopy this
Page 57 of 105 Created in ExamBuilder
page.
statements evaluate to True.

b 1 mark each 6 Must be clear that answer is a procedure definition, do not


 Define procedure (AO3 credit calling procedure for BP1. Allow function definition.
SaveLogs… 2b)
 …with two valid If parameters are later overwritten, do not credit BP2 but
parameters FT for BP4 and 6.
 Open file (for
write/append) … Closing text file does not need reference to file
 … using the file name/object – e.g. “close file” is enough. However, if
name passed in as given reference must be correct.
parameter
 Write data to file… If code given outside of procedure, do not give BP4 and
 …using the data BP6
passed in as
parameter Allow FT for multiple occurrences of same mistake (e.g.
 Close file not using filename correctly for open and close)

Example answer

procedure SaveLogs(data, filename)


logFile = open(filename)
[Link](data)
[Link]()
endprocedure

Examiner’s Comments

This question proved to be challenging for many


candidates. The question combined defining a procedure
with the use of text files.

The tasks required were partially decomposed in the bullet


points. A candidate attempting these in order would have
achieved a significant number of marks.

Candidates could also have achieved numerous marks for


a partial solution (e.g. defining a procedure that didn't use
text files or writing to a text file outside of a procedure)
and the mark scheme was deliberately constructed to
credit these responses.

Full marks were often given where candidates appear to


have had practical experience of these two techniques.

Exemplar 2

© OCR 2025. You may photocopy this


Page 58 of 105 Created in ExamBuilder
page.
Exemplar 2 shows a response that scored full marks. The
procedure has been defined with multiple parameters
which are then used to open the file and to write the data.
The candidate has also achieved the bullet point 7 on the
mark scheme (closing the file) but this wasn’t necessary in
this case.

Accept type casting Do not accept conversion. Do not


accept examples of casting.

1 mark for: 1 Examiner’s Comments


c i (AO3
 Casting / cast
2a) The use of the term "casting" to convert one data type to
another is now well known and understood by candidates.
This is given and referred to in the J277 specification and
is essential knowledge.

ii 1 mark each to max 6 6 BP2 can be achieved either by iteration accessing each
 Input date and store (AO3 event or manually repeating code to access each event.
in variable / use 2b) Must be 0 to 6, not 1 to 7.
directly
 Access all seven Allow reference to events (table given) or
(indexes 0 to 6) arrayEvents (2D array) in answer as long as used
events in array / consistently.
loop for each event
in array BP2 loop allow off by one errors (Python), looping to array
 Attempt at length or array length – 1. Allow for each item in array
selection… or any other suitable loop.
 …to compare date
input against date BP4 and BP5 allow array reference as either column
in array (element 0) major or row major.
 …adding length
(element 3) from Output can either be once at the end or on every iteration,
array to the total if as long as it is output at the end.
dates match.
 Outputting Only give output mark if attempt made to calculate total
calculated total and within the algorithm.
date in appropriate
message(s) at the Do not penalise capitalisation or minor misspellings of
end variable names.

Example answer 1

total = 0
date = input("Please enter date")
for count = 0 to [Link]-1
if events[0, count] == date then
total = total + events[3,count]
endif
next count
print("There were " + total + " events on "
+ date)

Example answer 2

© OCR 2025. You may photocopy this


Page 59 of 105 Created in ExamBuilder
page.
total = 0
date = input("Please enter date")
for item in events:
if item[0] == date then
total = total + item[3]
endif
next count
print("There were " + total + " events on "
+ date)

Examiner’s Comments

The final question in Section B is expected to be a high


demand question.

The techniques required (iteration through a 2D array,


selection, keeping a running total of times) are within the
specification but it is acknowledged that the level of
challenge was high.

Examiners were instructed to give marks for an attempt at


a solution (as with previous questions).

For this question marks were given for:


 any attempt at selection
 any solution that accessed each element in the
given array, even if this was via a manual process.
Therefore, many candidates gained multiple marks for an
attempt that only partially solved the problem.

A significant number of candidates were able to create a


solution that fully met the requirements of the question.
This was often done in an elegant and efficient manner.

This is extremely pleasing and shows excellent


understanding and significant experience of practical
programming.

Exemplar 3

© OCR 2025. You may photocopy this


Page 60 of 105 Created in ExamBuilder
page.
Exemplar 3 shows a high scoring response. A date has
been asked for as input which has then been used to
compare to each element at position 0 in the array.

Where any of these match, the total variable is updated to


keep a running total of the corresponding element at
position 3 in the array.

After each element has been checked, the total and date
are output in a suitable message.

This is not the only method by which a response could be


given full marks but is perhaps the most common.

Total 17

8 a  Start and end/stop 5


with all boxes (AO3
connected, no 2a)
boxes that do not
lead to another box
(no arrows needed)
 Input three variables
using
parallelogram
shape
 Checks all three
criteria (day,
student, discount
card) using
diamond shape(s)
with two lines from
each
 …Outputs “full
price” with correct
conditions using
parallelogram Question asks for a flowchart. Answers as pseudocode,
shape high level language or other forms are not acceptable 9
 …Outputs “half (NAQ).
price” with correct
conditions using BP 4 and 5 only to be awarded if all decisions ensure
parallelogram correct output and clear what the decisions are . FT for
shape incorrect shapes used or no inputs as long as decisions
Guidance for correct are logically correct. Must attempt all three decisions.
outputs
Allow calculation of half price / full price instead of
message but this must still be output.
Conditions Outcome
Inputs / decisions may be presented as individual or
Not Saturday Half price combined boxes but must still store as three variables.
and (either a
Penalise lack of parallelogram for input/output once only

© OCR 2025. You may photocopy this


Page 61 of 105 Created in ExamBuilder
page.
student or has a
discount card).

Saturday or (not
a student and then FT
Full price
doesn’t have a
discount card). BOD parallelogram shapes if not sure whether input or
output as long as context is clear (e.g inputs at start,
outputs at end)
Disco
Saturd Stude Outco Examiner’s Comments
unt
ay nt me
Card
Most candidates who answered this question were
Full comfortable using the correct flowchart symbols listed in
N N N
price the specification. A mark was available for including
suitable start / end symbols and connecting all other
N N Y
Half symbols, so even candidates who may struggle should
price feel confident of being able to access some marks.
Half
N Y N Marks were dropped when responses did not include
price
suitable inputs to the algorithm. The first bullet point in the
Half
question stem was clear that these were required.
N Y Y
price
Candidates achieving lower scores tended to group
Full decisions so that any processing was removed (such as
Y N N
price “can they have a discount?”). More successful responses
decomposed the problem and used a succession of
Full
Y N Y smaller decisions (“do they have a discount card?”, “are
price
they a student?”, “is it Saturday?”). These decisions then
Full
point towards the correct outputs.
Y Y N
price

Full
Y Y Y
price

b  Number of people 2 Ignore additional inputs that would be sensible, such as


(at the table) / (AO3 cost of the meal.
whether there are 2a)
more than 5 people Accept inputs in form of pseudocode / high-level
or not language.
 Choice between
percentage and Max 1 if other irrelevant inputs given.
value / actual value
of both percentage, "Whether to leave a tip or not” or "Amount of tip” NE for
value BP2. Must address both the percentage and value of tip if
asked for. BOD "type of tip” for BP2

Examiner’s Comments

This question type is new to the J277 specification and


asked candidates to list inputs that will be required as part
of the planning stage for an algorithm. Successful
candidates were able to identify the raw data needed from

© OCR 2025. You may photocopy this


Page 62 of 105 Created in ExamBuilder
page.
the user in order to be able to solve the problem.

Unsuccessful responses tended to simply rewrite the


question or miss out key information.

Total 7

9  input and 6 e.g.


stores/uses value (AO3
with message 2b) num = input(”Enter how many numbers”)
 attempt at (AO3
repeating… 2c) for x = 1 to num
 … correctly repeats
number of times temp = input(”Enter a number”)
given as input
 … correctly take total = total + temp
number as input
within loop and next x
calculates total of
these numbers print(total)
 … correctly
calculate an print(total / num)
average (total/num)
 Output both total If flow chart used, correct shapes needed.
and average
Allow tolerance of 1 with number of loops for BP3 with for
loops

BP1 requires input with a message (can be two


statements, e.g. print and then input or combined. Input
must be stored or used.

BP3, 4, 5 must be logically correct to be credited Ignore


non-initialisation of total

BP 5 can be given as FT as long as an attempt has been


made at working out a total within the loop.

BP6 can be given as FT long as attempt made at total and


average (not necessarily in a loop)

Examiner’s Comments

As this question appeared in Section A, candidates are


free to respond in any suitable way, including using
flowcharts, structured English, pseudocode or a high-level
language. The majority of candidates who scored highly
tended to use a high-level language consistently.

The question is already decomposed for candidates and


many were able to use these bullet points to build a
solution that achieved the majority (or all) marks available.

Where mistakes were made, these tended to be with

© OCR 2025. You may photocopy this


Page 63 of 105 Created in ExamBuilder
page.
repeating code. For example, many candidates repeated
the process of adding values up without repeatedly asking
for a new number (and therefore continually adding the
same number).

Other candidates used condition-controlled iteration to


repeat the process but did not make sure that the
condition being evaluated ever returned a False value,
therefore repeating infinitely.

Where a mistake was made in one section (such as with


iteration), examiners were instructed to use FT (follow
through) marks where possible if later sections were
logically constructed. This made sure that marks could be
given where appropriate.

A few candidates were not able to access many of the


marks available in this question, suggesting that they
would benefit from more practical programming time in
lessons.

Total 6

1 a i  Checks that both 5 Must have some attempt at all three checks to give output
0 firstname and (AO3 mark(s). Check for nights must check both upper and
surname are not 2a) lower limits.
empty…
 Checks that room is Iteration can be used as validation if input repeatedly
either “basic” or asked for until valid answer given.
“premium”…
 Checks that nights Do not accept logically incorrect Boolean conditions such
is between 1 and 5 as if firstname or surname == “”
(inclusive)…
 …Outputs “NOT Do not accept ≥ or ≤ for >=, <=. Ignore capitalisation
ALLOWED” (or
equivalent) if any of e.g.
the 3 checks are
invalid (must check valid = True
all three) if firstname == “” or surname == “” then
 …Outputs valid = False
“ALLOWED” (or end if
equivalent) only if all if room != “basic” and room != "premium"
three checks are then
valid (must check all valid = False
three) endif
Note : output marks are if nights < 1 or nights > 5 then
given for if entire system valid = False endif
produces the correct if valid then
output. For example, If a print(“ALLOWED”)
user enters a valid name else
and room but an invalid print(“NOT ALLOWED”)
number of nights, the endif
system should say “NOT
ALLOWED” (or equivalent). BP1 to 3 can check for valid or invalid inputs. . Pay

© OCR 2025. You may photocopy this


Page 64 of 105 Created in ExamBuilder
page.
If this works and produces particular attention to use of AND / OR. Only give marks
the correct response no for output if these work together correctly.
matter which input is
invalid, BP4 should be Example above shows checking for invalid data. Checks
given. for valid data equally acceptable Examples shown below:
 if firstname != “” and surname != “”
The same process holds for  if room == “basic” or room == “premium”
the valid output - if (and  if nights >= 1 and nights <= 5
only if) three valid inputs
results in an output saying
“ALLOWED” (or
Examiner’s Comments
equivalent), BP5 should be
given. Do not give this if
This question stretched the understanding of even highly-
ALLOWED is printed when
achieving candidates and it was not uncommon to see low
(for example) two inputs
scoring responses.
are valid and one is invalid.
Misunderstanding of Boolean operators (AND and OR)
For any output marks to be
within selection (IF) statements was something that
given, a sensible attempt
affected a lot of candidate responses.
must have been made at all
three checks. These may
As this question was in Section B, candidates needed to
not be completely correct
respond in OCR Exam Reference Language or a high-
(and may have been
level language. Responses must be logically correct to
penalised in BPs 1 to 3) but
gain the marks. As each check is two individual checks
should be enough to allow
that both need to pass, responses can quickly get
the FT marks for output.
relatively complicated.

As can be seen from the mark scheme, advice and


examples were given to examiners to make sure that
candidates who were able to successfully navigate this
logic chain were credited.

Misconception

Checking whether a room is either basic or premium can


be done in multiple ways. Candidates can either check for
the positive (i.e. check that it is either basic or premium) or
check that for the negative (i.e. check whether it is
something else). However, there are many common errors
that were seen :
 IF room == “basic” or “premium” is
incorrect as the second part of the statement is
not evaluated against anything. This was perhaps
the most common mistake.
 IF room == “basic” or room ==
“premium” is correct and checks for validity.
 IF room == basic or room == premium is
incorrect as the lack of string delimiters means
that basic and room would be treated as variables
rather than strings.
 IF room != “basic” or room !=

© OCR 2025. You may photocopy this


Page 65 of 105 Created in ExamBuilder
page.
“premium” is also incorrect. This checks for
invalid input but because or is used, only one
condition needs to be True for the whole statement
to be True. This means that if basic is entered, it
would be classed as invalid (as it isn’t premium)
and vice-versa. There is no way for any entry in
this example to be classes as valid.
 IF room != “basic” and room !=
“premium” is correct. This checks for invalid
inputs but needs both conditions to be True.

The same explanation follows for the other two necessary


checks.

Exemplar 3

This exemplar shows a fully correct response. The


candidate checks for invalid responses and correctly uses
Boolean operators to check multiple criteria at each step.
If any check returns True, “Not allowed” is printed and the
program ends. Efficient use of if … else … means that
the next check only proceeds if the previous check returns
False.

If all three checks return False, the final else is triggered to


print “Allowed”.

It must be noted that this is only one way of achieving full


marks. An equivalent program that checks for valid
responses at each turn would also be possible.
Candidates should be encouraged to use whatever
structure they feel is sensible. If a response can logically
be followed then it will achieve high marks.

ii  Normal 3 Allow other descriptions that mean normal (e.g. valid /


 1 or 5 (not 0 or 6 as (AO3 typical / acceptable)
says allowed) 2c)
 Any numeric value Expected
except 1 to 5 / any Test data (number of
Type of test
non-numeric input nights)
output
(e.g. "bananas”)

© OCR 2025. You may photocopy this


Page 66 of 105 Created in ExamBuilder
page.
2 Normal ALLOWED

1/5 Boundary ALLOWED

e.g. 7 Erroneous/Invalid NOT ALLOWED

Examiner’s Comments

This question was answered well by the majority of


candidates.

b i  Function header for 4 BP1 must be clear that a new function is being defined.
newPrice… (AO3 E.g. function / def keyword. Allow FT for subsequent
 …taking (at least) 2b) marks if not present.
two parameters
 …correctly Ignore any code outside attempt at function definition.
calculates price
based on Ignore additional parameters. Ignore inputs or additional
parameters (if code as long as these do not overwrite parameters or
present) within affect operation of function.
function …/
 … returns this If inputs used instead of parameters, FT for BP3. Allow
calculated price use of else for second room type in BP3.

Attempt at calculation needed to award BP4. Must return


(not output) value. Return can be done e.g. in VB by
assigning to function name (e.g. newPrice = price)

e.g.

function newPrice(nights, room)

if room == “basic” then

if room== 60 * nights then

elseif room == “premium” then

price = 80 * nights

endif

return price

endfunction

Examiner’s Comments

Defining functions appeared to be a concept that


candidates did not fully understand.

Where a candidate did not attempt to define a function


and instead simply calculated the price needed, very few
(if any) marks were available.

© OCR 2025. You may photocopy this


Page 67 of 105 Created in ExamBuilder
page.
Successful responses could have been constructed from
any suitable function definition keyword such as
function (OCR ERL, VB, JavaScript, etc), def (Python)
or others. Answers in C#, Java or other languages
referring to methods were also accepted.

Order of parameters not important

“premium” must use string delimiters (e.g. “quotes”)

e.g.

print(newPrice(“premium”, 5))

x = newPrice(5, “premium”)

print(x)

Do not allow function definitions for BP1

Ignore capitalisation of newPrice

Candidate could store returned value in a variable and


then print this, or store parameters in variables before
 Call function
passing in - these are all acceptable
newPrice…
 …with 3
(“premium”, 5) Ignore any superfluous code given
ii (AO3
as parameters 2b)
Do not credit answers where newPrice is overwritten
 … Output returned
prior to use.
value
Ignore spaces. Allow function call if brackets missing (e.g.
newprice instead of newprice() )

Examiner’s Comments

Even if candidates were not able to create a function, this


question was independent to (i) and so marks were
available for simply using the function to output a value.

Candidate found this question challenging. Many


candidates called the function but most did not understand
that the room type was a string and so required string
delimiters (e.g. quotation marks) around the parameter.

Where candidates defined local variables, assigned the


values needed to the variables and then passed these into
the function call were accepted.

c  Inputs hours AND 6 Initialisation of price and hours not necessary, but if
electric (two (AO3 present hours must be non-zero for BP6 to be given.
separate inputs), 2c)
storing or using BP5 must include all points attempted. Can still be

© OCR 2025. You may photocopy this


Page 68 of 105 Created in ExamBuilder
page.
credited if any of BP1 to 4 not attempted / incorrect.

BP6 can be given as FT even if BP5 (loop) is in the wrong


place / does not include all required code

BP6 could be achieved as repeated function calls /


recursion

Initial input outside of loop that is then also included within


loop is fine. For example, input of hours outside of loop
but input is then repeated again at end of loop.

Do not accept while hours > 0 (could be -1)

Do not penalise answers where 0 is output when loop


exits
these.
 Checks if car is e.g.
electric (IF/Select
statement)… while hours != 0
 … correctly hours = input(”Enter hours”)
calculates and electric = input(“enter Y for electric
outputs price (hours or N”)
* 2 / price / 2) for if electric == ”Y” then
electric price = hours * 2
 … correctly elseif electric == ”N” then
calculates and price = hours * 4
outputs price (hours endif
* 4 / electric price * print(price)
2) for non-electric endwhile
 Attempt at repetition
of BP1 to 4…
 …until 0 hours Examiner’s Comments
entered
This question was relatively well answered by candidates.

Candidates were generally able to create suitable high-


level program code to calculate and output the total price
based on the information given.

Many candidates ignored the requirement to repeat until 0


was entered; in this case, 4 out of the 6 marks were still
available.

To achieve marks for iteration it needed to both repeat the


correct parts of the program and correctly terminate as per
the requirements given.

A typical mistake was to repeatedly calculate the price but


not ask afresh for new inputs.

Total 21

1 a  Input two position 6 If flowchart / structured English, do not allow simple repeat

© OCR 2025. You may photocopy this


Page 69 of 105 Created in ExamBuilder
page.
values separately
 calls
checkblock() of question.

⋯with input
function⋯ Example answer
 loop = True

⋯ returned value
parameters while loop
 row = input(“enter row”)
1 used in selection col = input(“enter column”)
 If free, stores “A” to if checkblock(row,col) == “FREE” then
correct index of gamegrid[row,col] = “A”
gamegrid array (FT loop = False
for incorrect endif
selection) endwhile
 Loops until free
position chosen

 Parameter values
outside index
range / larger than 4 Answer must refer to either array or gameboard / grid /
b i 1
/ smaller than 0 / -1, block
16 is not a valid
block

 Use selection / IF /
Switch-Case / range

⋯check that
check Allow equivalent checks (e.g. <5, between 0 and 4) for
 BP2
ii parameters are >=0 3 Allow reference to r and c as parameters.

⋯Return error code


and <= 4⋯ BOD handle error for BP3 (e.g. repeat until valid)
 Answer must be a description, code by itself is NAQ
if invalid / set
outcome to error

Returned
Function call
value
Do not accept “blank” or any other returned value for third
checkblock(2, call.
c 1)
B 3
Ignore case and spelling as long as recognisable.
checkblock(3,
A
0)

checkblock(2,
FREE
3)

Total 13

1 a  Initialises (total) as 0 6 Example answer total = 0


2 (outside loop if while total <=100
present) x = input(“Enter a number”)
 Inputs a number and total = total + x
stores the value print(total)

© OCR 2025. You may photocopy this


Page 70 of 105 Created in ExamBuilder
page.
endwhile

Examiner’s Comments

This part required candidates to implement an algorithm.


The algorithm takes a numerical input, adds it to a total
and repeats this until the total is over 100.

Most candidates were comfortable with basic input and


output of values. Many candidates were able to attempt to
 Adds the input to implement a loop. Fewer candidates were familiar with
the total (initialised how to continually add to a total.
in BP1 if present)
 Prints the total A number of candidates did not appear to appreciate that
 Iterates over BP2-4 while print(total + x) may display the sum of the

⋯until total is over


(if present)⋯ two variables, it does not add the values together and then
 store them.
100

Misconception

print(total + x) will output the sum of the two


variables without changing either. Instead total =
total + x (or in some languages, total += x ) will
modify the variable total, which can then be printed if
needed.

b i  Count = 0 5
 Output Count
 All non-decision
boxes and YES from
decision boxes
linked in a
sequential fashion
from Start to End.
 NO from first
decision box linked
to skip over
increment of count
 NO from second
decision box linked
back to INPUT
Ignore superfluous
instructions as long as they
do not affect the outcome of
the algorithm.

BOD misspelling of Count


as long as it is recognisable
Ignore capitalisation.

Examiner’s Comments

© OCR 2025. You may photocopy this


Page 71 of 105 Created in ExamBuilder
page.
This question asked candidates to complete a flowchart
for an experiment. Many candidates were able to gain
some marks for:

• initialising the 'Count' variable


• outputting this at the end
• repeating if 10 values had not been asked.

Some candidates did not complete the flowchart. They did


not successfully join the elements together correctly from
top to bottom.

Only high achieving candidates were able to correctly


decide where the NO output from the first decision box
should lead to. The correct response was to skip over the
increment but then complete the second decision.

AfL

The use of flowcharts to communicate algorithms should


be taught as an alternative to pseudocode and students
assessed on the logical flow expressed in these.

ii 1 mark per bullet point, max 5 Example answer


5 count = 0
 Initialises a count for x = 1 to 10
variable to 0 value = input(“enter a value”)
 asks user for an if value > 50 then
input count = count + 1
 Check if input is endif

 ⋯ increment count
over 50⋯ next x
print(count)
variable if True
 Repeats BP 2 and 3 Response must be in pseudocode as per question,
(if present) until 10 flowcharts or structured English are NAQ.
numbers have been
entered Examiner’s Comments
 Outputs count once This question utilised similar understanding to this part,
10 numbers have but utilised the loop in a different way.
been entered
This time, the algorithm was required to repeat a set
number of times and so a count-controlled loop would be
most appropriate. Many candidates did this successfully
and were credited for their answers.

Where candidates used condition-controlled loops or other


methods (such as recursive calls to a function), these
were also credited as long as they were logically correct.

The loop had to repeat 10 times to be correct. Benefit of

© OCR 2025. You may photocopy this


Page 72 of 105 Created in ExamBuilder
page.
doubt is given where languages such as Python are used,
where defining this precisely could be ambiguous.

A small number of candidates attempted to write out the


algorithm ten times which did not meet the requirements of
the question.

AfL

Centres should be encouraged to teach about iteration


using both count-controlled and condition-controlled loops,
comparing and contrasting the use of these for various
situations. Rewriting a count-controlled loop to use a
condition instead (and therefore manually incrementing
the counter variable) is a relevant challenge for students.

Total 16

1 mark for each completed


statement
function
calculate(measuremen
t, number)
if measurement =
"gigabytes" then
value = number *
1024 * 1024 * 1024 *
8
elseif measurement
= "megabytes" then
value = number *
1 1024 * 1024 * 8
6 Allow singular/plural, ignore case/spelling
3 elseif measurement
= "kilobytes" then
value = number *
1024 * 8
elseif measure =
"bytes" then
value = number *
8
else
return -1 /
value = -1
endif
return value
endfunction

Total 6

1  Use of iteration (any 6 BP 2 and 3 may be met together with suitable input
4 use) … statement. Both dependent on attempt at iteration.
 …loops for each AO3
© OCR 2025. You may photocopy this
Page 73 of 105 Created in ExamBuilder
page.
item in array / loops 2b(6) BP5 not dependent on correct previous parts.
6 times
 …to print out each BP6 needs reasonable attempt at totalling present and
item in absent figures.
studentnames
 …input attendance Ignore non-initialisation of counter variables.
 Add up/calculate
students present Flowcharts are acceptable but must show how to solve
and absent the problem, not simply repeat the question.
 …Outputs present
and absent (in Example algorithm
suitable message) present=0
absent=0
for i = 0 to ([Link]) -1
print(studentnames[i])
attendance=input("absent or present?")
if attendance=="present" then
present=present+1
else
absent=absent+1
endif
next i
print ("Present students: " + present)
print ("Absent students: " + absent)

Examiner’s Comments
Question (c) asked candidates to write an algorithm to:

1. Call an attendance register from a given array.


2. Count and output how many students were present and
absent.

It was pleasing to see candidates decompose the problem


and tackle each part to build a full solution.

The bullet points given in the question served as a


scaffold.

Where one section was incorrect, other marks could be


given.

A number of candidates attempted to use a FOR…IN loop


to iterate over the given student array.

FOR…IN is not listed in the specification but is an entirely


suitable way to approach the problem. Where this was
logically sound, full marks were available.

Other candidates used FOR…NEXT loops or WHILE


loops in conjunction with the length of the array. Again,
marks were given where the solution was logically sound.

Marks were more limited for those candidates who did not

© OCR 2025. You may photocopy this


Page 74 of 105 Created in ExamBuilder
page.
attempt any sort of loop, but some were still able to be
given where appropriate.

AfL

Centres should be encouraged to connect together


content within the specification, so that rather than
teaching arrays in isolation, they could perhaps be
combined with iteration to be able to count up or total
values in an array, or apply this to how searching and
sorting algorithms work. Where this is done on a regular
basis, questions such as 6(c) perhaps become less
daunting for candidates.

OCR support

Appendix 5f of the current J276 specification covers the


pseudocode guide for this examination. Candidates do not
need to use this in their responses but they should be
aware of this as questions will be presented using this
format.

For the new J277 specification, this has been replaced by


OCR Exam Reference Language. This is detailed from
page 25 onwards.

Total 6

1 1 mark for each letter in the 6


5 correct place

procedure storeData()
if RAM is C/Full then
move data from RAM to
A/Secondary Storage
endif
store data in next free
space in H/RAM
F/endprocedure
procedure accessData()
if B/NOT (data required is
in RAM) then
if RAM is full then
move unneeded data
from RAM to HDD
endif
move required data
from HD to RAM
endif

© OCR 2025. You may photocopy this


Page 75 of 105 Created in ExamBuilder
page.
read data from H/RAM
endprocedure

Total 6

1
1
a  RebEl (AO2 Correct Answer Only (allow any case)
6
1b)

1
b i  uitFr (AO2 Correct Answer Only (allow any case)
1b)

ii  Taking firstname, 6 1 mark for each correct bullet to a maximum of 6.


surname and (AO3
teacher or student 2b) If used, a flowchart should represent the bulleted steps in
as input the answer column.
 Checking IF role is
teacher/student
(using appropriate
selection)
 For
teacher ...Generatin
g last 3 letters of
surname using
appropriate string
manipulation
 ...Generating first 2
of letters of
firstname and
adding to previous
 For student....
correctly calculating
as before
 Correct
concatenation and
output

e.g.
Ask the user to input the
data, store in variables
firstname, surname and
role.
Check whether the role
entered is teacher. If it is,
join the right 3 most letters
in surname with the left 2
letters in firstname. Store
this in username.
If it is not teacher, join the
left 3 letters from firstname
with the left 2 letters from
surname. Store this in

© OCR 2025. You may photocopy this


Page 76 of 105 Created in ExamBuilder
page.
username. Output the value
in username.

Total 8

BP2 and 3 must check for both ends of range – must


check that input data is not negative.
1 mark per bullet, max 4
Allow FT for BP4 if already penalised under BP2 and/or 3
 Miles and age input
and output is otherwise correct.
separately
 Checks for valid
e.g.
mileage
1  Checks for valid age
a i 5 miles = input("enter miles driven")
7  Checks both are
age = input("enter age of car")
greater than / valid = True
greater than equal if miles > 10000 or miles < 0 then
to zero valid = False
 …correctly outputs
elseif age > 5 or age < 0 then
both True and False
valid = False
endif
print(valid)

1 mark per row, max 3


 Normal : miles (0 – Specific data must be given, not a description
9,999), age (0 - 5) e.g.
 Erroneous: miles
(less than 0, larger
than 9,999), age
ii (less than 0 / more 3
Miles Age
than 5) / non-
numeric data Normal 7,000 3
 Boundary : miles (-
Erroneous 12,000 7
1/0 / 9,999 /
10,000), age (-1/0 / Boundary 10,000 5

5/6)

 During
development / whilst
ii
writing the program / 1
i
before development
is complete.

b 1 mark per bullet, max 6 6 Allow output of 0 hours 0 minutes if full.


 Inputs the current Allow answers referencing decimal parts (e.g. 0.8 = 80%)
battery charge BP5 can be attempted in many ways (e.g. DIV and MOD,
percentage repeated division, etc)
 Outputs “full” if Allow FT for BP6 if reasonable attempt at conversion for
100% BP5 has been given.
 Calculates the
amount to charge e.g.
 Calculates the time charge = input("enter battery charge")
in minutes… if charge == 100 then
 …converts to hours print(“full”)

© OCR 2025. You may photocopy this


Page 77 of 105 Created in ExamBuilder
page.
else
time = (100-charge) * 10
and minutes
hours = time DIV 60
 Outputs the time in
mins = time MOD 60
hours and minutes
print (hours, mins)
endif

Total 15

Input
 Number of hours
and minutes 2
1
i (AO3 Enter text here.
8
2a)
Output
 Number of minutes

hours = input("Please enter number of hours


played")

minutes = input("Please enter number of


minutes played")

finalTotal = totalMins(hours, minutes)


 Program calls
function correctly print (finalTotal)
using hours and
minutes variables
 Parameters used 4 function totalMins(hours,minutes)
ii appropriately (AO3
 Calculation is 2a) total = hours + mins * 60
computed
accurately return total
 Final total is
returned suitably endfunction

1. Parameters named in function must be used within


the function itself
2. Does not matter if function uses different names to
those declared in main program
3. Return must be included with the correct local
variable for total

4. ii  Takes input from the 4 High-level programming language / OCR Exam


i user (AO3 Reference Language response required
 Compares if input is 2b)
larger than 120… Do not accept pseudocode / natural English.
 …if true, outputs
"You played Example algorithm given below
games for too
long!" minutes = input("Enter minutes played")
 …if false, outputs if minutes > 120
"You are under print "You played games for too long!"
your time else
© OCR 2025. You may photocopy this
Page 78 of 105 Created in ExamBuilder
page.
print "You are under your time limit!"
endif

limit!"
Accept alternative (but suitable) output messages.

Accept logical comparison of input less than or equal to


120 and appropriate True/False statements.

Total 10

1 a i 1 mark per bullet to max 6 6 Bullet points 3, 4, 5 can be awarded even if no mention of
9  Function AO3 a function / parameters (for example, if candidate has
ticketprice() defined 2b (6) inputted the number of tickets needed.
 … that accepts two
parameters and has Do not award return value if no attempt at a function.
no other inputs Return mark can be given if a good attempt made at
 Works out total calculating the total, even if this is incorrect.
ticket price for adult
(eg adult * 19.99) Allow 2.50 booking fee to be per order or per ticket
 Works out total
ticket price for Ticket prices must be stored appropriately if needed.
children (eg child *
8.99) example algorithm
 Adds on correct
booking fee function ticketprice(numadult, numchild)
 Returns the price = (numadult * 19.99) + (numchild
calculated value. * 8.99) + 2.50
return price
end function

Allow alternatives in high level languages (e.g. def in


Python).

Allow return as assigning the value to the name of the


function (VB syntax)

Examiner’s Comments

This question assessed not only whether candidates could


create an algorithm to calculate a ticket price using the
information given, but also whether this could be done as
a function.

Many candidates were able to achieve the first part of this


well, but only a small number even attempted to create
this in the form of a function with parameters passed in.

Most candidates chose to ask for inputs during the


algorithm instead of passing parameters and were
therefore only able to achieve a maximum of 3 marks out
of 6.

© OCR 2025. You may photocopy this


Page 79 of 105 Created in ExamBuilder
page.
Misconception

A function should not take input directly from the user;


instead, values required should be passed in as
parameters.

Equally, when the required calculations are completed the


value should not be printed out but returned.

Using parameters and returned values in this way makes


a function truly reusable.

Exemplar 3

Exemplar 3 shows a response that successfully covers all


of the points required by the question and therefore
achieves 6 marks.

Exemplar 4

The response above shows a response that only managed


to gain 2 marks, for the calculation of the total price for
adults and the total price for children.

There is no attempt to use a function and the input/outputs


are done through inputs and print statements rather than
parameters passed and a value returned.

In addition, the booking fee was not correctly added to the


overall price as the assignment statement is the wrong
way around.

ii 1 mark per bullet to max 2 2 Allow String only if matching justification shows
 Real… AO2 understanding (e.g. £ sign attached, message returned
 …Returned value 1a (1) alongside value).
may not be a whole AO2
number / may have 1b (1) Examiner’s Comments

© OCR 2025. You may photocopy this


Page 80 of 105 Created in ExamBuilder
page.
The majority of candidates answered this well, with Real
being chosen because of the potential need to use
decimal places in the value returned as the main correct
a decimal point in answer.

Where candidates had justified the use of a string


(because the returned data would include currency
symbols or other text) this was also credited.

b i 1 mark per bullet to max 2 2 The variable records whether a swap has taken place; it
 Flag / record AO2 does not perform the swap.
whether a swap has 1b (2)
taken place or not Examiner’s Comments
 checked as
condition to decide This question presented candidates with an algorithm for
whether to repeat a bubble sort and asked them to explain the purpose of
the Boolean value swaps.

This proved to be a very tough question, with the majority


unable to explain its use as a flag to store whether a swap
had taken place during that pass, and then further as a
condition to check whether to repeat lines 03 to 11.

Many candidates understood, perhaps through the name


given to the variable, that it was involved in swapping
something, but many said that the variable itself made the
swap, which is logically incorrect.

Some candidates seemed to not understand the while


loop on line 02.

Misconception

A while loop, as its name suggests, repeats while a


condition is True.

For example, while x>5 will repeat while the condition


x>5 is evaluated to be True.

However, if the condition given is itself a Boolean value,


then no evaluation is necessary, and the True of False
nature of this condition is used to decide whether to repeat
or not.

In this question, swaps is a Boolean value.

The line while swaps is logically equivalent to the more


verbose and unnecessary while swaps == True

Exemplar 5

© OCR 2025. You may photocopy this


Page 81 of 105 Created in ExamBuilder
page.
The above response shows a typical answer where the
candidate has not quite understood the process
undertaken by the bubble sort algorithm; swaps is set to
True when a swap has occurred and not, as this candidate
suggests, that the swap occurs because of the variable
being set.

Do not accept “sorts numbers”

“swaps numbers” meets BP1. Explanation of which values


in the array are swapped meets BP1 and BP2.

Do not accept direct word for word repetition from the


program (e.g. temp = queuesize[p] ) , question asks
for an explanation.
1 mark per bullet to max 2
 Swaps.. Explanation of temporary variable must be logically
 …values of correct.
queuesize[p] and
queuesize[p+1] Examiner’s Comments
 …when
queuesize[p] is 2 This was another question where candidates struggled to
ii larger than AO2 explain clearly the purpose of a specific part of the given
queuesize[p+1] 1b (2) algorithm.
 using a temporary
variable /doesn’t Lines 06 to 08 dealt with swapping two values over.
overwrite Simply identifying that swap takes place and which
numbers numbers are swapped was sufficient to achieve both
/explanation of marks here, but the majority were unable to successfully
process do this.

A mark could also have been given for explaining that the
two numbers were not directly swapped over, but that a
temporary value was used as an intermediary.

Many candidates provided answers that were entirely


different from this. In some cases, candidates attempted
to simply translate each line into structured English.

ii 1 mark per bullet to max 2. 2 Mark first answer only


i  Comments AO2
 … to enable 1a (1) Do not accept indentation (already done)
programmers to AO2
understand the 1b (1) Accept “show what each line does” for comments.
purpose of each line
/ section Examiner’s Comments
 …by example (e.g.
on line 4 add the Maintainability is obviously well understood by centres
comment…) and students, with many students giving very pleasing

© OCR 2025. You may photocopy this


Page 82 of 105 Created in ExamBuilder
page.
 Naming variables
sensibly
 … to enable
programmers to
answers to this question.
understand the
purpose of each
Commenting and the need for comments was perhaps the
variable
most popular answer.
 …by example (e.g.
change identifier p
It was nice to see modularisation discussed also, although
to …)
a number of students were unable to explain what they
 Modularise
meant by this and how it could be applied to the code
 …to allow reuse /
given.
makes easier to test
/ reduces errors
 …by example (e.g.
create as a function)

Accept “insert”. Do not penalise spelling.

Do not accept bubble sort (given in previous questions)

Do not award searching algorithms

Allow other valid sorting algorithms.


(e.g. quick sort, heap sort, shell sort, selection sort, radix
sort, bucket sort, tim sort, comb sort, pigeonhole sort, etc.)

Examiner’s Comments
1 mark per bullet to max 2. 2
i
 Insertion (sort) AO1 This question was answered extremely well by candidates
v
 Merge (sort) 1a (2) and shows that the prescribed sorting algorithms are
covered in centres and their names retained well by
candidates.

Merge sort and insertion sort are the two other algorithms
covered in the specification and these were the two most
popular answers given by candidates. However, credit
was also given to many other valid sorting algorithms and
it is pleasing to see that centres or candidates are
interested in going beyond the confines of the
specification to investigate algorithms such as Quick sort
(which appears in the A Level specification) and even
Bogo sort. This additional learning is to be applauded.

c 1 mark per bullet to max 8. 8 Answers can be in any suitable format (including
 Input height AO3 pseudocode, flowchart, etc). If flowchart used, accept any
 Accepts riders > / >= 2b (8) sensible shapes.
140 with suitable
message Do not penalise for lack of initialisation of variables.
 Rejects riders < / <=
120 with suitable Loop must repeat until 8 riders allowed, not just loop 8
message times.
 Checks if height

© OCR 2025. You may photocopy this


Page 83 of 105 Created in ExamBuilder
page.
between 120 and Do not credit asking whether accompanied if in the wrong
140… place.
 … If True, input
whether Condition for BP4 may be 120 < h < 140
accompanied
 … Suitable output Example algorithm
message for True riders=0
AND False while riders <8
 Correctly counts input height
number of riders in if height >= 140 then
all cases of being output “allowed”
allowed to ride (do riders = riders + 1
not penalise elif height >=120 then
candidates for input withadult
counting or not if withadult == “yes”
counting output “allowed”
accompanying riders = riders + 1
adults) else
 Attempt to loop output “not allowed”
based on 8 riders end if
allowed else
output “not allowed”
end if
endwhile

Examiner’s Comments

This question asked candidates to create an algorithm for


checking the heights of riders on a theme park ride.

The algorithm was decomposed for candidates using


bullet points and many candidates had a solid attempt at
completing this.

Most candidates were able to ask for the input of a rider’s


height, although some candidates struggled to use (or
missed out) either the assignment operator or the INPUT
(or equivalent) command. A line of pseudocode that
simply printed out ‘enter a height’ is not the same logically
as an input and was not credited.

Where an input was taken and comparisons made, these


were generally well attempted.

Examiners worked logically through the code and credit


was given for checking for the three types of riders (over
140 and so can ride alone, between 120-140 and so need
to ride with an adult, under 120 and so cannot ride) and
giving the right output to each rider.

There were many different valid and invalid attempts at


this but logically, if each type of rider would have
produced the right output then this should have been

© OCR 2025. You may photocopy this


Page 84 of 105 Created in ExamBuilder
page.
credited. The mark scheme provides an exemplar answer,
but a wide range of responses were accepted.

Many candidates did not attempt to repeat the algorithm


until 8 riders had been allowed to ride and so were unable
to access these marks. However, several higher ability
candidates thought even more deeply about this and
wrote algorithms that added two riders if someone was
riding with an adult; this was a valid thought and so was
credited as well.

Exemplar 6

Exemplar 6 shows a well organised response that gained


full marks. Each check is completed in order, with ELIFs
and ELSE used efficiently to make sure that logically
correct comparisons are made. The loop works correctly
and repeats until 8 riders have been allowed to ride. This
is a very good example of the sort of response needed to
achieve highly.

Total 24

2 a 1 mark per bullet to max 4, 4 Correct Answer Only

© OCR 2025. You may photocopy this


Page 85 of 105 Created in ExamBuilder
page.
Do not accept “X”, “Y”, etc.

Examiner’s Comments

This question required candidates to follow through the


given algorithm and decide on the value that would be
1 mark per row output given a set of input values.
 10
AO2
0  6 Most candidates were able to complete this successfully
1b (4)
 6 for at least some values.
 2
Where mistakes were made, these tended to be with the
last set of values and the decision as to whether 12 is less
than 12, which should be evaluated to be False.

Candidates gained a good understanding of this algorithm


through this question which was then intended to lead
onto the next question.

b 1 mark per bullet to max 6. 6 Question specifically asks for pseudocode.


 Inputs two value (as AO3
X and Y) 2b (6) Outputs should only be given if they occur with the right
 Compares if X is condition(s).
larger than Y…
 …Outputs Y*X Example algorithm
only when False
 Compares if X is input x
less than 12… input y
 …Outputs X only if x > y then
when True and X > if x < 12 then
Y print x
 …Outputs Y only else
when False and X > print y
Y end if
else
print y*x
end if

Variables do not have to be called x and y.

Accept equivalent comparisons (e.g. if X <= Y)

Allow FT for outputs from incorrect comparisons where a


sensible attempt has been made.

Please note how mark


bullet points match up to
the flowchart given in the

© OCR 2025. You may photocopy this


Page 86 of 105 Created in ExamBuilder
page.
question.

BP1 is for taking both inputs

BP2 and 4 are for correct


comparisons of variables.
This may be done in
alternative ways (e.g. Examiner’s Comments
X<=Y, X>=12, etc)
This question asked candidates to translate the given
BP3, 5 and 6 are for the flowchart into pseudocode. It should be noted that no
correct outputs in the right specific format for pseudocode is expected; candidates
place. may use any code-like format that they choose as long as
this conveys the logical intention of the solution.
If the answer logically works
to produce the correct Large numbers of candidates achieved full marks on this
output, it should be marked question and candidates who explored the whole of the
as correct. algorithm were likely to do very well.

By comparison, candidates who attempted to convert


each box of the flowchart into lines of pseudocode strictly
from top to bottom often fell foul of the False outcome
from the first decision being in the wrong place.

The most common issue here was a lack of understanding


that the opposite of X>Y is not simply X<Y; this does not
cater for X being equal to Y. Where candidates put X <=Y
or equivalent, this was accepted.

This logical issue was also frequently repeated on the


second decision for X<12.

Exemplar 1

© OCR 2025. You may photocopy this


Page 87 of 105 Created in ExamBuilder
page.
In Exemplar 1, the candidate has logically hit every point
from the flowchart and converted this successfully into
pseudocode. This response achieved 6 marks.

Total 10

Final answer must be 10, not 10.24

1 mark for working, 1 mark 2


for answer AO2
2 Examiner’s Comments
i  1024(1000) / 100 / 1a (1)
1
10*100 = 1000 AO2
Most candidates were able to answer this question fully.
 = 10 (videos) 1b (1)
They performed the correct calculation and gained the
correct answer, rounding the number of videos
appropriately. The most common error involved
candidates multiplying 100 by 1000.

ii 1 mark per bullet to max 6 6 Award bullet 5 even if bullets 3 and 4 are wrong. Do not
 Output asking for file AO3 award if outputting the original input value.
size (in megabytes) 2b (6)
 Taking number of
MB as input
 Multiplying by 1024 Bullet 4 must be the final calculation to get the mark. If
or 1000 there are any further calculations, or changes to the final
 Multiplying by 1024 bytes value then bullet 4 cannot be awarded.
or 1000 (may be
same line as bullet
3, this must be the Input = value is incorrect, variable must be on left.
final value with no
further changes) Bullet 6 is dependent on bullet 5.
 Outputting the final
bytes value… Input must be stored e.g. user input – no mark
 …in an appropriate
message Outputs must have "" around strings, variable identifiers
must not have "".

output "Please enter If bullet 5 is not given because the variable is in "", still
the file size in award bullet 6 if correct.
megabytes"
input numberMB Bullet 3 and 4, could be multiplying by 1,000,000 or
numberKB = numberMB 1,048,576 (award both bullets).
* 1024 (or 1000)

© OCR 2025. You may photocopy this


Page 88 of 105 Created in ExamBuilder
page.
numberBytes = numberMB = input("Enter the file size")
numberKB * 1024 (or would get both bullets 1 and 2.
1000)
output "There are "
& numberBytes & " Concatenation is not required for the final bullet.
bytes in " &
numberMB & "MB" input("Filesize") will get 1 mark for outputting File
size, it will not get the input as there is no variable.

Examiner’s Comments

This question covered the synoptic algorithm element of


the examinations. Candidates were required to use their
knowledge of binary numbers to write a pseudocode
algorithm. Most candidates attempted to write a
pseudocode algorithm. A small number of candidates
drew a flowchart, which does not meet the criteria of
pseudocode. Most candidates were able to gain at least
some marks, most commonly for the output of a message,
and then input of the required data.

Common errors including inaccurate use of assignment,


for example INPUT = FileSize is incorrect. This line of
code states that the data within FileSize is stored in
INPUT. The correct assignment is FileSize = INPUT.

Candidates need to be aware of how to output strings and


values within variables. These could have been output as
individual statements, but when combined candidates
need to differentiate between the variables and text. For
example, OUTPUT (The new file size is & FileSize) makes
use of concatenation, but the text is not identified as a
string and requires speech marks e.g. OUTPUT (The new
file size is & “FileSize”).

Some candidates did not attempt to output a message to


the user, asking them to input the file size. Candidates
need to read all aspects of the question carefully to make
sure they are meeting all of the criteria.

Exemplar 1

This candidate has not identified that “how large is the file
in megabytes” is an output, and has not explicitly asked

© OCR 2025. You may photocopy this


Page 89 of 105 Created in ExamBuilder
page.
for an input therefore cannot gain either of these marks.
This first line of code is assigning a string to the variable
size_in_mb. This error is not followed through, and the
candidate has performed the correct calculation, and then
output an appropriate message along with the new
variable.

Exemplar 2

This candidate has outputted an appropriate message and


read the input into the variable filesize. They have
performed the appropriate calculation (although ∗ is
preferable for multiplication, as an algorithm x is
accepted). They have output an appropriate message and
the correct variable.

Total 8

Ignore capitalisation.

Allow librarycode = for 3rd mark – this is an equivalent in


some languages for returning a value (eg. Visual Basic).

Examiner’s Comments
1 mark per filled gap, max 3
Responses to this question were mixed. The majority of
01 function candidates were able to decide on the correct passing of
librarycode(title, year as a second parameter; this had to be specifically
year) year and nothing else as this identifier was referred to
02 parta = later in the algorithm.
2
a i [Link](0, 3
2
3) Fewer candidates were able to correctly decide that three
03 partb = characters were required from the title; this was often not
[Link](2, 2) completed as expected as subString is listed in
04 return [Link] appendix 5f of the specification as a string handling tool
+ partb that could be used in the examination and a full example
05 endfunction of its use is also given on line 03.

Even fewer candidates understood that a function must


return a value, this being the answer to line 04. The most
common incorrect answer here was candidates attempting
to print / output the book code rather than return it. A mark
was given if they assigned the return value to the name of
the function (e.g. librarycode = [Link] +
partb) as this is a valid method of returning a value in
some high-level languages such as Visual Basic.
© OCR 2025. You may photocopy this
Page 90 of 105 Created in ExamBuilder
page.
ii 1 mark per bullet, max 6 6 Example algorithm
 Input title and year
from user
 Open [Link] title = input(“enter title”)
 Call the librarycode() year = input (“enter year”)
function… code = librarycode(title, year)
 … with the two myFile = openWrite(“[Link]”)
parameters that [Link](code)
match input values [Link]()
 … write out code
obtained to the text Note, pseudocode shown above is an example –
file candidates may answer very differently, but award marks
 Close text file if intention can be seen.

Bullet points 3,4 and 5 could be done in one line:


[Link](librarycode(title, year))

Do not award bullet point 3 if candidate is defining the


function rather than calling it.

Allow bullet point 2 (opening text file) if correctly referred


to during write operation.

Bullet point 3 must include brackets () to signify it is the


function being called or indication that is being called.

Examiner’s Comments

This question was answered extremely poorly by


candidates and shows a lack of understanding of the use
of functions (and subroutines in general). Where
candidates scored highly here, it was a very good
indicator that they would score highly across the paper as
a whole.

The majority of candidates were able to access the first


mark for inputting the two requested values. However, a
significant number did not make it clear that the value
inputted had to be stored somewhere* (typically in a
variable). Therefore although x = input(‘enter a
title’) was OK, simply stating input(‘enter a
title’)was too vague to achieve the mark. Another
common misunderstanding was that both values could be
input at the same time; a variable will only ever store one
value and so asking for both in one go is unlikely to
achieve the marks.

* Where higher ability candidates showed an


understanding of how to do this differently, e.g. using the
input value as the argument to pass into the function, this
was of course credited by examiners.

However, the bigger misconception was around the use of

© OCR 2025. You may photocopy this


Page 91 of 105 Created in ExamBuilder
page.
pre-existing functions. One of the benefits of subroutines
is that code can be modularised and re-used without
requiring programmers to copy and paste code if they
require it multiple times. Perhaps the most common
student answer for this question was to write out the code
from the function again to try to calculate the book code.
This was not what was required from the question and
shows a fundamental lack of understanding of the use of
functions.

Marks were given for calling the existing function, passing


in the values previously input and then writing the returned
code to the text file. The vast majority of candidates
achieved none of these marks.

Other independent marks were given for opening and


closing the text file and a pleasing number of candidates
were able to do this successfully.

Misconception
Functions modularise code; they can be written once and
used multiple times in a program. If a pre-written function
is given as part of a question and candidates are told to
use it, they will NOT be credited for simply copying and
pasting the code inside the function to use; this shows a
lack of understanding.

Exemplar 3

In the exemplar above, the candidate has successfully


input two values from the user. They have then called the

© OCR 2025. You may photocopy this


Page 92 of 105 Created in ExamBuilder
page.
pre-existing function librarycode() with the values
previously input as arguments (in parenthesis). This will
return a value which is stored in the variable bookCode.
The correct text file is then opened, the returned value is
written to the text file and then the file is closed. This
response covered everything required from the question
and so is credited with full marks [6 out of 6].

Exemplar 4

In the exemplar above, the candidate has successfully


input two values from the user. However, they then
misunderstand the purpose of a function and instead of
calling this, re-write out the function code. Note that there
is no call to this function, which could have made it
correct; the assumption is that the candidate thinks they
must place the code here for it to run, which is incorrect.

The candidate does gain a mark from opening the text file
but they cannot get the mark for writing to it (as no book
code was ever calculated) and they do not close the file.
This response gained two out of six marks and is typical of
the average candidate answer.

b i 1 mark per bullet, max 4. 4 Candidates can describe how the merge sort would work
 List split into rather than showing output values at each stage.
individual elements
(may be done over Ignore intermediate steps.
several steps or just
as a starting point) Do not give final mark for simply showing the list sorted.
 Merge individual Must have the (correct) idea of where it being merged
elements into from previous lists.
sorted lists of size 2
© OCR 2025. You may photocopy this
Page 93 of 105 Created in ExamBuilder
page.
Candidates’ answers describing / showing other sorting
algorithms (e.g. bubble sort, insertion sort) are worth 0
 Merge lists of size 2
marks.
into sorted lists of
size 4
 Merge lists of size 4
into final sorted list.

ii 1 mark per bullet, max 2. 2 Accept (correct) reference to big O notation for 2nd mark
 Faster/quicker (to on either mark point although this is beyond scope of
sort)… GCSE specification.
 …for large lists / for
lists that are more Allow “more efficient” for BOD on first bullet point.
unordered
 Has a consistent
running time (for a
lists of same length)
… Examiner’s Comments
 …doesn’t depend on
how ordered original Large numbers of candidates understood the divide and
list is conquer strategy applied by the merge sort algorithm; the
list is continually divided in half until lists of size 1 are
achieved before the lists are then merged together to
achieve the sort, with the size of lists doubling with every
iteration (i.e. when two lists of size 2 are merged, the
result is a list of size 4). Many candidates achieved good
marks on this question.

Where mistakes were made, they generally fell into one of


three categories. One was applying a different algorithm
than had been asked (e.g. showing a bubble sort).
Another was misunderstanding where the sorting takes
place; some candidates showed the lists being split up
correctly, but then these being merged and the list sorted
in place afterwards – this is incorrect, it is the act of
merging that sorts the values. A third and more common
issue was that examiners found it extremely tough to
decide where lists were split up or merged from candidate
responses that seemed to list all values in one row with no
seeming differentiation between one list of eight values
and eight lists of one value. Where examiners were not
able to see this, marks could not be given.

Misconception

When using merge sort to merge together [1, 3] and [2, 4]


into ascending order, the algorithm will take the lowest
value from the front of either list (in this case 1) and place

© OCR 2025. You may photocopy this


Page 94 of 105 Created in ExamBuilder
page.
it into the new, merged list. This will then repeat meaning
that the new list will be [1, 2, 3, 4]. It does not merge the
lists to be [1, 3, 2, 4] and then sort this list.

Exemplar 5

The exemplar above shows an ideal way to respond to


this question. The list is obviously and clearly split up in
successive passes into lists of a single value. Each pair of
lists is then merged, with the process of merging resulting
in sorted lists. Each time the lists are merged, the result is
a larger list in ascending order. The candidate response
shown here not only shows this process but makes it very
clear that the values are held in separate lists and even
includes arrows to illustrate the process of merging. This
achieved full marks [4 out of 4].

Total 15

1 mark per bullet, max 6. Example algorithm


 Initialisation of A, B
and C as zero.
 Allows input (of
2 anything) from the acount = 0
6
3 user
 Incrementing A, B
and C depending on acount = 0
input
 Repeats bullet

© OCR 2025. You may photocopy this


Page 95 of 105 Created in ExamBuilder
page.
bcount= 0

ccount= 0

vote = ““

while vote != “END”

vote = input(“enter A, B or C”)

if vote == “A” then

acount = acount + 1

points 2 and 3 elseif vote == “B” then


 …stopping only
when “END” is
entered bcount = bcount + 1
 Prints out all 3
individual counts
and prints elseif vote == “C” then
calculated total
count
ccount = ccount + 1

end if

endwhile

print acount

print bcount

print ccount

print acount+bcount+ccount

Do not penalise for missing initialisation of variable used in

© OCR 2025. You may photocopy this


Page 96 of 105 Created in ExamBuilder
page.
the while loop or total (if used)

Comparison with value inputted MUST be a string (e.g. if


vote == A) is incorrect as A here is a variable, not a
string.

Answer can be any recognised algorithm – pseudocode,


flowcharts, structured English, etc. Mark on whether the
bullet points on the left hand side have been met. Does
not have to match algorithm above.

4th bullet point (repeat) can be given for any sensible


attempt at iteration.

Use professional judgement on where loops end (WHILE /


END WHILE or indentation).

Examiner’s Comments

This question required candidates to write an algorithm


(which could equally have been pseudocode or a
flowchart) to count how many votes three candidates
received in an election. The essential elements of the
algorithm were given as bullet points to help candidates to
decompose the problem.

The majority of candidates attempted to allow the user to


input their choice and then increment a counter variable
based on this choice. However, for many candidates, the
response provided was not logically correct and so did not
achieve all of the marks available. One typical problem
was the comparison missing the required quotation marks
(or similar) around the literal string value, so while if
vote == ‘B’ checks the value of the variable vote
against the string ‘B’, if vote == B instead compares
two variables. Other common issues included candidates
mixing up the left and right side of an assignment
operation (e.g. c = 1 is not the same as 1 = c) or
overwriting the value of their counters rather than
incrementing them (e.g. a = 1 rather than a = a + 1 or
a +=1).

Many candidates stopped at this point with relatively few


even attempting to use iteration (or other methods) to
ensure that further votes could be counted. Where this
was attempted, it was pleasing to see candidates
understanding condition controlled loops to successfully
end when required.

The final criterion was to print the number of votes for


each candidate and the number of votes overall. Many
candidates successfully completed the first part of this but
completely missed out even an attempt at the second part
© OCR 2025. You may photocopy this
Page 97 of 105 Created in ExamBuilder
page.
even though it appears to be relatively straightforward;
centres should encourage candidates to carefully read the
questions and check their answers for completeness.

Examiners saw many answers which used alternative


techniques (such as storing the vote counts in an array, or
achieving repetition by use of subprograms) and where
these were logically correct they were able to achieve full
marks.

Exemplar 6

This response gained 3 marks. The candidate successfully


takes an input from the user and stores this in the variable
vote [1 mark]. This is then compared against string
values ‘A’, ‘B’ and ‘C’, incrementing the appropriate value
[1 mark]. The counter variables have previously been
initialised to zero [1 mark]. There is some attempt to loop
on the very last line, but this is weak and would have the
effect of re-initialising the counter values back to zero
every time and so is incorrect. The candidate attempts to
print the three variables but misses off outputting the total
vote count (which would have just been A+B+C).

© OCR 2025. You may photocopy this


Page 98 of 105 Created in ExamBuilder
page.
Exemplar 7

This response achieved 5 marks, just 1 mark short of the


maximum. The three counter values are initialised [1 mark]
and user input successfully taken and stored in a variable
[1 mark]. This input is then compared against A, but the
lack of quotation marks (or equivalent) around A means
that this is a variable (which has been defined on the very
first line), meaning that the comparison being undertaken
is effectively ‘is the user input equal to zero?’, which is
incorrect. However, there is a loop present around the
relevant instructions [1 mark] and this does repeat until the
user enters ‘END’ [1 mark] (the initial error of missing the
quotation marks on comparisons being followed through
and only penalised once), at which point the values of A,
B, C and the total are all output [1 mark]. It is pleasing to
see that the candidate also includes some basic input
validation, although this is not asked for in the question
and so cannot be credited.

© OCR 2025. You may photocopy this


Page 99 of 105 Created in ExamBuilder
page.
Total 6

1 mark per bullet


 Taking the move as
The output mark can only be awarded if a reasonable
input attempt at adding the free spaces have been performed
 Checking if array
element input is free

o …Outputting
Counting how many free spaces there are can be done by
if it is taken either:
 Writing “A” to the
 Looping through each element of the array and
correct array
updating a variable if free / taken
element
 Subtracting 1 each time an element is taken (this
 Counting how many
must work, i.e. there is no initialisation of the
free space there
variable e.g. to 101, as that would run every time
are…
o …Outputting
and reset the variable). If Initialisation is used, this
must be outside a loop and must be 101.
the number
of free
spaces (if
2 good attempt Examiner's Comments
6
4 at counting
free spaces) Candidates were required to write an algorithm to access
specific array elements and then either keep track of the
number of taken elements, or to loop through and count
the number not taken.

Most candidates were able to take the number as input.


Few candidates had a good understanding of arrays and
how to access specific array elements. Some candidates
attempted to keep track of the number of spaces taken by
adding 1 to a variable each time through, but a common
mistake was to also reset this value each time so that it
was not actually keeping track correctly.

Many candidates who tackled this question used pseudo


code and often made a better attempt at the question.
When a flow chart was used, there was rarely any use of
arrays and accessing the array elements.

Total 6

2
a  Lidia 1 Accept incorrect spelling if intention is clear.
5

b  Program finds there 2 Only award bullet 1 if answer is clearly about the contents
is no position 7 in of the array and not about the context.
the array / array
index out of bounds Do not award bullet 2 if candidate specifically mentions
 An error will occur / syntax error.
an error message
would be displayed /

© OCR 2025. You may photocopy this


Page 100 of 105 Created in ExamBuilder
page.
program will crash

Example

Award marks for:


 Input the number of
places to move (e.g.
If there is more than one loop, award bullets 3 and 4 for
Num)
any non-trivial loop that contributes to the solution.
 Use of temporary
variable(s) or
For bullet 3, “sensible” use of a loop, requires that the loop
c second array to 6
clearly address the problem (e.g. move every player from
avoid overwriting
pos a to b). Although candidates can get partial marks
values in the array
here, candidates will only get full marks (incl bullet 6) if all
 Sensible use of a
conditions of all loops are correct.
loop
 … with correct end
condition
 Correctly deals with
moving from
position 1 (e.g. 1 +
Num)
 Correctly deals with
moving from
position 6 (e.g.
Num)

Total 9

2 Example 5 There are various ways to implement this but the two most
6 common methods will be the method shown or one
disjuncted IF statement (ie IF Length1 = Length2 OR
Length1 = Length3 OR Length2 = Length3). In all cases,
apply the criteria in the last 4 bullet points to the whole
algorithm to determine the mark.

?Examiner's Comments??

This question was generally well answered with most


candidates obtaining 4 or 5 marks out of 5. Candidates
not gaining the highest marks often made errors in writing
Award marks for: an imprecise condition for the IF statements such as
 Inputting three “Length1 = Length2 OR Length3”. While algorithms were
lengths acceptable in pseudocode, flowchart or code, the
 Comparing lengths pseudocode of some of the candidates was so vague that
in pairs it did not add anything to the specification in the question.
 … for all three ways Several candidates had innovative ways of determining
correctly whether the sides were equal and it was pleasing to see
 … outputting this creativity. Centres should advise candidates that

© OCR 2025. You may photocopy this


Page 101 of 105 Created in ExamBuilder
page.
when asked to give an algorithm to a specification, they
“Isosceles” for all
read and follow the specification carefully. Some people
valid cases
do not class an equilateral triangle as an isosceles
 … outputting “Not
triangle, but the specification in this question made it clear
Isosceles” for all
that they should. Some candidates added additional
cases and only in
constraints and while, on the whole they were not
cases where the
disadvantaged in this case from deviating from the
three lengths are
specification, it is important that as programmers they
different.
learn to stick to a specification given.

Total 5

2 Example: 6 High Level Response (5/6):


7 A clear and complete algorithm with correct input,
validation and reasonable output / outcome (accept minor
errors).
Algorithm presented in algorithm in code, pseudocode or
as a flowchart with correct conventions used to make it
clear (e.g. indentation, shapes of flow chart objects).
Technical terms are used correctly and there are few, if
any, errors in spelling.

Medium Level Response (3/4):


An algorithm that deals with input, validation and
reasonable output / outcome but there may be some
logical errors. Algorithm may be in code, pseudocode,
flowchart, or very well structured English (e.g. clear
bulleted steps) using some accepted conventions,
although this may not be consistent. Technical terms are
mainly correct and there may be occasional spelling
errors.

Low level response (1/2):


A description of the Input, validation and output required,
but some may be missing.
Response may be in English or a poorly structured code /
flowchart. Limited, if any, use of technical terms and errors
of spelling may be intrusive.

0: Response not worthy of credit

Examiner's Comments

Once again, it is important to emphasise that QWC does


not mean candidates are required to write essays. As part
of a computer science qualification, it is important to
assess the candidates’ technical writing skills as relevant
to computer science, including their ability to select and
use the most appropriate form and register of written
communication for the question set. In a QWC question,
this is assessed in a holistic manner alongside the
correctness and accuracy of the answer using levels of
response. In this question, the most appropriate form of
written communication for an algorithm was evidently

© OCR 2025. You may photocopy this


Page 102 of 105 Created in ExamBuilder
page.
pseudocode or a flowchart. A few candidates attempted to
give their algorithms in prose which reduced the overall
quality of the response, even when the logic of the
algorithm was largely correct. That said, most candidates
did answer in a flow chart, pseudocode or code in a
language they have studied. Candidates who used a flow
chart seemed to score better. They were less likely to omit
parts of the specification or to create errors in their logic
by incorrectly nesting branching structures. Overall, the
question discriminated well between candidates of
different abilities, with weaker candidates tending to either
make an error in their logic, usually with the validation, or
ignore parts of the question. Most often, candidates
omitted checking that drinks were available before
dispensing them and/or omitted to actually dispense the
drink. Checking the algorithm with the requirements of the
question may have prevented this. As well as the
correctness of the algorithm, examiners considered the
effectiveness of the written communication including for
example the use of meaningful identifiers, consistent and
clearly labelled symbols in flow charts or indentation in
pseudocode. Centre’s should also note that, as is often
the case with QWC question, this question was
intentionally open ended and candidates could adopt a
variety of approaches such as considering the input of the
system as a continuous input stream (as in the example
given in the published mark scheme) or a completely
event driven system with each key having its own logic or
a hybrid of these approaches mimicking an interactive
console application with the OK button serving as an
Enter key and the Cancel button clearing the input buffer.
All of these approaches were equally valid.

Total 6

2
a i print (hoursPlayed[0,2]) 1 Correct Answer Only
8

ii 1 Correct Answer Only

ii
80 1 Correct Answer Only
i

i  Adding all correct 3 1 mark per bullet to a maximum of 3.


v elements If used, a flowchart should represent the bulleted steps in
 Outputting correctly the answer column
 Using a loop

e.g.
total = 0
for x = 0 to 4
total = total +
hoursPlayed[0,x]

© OCR 2025. You may photocopy this


Page 103 of 105 Created in ExamBuilder
page.
next x
print (total)

 Loop 0 to 29
 Loop 0 to 4
 Accessing
hoursplayed[x,y]
 Addition of
hoursplayed[x,y] to
total
 Calculating average
correctly outside of
loops
Accept any type of average calculation (mean, median,
 Outputting the
mode).
results
b 6
If used, a flowchart should represent the bulleted steps in
the answer column.
e.g.
total = 0
for x = 0 to 29
for y = 0 to 4
Total = total +
hoursPlayed[x,y]
next y
nextx
average = total / (30*5)
print (average)

Total 14

e.g.
If correctly calculated but not output give benefit of doubt
once

Examiner's Comments

This was quite well answered with nearly half the


Award marks for: candidates gaining all marks for a fully correct algorithm,
which is pleasing to see. The question was generally
2  Inputting teddybears
6 answered equally well as a flow chart or (pseudo)code.
9 and hours
Where candidates did not get full marks it was often for
 2 * number of teddy
omissions such as not outputting the final result.
bears
Candidates should also be aware that while it is perfectly
 5 * hours
acceptable to answer in pseudocode, their pseudocode
 Comparing the two
should add to the information in the question. For example
answers
answers like “output the greater” are too vague because
 Outputting the piece
we are looking for precisely how they determine which is
rate if it is greater
greater.
 Outputting the hour
rate if it is greater.

Total 6

3  (Age is less than 20 4 Candidates do not need to refer to dose, provided it is

© OCR 2025. You may photocopy this


Page 104 of 105 Created in ExamBuilder
page.
= true) so Dose =
clear that they are performing the correct operation.
0.1 * Age
 1.9
For 3rd bullet it is sufficient if the candidate has shown that
0  [is Pregnant AND
both isPregnant and (Dose > 1.5) are TRUE (This may not
Dose > 1.5 ] is
be at the same point in the answer and they do not need
TRUE
to explicitly state the result of the AND).
 Dose = 1.5

Total 4

© OCR 2025. You may photocopy this


Page 105 of 105 Created in ExamBuilder
page.

You might also like