Android Kotlin Multiplatform Interview Questions
Shared code, expect/actual, targets, and interop.
50 questions in this topic · 8 sample questions below
Practice Kotlin Multiplatform in the quiz engine
Sample questions
Which source set holds code that is compiled against every declared target and may use only APIs available on all of them?
Why: commonMain is compiled for all targets and is restricted to APIs common to them, so it is where truly shared code lives. sharedMain is not a special reserved name, and androidMain is platform-specific rather than shared.
What is the primary role of an expect declaration in common code?
Why: expect/actual is resolved at compile time per target, so every target compiling the common source set must provide an actual. It is not a runtime interface picked by DI, nor a JVM-only linking trick.
Since Kotlin 1.7.20 with the new Kotlin/Native memory manager, how do you share a mutable object between threads?
Why: The new memory manager removed the freezing requirement, so objects move between threads without being frozen and freeze() is deprecated. The requirement to freeze before sharing was the old model and is the misconception here.
How are Kotlin suspend functions exposed to Swift and Objective-C by default in the generated framework?
Why: The Kotlin/Native compiler exposes a suspend function with a completion-handler signature that Swift can call using async/await, so it is neither blocking nor stripped. Automatic Combine publishers are not part of the default export.
What is a known limitation when consuming Kotlin generics from Swift through the Objective-C interop framework?
Why: Because export flows through Objective-C, generic type information is largely erased and Swift sees weakly typed APIs. It does not preserve full variance, nor convert every generic into an associated-type protocol, nor fail to compile.
Why might launching a coroutine on Dispatchers.Main work in a shared module on Android but fail at runtime on iOS if misconfigured?
Why: Dispatchers.Main is backed by the platform main queue and needs the multiplatform coroutines artifact plus a running run loop. iOS does have a main thread and coroutines are supported on Native, so the other options are false.
Which of the following is generally NOT shareable in commonMain and must live in platform source sets?
Why: Platform UI types exist only in their platform source sets, so they cannot be referenced from commonMain. Serialization models, Ktor logic, and SQLDelight queries are all explicitly designed to be shared.
What does the default hierarchy template, enabled by default in recent Kotlin versions, provide?
Why: The default hierarchy template wires up intermediate source sets, for example an iosMain shared by the iOS device and simulator targets, from your target list. It neither generates actuals nor collapses platform main sets together.
Practice all 50 Kotlin Multiplatform questions
These 8 are a sample. The full Kotlin Multiplatform bank is scored, tracks your progress, and explains every answer.
More Android interview topics
- Android Hilt interview questions
- Android Coroutines & Flow interview questions
- Android Room interview questions
- Android Design Patterns interview questions
- Android Mobile System Design interview questions
- Android Coding Interview Patterns interview questions
- Android NDK interview questions
- Android Sensors interview questions
- Android Security interview questions
- Android Jetpack Compose interview questions
- Android Canvas & Animation interview questions
- Android CI/CD interview questions
- Android Git interview questions
- Android Unit Testing interview questions
- Android Kotlin interview questions
- Android Retrofit interview questions
- Android Architecture interview questions
- Android Android Framework interview questions
- Android WorkManager & Background interview questions
- Android Performance & Memory interview questions