OCR GCSE Computer Science Paper 2, June 2025: question 1

A PrepWise guide to a real paper, with our descriptions and answers. Not made or approved by OCR.

PrepWise guide: OCR GCSE Computer Science Paper 2Question 11 of 6

A program asks the user for a whole number and only accepts values from 1 to 100, including both ends. The program is being tested, and an algorithm has been written for it.

Figure 1
A table of four test values with empty tick columns for normal, boundary and invalid data.Open full size to read the labels (Figure 1, opens in a new tab)
Figure 2
An algorithm of six lines with three gaps marked by numbered black circles.Open full size to read the labels (Figure 2, opens in a new tab)
01.1[4 marks]

Tick one or more boxes against each value in Figure 1, to name its type or types of test data.

See how you would score on Testing

Our own questions on this topic, marked straight away, so you see what to revise. Free now.

Normal
Boundary
Invalid / erroneous
Show model answer for 01.1Hide model answer for 01.1

27: Normal

"Hello": Invalid / erroneous

105: Invalid / erroneous

100: Boundary (and also Normal)

4 marks

How the marks are earned

  1. One mark for each row, up to 4.
  2. 27: normal.
  3. "Hello": invalid or erroneous.
  4. 105: invalid or erroneous.
  5. 100: boundary, or boundary and normal together. Boundary alone is credited, and so is boundary with normal.

Why it scores

27 is a sensible value inside the range 1 to 100 and is not on an edge.

Text is the wrong type of data. The program wants a whole number.

105 is a number but it is above the largest value allowed, 100.

100 sits exactly on the edge of the allowed range, so it is boundary data. It is also accepted by the program, so ticking normal as well is credited.

Revise Testing
01.2[3 marks]

Complete the algorithm in Figure 2 by filling the three numbered gaps so that 1 to 100 is accepted and other numbers are rejected.

See how you would score on Selection (IF Statements)
Show model answer for 01.2Hide model answer for 01.2

Gap 1: >= 1

Gap 2: num <= 100

Gap 3: else

num = input("Enter a number between 1 and 100")
if num >= 1 AND num <= 100 then
    print("accepted")
else
    print("not accepted")
endif
3 marks

How the marks are earned

  1. One mark for each gap, up to 3.
  2. BP1, gap 1: a check that num is at least 1; >= 1 or > 0 are both credited.
  3. BP2, gap 2: a check that num is at most 100. The form num <= 100 or num < 101 is credited. The variable num must appear in this check.
  4. The two checks may be written in either order, so the upper limit may come first.
  5. BP3, gap 3: else. An elseif or elif is credited only if it carries a full correct comparison, such as num < 1 OR num > 100.
  6. This is Section A, so wording such as less than or equal to is credited in place of the symbols.

Why it scores

The word num is already printed before the gap, so only the comparison is written here. The first AND condition rules out numbers below the bottom of the range. 1 itself must be allowed, so use >= and not >.

The second AND condition rules out numbers above the top of the range. 100 itself must be allowed, so use <= and not <. The condition has to name num again.

The else branch runs for every value that fails the check, so it prints the rejection message. Nothing needs to be compared here.

The finished algorithm. AND needs both checks to be true, so a number is accepted only when it is at least 1 and at most 100.

Revise Selection (IF Statements)
01.3[1 mark]

Give an identifier for one variable that the completed algorithm uses.

See how you would score on Variables & Constants
Show model answer for 01.3Hide model answer for 01.3
num
1 mark

How the marks are earned

  1. num.
  2. Extra code around the name earns nothing. Capital letters and small spelling slips are ignored.
Revise Variables & Constants
01.4[1 mark]

Give one Boolean operator that the completed algorithm uses.

See how you would score on Boolean Expressions
Show model answer for 01.4Hide model answer for 01.4
AND
1 mark

How the marks are earned

  1. AND.
  2. Extra code around the operator earns nothing. Capital letters and small spelling slips are ignored.
Revise Boolean Expressions
OCR owns the copyright in its exam questions, so we cannot copy their wording. These descriptions and answers are ours. Not made or approved by OCR.[9 marks]