Android Jetpack Compose Interview Questions
State, layout, navigation, and performance.
50 questions in this topic · 8 sample questions below
Practice Jetpack Compose in the quiz engine
Sample questions
A Composable reads a value from a State object during composition. What guarantees that this Composable recomposes when the value changes?
Why: Snapshot state records which recomposition scopes read it, so only those scopes are invalidated on write. There is no per-frame tree diff; reading state is what creates the dependency, not the @Composable annotation.
Which statement about the three Compose phases is correct?
Why: The phases are composition, layout, draw, and reading state in a later phase (for example via a lambda) can skip earlier phases. Layout does not automatically re-run just because composition did if no layout-affecting state changed.
You animate a scroll offset and apply it with Modifier.offset { IntOffset(0, scroll.roundToInt()) } using the lambda overload instead of Modifier.offset(y = scroll.dp). Why is the lambda version more efficient?
Why: The lambda overload defers the state read to the layout phase, so an offset change invalidates layout and draw but not composition. The non-lambda version reads state in composition, forcing recomposition each frame.
What does it mean for a Composable to be skippable?
Why: Skippable means Compose can bypass re-execution when every parameter is stable and compares equal to the last call. Having no state is neither necessary nor sufficient; stability of parameters is the criterion.
What is the difference between a restartable and a skippable Composable?
Why: Restartable means the compiler wrapped the function so it can restart at its own scope; skippable means that restart can be avoided when arguments are equal and stable. A function returning a value is typically neither restartable nor skippable.
A data class has all val properties of stable types but Compose still treats it as unstable, breaking skipping. What is the most likely cause?
Why: The compiler can only infer stability for types it compiles; a class from a non-Compose module is treated as unstable unless annotated. Data classes with stable vals are otherwise inferred stable, and vals are not treated as mutable.
Why does passing a lambda that captures a mutable variable sometimes prevent a child Composable from being skipped?
Why: Compose can memoize lambdas that capture only stable values, keeping them stable across recompositions; capturing an unstable value makes the lambda unstable so the child is not skipped. Lambdas are not inherently unstable, and captured stable values are remembered.
What is the practical effect of annotating a class with @Immutable versus @Stable?
Why: @Immutable is a stronger contract that values never change after construction; @Stable allows mutation but promises Compose is notified through snapshot state. Neither controls restartability, and they are not equivalent.
Practice all 50 Jetpack Compose questions
These 8 are a sample. The full Jetpack Compose 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 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 Kotlin Multiplatform interview questions
- Android WorkManager & Background interview questions
- Android Performance & Memory interview questions