Free Coroutines & Flow Interview Questions
Structured concurrency, cancellation, and hot vs cold Flow.
Browse all 50 questions. Sign in with a free account to reveal the detailed answers.
What does the suspend keyword actually change about a function, and does it make the function run off the main thread?
Sign in to view the detailed answer.
In structured concurrency, what guarantee does a coroutineScope block give you that GlobalScope.launch does not?
Sign in to view the detailed answer.
What is the difference between launch and async, and when is using async without ever calling await a mistake?
Sign in to view the detailed answer.
Why does wrapping an async call site in try/catch sometimes fail to catch the exception?
Sign in to view the detailed answer.
What is the core behavioral difference between coroutineScope and supervisorScope?
Sign in to view the detailed answer.
How do Job and SupervisorJob differ in the direction that cancellation and failure propagate?
Sign in to view the detailed answer.
A CoroutineExceptionHandler you installed does not fire for an exception thrown inside an async. Why?
Sign in to view the detailed answer.
Why is putting a CoroutineExceptionHandler in the context of a child launch, rather than the scope, ineffective?
Sign in to view the detailed answer.
What is the practical difference between withContext(Dispatchers.IO) and launching an async on the IO dispatcher and awaiting it immediately?
Sign in to view the detailed answer.
What actually distinguishes Dispatchers.IO from Dispatchers.Default, and can work migrate between them cheaply?
Sign in to view the detailed answer.
What does limitedParallelism on a dispatcher give you, and how does it differ from a fixed-size thread pool?
Sign in to view the detailed answer.
Why does Dispatchers.Unconfined behave surprisingly, and where is it legitimately used?
Sign in to view the detailed answer.
Why does a tight computational loop ignore cancellation, and what are the ways to make it cooperative?
Sign in to view the detailed answer.
What is the difference between checking isActive, calling ensureActive, and calling yield inside a loop?
Sign in to view the detailed answer.
Why can't you simply run suspending cleanup code in a finally block after cancellation, and what fixes it?
Sign in to view the detailed answer.
What is a cold Flow, and what specifically makes it cold?
Sign in to view the detailed answer.
Why does StateFlow drop values, and how do its conflation and equality check affect what collectors see?
Sign in to view the detailed answer.
You update a StateFlow with a value equal to the current one and collectors do not react. Why, and how do you force an emission?
Sign in to view the detailed answer.
What do replay, extraBufferCapacity, and onBufferOverflow control in a MutableSharedFlow, and how do they interact?
Sign in to view the detailed answer.
Why does SharingStarted.WhileSubscribed(5000) exist, and what problem does the 5000 specifically solve?
Sign in to view the detailed answer.
How do SharingStarted.Eagerly, Lazily, and WhileSubscribed differ in when the upstream runs?
Sign in to view the detailed answer.
What is the difference between stateIn and shareIn, and when must you use shareIn?
Sign in to view the detailed answer.
What exactly does flowOn change, and why does it only affect the upstream part of the chain?
Sign in to view the detailed answer.
Why is calling withContext to change dispatcher inside a flow builder's emit wrong, and what is context preservation?
Sign in to view the detailed answer.
What is the difference between buffer, conflate, and collectLatest for handling a slow collector?
Sign in to view the detailed answer.
How does flatMapLatest behave differently from flatMapMerge and flatMapConcat?
Sign in to view the detailed answer.
Why is callbackFlow required for bridging callback-based APIs, and what happens if you forget awaitClose?
Sign in to view the detailed answer.
What does suspendCancellableCoroutine give you over suspendCoroutine, and why does it matter?
Sign in to view the detailed answer.
Why is runBlocking dangerous in production Android code, and where is it acceptable?
Sign in to view the detailed answer.
Why does GlobalScope.launch leak and misbehave, beyond just being discouraged?
Sign in to view the detailed answer.
What lifecycle does viewModelScope have, and what dispatcher does it default to?
Sign in to view the detailed answer.
Why is repeatOnLifecycle preferred over launchWhenStarted for collecting flows in the UI?
Sign in to view the detailed answer.
When collecting a flow with repeatOnLifecycle(Lifecycle.State.STARTED), what happens to a StateFlow's upstream on each stop and start?
Sign in to view the detailed answer.
What is exception transparency in Flow, and why is wrapping emit in try/catch a violation?
Sign in to view the detailed answer.
How does the catch operator differ from a try/catch around collect, and what can catch not handle?
Sign in to view the detailed answer.
What is the semantic difference between combine and zip on two flows?
Sign in to view the detailed answer.
In combine, why might you miss the very first combined emission, and how does it handle initial values?
Sign in to view the detailed answer.
Why is runTest preferred over runBlocking for testing suspend code, and what does it automate?
Sign in to view the detailed answer.
What is the difference between StandardTestDispatcher and UnconfinedTestDispatcher in tests?
Sign in to view the detailed answer.
What does advanceUntilIdle do, and why might a test not observe an emission without it?
Sign in to view the detailed answer.
Why should you inject dispatchers rather than reference Dispatchers.IO directly, especially for tests?
Sign in to view the detailed answer.
When should you use Mutex.withLock instead of a synchronized block in coroutine code?
Sign in to view the detailed answer.
Mutex in kotlinx.coroutines is not reentrant. What problem does that cause and how do you avoid it?
Sign in to view the detailed answer.
When would you choose a Channel over a SharedFlow, given both can broadcast events?
Sign in to view the detailed answer.
Why can a SharedFlow with zero replay silently drop events for one-time UI actions, and what is a robust alternative?
Sign in to view the detailed answer.
Why does cancelling a parent coroutine not immediately stop a child doing blocking JVM work, and how do you make it interruptible?
Sign in to view the detailed answer.
Why must you never catch CancellationException and swallow it, and what is the correct handling?
Sign in to view the detailed answer.
How do onEach plus launchIn differ from a plain collect, and when does the distinction matter?
Sign in to view the detailed answer.
What is the difference between a SupervisorJob installed in a scope and using supervisorScope, in terms of lifetime?
Sign in to view the detailed answer.
Why can awaiting an async inside supervisorScope still throw even though a child failure does not cancel the scope, and how do you handle it correctly?
Sign in to view the detailed answer.
Practice all Coroutines & Flow questions interactively
Search and filter questions in the free Preparation Path, then sign in to reveal answers and save your progress.
More Android interview topics
- Kotlin interview questions
- Jetpack Compose interview questions
- Android Architecture interview questions · Premium
- Android Framework interview questions · Premium
- Testing interview questions · Premium
- Dependency Injection interview questions · Premium
- Networking interview questions · Premium
- Room & Persistence interview questions · Premium
- Android System Design interview questions · Premium
- Android Tools interview questions · Premium
- Android Security interview questions · Premium
- Performance & Memory interview questions · Premium
- Background Work interview questions · Premium
- Kotlin Multiplatform interview questions · Premium
- NDK & JNI interview questions · Premium
- Sensors & Location interview questions · Premium
- CI/CD & Release interview questions · Premium
- Graphics & Animation interview questions · Premium