Coroutine is just another name for a subroutine.
View worked solution
Answer: 1
The statement is False.
Explanation:
A subroutine and a coroutine are distinct control flow mechanisms with fundamental differences:
- Subroutine (Procedure/Function): Follows a strict hierarchical (caller-callee) relationship. A subroutine always starts execution from the very beginning (single entry point) and runs until it returns control to the caller (single exit point), destroying its activation record upon termination.
- Coroutine: Supports cooperative, symmetric control transfer. A coroutine can suspend its execution at any point (often using a
yieldstatement) to pass control to another coroutine. When resumed, it continues execution from the exact point where it was suspended, preserving its local state and execution context.
Thus, a coroutine is not just another name for a subroutine.
Free practice · Your answers on this page are not saved.
