Build fluency in the vocabulary of a function that suspends and later resumes with all of its local state intact.
0 / 5 completed
1 / 5
At standup, a dev mentions a function that can suspend its own execution partway through, yielding control back to its caller, and later resume exactly where it left off with all of its local state intact. What is this construct called?
A coroutine is exactly this: a function that can suspend its own execution partway through, yielding control back to whatever resumed it, and later pick up exactly where it left off with all of its local variables and execution position preserved, rather than starting over from the beginning. A hash collision is an unrelated hash-table concept about two keys sharing a bucket. This suspend-and-resume-with-preserved-state behavior is exactly why coroutines are the foundation for writing asynchronous code that reads like straightforward, sequential logic.
2 / 5
During a design review, the team writes an asynchronous data-fetching sequence as a coroutine that suspends while waiting on a network call and resumes automatically once the response arrives. Which capability does this provide?
Writing the sequence as a coroutine provides sequential-looking code that handles asynchronous waiting without blocking the underlying thread, since suspending at the network call frees that thread to do other useful work until the response arrives, at which point the coroutine resumes automatically right where it left off. Blocking the thread entirely while waiting would tie up that thread's resources for the whole duration of the network call, unable to do anything else in the meantime. This non-blocking suspension is exactly why coroutines let asynchronous logic read like simple, top-to-bottom sequential code while still avoiding wasted thread time.
3 / 5
In a code review, a dev notices an asynchronous data-fetching flow is implemented as a deeply nested chain of callbacks, one triggered after another, instead of a coroutine that could express the same sequence as straightforward, sequential-looking code. What does this represent?
This is a missed coroutine opportunity, since a deeply nested callback chain forces the asynchronous sequence's logic to be scattered across many separate callback functions, when a coroutine would let that exact same sequence be written as straightforward, sequential-looking code that simply suspends at each asynchronous step and resumes once it completes. A cache eviction policy is an unrelated concept about discarded cache entries. This nested-callback pattern is exactly the kind of hard-to-follow structure a coroutine is designed to replace with clearer, linear-looking logic.
4 / 5
An incident report shows a maintenance change to an asynchronous data-fetching flow introduced a subtle bug, because the logic was spread across a deeply nested chain of callbacks that made the actual order of operations hard to follow. What practice would prevent this?
Rewriting the flow as a coroutine expresses the same asynchronous sequence as sequential-looking code, with suspension points instead of nested callback functions, which makes the actual order of operations far easier to follow and directly addresses the maintainability problem behind this incident. Continuing to implement the flow as a deeply nested callback chain regardless of how hard it is to follow is exactly what let the subtle bug slip through during maintenance. This coroutine-based rewrite is the standard fix for asynchronous logic that has grown difficult to reason about as a tangle of nested callbacks.
5 / 5
During a PR review, a teammate asks why the team reaches for coroutines instead of just spawning a dedicated operating-system thread for every concurrent asynchronous task. What is the reasoning?
A coroutine is far lighter-weight than an operating-system thread, since suspending and resuming it doesn't require the operating system's full thread-scheduling machinery, letting many thousands of coroutines run concurrently on top of a comparatively small pool of actual threads. The tradeoff is that coroutines depend on language or runtime support for suspending and resuming them, and mixing coroutine-style code with traditional blocking code requires care. This lightweight-concurrency advantage is exactly why coroutines are favored for workloads with a huge number of concurrent, mostly-waiting tasks, like network requests, over spawning a dedicated thread for each one.
What does the "Coroutine Vocabulary" vocabulary exercise cover?
This exercise tests real IT vocabulary related to coroutine vocabulary through 5 multiple-choice questions, each built from realistic workplace sentences rather than abstract definitions.
Is this vocabulary exercise free to use?
Yes. Every exercise on CoderSlingo, including this one, is completely free — no account, sign-up, or payment required.
How many questions does this exercise have?
This exercise has 5 questions. Each one shows a real-world sentence or scenario with multiple-choice options and an explanation once you answer.
What happens after I answer a question?
You'll see immediate feedback showing whether your answer was correct, along with a short explanation of why — then a button to move to the next question, and a full results screen at the end.
Can I retry the exercise if I get questions wrong?
Yes. Once you reach the results screen, click "Try again" to reset your answers and go through the exercise from the start as many times as you like.
Do I need to create an account to take this exercise?
No account is needed. Your answers are scored in your browser during the session — nothing is saved to a server, so you can jump straight in.
Is my progress saved if I leave the page?
No — progress within an exercise resets if you navigate away or reload. Each exercise is short enough to complete in a few minutes in one sitting.
Are these vocabulary exercises connected to other topics?
Yes — this module shares real-world context with 9 other vocabulary modules. See "Related vocabulary" below to keep building a connected skill set.
How is this different from reading a glossary or blog article?
Exercises like this one are active recall drills — you have to choose the correct term or phrasing yourself, which builds retention faster than passively reading a definition.
Where can I find more vocabulary exercises?
Browse the full Vocabulary exercises hub for hundreds of modules covering Agile, DevOps, security, databases, architecture, and more — organised by IT role and skill.