Jetpack compose
33 bites tagged Jetpack compose: interview questions with model answers, and 60-second explainers.
Test yourself: Top 30 Jetpack compose interview questions →Multiple choice, with the correct answer and why it is correct on every question. Free, no sign-in.Material Design: Android's Paper Metaphor
Material Design models Android UI as stacked paper with light and elevation. It ships pre-built components like cards and FABs so your app feels native immediately.
How do you diagnose and fix excessive recomposition in Jetpack Compose?
This tests your grasp of Compose's stability system. First, use Layout Inspector to find high-recomposition areas. Then, enable and analyze the Compose compiler report to diagnose unstable parameters (like List) or lambdas.
`remember` vs. `rememberSaveable`: When and why to use each?
Tests understanding of state survival in Compose. A good answer contrasts remember (for composition) with rememberSaveable (for activity recreation/process death), explaining its use of the Bundle mechanism. A red flag is confusing the two lifecycles.
How to implement efficient large lists in Jetpack Compose?
This tests your grasp of Compose performance. Use LazyColumn to compose only visible items, unlike a Column which renders all items at once. A red flag is suggesting a scrollable Column, which has severe performance costs for large lists.
Which Compose side-effect for a one-time coroutine action?
Tests if you can choose the right Compose side-effect for a one-time coroutine. A great answer names LaunchedEffect(Unit), explains it runs once and cancels on exit. A red flag is suggesting rememberCoroutineScope directly in the composable body.
Describe the state hoisting pattern in Compose
Tests your grasp of unidirectional data flow. Explain state hoisting is moving state up to make composables stateless. This enables reusability, easier testing, and a single source of truth. A red flag is just describing the mechanics without the benefits.
Explain Recomposition in Jetpack Compose
This tests your core understanding of Compose's declarative model. Explain that recomposition is re-running composables when state they read changes. Mention that Compose optimizes by only recomposing the nearest scope and skipping composables with stable…
How do you arrange UI elements in Jetpack Compose?
Tests your grasp of Compose's declarative layout model. Explain Row (horizontal) and Column (vertical) as the core layout composables. Define Modifier as the standard way to configure size, spacing, and behavior.
What is the purpose of `remember` in Jetpack Compose?
This tests your grasp of Compose's recomposition lifecycle. A good answer explains remember caches an object across recompositions, preventing state loss. It's used with mutableStateOf to hold the same state instance.
How do you diagnose and fix excessive recomposition in Jetpack Compose?
This tests your understanding of Compose's stability system for performance. Use the Layout Inspector and Compiler Metrics to find unstable composables, then fix them with immutable data types and stable lambdas.
remember vs. rememberSaveable: When and Why to Use Each
Tests understanding of Compose state survival. remember is for recomposition scope. rememberSaveable survives activity recreation and process death via a Bundle, requiring custom Savers for complex types. Red flag: saying remember survives rotation.
Implement an efficient list in Jetpack Compose
Tests your grasp of UI virtualization in Compose. Answer: Use LazyColumn as it only composes visible items. Contrast this with Column, which composes all items at once, causing poor performance. Mention the items DSL.
Which side-effect handler for a one-time coroutine action in Compose?
This tests your understanding of Compose lifecycles and side-effect handlers. A good answer names LaunchedEffect(Unit), explaining the constant key ensures the effect runs only once. A red flag is suggesting launching coroutines on every recomposition.
Describe state hoisting in Jetpack Compose.
Tests your grasp of unidirectional data flow. Explain state hoisting is moving state up to make composables stateless. This improves reusability, testability, and creates a single source of truth. A red flag is defining it without explaining the benefits.
Explain Recomposition in Jetpack Compose
Tests your grasp of Compose's declarative model. A good answer defines recomposition, explains state-read triggers, and details how stability and positional memoization enable skipping. A red flag is assuming any state change redraws the entire UI.
How to arrange UI elements in Jetpack Compose?
This tests your grasp of Compose's declarative layout basics. A good answer defines Column (vertical) and Row (horizontal) for structure, and Modifier for decoration, size, and behavior. A red flag is confusing Modifiers with simple styling.
What is the purpose of the `remember` function in Compose?
This tests your grasp of recomposition. Explain that remember stores an object in the composition tree, preventing it from being re-initialized on every render. A red flag is confusing it with rememberSaveable, which survives configuration changes.
Constraints: Building UIs with Relationships, Not Boxes
Constraints define UI by relationships, not nested boxes. Think of it like telling elements 'align with that one' instead of placing them in rigid rows. This is key for complex, responsive layouts, but can lead to unsolvable rules if not defined carefully.
Adaptive UI for Foldables: Thinking in Postures
An adaptive UI for foldables thinks in "postures," not just screen sizes, reacting to states like folded or tabletop mode. This is key for apps on devices like the Pixel Fold. The footgun is treating a foldable like a big tablet, ignoring its unique physical.
Jetpack Compose Theming for Design Systems
Compose theming uses CompositionLocal to implicitly pass design tokens like colors and fonts down the UI tree. This is key for building a design system where you can swap themes (like light/dark) without rewriting components.
ConstraintLayout in Compose
ConstraintLayout in Compose lets you position elements relative to each other and to guidelines using constraints, the same model as the View system's ConstraintLayout. It solves layouts that would otherwise need deeply nested Row and Column combinations.
Android's UI Layer: Displaying Data, Handling Events
The UI layer is what users see and touch. It displays app data on screen and sends user input like taps to your business logic. It's used in every screen, from login forms to media players.
Compose UI Testing: Find Nodes, Assert State, Perform Actions
Compose UI tests treat your UI as a node tree. You find nodes by properties (like text or a test tag), assert their state (e.g., 'is displayed'), and perform actions like clicks. Use it to verify composables react correctly to state changes or user input.
CompositionLocal: Implicitly Pass Data Down the UI Tree
CompositionLocal is like CSS inheritance for your UI tree, letting you pass data down implicitly without parameter drilling. It's ideal for ambient data like theming or localization. The footgun is overusing it, which makes components harder to test.
Get Jetpack compose bites daily.
Five a day, five minutes, offline. With quizzes so it sticks.
The iPhone app is on the way
We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.
Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.