Jetpack Compose interview questions and answers for Android developers

Jetpack Compose interview questions check whether you can reason about recomposition: which state a composable reads, who owns that state, and what runs again when it changes. Expect questions on remember versus rememberSaveable, state hoisting, Modifier order, LazyColumn keys, LaunchedEffect and the other side-effect APIs, collecting a ViewModel's state safely, and stability. Senior rounds add performance, interop with Views and testing with semantics.

By Published 7 min read

How Compose shows up in Android interviews

New Android screens are mostly written in Compose, so the Android loop now tends to include a Compose section next to the Kotlin and architecture questions. Typical formats: a conceptual screen on state and recomposition, a live exercise where you build a list with a detail screen in Android Studio or a plain editor, and a code review where you are shown a composable that recomposes too often or leaks a coroutine and asked to fix it. Senior candidates also get migration questions about apps that still have XML layouts and Fragments.

What each part of the loop is listening for
StageTypical questionThe signal
Recruiter or tech screenWhat is recomposition? What does remember do?Clear one-sentence definitions without mixing up composition and recomposition.
Build exerciseShow a list of items from a fake repository with loading and error states.Hoisted state, a ViewModel exposing one UI state, keys in the lazy list.
Code reviewWhy does this screen flicker and restart its animation?You spot unstable parameters, effects with the wrong keys or state created in the wrong place.
Senior discussionHow would you move a large XML app to Compose?A screen-by-screen plan, interop in both directions and a view on navigation and theming.
What each part of the loop is listening for. Scroll sideways on a small screen.

Fundamentals: composables, state and modifiers

  • What is a composable function? A Kotlin function marked @Composable that emits UI into the composition instead of returning a View. It should be fast, free of side effects and safe to run many times, in any order.
  • What happens during recomposition? When a snapshot state object that a composable read during composition changes, Compose runs that composable again and updates only what changed. Composables whose inputs are unchanged and stable can be skipped.
  • Name the three phases of a frame. Composition decides what to show, layout measures and places it, drawing renders it. A state read in a later phase, such as inside a draw lambda, can skip the earlier phases when it changes.
  • remember versus rememberSaveable? remember keeps a value across recompositions but loses it when the composable leaves the composition, on rotation, or when the process dies. rememberSaveable also stores it in the saved instance state, so it survives configuration changes and process recreation, as long as it fits a Bundle or has a Saver.
  • Why does `mutableStateOf` need remember around it? Without remember, every recomposition creates a fresh state object with the initial value, so the screen appears to ignore input.
  • Why does Modifier order matter? Modifiers apply from left to right as a chain. padding then background leaves the padding outside the color; background then padding colors the padded area. clickable placed before or after padding changes the touch target.
  • Column versus LazyColumn? Column composes every child immediately. LazyColumn composes only items near the viewport and reuses as you scroll, so it suits long or unknown-length lists.
  • What is CompositionLocal? A way to pass values implicitly down the tree, as MaterialTheme does with colors and typography. Use it for cross-cutting values, not to hide normal parameters.
  • How do previews work? A composable annotated with @Preview renders in Android Studio with sample data. Keeping UI composables stateless makes them easy to preview in several states.
@Composable
fun Counter(count: Int, onIncrement: () -> Unit, modifier: Modifier = Modifier) {
    Button(onClick = onIncrement, modifier = modifier) {
        Text("Clicked $count times")
    }
}

@Composable
fun CounterScreen() {
    var count by rememberSaveable { mutableIntStateOf(0) }
    Counter(count = count, onIncrement = { count++ })
}
State hoisting: a stateless counter that takes a value and an event, and a stateful wrapper that owns the state.

Intermediate: state hoisting, ViewModels and side effects

Intermediate questions with what interviewers expect
QuestionWhat it testsWhat a strong answer shows
What is state hoisting and why do it?DesignMove state up to the caller and pass value plus event lambdas down. The child becomes reusable, previewable and testable, and there is one source of truth.
Where should screen state live: a ViewModel or remember?OwnershipBusiness and screen state that must survive configuration changes goes in a ViewModel. Pure UI element state, such as whether a dropdown is open, can stay in remember.
collectAsState versus collectAsStateWithLifecycle?LifecycleThe lifecycle-aware version stops collecting when the app goes to the background and restarts when it returns, so upstream flows do not keep working off screen.
What does the key of LaunchedEffect do?EffectsThe effect starts when it enters the composition and is cancelled and restarted whenever a key changes. Using Unit runs it once for as long as it stays in the composition.
When do you need rememberUpdatedState?Stale capturesWhen a long-running effect should not restart but must call the latest version of a lambda, such as a timeout that calls the current onTimeout.
What is DisposableEffect for?CleanupRegistering something that must be unregistered, like a lifecycle observer or a listener. onDispose runs when the keys change or the composable leaves.
rememberCoroutineScope versus LaunchedEffect?Coroutines in UILaunchedEffect starts work because of composition. rememberCoroutineScope gives a scope for work started by a user event, such as scrolling a list when a button is tapped.
What is derivedStateOf for?Fewer recompositionsTurning a state that changes often into one that changes rarely, such as whether the first visible item index is above zero. Readers recompose only when the derived result changes.
What does SideEffect do?Publishing stateRuns after every successful recomposition, for pushing Compose state to code that is not Compose, like an analytics user property.
Intermediate questions with what interviewers expect. Scroll sideways on a small screen.
data class Article(val id: Long, val title: String)

data class FeedUiState(
    val loading: Boolean = true,
    val articles: List<Article> = emptyList(),
)

@Composable
fun FeedScreen(viewModel: FeedViewModel) {
    val state by viewModel.uiState.collectAsStateWithLifecycle()
    val listState = rememberLazyListState()
    val scope = rememberCoroutineScope()
    val showTop by remember {
        derivedStateOf { listState.firstVisibleItemIndex > 0 }
    }

    Box(Modifier.fillMaxSize()) {
        LazyColumn(state = listState) {
            items(state.articles, key = { article -> article.id }) { article ->
                Text(article.title, Modifier.padding(16.dp))
            }
        }
        if (showTop) {
            Button(
                onClick = { scope.launch { listState.animateScrollToItem(0) } },
                modifier = Modifier.align(Alignment.BottomEnd).padding(16.dp),
            ) { Text("Top") }
        }
    }
}
A screen that collects UI state from a ViewModel and shows a scroll-to-top button only when the list has scrolled.
  • Why pass a key to items()? Without keys, item state is tied to position, so inserting at the top shifts remembered state onto the wrong rows. Stable keys from the model keep state and animations attached to the right item. Keys must be unique, or the list throws at runtime.
  • Why does the button use rememberCoroutineScope and not LaunchedEffect? The scroll happens because of a tap, not because of composition, so it needs a scope tied to the composable that a click handler can launch into.
  • What would break if showTop read firstVisibleItemIndex directly? It would still work, but the whole screen would recompose on every index change while scrolling. derivedStateOf limits recomposition to the moment the boolean flips.

Senior questions: stability, performance and architecture

Senior and scenario questions
QuestionWhat it testsWhat a strong answer shows
What makes a parameter stable?SkippingCompose can trust that equal values mean nothing changed: primitives, strings, lambdas without unstable captures, and classes whose public properties are vals of stable types. A plain List or a class with var properties from another module is treated as unstable.
How do you fix unstable parameters?Performance toolsUse immutable data classes, annotate with @Immutable or @Stable when the contract is true, consider immutable collection types, or read the compiler's stability reports. Recent Compose compiler releases enable strong skipping by default, which relaxes some of this, so check the version in use.
How do you find excessive recomposition?DiagnosticsLayout Inspector recomposition counts, composition tracing in a system trace, and stability reports. Then look for state read too high in the tree.
What is deferring a state read?PhasesPassing a lambda instead of a value, as in Modifier.offset { IntOffset(0, scroll.value) }, so the read happens in layout or draw and changes skip composition.
How do you use a View inside Compose and Compose inside a View?InteropAndroidView with factory and update lambdas for the first. ComposeView in XML or a Fragment for the second, with a composition strategy that matches the Fragment's view lifecycle.
How would you migrate an XML app?MigrationNew screens in Compose first, then leaf screens, sharing one theme. Keep one navigation system per flow, and measure startup and scroll performance before and after, using baseline profiles.
How do you test a composable?TestingWith a compose test rule: set content, find nodes through semantics (text, content description or test tag), perform actions and assert. Keep logic in the ViewModel and unit test it without UI.
How do you make a custom component accessible?AccessibilityAdd semantics: a content description, a role, merged descendants for a row that acts as one control, and state descriptions for toggles. Check touch target size and TalkBack order.
How do you survive process death?State restorationrememberSaveable for UI state, SavedStateHandle in the ViewModel for arguments and key screen state, and reloading the rest from the repository.
Senior and scenario questions. Scroll sideways on a small screen.
class CounterScreenTest {
    @get:Rule
    val composeRule = createComposeRule()

    @Test
    fun clickIncrementsCount() {
        composeRule.setContent { CounterScreen() }

        composeRule.onNodeWithText("Clicked 0 times").performClick()
        composeRule.onNodeWithText("Clicked 1 times").assertIsDisplayed()
    }
}
A UI test that finds nodes by their semantics instead of view IDs.
  • Scenario: an animation restarts every time the user types. The animated composable likely sits under state that changes per keystroke, or its LaunchedEffect is keyed on the text. Move the read lower or key the effect on what should really restart it.
  • Scenario: a timer keeps running after leaving the screen. Work was launched from a scope that outlives the screen, such as GlobalScope or a custom scope. Use LaunchedEffect or viewModelScope so cancellation follows the owner.
  • Scenario: list rows show the wrong checkbox state after deleting an item. State is keyed by position. Add stable keys and hoist the checked state into the item model.
  • Scenario: the team asks whether to use one big UI state class or many flows. Discuss a single immutable state for consistency and easy testing versus finer flows for very busy screens, and what each does to recomposition.

Fictional example

Answering "Tell me about a Compose bug that took a while to find"
In a chat app, typing in the message box made the whole conversation list stutter. Layout Inspector showed every message row recomposing on each keystroke. The screen took the full UI state, including the draft text, and passed the message list as a plain List from a data module, which the compiler treated as unstable. I split the draft into its own state read only by the input bar, and mapped messages into immutable UI models. Row recompositions while typing dropped to zero, and I added a recomposition check to our review notes so the pattern did not come back.

A ten-day Compose practice plan

  1. Days 1 and 2: write five small composables with hoisted state and previews for each state. Explain recomposition out loud for each one.
  2. Days 3 and 4: build a list screen with a fake repository, a ViewModel, one UI state class and collectAsStateWithLifecycle.
  3. Days 5 and 6: one example per effect API. Change keys and watch which effects restart, then write down the rule for each.
  4. Day 7: break performance on purpose with an unstable parameter and a high state read, then fix both using Layout Inspector counts.
  5. Day 8: write three semantics-based UI tests and one ViewModel unit test.
  6. Days 9 and 10: two timed mock builds of about an hour, followed by a five-minute talk on how you would migrate a Fragment screen.

Coroutines, Flow and the language features behind all of this are covered in Kotlin interview questions. The full Android loop is in Android developer interview questions, and Apple's version of the same declarative model is SwiftUI interview questions.

Natively is an AI interview assistant that runs on Mac and Windows, and it is useful for running mock Compose rounds with a friend. It transcribes the session so you can reread how you explained recomposition, it can take a screenshot of a build prompt and suggest a structure or point to a missed edge case, and with Pro or the free trial it uses the résumé and job description you give it. Notes and transcripts are saved for later review.

Questions people ask

What Jetpack Compose questions are asked in Android interviews?

Recomposition and the three phases, remember versus rememberSaveable, state hoisting, Modifier order, LazyColumn keys, LaunchedEffect and the other side-effect APIs, ViewModel state collection, stability and testing with semantics.

What is the difference between remember and rememberSaveable?

remember keeps a value across recompositions only. rememberSaveable also saves it in instance state, so it survives rotation and process recreation if the value can be stored in a Bundle or has a Saver.

What is state hoisting in Jetpack Compose?

Moving state out of a composable to its caller and passing the value and an event lambda down instead. The composable becomes stateless, easier to reuse, preview and test, with one source of truth.

How do I prepare for a Jetpack Compose coding round?

Build a list and detail screen with a ViewModel, one UI state class, lazy list keys and loading and error states within an hour, then practice explaining which composables recompose and why.

Where to go next

Practice with the same assistant you would use on a call: it listens, transcribes and suggests answers from your own resume and the job description.

Facts on this page were last checked on . Product details come from the Natively app itself; if something here is out of date, tell us at hello@heynatively.com.

Keep reading

Put it on your own machine.

A live-conversation assistant that runs locally. Your conversations stay on your machine.

macOS 12+ · Windows 10/11

© 2026 Natively AI Private Limited

Source-available under the Natively Personal Use Source License v1.0 · IP geolocation by DB-IP