Exclusive Practice Resource

Monday 25 May 2026 - Afternoon

GCSE (9-1) Computer Science

Unofficial Practice Paper: J277/02 Computational Thinking, Algorithms and Programming [VERSION A]

Time allowed: 1 hour 30 minutes

Centre number
Candidate number
First name(s)
Last name

INSTRUCTIONS

This is an unofficial practice resource created exclusively for gcsecomputerscience.co.uk. It is not endorsed by, affiliated with, or approved by Oxford Cambridge and RSA Examinations (OCR).
Turn over
2

SECTION A

1

(a) Complete the flowchart logic below by filling in the empty boxes and labels. The flowchart should ask for a price, and if it is greater than 50, output "Discount", otherwise output "No Discount".

Start Input price Is price > 50? ( ) ( ) End
[4]

(b) Match the computational thinking terms to their definitions.

Term A: Abstraction  |  Term B: Decomposition  |  Term C: Algorithmic Thinking

1. The process of removes unnecessary detail to focus on key areas.

2. The process of creates a step-by-step logic to solve a task.

3. The process of breaks the problem down into sub-tasks.

[3]
Turn over
3
2

(a) Describe the steps involved in a Merge Sort.

[4]

(b) (i) State the pre-condition that must be met before a Binary Search can be used on an array.

[1]

(b) (ii) A Linear Search is used on an array of 5,000 unsorted items.

Explain why a Binary Search would be more efficient if the array was sorted.

[3]
3

(a) Tick (✓) one box in each row to show whether the statement applies to a Compiler, an Interpreter, or Both.

StatementCompilerInterpreterBoth
Translates high-level code into machine code
Translates and executes the code line-by-line
Produces a final executable file that can be distributed
Stops translating as soon as the first error is found
[4]

(b) Identify and describe two tools provided by an IDE to help a programmer debug their code.

Tool 1:

Description:

Tool 2:

Description:

[4]
Turn over
4
4

(a) Draw a logic gate circuit to represent the Boolean expression: P = (A AND B) OR (NOT C)

A
B
C
P
[4]

(b) Complete the truth table for the logic circuit.

ABC(A AND B)(NOT C)P
000
001
010
011
100
101
110
111
[4]
5

(a) A database table `Products` stores the `ProductID`, `Name`, and `Price`.

Write an SQL query to output the `Name` and `Price` of all products where the `Price` is greater than 20.

SELECT FROM WHERE
[5]

(b) Complete the table to justify the most appropriate data type for each variable.

VariableData TypeJustification
Price (e.g. 15.99)
InStock (e.g. True)
[4]
Turn over
5

SECTION B

Context: Retail Stock Management System

A clothing store uses a computer system to manage its inventory and restock orders.

6

(a) The system validates the Quantity of items received in a delivery. The quantity must be between 1 and 500 inclusive.

Complete the table with one example of test data for each category.

Test CategoryTest Data Example
Normal Data
Valid Boundary Data
Invalid Data
[3]

(b) Identify two ways the programmer can make the stock management code more maintainable, and explain why each helps.

Method 1:

Reason:

Method 2:

Reason:

[4]
7

(a) The programmer has written a flawed function to check if restock is needed.

01 function checkStock(current, minimum) 02 current = input("Enter current stock") 03 if current < minimum then 04 print("Order more") 05 else 06 print("Stock OK") 07 endif 08 endfunction

Identify the line number of the logic error regarding parameter usage, and write the corrected line of code.

Line number of error:

Corrected code (or state if line should be removed):

[2]

(b) Write a new function called calculateOrder.

  • It must take two parameters: currentStock and maxCapacity.
  • It must calculate how many items are needed to fill the stock to maxCapacity.
  • It must return this calculated value.

You must use OCR Reference Language or a high-level programming language.

[4]
Turn over
6
8

(a) The system requires staff to enter a Product Code. The code must be exactly 5 characters long.

Write an algorithm using a validation loop that:

[6]

(b) A trace table is used to test a different algorithm below:

x = 0 y = 10 while x < 3 y = y - x x = x + 1 endwhile print(y)

Complete the trace table for this algorithm.

xyOutput
010
[5]
Turn over
7
9

(a) The store's inventory is stored in a 2D array called inventoryData. There are 50 rows (representing different products) and 3 columns (representing data for each product).

Column index 2 holds the quantity in stock for that product.

Write an algorithm using iteration to calculate and output the total quantity of all products combined.

[8]

(b) The store needs to save a list of critical products to an external text file.

A 1D array called criticalItems contains 20 product names. Write an algorithm that:

  • Opens a file called "urgent.txt" in write mode.
  • Iterates through the criticalItems array.
  • Writes each product name to a new line in the text file.
  • Closes the file.
[8]
END OF QUESTION PAPER