In the C language:
View worked solution
Answer: B
In the C programming language, function calls are managed at runtime using a single call stack. Each active function call is represented by an activation record (or stack frame) on this stack.
- Option A is incorrect: There is no limit on the number of intermediate function calls. If
main()callsf1(), which callsf2(), which callsf3(), there will be multiple activation records betweenmainand the current active functionf3. - Option B is correct: The call stack grows and shrinks dynamically. The number of activation records currently residing on the stack between the active function and
main()depends entirely on the sequence of active function calls at that point in execution. - Option C is incorrect: C uses static (lexical) scoping. The visibility of global variables is determined at compile-time based on their position in the source code, not by the runtime function calling sequence (which would be dynamic scoping).
- Option D is incorrect: Recursive function calls do not require a separate stack. Each recursive call simply pushes a new activation record for the same function onto the standard runtime call stack.
Free practice · Your answers on this page are not saved.
