Mark Scheme
Question Answer/Indicative content Marks Guidance
1 a 1 mark per bullet 5
AO2.1
Calculation of result to 3 (3)
Call with thisFunction(theArray, AO2.2
num1=4, num2=7, num3=35) (2)
Result = 5
call with
thisFunction(theArray,num1=6
,num2=7,num3=35)
(Result = 6) return of value 6
Function call num1 num2 num3 result
thisFunction
(theArray,0, 0 7 35 3
7,35)
thisFunction
(theArray,4, 4 7 35 5
7,35)
thisFunction
(thisArray,6 6 7 35 6
,7,35)
b Binary search 1
AO2.1
(1)
c 1 mark per bullet to max 4, e.g. 4
AO1.1
Recursion uses more memory… (2)
…iteration uses less memory AO1.2
Recursion declares new variables (2)
//variables are put onto the stack each
time…
…iteration reuses the same variables
Recursive can run out of
memory/stack space…
…while iteration cannot run out of
memory
Recursion can express a problem
more elegantly // in fewer lines of
code…
…while iteration can take more lines of
code // be harder to understand
Recursion will be self-referential // will
call itself…
… whereas iteration does not
© OCR 2025. You may photocopy this page. 1 of 8 Created in ExamBuilder
Mark Scheme
Question Answer/Indicative content Marks Guidance
d 1 mark per bullet to max 6 6
AO2.2
Retains function call (3)
Uses a loop AO3.1
…that will loop until all elements (3)
inspected or value found
Updates num1 appropriately
Updates num2 appropriately
Returns -1 in the correct place if the
value has not been found
Returns the result in the correct place
if the value has been found
e.g.
function thisFunction(theArray, num1, num2,
num3)
while (true)
result = num1 + ((num2 - num1) DIV 2)
if num2 < num1 then
return -1
else
if theArray[result] < num3 then
num1 = result + 1
elseif theArray[result] > num3 then
num2 = result - 1
else
return result
endif
endif
endwhile
endfunction
Total 16
© OCR 2025. You may photocopy this page. 2 of 8 Created in ExamBuilder
Mark Scheme
Question Answer/Indicative content Marks Guidance
2 i 1 mark for benefit, 1 mark for drawback 2
Benefit: Examiner’s Comments
AO1.1
(1) Most candidates achieved some credit, but
• The program can/might run faster many answers were often too vague.
• Cannot run out of stack space/memory
• Easier to trace/follow
Drawback:
• Iteration can lead to lengthier code
• Iteration can lead to code that looks
more complex / is harder to understand
• some problems are more elegantly
coded with a recursive solution
ii 1 mark for each correct statement 4
AO2.2 Examiner’s Comments
function newGCD(num1, num2) (2)
AO3.2 Most candidates attempted the question
temp = 0 (2) and achieved some credit. Relatively few
achieved full marks for this question.
while (num2 != 0)
temp = num2
num2 = num1 MOD num2
num1 = temp
endwhile
return num1
endfunction
Total 6
© OCR 2025. You may photocopy this page. 3 of 8 Created in ExamBuilder
Mark Scheme
Question Answer/Indicative content Marks Guidance
3 a 05 and 07 1
AO2.1
(1)
b 1 mark per bullet to max 4 4
AO2.1
(1)
Suitable loop with correct condition AO2.2
(1)
In IF: Overwriting num2 with num2 – AO3.2
num1 (2)
In ELSE: Overwriting num1 with
num2…
… Overwriting num2 with num1–num2
correctly (using a temp variable)
e.g. Alternatively swapping values by
temp = num1
num1 = num2
num2 = temp – num2
Examiner’s Comment:
Most candidates produced recognisable
pseudocode. Weaker candidates
produced logically incorrect solutions or
did not understand the difference between
an iterative and a recursive solution –
reformulating another recursive solution.
Where strong candidates produced good
solutions they sometimes forget the
necessity to have a temporary swap
variable when swapping the values in two
different variables over.
Total 5
© OCR 2025. You may photocopy this page. 4 of 8 Created in ExamBuilder
Mark Scheme
Question Answer/Indicative content Marks Guidance
4 a The function calls itself on line 06 2
The function calls itself on line 08 Examiner's Comments
Most candidates understood what
recursion is but some failed to give the
locations of where it was used in the
algorithm and subsequently lost marks.
There was a worrying number of
candidates who confused it with Iteration
and even the IF statement. As with
question 4(b) the candidates did not
read/understand the question fully, in that
it asked “Describe how … used in this
function”.
b Award one mark for each of the sets of 6 Response may be as a diagram or as text
steps below but must fully address each point to get
the marks. Recursive calls must be clearly
(1st call: IsOdious(2) / n is 2) indicated as such and returned values. Do
not accept simply “goes back to line 2” if it
is not clear that this is a new call.
(line 2) FALSE so go to line 04 Example:
(line 5) TRUE so go to line 06
2nd call : IsOdious(1) / n = 1
(line 2) FALSE so go to line 04
(line5) FALSE so go to line 08
3rd call : IsOdious(0)/n = 0
Line(2) TRUE so go to line 03
Return FALSE
Return to 2nd call and complete
line 08 so
Return NOT(FALSE) = TRUE
Return to 1st call and complete line 06
so
Return TRUE
Examiner's Comments
Quite a few no responses here. Very few
responses clearly showed the steps taken
in each call to the recursive function and
especially the unravelling of the recursive
calls. Although some candidates scored
full marks their answers were not always
absolutely clear. Only a few candidates
used diagrams, and on the whole their
answers were easier to follow.
© OCR 2025. You may photocopy this page. 5 of 8 Created in ExamBuilder
Mark Scheme
Question Answer/Indicative content Marks Guidance
c i eg 1
Code is generally shorter Allow humans think recursively
(can be) closer to natural language
description Examiner's Comments
Many poor answers were given here.
Many students didn't appear to have a
depth of knowledge regarding recursion
and its issues beyond “it calls itself”.
ii eg 1 Difficult to understand is TV
Uses more memory / resources
Difficult to trace / debug
Allow difficult to follow
Examiner's Comments
Many poor answers were given here.
Many students didn't appear to have a
depth of knowledge regarding recursion
and its issues beyond “it calls itself”.
Total 10
© OCR 2025. You may photocopy this page. 6 of 8 Created in ExamBuilder
Mark Scheme
Question Answer/Indicative content Marks Guidance
5 i 1 mark per bullet to max 2 2
Declares a function called
(1)
Has parameter (1)
ii 08 (1) 1
iii max 3 marks for benefit, max 3 for 4
drawback, max 4 marks overall
Benefit
More natural to read (1)
Quicker to write / less lines of code. (1)
As some functions are naturally
recursive (1)
Suited to certain problems (1) For
example those using trees (1)
Can reduce the size of a problem with
each call. (1)
Drawback
Can run out of stack space / memory
(1) (due to too many calls (1)) causing
it to crash (1) This can be avoided with
tail recursion (1)
More difficult to trace / follow (1) as
each frame on the stack has its own
set of variables (1)
Requires more memory than the
equivalent iterative algorithm.
Usually slower than iterative methods
(1) due to maintainence of the stack
(1)
iv 1 mark per bullet 4
Loop start and end in correct positions
(1)
With correct number of iterations (1)
Returns a value (1)
All other code correct, in the right
place (1)
e.g.
© OCR 2025. You may photocopy this page. 7 of 8 Created in ExamBuilder
Mark Scheme
Question Answer/Indicative content Marks Guidance
v 1 mark per bullet, to max 3 3
Appropriate declaration of function,
taking 2 parameters (1)
Checks position in board against “”
correctly (1)
Returns and true correctly (1)
e.g.
Total 14
6 i The function calls itself (1) from within 2 Up to 2 marks for a valid description.
the function.
ii Return S(A, value, low, mid-1) (1) 1 For 1 mark (either point).
return S(A, value, mid+1, high) (1).
Accept if point in the algorithm is
unambiguously referenced. There are two
recursive calls in the program. Either is
acceptable.
Total 3
© OCR 2025. You may photocopy this page. 8 of 8 Created in ExamBuilder
Powered by TCPDF ([Link])