Skip to content
All resources

checklist

Kotlin coroutines and Flow interview checklist

A senior Android checklist for coroutine ownership, structured concurrency, cancellation, Flow collection, state sharing and deterministic tests.

Use this in practice

Use this before an Android interview to check whether your answers describe ownership and failure behavior, not only coroutine builders and Flow operators.

Must be able to explain

  • Structured concurrency gives child coroutines a parent that owns cancellation, failure propagation and completion.
  • Cancellation is cooperative. Blocking work and code that never checks cancellation can continue after its owner is gone.
  • A CoroutineScope is an ownership decision. Its lifetime must match the work it launches.
  • StateFlow represents current observable state. SharedFlow represents shared events or values whose replay and buffering must be chosen deliberately.
  • Flow is cold by default. Collection starts work, so repeated collectors can repeat upstream work unless sharing is explicit.
  • flowOn changes the context of upstream operators. It does not move arbitrary downstream UI work away from the main thread.
  • Exception handling depends on the coroutine hierarchy. A CoroutineExceptionHandler is not a replacement for local recovery and result modeling.

Questions to rehearse

  • A search screen emits on every keystroke. How do you cancel stale requests and prevent old results from replacing new ones?
  • A Flow is collected after every configuration change. How do you avoid duplicate upstream subscriptions and repeated network work?
  • When would you use stateIn or shareIn, and who owns the resulting scope?
  • How would you model one-time navigation without losing or replaying it unexpectedly?
  • A child coroutine fails inside coroutineScope. What happens to its siblings, and when would supervisorScope be appropriate?
  • How do you test debounce, retry and timeout logic without real delays?

Red flags to remove

  • GlobalScope is fine for fire-and-forget work.
  • viewModelScope means the work has the right owner automatically.
  • StateFlow is LiveData with a different API.
  • Dispatchers.IO makes any operation safe and non-blocking.
  • A catch operator handles every exception in the pipeline.

Use this resource inside a path.

The free tools are designed to plug into the larger Salari career system.