Kotlin language interview questions

Null safety, classes, equality, scope functions, generics, inline functions and what Kotlin 2 and the K2 compiler changed.

6 quick facts

– interview-ready · 20 questions in this topic

– of 20 tried

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

Questions

  1. How Kotlin code runs on AndroidOrder the steps
  2. Null safety and !!Predict
  3. val, var and const valPredict
  4. Data classesPredict
  5. Sealed classes and exhaustive whenPredict
  6. == vs ===Predict
  7. let, run, with, apply, alsoPredict
  8. Extension functionsPredict
  1. lateinit vs by lazyPredict
  2. inline functions and reifiedPick the fix
  3. Lambdas, function types and fun interfacesPredict
  4. object, companion object and singletonsPick the fix
  5. Generics: in, out and star projectionPredict
  6. Delegation with byPredict
  7. Smart casts and their limitsPredict
  8. Value classesPredict
  9. Collections vs sequencesPredict
  10. Kotlin 2 and the K2 compilerPick the fix
  11. @JvmStatic, @JvmField and @JvmOverloadsPick the fix
  12. Visibility: internal and friendsPick the fix

Practise this topic

Flashcards · 26

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

Quick quiz · 20 questions

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

Mock interview · 4 sets

Timed, out loud, then tick what you covered. 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