Question 2(e) 2025 · October-November · Paper 42 · 6 marks
Reveal official mark-scheme answer
Official answer for Question 2
Part (e)
Question 1
mark each
Question 6
- Function header (and end) taking four parameters and recursive function written
- Calculating middle value
- Comparing middle value to data parameter and returning index if equal
- If middle is greater than, recursive call with middle –1 for upper
- If middle is less than, recursive call with middle + 1 for lower
- Checking if not found and returning –1
Show text version of question
Question 2
Part (e)
Question 2
A program stores 20 unique random integers between 0 and 100 (inclusive) in a 1D array that is
local to the main program.
Part (e)
The recursive function RecursiveBinarySearch() takes four parameters:
- an integer array
- the lower bound of the array
- the upper bound of the array
- the value to find in the array.
The recursive function performs a binary search to find the index of the value in the array.
The function returns the index of the value if it is found. The function returns –1 if the value is not found.
Write program code for RecursiveBinarySearch()
Save your program.
Copy and paste the program code into part 2(e) in the evidence document.
Question 8
Why this question appears here
98% assigned-topic match · Computational thinking and problem-solving › Recursion
Topic-match percentages estimate how closely each question fits the selected syllabus topic. They are a guide for choosing stricter or broader practice.
Permanent source page: Educate A Change · From 9618_w25_qp_42.pdf
