ITPEC FE Subject B April 2026 Question 5
ITPEC FE Subject B April 2026 — Question 5 of 20
B, C, C, A — a procedure's own output runs only after the calls written above it have returned.
Expand proc1 step by step:
- •
proc1first callsproc2 - •
proc2outputs B, then callsproc3, which outputs C - •control returns to
proc1, which callsproc3directly — another C - •only now does
proc1reach its own statement and output A
Note that proc3 runs twice: once from inside proc2 and once from proc1.
Answer (e)
Why not others:
- (a), (b) and (c) — place A first or second, but proc1 outputs last of all, after both of its calls have finished
- (f), (g) and (h) — start with C, which would require proc3 to run before proc2 printed; proc2 outputs B before calling proc3
- (d) — has B in third place, yet the second call made by proc1 is proc3, which prints C
Key rule: Read a call as "pause here, run the whole procedure, come back". Statements after the call wait; the deepest procedure prints first.
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.