Kotlin coroutines and Flows are the foundation of modern Android and server-side Kotlin development. These exercises cover structured concurrency, the Flow abstraction, hot vs cold flows, lifecycle-aware coroutine scopes, and key Flow operators.
0 / 5 completed
1 / 5
At standup, a colleague asks what structured concurrency means in Kotlin coroutines. What is the correct answer?
Structured concurrency in Kotlin means coroutines are launched within a CoroutineScope that defines their lifetime. A parent scope waits for all its child coroutines before completing. If the parent is cancelled, all children are cancelled automatically. If a child fails, the exception propagates to the parent (with SupervisorJob as the exception). This prevents coroutine leaks and makes reasoning about concurrency lifetimes much easier.
2 / 5
During a PR review, a teammate asks what a Flow in Kotlin is. Which answer is correct?
A Kotlin Flow<T> is a cold asynchronous stream. It does not execute until a consumer calls .collect { } (or another terminal operator). Each collection triggers a fresh execution of the flow builder. Flows support a rich operator library (map, filter, flatMapLatest, debounce, etc.) and are fully integrated with coroutine cancellation. They are the primary abstraction for reactive-style programming in Kotlin.
3 / 5
In a design review, the team discusses StateFlow vs SharedFlow. A junior engineer asks what the key differences are. What is correct?
StateFlow is a hot flow designed for state: it always holds a current value, new collectors immediately receive the latest value (replay = 1), and it uses structural equality to skip emitting when the new value equals the current value. SharedFlow is more flexible: configurable replay cache (0+), no mandatory initial value, and it emits every value regardless of equality. Use StateFlow for UI state; use SharedFlow for events and one-time signals.
4 / 5
An incident report shows an Android app crashing with CancellationException when the ViewModel is cleared. A senior engineer asks how viewModelScope relates to coroutine lifecycle. What is correct?
viewModelScope is a CoroutineScope bound to the ViewModel's lifecycle. When the ViewModel is cleared (e.g., the user navigates away), onCleared() is called and the scope is cancelled — all running coroutines receive a CancellationException. This is intentional and correct behaviour, preventing work from continuing after the UI is gone. CancellationException should be caught carefully — it should generally not be swallowed, as catching it can prevent coroutine cancellation from propagating.
5 / 5
During a code review, a senior engineer asks what flatMapLatest does on a Kotlin Flow. What is accurate?
flatMapLatest is the key operator for cancelling stale work. When a new value arrives from the upstream flow, flatMapLatest cancels the currently running inner flow and starts a new one for the latest value. This is perfect for search-as-you-type: each character triggers a new search flow, and the previous in-flight search is cancelled automatically. Use flatMapMerge when you want all inner flows to run concurrently, or flatMapConcat to run them sequentially.
What does the "Kotlin Coroutines and Flows Vocabulary" vocabulary exercise cover?
This exercise tests real IT vocabulary related to kotlin coroutines and flows 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 — browse the full vocabulary exercises hub to find related modules covering adjacent IT topics and roles.
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.