Kotlin coroutines interview questions

Suspend functions, scopes, dispatchers, structured concurrency, cancellation and errors: the questions every senior Android loop opens with.

6 quick facts

– interview-ready · 18 questions in this topic

– of 18 tried

Saved on this device. Interview-ready means you got it right on two different days. Guesses and hints count for less.

Questions

  1. What happens to viewModelScope work on rotation?Predict
  2. Coroutines vs threadsPredict
  3. What does suspend mean?Pick the fix
  4. launch vs asyncPredict · timeline
  5. Structured concurrencyPredict
  6. CoroutineScope vs CoroutineContextPredict
  7. Choosing a dispatcherPick the fix
  8. withContext and main-safetyFill the blank
  1. Cooperative cancellationSpot the bug
  2. Don't swallow CancellationExceptionSpot the bug
  3. Job vs SupervisorJobPredict
  4. Where CoroutineExceptionHandler worksPick the fix
  5. Loading several things in parallelOrder the steps
  6. withTimeout vs withTimeoutOrNullPredict
  7. Shared mutable statePick the fix
  8. Collecting safely from the UIPick the fix
  9. Why not GlobalScope?Pick the fix
  10. runBlocking on AndroidPredict

Practise this topic

Flashcards · 24

Flip, then say if you knew it. Needs JavaScript; every answer is also on its question page.

Quick quiz · 18 questions

One exercise per question, checked as you go. Needs JavaScript.

Mock interview · 3 sets

Timed, out loud, then tick what you covered. Needs JavaScript.

Fix this PR · 2 reviews

Review a diff like a senior: flag the lines you'd comment on. Needs JavaScript.

Quick facts

Recall the answer first, then tap Show to check.

Sources: Question outline adapted from Android-Interview-Questions by Mohsen Mirhoseini, licensed under Apache 2.0. We reorganised the questions, rewrote every answer and added new ones. Credits and license