ITPEC FE Subject B April 2026 Question 5
From the answer group below, select the correct answer to be inserted into blank in the description.
When the procedure proc1 is called, the output is “blank” in turn.
Answer group
Explanation
B, C, C, A — a call runs to completion before the statement after it starts, so proc1 prints its own A last.
- •
proc1first callsproc2 - •
proc2outputs B, then callsproc3, which outputs C - •control returns to
proc1, which callsproc3directly: another C - •only then does
proc1reach its own output statement: A
proc3 runs twice, once from inside proc2 and once from proc1.
Answer (e)
Why not others:
- •(a) and (b) — put A first, but
proc1outputs only after both of its calls have returned - •(c) — puts A second, as if
proc1printed between its two calls - •(d) — prints B again in third place, but the second call in
proc1isproc3, which prints C; nothing callsproc2twice - •(f), (g) and (h) — start with C, but
proc2outputs B before it callsproc3
Key rule: Read a call as "pause here, run the whole procedure, come back"; the order of statements inside each procedure decides whether its own output comes before or after the calls it makes.
Stack · AI-written, may contain errors
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.