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

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 22 of 6

Figure 3 shows a loop drawn as a flowchart. A programmer is going to write it as a high-level language program, using an IDE.

Figure 3
A flowchart with start, an input box, an output box, a process box, a decision with a loop back, and an end.Open full size to read the labels (Figure 3, opens in a new tab)
Figure 4
A table with two inputs and an empty column for the number of outputs.Open full size to read the labels (Figure 4, opens in a new tab)
02.1[2 marks]

Complete Figure 4: identify how many times OK is output for each input value when Figure 3 runs.

See how you would score on Trace Tables

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

Show model answer for 02.1Hide model answer for 02.1
Input 3
x = 3
OK (1)
x = 1, 1 < 0 is false
OK (2)
x = -1, -1 < 0 is true
stop
2 times
Input 10
x = 10
OK (1), x = 8
OK (2), x = 6
OK (3), x = 4
OK (4), x = 2
OK (5), x = 0, 0 < 0 is false
OK (6), x = -2, -2 < 0 is true
stop
6 times
2 marks

How the marks are earned

  1. One mark for each input value, up to 2.
  2. Input 3: OK is output 2 times.
  3. Input 10: OK is output 6 times.

Why it scores

Each pass outputs OK, then subtracts 2, then tests x. The loop only ends once x has gone below 0.

0 is not less than 0, so the loop goes round once more. That is why the count is 6 and not 5.

Revise Trace Tables
02.2[4 marks]

Identify and describe two different kinds of iteration that a high-level language offers.

See how you would score on Iteration (Loops)
Show model answer for 02.2Hide model answer for 02.2

A FOR loop is count controlled. It repeats a set number of times.

A WHILE loop is condition controlled. It tests its condition before the code runs and repeats while that condition is true.

4 marks

How the marks are earned

  1. Two marks for each loop, up to 4 in total. The marks are independent, and a description can score even if the loop is not named. Any two marks are credited for each loop.
  2. FOR loop, up to 2 marks from three creditable points: (a) the loop is named; (b) it is count controlled; (c) it repeats a set number of times.
  3. WHILE loop, up to 2 marks from three creditable points: (a) the loop is named; (b) it is condition controlled; (c) one mark for any one of these: it carries on as long as the condition holds, it stops once the condition is false, or the test is made before the body runs.
  4. DO UNTIL or REPEAT UNTIL loop, credited instead, up to 2 marks from three points: (a) the loop is named; (b) it is condition controlled; (c) one mark for any one of these: it carries on until the condition holds, it carries on while the condition is false, or the test is made after the body has run.
  5. Loops from other high-level languages are credited if suitable.
  6. If both a WHILE and a DO UNTIL are given, condition controlled can describe both, but it is credited once only unless the two are told apart in some other way.
  7. The description repeats infinitely earns nothing, because that is only true when the condition is never met.
  8. No credit where the description fits a different loop, for example saying that a while loop carries on until its condition becomes true.

Why it scores

Two marks from three creditable points: the name, the type and the rule for repeating. Only two are needed.

Two marks from three creditable points: the name, the type and the rule for repeating. Only two are needed.

Revise Iteration (Loops)
02.3[2 marks]

Give the names of two programming constructs, other than iteration, that high-level languages use.

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

Sequence

Selection

2 marks

How the marks are earned

  1. One mark for each construct, up to 2.
  2. Sequence. The form sequencing is credited.
  3. Selection. Branching is credited in its place.
  4. A bare example such as IF with no construct name earns nothing.

Why it scores

Sequence means instructions run one after another in the order they are written.

Selection means the program chooses which instructions to run, for example with an if statement.

Revise Selection (IF Statements)
02.4[4 marks]

Identify and describe two IDE tools the programmer could use to create the program from Figure 3.

See how you would score on IDE Features
Show model answer for 02.4Hide model answer for 02.4

Tool 1: a code editor. It lets the programmer type in and change the program code, and fix errors.

Tool 2: a debugger. It finds errors in the program and shows the programmer where they are.

4 marks

How the marks are earned

  1. For each tool, one mark for naming it and one mark for a matching description, up to 4. The description must add something beyond the tool name, and it must fit the tool named. If the tool name is wrong or missing, the description earns nothing. Other sensible names for a tool are accepted.
  2. Text or code editor: it lets program code be written, entered or changed, or errors fixed.
  3. Debugger, error reporting or diagnostics: it finds, identifies or checks for errors, shows where an error is or what it is, or suggests fixes.
  4. Run-time environment or output window: it lets the program be run, or shows the output of the program.
  5. Translator, compiler or interpreter: it converts the code to low-level or machine code, lets the program run, makes an executable file (compiler only) or stops at the first error (interpreter only). A translator and a compiler or interpreter are not both credited as two separate tools; compiler and interpreter as two separate tools are both credited with descriptions.
  6. Stepping: it runs the program one line at a time.
  7. Variable watch: it shows what the variables hold or how they change.
  8. Breakpoints: they stop the program at a chosen place.
  9. Pretty printing or keyword highlighting: it lets keywords or variables be coloured or identified.
  10. Keyword completion, autocomplete, autocorrect or syntax suggestions: they suggest or correct code; saying it happens once the first part is typed is not needed.
  11. GUI or GUI builder: it lets a user interface, such as buttons, be created.
  12. Other sensible IDE features are credited, for example line numbers, auto indent or collapsing blocks, if the description says a little more than the name.
  13. Features of a programming language, such as comments or casting, are not IDE tools and earn nothing.
  14. Sensible references to AI are credited.
  15. An editor, error diagnostics or debugger may be given a description that belongs to another feature in this list, for example the editor does pretty printing or the debugger does stepping.

Why it scores

Two marks: the tool, and a description that says what the tool is used for.

Two marks: the tool, and a matching description. The description fits the debugger and says more than its name.

Revise IDE Features
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.[12 marks]