OCR GCSE Computer Science Computational thinking, algorithms and programming (02), June 2025: Question 1

9 marks · Easy difficulty · Short Answer

Identify suitable test data types for a range check, complete an algorithm that validates integer input, and identify a variable and a Boolean operator from the code.

Practise this question

Question

Question 1 asks about a program accepting integers between 1 and 100 inclusive. Part (a) shows a table with rows for test data 27, "Hello", 105, and 100, asking to tick Normal, Boundary, or Invalid/erroneous test data. Part (b)(i) gives pseudocode with blanks to complete an IF condition checking the range and the ELSE branch. Part (b)(ii) asks for the identifier of one variable, and (b)(iii) asks for one Boolean operator used in the code.
Question text

1 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.

Invalid /

Example Normal Boundary

erroneous

test data test data test data

test data

"Hello"

[4]

(b) An algorithm is written for the program.

(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]

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

… [1]

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

… [1]

Mark scheme

Show the mark scheme Mark scheme for Question 1: (a) gives Normal for 27, Invalid/erroneous for "Hello", Invalid/erroneous for 105, and Boundary or both Boundary and Normal for 100 (4 marks). (b)(i) awards 3 marks for '>= 1' (or '> 0'), 'num <= 100' (or 'num < 101'), and 'else'. (b)(ii) awards 1 mark for 'num'. (b)(iii) awards 1 mark for 'AND'.

Question Answer Mark Guidance

1 (a) • Normal 4 Accept either boundary by itself for last row or both

• Invalid / erroneous boundary and normal.

• Invalid / erroneous

• Boundary // boundary and normal

1 (b) (i) • >= 1 // > 0 3 Allow check either way around (e.g. could check

• num <=100 // num < 101 higher boundary first) for BP1 and BP2.

• else

BP2 must include reference to num variable.

BP3 Do not allow elseif / elif unless full

correct logical comparison included (e.g elseif

num <1 or num > 100)

Section A so allow “less than or equal to” etc.

1 (b) (ii) • num 1 Do not allow any other code around variable

identifier. Ignore capitalisation. Ignore minor

spelling errors.

1 (b) (iii) • AND 1 Do not allow any other code around operator.

Ignore capitalisation. Ignore minor spelling errors.

How to answer it

Testing Types and Selection Logic

📋 What this question tests

This question evaluates your core understanding of validation and software testing (categorising normal, boundary, and invalid/erroneous test data) and fundamental pseudocode programming constructs (compound conditional statements using comparison and Boolean operators, branch statements, variable identifiers, and logic keywords).

Part (a) Test Data Classification

4 Marks

✅ Correct Answers

Example test data Normal Boundary Invalid / erroneous
27 ✓
"Hello" ✓
105 ✓
100 (✓) ✓

Mark allocation: 1 mark per correct row. For 100, the mark scheme accepts ticking Boundary alone OR ticking both Boundary and Normal.

💡 Key Knowledge

  • Normal data: Data that is valid, expected, falls within the accepted range (e.g. 2 to 99), and should be processed correctly.
  • Boundary (extreme) data: Data right at the outer edges of what is allowed (e.g. 1 and 100).
  • Invalid / erroneous data: Data that is either the incorrect data type (e.g. string "Hello" instead of integer) or outside the allowed range (e.g. 105 or -2).

🧠 Exam Technique

Read the rule carefully: "Only integer values between 1 and 100 (inclusive) are accepted."

  • "Inclusive" means 1 and 100 are strictly accepted limits. Therefore, 100 is at the boundary edge.
  • Always check the data type: if it requires an integer and receives text, it is instantly invalid/erroneous.

❌ Common Errors

  • Confusing boundary with invalid (e.g., thinking 105 is boundary because it is near 100—105 is out of range, hence invalid).
  • Forgetting that boundary data can technically be considered valid/normal data too, which is why OCR allows both boxes to be ticked for 100.

Part (b)(i) Completing the Algorithm

3 Marks

📐 Code Trace & Structure

The code requires checking if a value falls between 1 and 100 (inclusive):

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

if num >= 1 AND num <= 100 then

print("accepted")

else

print("not accepted")

endif

✅ Mark Scheme Breakdown

  • Blank 1 (1 mark): >= 1 or > 0
  • Blank 2 (1 mark): num <= 100 or num < 101
  • Blank 3 (1 mark): else

Note: The conditions can be in either order (e.g. testing the upper bound first, then the lower bound). English descriptions such as "less than or equal to" are accepted in Section A.

❌ Common Errors & Examiner Traps

  • Missing the variable in the second condition: Writing if num >= 1 AND <= 100 loses a mark. Each side of an AND must be a complete relational comparison containing the variable num .
  • Using strict inequalities incorrectly: Writing > 1 instead of >= 1 accidentally excludes 1 from being accepted.
  • Writing elseif instead of else : A bare elseif without a complete logical condition earns 0 marks for line 3.

Parts (b)(ii) & (b)(iii) Identifiers and Operators

2 Marks (1 mark each)

✅ Correct Answers

(ii) Variable Identifier:

num

Examiner Guidance: Do not include surrounding code like num = or brackets. Capitalisation is ignored.

(iii) Boolean Operator:

AND

Examiner Guidance: Only name the operator itself. Capitalisation is ignored.

💡 Key Terminology

  • Identifier: The unique name given to a variable, constant, or subprogram to identify it in the program (here: num ).
  • Boolean Operators: Logical operators used to combine or invert conditions. The three standard ones are:
    • AND (both conditions must be true)
    • OR (at least one condition must be true)
    • NOT (reverses the boolean truth value)
  • Relational Operators: Operators that compare two values, such as >= , <= , == , and != . Do not confuse these with Boolean operators!

Topics

2.1 Algorithms · 2.2 Programming fundamentals · 2.3 Producing robust programs · 2.1.2 Designing, creating and refining algorithms · 2.2.1 Programming fundamentals · 2.3.2 Testing

Question and mark scheme from the OCR GCSE Computer Science examination, Computational thinking, algorithms and programming (02), June 2025. QuestionVault is an independent revision resource; questions remain the copyright of the awarding body.