ITPEC FE Subject B April 2026 Question 7
ITPEC FE Subject B April 2026 — Question 7 of 20
A is Index and B is index - 1.
The recursion scans the array from the last position down to the first:
- •
linearSearchstarts it withindex = N - •
index < 1means the whole array has been examined without a hit, so-1is returned - •if
D[index]equals the key, the position wanted is the currentindexitself — that is blank A - •otherwise the search must continue one position to the left, so the recursive call passes
index - 1— that is blank B
Answer (d)
Why not others:
- (a), (b) and (c) — return the constant 1 on a hit, reporting the first position no matter where the value was found
- (g), (h) and (i) — return index - 1, one position to the left of the element that actually matched
- (e) and (h) — recurse with N - 1, a value that never changes between calls, so the recursion never reaches the base case
- (f) and (i) — recurse with N - index, which jumps around the array instead of stepping through it
Key rule: In a recursive scan the parameter must move steadily toward the base case. Anything built from N alone is constant across calls and loops forever.
AI-generated — may contain errors
The original exam layout is preserved in the image so diagrams, formulas, tables, and code remain accurate.
This question comes from an official ITPEC past paper. ITPEC Practice is an independent study tool and is not affiliated with ITPEC. See the official FE past-paper collection or Report an issue.