OCR GCSE Computer Science June 2025 Paper 2, Question 1: test data and a range check
OCR J277/02 June 2025, Question 1: decide whether 27, Hello, 105 and 100 are normal, boundary or invalid test data, then complete an algorithm that accepts numbers from 1 to 100. Worked through, with the check to run on all four values.
Question 1 of the OCR GCSE Computer Science Paper 2 sat on 20 May 2025 (J277/02, Computational thinking, algorithms and programming) is about a program that only accepts whole numbers from 1 to 100 inclusive. Part (a) classifies four pieces of test data (4 marks). Part (b) completes the algorithm and asks two vocabulary questions (5 marks).
We do not copy the exam paper here. Open it beside this page: OCR June 2025 J277/02 question paper (PDF). When you have finished, check the mark scheme too.
Part (a): what kind of test data?
| Test data | Type | Why |
|---|---|---|
| 27 | Normal | comfortably inside 1 to 100 |
| "Hello" | Invalid / erroneous | the wrong data type |
| 105 | Invalid / erroneous | outside the range |
| 100 | Boundary | the very edge of what is accepted |
The question lets you tick more than one box in a row. For 100, boundary alone gets the mark, and so does boundary with normal, because 100 is also accepted.
105 is not boundary data. It is near the edge, but boundary data sits on the edge: 1 and 100 here. (Some courses also count the values just outside, 0 and 101. 105 is neither.)
Part (b)(i): complete the algorithm
The skeleton reads num, then has if num ...... AND ...... then, prints "accepted", has a gap, and prints "not accepted".
num = input("Enter a number between 1 and 100")
if num >= 1 AND num <= 100 then
print("accepted")
else
print("not accepted")
endif
The three gaps are >= 1, num <= 100 and else. > 0 and num < 101 are accepted as well.
Parts (b)(ii) and (iii)
- The identifier of a variable:
num. It is the only one. - A Boolean operator:
AND. It joins two conditions.>=and<=are comparison operators, not Boolean ones.
Where the marks are lost
<= 100withoutnum. The second gap needs the variable again.num >= 1 AND <= 100is not a valid condition, and the mark scheme insists onnum.elseifin the third gap. With no condition after it, it is wrong. The gap is a plainelse.> 1and< 100. Inclusive means 1 and 100 are accepted.inputorprintas the variable. Those are functions. And write the identifier on its own:num, notnum = input(...).
Run it
The check as a function, run on the four values from part (a) and on both boundaries. A value that is not a number at all is caught before the range check.
The program
from bugbot import *
connect()
TESTS = ["27", "Hello", "105", "100", "1", "0"]
def check(text):
if not text.isdigit():
return "not accepted"
num = int(text)
if num >= 1 and num <= 100:
return "accepted"
else:
return "not accepted"
for text in TESTS:
print(text, check(text))
Questions
What are the answers to OCR J277 June 2025 Paper 2 Question 1(a)?
27 is normal. "Hello" is invalid or erroneous. 105 is invalid or erroneous. 100 is boundary (boundary and normal is also accepted).
What is the difference between boundary and erroneous test data?
Boundary data is at the limit of what the program should accept, such as 1 and 100 for a range of 1 to 100. Erroneous data should be rejected: it is outside the range or of the wrong type.
What are the Boolean operators?
AND, OR and NOT. They combine or reverse conditions. Comparison operators such as ==, <, >= are different: they compare two values.
More from this paper
- Question 2(a), (b): Count the passes of a flowchart loop, and describe the kinds of iteration 8 marks
- Question 3(a): Show the steps of a merge sort on eight numbers 4 marks
- Question 4: Complete an algorithm that reads numbers from a text file, and casting 6 marks
- Question 5(a), (b): A logic circuit from a description, and the truth table for A AND B 5 marks
- Question 5(d): Validate a 4 character PIN that must not be 1234 or 4321 6 marks
Every OCR J277 question we have worked · Guide: Logic gates and truth tables explained
Learn it step by step
- F6.3 Testing and test data Robust programs
- F6.1 Defensive design and validation Robust programs
- F2.3 else, elif and Boolean operators Decisions and loops
This is our own explanation of a published exam question. It is not written or endorsed by OCR, and the question paper and mark scheme remain OCR's copyright. Read them on OCR's site with the links on this page.