BREAKING
Student's code works, nobody knows why, including studentβ˜…Local teen writes pseudocode, accidentally invents a languageβ˜…Binary joke told in class, exactly 10 students laughβ˜…
  1. Home
  2. GCSE
  3. Computer Science
  4. OCR
  5. Algorithms in pseudocode, flowcharts and reference language

OCR GCSE Computer Science

Topic questions Algorithms Algorithms in pseudocode, flowcharts & reference language

Algorithms in pseudocode, flowcharts & reference language

10 questions · 159 marks · about 3 hours

Algorithms in pseudocode, flowcharts and reference language questions

TopicAlgorithms in pseudocode, flowcharts & reference language

OCR J277 Algorithms in pseudocode, flowcharts and reference language 10 questions

Computational thinking, algorithms and programming June 2025, Question 1 9 marks

A program asks a user to enter a number. Only integer values between 1 and 100 (inclusive) are accepted. The program is tested.

(a)

Tick (βœ“) one or more boxes in each row to identify the type or types of test for each example of test data.

Figure for question 1
[4]
Reveal mark scheme Mark scheme for question 1(a)
(b)

An algorithm is written for the program.

(b)(i)

Complete the algorithm for the program.

num = input("Enter a number between 1 and 100")

if num........ AND........ then

print("accepted")

print("not accepted")

endif

[3]
Reveal mark scheme Mark scheme for question 1(b)(i)
(b)(ii)

Give the identifier of one variable used in the algorithm in part (b)(i).

[1]
Reveal mark scheme Mark scheme for question 1(b)(ii)
(b)(iii)

Give one Boolean operator used in the algorithm in part (b)(i).

[1]
Reveal mark scheme Mark scheme for question 1(b)(iii)

Computational thinking, algorithms and programming June 2025, Question 2 12 marks

This flowchart uses iteration.

Figure for question 2
(a)

Complete the table by identifying how many times "OK" will be output for when each value is input.

Figure for question 2
[2]
Reveal mark scheme Mark scheme for question 2(a)
(b)

Iteration is a programming construct.

(b)(i)

Identify and describe two different examples of iteration that can be used in a high-level language.

[4]
Reveal mark scheme Mark scheme for question 2(b)(i)
(b)(ii)

Give the names of two other programming constructs that are used in a high-level language.

[2]
Reveal mark scheme Mark scheme for question 2(b)(ii)
(c)

A programmer implements the flowchart as a program in a high-level language using an Integrated Development Environment (IDE).

Identify and describe two tools that the programmer could use in the IDE to create a program from the flowchart.

[4]
Reveal mark scheme Mark scheme for question 2(c)

Computational thinking, algorithms and programming June 2025, Question 5 14 marks

A security system protects online credit card payments. The system has three inputs:

InputDescription
ATrue when the user enters their correct password
BTrue when the user enters their correct PIN
CTrue when the card is blocked

The output (P) is True if both of the following conditions are True:

β€’ the user has entered either their correct password or has entered their correct PIN

β€’ the card is not blocked.

(a)
Figure for question 5 Figure for question 5
[3]
Reveal mark scheme Mark scheme for question 5(a)
(b)

Complete the truth table for P = A AND B

Figure for question 5
[2]
Reveal mark scheme Mark scheme for question 5(b)
(c)

Computational thinking techniques were used to design the security system.

Draw one line to match each computational thinking technique to its correct example.

Computational thinking
Example

Figure for question 5
[3]
Reveal mark scheme Mark scheme for question 5(c)
(d)

As part of the security system, the user is asked to choose a 4-digit value for their PIN. This PIN cannot be 1234 or 4321

Create an algorithm that:

β€’ takes the PIN as input as a string

β€’ checks that the PIN is 4 characters in length

β€’ checks that the PIN is not either β€œ1234” or β€œ4321”

β€’ outputs "VALID PIN" if the PIN meets all of the criteria

β€’ outputs "INVALID PIN" if the PIN does not meet all of the criteria.

You do not need to check that the digits entered are numeric.

[6]
Reveal mark scheme Mark scheme for question 5(d)

Computational thinking, algorithms and programming June 2025, Question 6 30 marks

OCR Rockfest is a yearly music festival. Visitors buy tickets to attend and watch the music acts.

A computer system is created to sell tickets and store information about visitors and the music acts.

(a)

Visitors are asked to choose a password. The password is entered twice and stored in the variables passA and passB

(a)(i)

Tick (βœ“) one box to identify the correct OCR Exam Reference Language statements for the design of this task.

Figure for question 6
[1]
Reveal mark scheme Mark scheme for question 6(a)(i)
(a)(ii)

Design an algorithm that:

β€’ checks if the passwords stored in passA and passB are the same

β€’ outputs "passwords match" if they are the same

β€’ outputs "passwords do not match" if they are not the same.

[3]
Reveal mark scheme Mark scheme for question 6(a)(ii)
(b)

The database table TblMusic stores data about the music acts.

Some of the data in TblMusic is shown:

ActIDStageDaySetLength
1PlatinumSaturday0.5
2HillsSaturday1.5
3TriangleSunday1.0
4PlatinumSunday0.5

An SQL statement has been written to show ActID and Stage for all acts playing on Saturday. The SQL statement is incorrect.

SELECT ActID AND Stage FROM TblActs IF Day = Saturday

(b)(i)

Refine the SQL statement to correct the errors.

[4]
Reveal mark scheme Mark scheme for question 6(b)(i)
(b)(ii)

Identify one example of a record from TblMusic

[1]
Reveal mark scheme Mark scheme for question 6(b)(ii)
(b)(iii)

Give the most appropriate data type for each field shown.

Figure for question 6
[2]
Reveal mark scheme Mark scheme for question 6(b)(iii)
(c)

Tickets to the festival are Β£60 each. Visitors can buy multiple tickets. For example, a visitor buying 4 tickets would pay Β£240.

(c)(i)

Write a function, calculatePrice() that:

β€’ takes the number of tickets to be purchased as a parameter

β€’ calculates and returns the total price to pay.

You must use either:

β€’ OCR Exam Reference Language, or

β€’ a high-level programming language that you have studied.

[4]
Reveal mark scheme Mark scheme for question 6(c)(i)
(c)(ii)

Write an algorithm that:

β€’ uses the function calculatePrice() to find the price for a visitor buying 3 tickets

β€’ stores the result in the variable totalPrice

You must use either:

β€’ OCR Exam Reference Language, or

β€’ a high-level programming language that you have studied.

[2]
Reveal mark scheme Mark scheme for question 6(c)(ii)
(d)

The number of different music acts on each of the three stages is stored in the array actNumbers.

Each index of the array represents one stage.

Question 6, shown as an image
Figure for question 6
Question 6, shown as an image

This algorithm adds up the total number of acts on all three stages.

01 count = 0

02 for x = 0 to 2

03 count = count + actNumbers[x]

04 next x

05 print(count)

(d)(i)

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

Figure for question 6
[4]
Reveal mark scheme Mark scheme for question 6(d)(i)
(d)(ii)

The array actNumbers is changed to include data for two more stages. The new array is shown:

Index 0 1 2 3 4

Figure for question 6

The algorithm from part (i) needs refining to work for the new array. The algorithm is repeated here:

01 count = 0

02 for x = 0 to 2

03 count = count + actNumbers[x]

04 next x

05 print(count)

Identify the line number that will need to be changed for the new array and write the updated line of code.

[2]
Reveal mark scheme Mark scheme for question 6(d)(ii)
(d)(iii)

Refine line 05 in the algorithm to output "The total act count is " and then the content of the variable count

For example:

The total act count is 50

[1]
Reveal mark scheme Mark scheme for question 6(d)(iii)
(e)

There are 500 tickets available for the music festival. The number of tickets currently available is stored in the variable tickets

Complete the algorithm to:

β€’ prompt the user to enter how many tickets they would like and take this value as input

β€’ output "Tickets booked" and reduce the value stored in tickets if there are enough tickets available

β€’ output "Not enough tickets" if there are not enough tickets available

β€’ repeat the steps until there are no tickets left.

You must use either:

β€’ OCR Exam Reference Language, or

β€’ a high-level programming language that you have studied

tickets = 500

[6]
Reveal mark scheme Mark scheme for question 6(e)

Computational thinking, algorithms and programming June 2024, Question 9 30 marks

Students take part in a sports day. The students are put into teams.

Students gain points depending on their result and the year group they are in. The points are added to the team score.

The team with the most points at the end of the sports day wins.

(a)

Data about the teams and students is stored in a sports day program.

(a)(i)

Identify the most appropriate data type for each variable used by the program.

Each data type must be different.

VariableExampleData type
teamName"Super-Team"
studentYearGroup11
javelinThrow18.2
[3]
Reveal mark scheme Mark scheme for question 9(a)(i)
(a)(ii)

The student names for a team are stored in an array with the identifier theTeam

An example of the data in this array is shown:

Index 0 1 2 3 4 5

Figure for question 9

A linear search function is used to find whether a student is in the team. The function:

β€’ takes a student name as a parameter

β€’ returns True if the student name is in the array

β€’ returns False if the student name is not in the array.

Complete the design of an algorithm for the linear search function.

function linearSearch(studentName)

for count = 0 to …………….….....……………

[4]
Reveal mark scheme Mark scheme for question 9(a)(ii)
(b)

endif

next count

return False

endfunction

Figure for question 9
[4]
Reveal mark scheme Mark scheme for question 9(b)
(c)

The height a student jumps in the high jump needs to be input and validated. The height is entered in centimetres (cm) and must be between 40.0 and 180.0 inclusive.

(c)(i)

Write an algorithm to:

β€’ take the height jumped as input

β€’ output "VALID" or "NOT VALID" depending on the height input.

You must use either:

β€’ OCR Exam Reference Language, or

β€’ A high-level programming language that you have studied.

[4]
Reveal mark scheme Mark scheme for question 9(c)(i)
(c)(ii)

The algorithm is tested using a range of tests.

Complete the table to identify an example of test data for each type of test.

Test data (height jumped in cm)Type of testExpected output
Normal"VALID"
Boundary"VALID"
Erroneous"NOT VALID"
[3]
Reveal mark scheme Mark scheme for question 9(c)(ii)
(d)

The individual results for each student in each event are stored in a database.

The database table TblResult stores the times of students in the 100 m race. Some of the data is shown:

StudentIDYearGroupTeamNameTime
11GC111Valiants20.3
10VE110Super-Team19.7
10SM110Super-Team19.2
11JP211Champions19.65

Complete the SQL statement to show the Student ID and team name of all students who are in year group 11

SELECT StudentID,........

[4]
Reveal mark scheme Mark scheme for question 9(d)
(e)

Abstraction and decomposition have been used in the design of the sports day program.

(e)(i)

Identify one way that abstraction has been used in the design of this program.

[1]
Reveal mark scheme Mark scheme for question 9(e)(i)
(e)(ii)

Identify one way that decomposition has been used in the design of this program.

[1]
Reveal mark scheme Mark scheme for question 9(e)(ii)
(f)

An algorithm works out which team has won (has the highest score).

Write an algorithm to:

β€’ prompt the user to enter a team name and score, or to enter "stop" to stop entering new teams

β€’ repeatedly take team names and scores as input until the user enters "stop"

β€’ calculate which team has the highest score

β€’ output the team name and score of the winning team in an appropriate message.

You must use either:

β€’ OCR Exam Reference Language, or

β€’ A high-level programming language that you have studied

[6]
Reveal mark scheme Mark scheme for question 9(f)

Computational thinking, algorithms and programming June 2023, Question 2 6 marks

This pseudocode algorithm totals all the numbers in the 0-indexed array scores

01 total = 0 02 for scoreCount = 1 to scores.length – 1 03 scores[scoreCount] = total + total 04 next scoreCount 05 print(total)

The function length returns the number of elements in the array.

The algorithm contains several errors.

Two types of errors in a program are syntax and logic errors.

(a)

State what is meant by a syntax error and a logic error.

[2]
Reveal mark scheme Mark scheme for question 2(a)
(b)

Identify two logic errors in the pseudocode algorithm.

Write the refined line to correct each error.

Error 1 line number........

Error 2 line number........

[4]
Reveal mark scheme Mark scheme for question 2(b)

Computational thinking, algorithms and programming June 2023, Question 5 20 marks

Charlie is developing an adding game. The rules of the game are:

β€’ 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.

(a)

Charlie has been told that the game will need to be tested before giving it to the players.

(a)(i)

Explain why programs should be tested before use.

[2]
Reveal mark scheme Mark scheme for question 5(a)(i)
(a)(ii)

Complete the table by naming and describing one type of test that should be used on Charlie's program before releasing it.

Figure for question 5
[2]
Reveal mark scheme Mark scheme for question 5(a)(ii)
(a)(iii)

Complete the table by identifying and describing two features of an IDE that can be used when testing a program.

Figure for question 5
[4]
Reveal mark scheme Mark scheme for question 5(a)(iii)
(b)

Validating inputs can reduce errors when a program is being run.

Identify two methods of validation and explain how they can be used on this game.

Validation method 1........

Validation method 2........

[6]
Reveal mark scheme Mark scheme for question 5(b)
(c)

Write an algorithm to play this game. The rules are repeated from the start of the question here:

β€’ 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.

[6]
Reveal mark scheme Mark scheme for question 5(c)

Computational thinking, algorithms and programming June 2022, Question 2 19 marks

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.

A computer system is used to identify whether the customer can have a half-price meal.

The table identifies the three inputs to the computer system:

InputValue
AIs a student
BHas a discount card
CThe current day is Saturday
(a)

The logic system P = (A OR B) AND NOT C is used.

(a)(i)

Complete the following logic diagram for P = (A OR B) AND NOT C by drawing one logic gate in each box.

Figure for question 2
[3]
Reveal mark scheme Mark scheme for question 2(a)(i)
(a)(ii)

A truth table can be produced for this logic circuit.

Describe the purpose of a truth table.

[2]
Reveal mark scheme Mark scheme for question 2(a)(ii)
(a)(iii)

State how many rows (excluding any headings) would be required in a truth table for the logic expression:

P = (A OR B) AND NOT C

[1]
Reveal mark scheme Mark scheme for question 2(a)(iii)
(b)

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.

[5]
Reveal mark scheme Mark scheme for question 2(b)
(c)

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]
Reveal mark scheme Mark scheme for question 2(c)
(d)
Figure for question 2
(d)(i)

Define the term casting and give the line number where casting has been used in the algorithm.

[2]
Reveal mark scheme Mark scheme for question 2(d)(i)
(d)(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.

Figure for question 2
[4]
Reveal mark scheme Mark scheme for question 2(d)(ii)

Computational thinking, algorithms and programming June 2022, Question 4 15 marks

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") c = input("Enter a number") d = input("Enter a number") e = input("Enter a number") f = (a + b + c + d + e) print(f)

(a)

Give two ways that the maintainability of this program could be improved.

[2]
Reveal mark scheme Mark scheme for question 4(a)
(b)

Jack’s program uses the addition (+) arithmetic operator. This adds together two numbers.

(b)(i)

State the purpose of each of the arithmetic operators in the table.

Figure for question 4
[2]
Reveal mark scheme Mark scheme for question 4(b)(i)
(b)(ii)

Complete the description of programming languages and translators by writing the correct term from the box in each space.

continues crashes debugging error executable

high-level interpreter language low-level many

no one stops with without

Jack writes his program in a........ language. This needs to be

translated into assembly or machine code before it can be executed. This is done using

a translator.

One type of translator is an interpreter. This converts one line of code and then

executes it, before moving to the next line. It........ when an error is

found, and when corrected continues running from the same position. This translator is

helpful when debugging code.

A second type of translator is a compiler. This converts all of the code and produces

an error report. The code will not run until there are........ errors.

The........ file produced can be run........ the

compiler.

[5]
Reveal mark scheme Mark scheme for question 4(b)(ii)
(c)

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.

[6]
Reveal mark scheme Mark scheme for question 4(c)

Report a problem with a question on this page
What is wrong?

Goes to whoever maintains the question split. No account needed and nothing is published on this page.

Memes

Certified Computer Science memes. Peer-reviewed by nobody.

Laugh now. Cry in the exam hall later. Then come back and do a past paper.

Write a proper algorithm
Write β€˜sort it’ and leave
Me on the 6-mark pseudocode question
Debugging with print statements
Using a trace table
Knowing the difference between = and ==
Explaining recursion by explaining recursion
Code enlightenment, ranked

Mum πŸ’–

can you fix the wifi since you do computers πŸ₯°

that's not what computer science is

so that's a no then

πŸ“± Screen time this week Β· Discord8h 2m

Turned it off and on again

Computer Science starter pack

Laptop with 47 tabs openPython error on line 1Counting binary on fingersThis website
Compiled with zero errors