ITPEC FE Subject B April 2026 Question 14
ITPEC FE Subject B April 2026 — Question 14 of 20
A is n and B is (count ÷ (n - 1)) × 100.
Blank A — the inner loop counts how many students scored below arr[i], so it must compare against every student, j running from 1 to n. The comparison arr[i] > arr[j] is false when j equals i, so a student is never counted against themselves.
Blank B — the formula divides that count by the total number of students minus one, then scales by 100.
Check against the worked example {30, 60, 80, 72, 15}: only 15 is below 30, so count is 1 and the percentile is (1 ÷ 4) × 100 = 25, matching the stated result.
Answer (f)
Why not others:
- (a) and (b) — stop the inner loop at i, comparing each student only with those appearing earlier in the array; the first student would always score 0 regardless of their mark
- (c) and (d) — stop at i - 1, the same flaw with one fewer comparison
- (a), (c) and (e) — subtract 1 from count before dividing; the first student of the example would come out at 0 instead of 25
Key rule: The percentile depends on the whole cohort, so the inner loop must cover the whole array. A bound tied to i makes the result depend on the order the scores happen to be stored in.
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.