Android Architecture Interview Questions
MVVM, Clean Architecture, and data flow.
50 questions in this topic · 8 sample questions below
Practice Architecture in the quiz engine
Sample questions
In a strict MVI architecture, what is the defining constraint that most distinguishes it from MVVM?
Why: MVI centers on a single immutable state produced by reducing intents into new state, giving unidirectional flow. MVI is a pattern, not a library, so it never requires Redux or a global store.
Why is exposing a public MutableStateFlow from a ViewModel considered an antipattern?
Why: Publicly mutable state lets Views write to it, violating unidirectional flow and the single source of truth. MutableStateFlow is perfectly collectable from Compose; the problem is write access, not readability.
A screen must show a one-time snackbar when saving fails. Which approach most reliably delivers exactly-once without loss on configuration change?
Why: A Channel with receiveAsFlow buffers until collected and delivers once; alternatively events can be state the UI explicitly consumes. A replay=1 SharedFlow re-emits stale events to new collectors, causing duplicate snackbars after recreation.
Which statement about SharedFlow with replay set to 0 for one-off events is correct?
Why: SharedFlow with replay=0 and no extra buffer drops emissions when no collector is subscribed, so events during recreation can be lost. That is exactly why it is unreliable for one-off events compared to a Channel.
What is the purpose of the private MutableStateFlow plus public asStateFlow() idiom in a ViewModel?
Why: asStateFlow returns a read-only view so only the ViewModel can update the value, preserving unidirectional flow. It does not add lifecycle awareness or replay buffering.
SavedStateHandle in a ViewModel primarily protects against which scenario?
Why: A plain ViewModel already survives configuration changes; SavedStateHandle adds survival across system-initiated process death via the saved state bundle. It does nothing after an explicit force-stop, which clears saved state.
Why should collectAsStateWithLifecycle be preferred over collectAsState in Compose for UI state?
Why: collectAsStateWithLifecycle suspends collection when the UI is not at least STARTED, saving work and preventing background updates. Plain collectAsState keeps collecting even when the screen is not visible.
In stateIn with SharingStarted.WhileSubscribed(5000), what does the 5000 millisecond timeout accomplish?
Why: The timeout keeps the shared upstream alive briefly after the last collector unsubscribes, so a rotation does not tear down and restart the underlying work. It is not a debounce, delay, or retry interval.
Practice all 50 Architecture questions
These 8 are a sample. The full Architecture 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 Android Framework interview questions
- Android Kotlin Multiplatform interview questions
- Android WorkManager & Background interview questions
- Android Performance & Memory interview questions