# android & kotlin
// [54] real interview questions. Answers and sources live in the practice app.
practice this topic- Walk through the Activity lifecycle callbacks. What work belongs in each, and which ones are not guaranteed to run?(junior)
- When is onDestroy() called for an Activity without onPause() and onStop() being called first?(senior)
- Why must a Fragment have a public no-argument constructor, and how do you pass data to it correctly?(mid)
- What are onSaveInstanceState() and onRestoreInstanceState(), and how do they relate to ViewModel for surviving configuration changes and process death?(mid)
- What are Activity launch modes, and when would you actually use singleTask?(mid)
- What is a suspend function in Kotlin, and what is the difference between suspending and blocking?(mid)
- Explain coroutine Dispatchers: Main, IO, and Default. How do you pick, and how do you switch between them?(mid)
- What is the difference between launch and async in Kotlin coroutines, and when is async the wrong choice?(mid)
- Why did Android move from threads (Thread/Runnable) to coroutines? What concrete problems do coroutines solve?(mid)
- What is recomposition in Jetpack Compose? What triggers it, and how does Compose avoid re-running your whole UI?(mid)
- In Compose, what is the difference between remember and rememberSaveable, and when does each lose its value?(mid)
- Compare LaunchedEffect and DisposableEffect in Compose. What do the keys do, and what bug do wrong keys cause?(senior)
- Your app shows 'Application Not Responding' dialogs in production. What exactly triggers an ANR, and how do you diagnose and prevent them?(mid)
- Users say your app 'feels laggy' while scrolling. What causes jank on Android, and how do you find the actual bottleneck?(mid)
- What do ProGuard and R8 do in an Android build? Explain shrinking vs obfuscation vs optimization, and what keep rules are for.(mid)
- Memory leak vs OutOfMemoryError: how are they related, and how do you actually find leaks in an Android app?(mid)
- What is Context in Android? Explain application context vs activity context, and the classic context-related memory leak.(senior)
- What problem does ViewModel solve, and how does it survive configuration changes when the Activity doesn't?(mid)
- StateFlow vs LiveData for exposing UI state: how do they differ, and what is the setValue vs postValue distinction in LiveData?(senior)
- You must upload analytics data reliably, even if the user closes the app or reboots the phone. What are your background execution options, and how does WorkManager guarantee execution?(mid)
- Explain lateinit vs lazy in Kotlin. When is each appropriate, and what are their failure modes?(junior)
- What are sealed classes in Kotlin, and why are they the standard way to model UI state on Android?(junior)
- Toggling one checkbox recomposes your entire Compose screen. Explain stability: what makes a composable skippable, and how do you fix unstable parameters?(senior)
- A 'scroll to top' button that appears after the first list item makes your LazyColumn jittery. Why does reading scroll state cause a recomposition storm, and how do derivedStateOf and lambda modifiers fix it?(mid)
- Why do keys matter in a LazyColumn, and what breaks without them when the list reorders?(mid)
- You must upload a 300 MB video the user just recorded, continuing if they leave the app. WorkManager, a foreground service, or something else — and how do modern Android restrictions change the answer?(senior)
- QA rotates the phone and everything works, but users lose their half-filled form 'when coming back from the camera'. What's different, and how do you survive process death?(senior)
- What is a Baseline Profile, and why does shipping one make your app start faster on a user's first day?(mid)
- What Google Play policy and platform requirements can block a release even when your code is fine?(mid)
- Your single-module Android app takes 8 minutes to build. How does modularization help, what modules do you create, and what are the traps?(senior)
- Your team wants Kotlin Multiplatform 'to stop writing everything twice'. What do you actually share, what stays native, and when is KMP the wrong call?(senior)
- Deep links vs Android App Links — what's the difference, and your https link opens the browser instead of the app. What do you check?(mid)
- Your reminder app fires reliably in testing but 'randomly late' for real users. Explain Doze, App Standby, and OEM battery killers — and what a correct design looks like.(senior)
- Play Console flags your app for slow cold starts. What happens during a cold start, and where do the wins usually come from?(mid)
- What is an Android App Bundle, and how does it differ from shipping a fat APK?(junior)
- Why doesn't try/catch around launch { } catch the exception, and how do exceptions actually propagate through coroutines?(mid)
- Your Compose screen fetches data in a composable body and it re-fetches on every recomposition, then double-fetches on rotation. Where should the fetch live, and how do you tie it to the right scope?(senior)
- You collect a StateFlow with collectAsState() and the UI keeps updating while the app is in the background, wasting battery and sometimes crashing. What's wrong and what's the correct collection API?(mid)
- Explain the difference between a cold Flow, a hot StateFlow, and a SharedFlow, and how stateIn/shareIn convert between them. When does the wrong choice cause missed or duplicated events?(mid)
- What does Dagger/Hilt actually give you over just constructing objects yourself, and what is the real cost when a new engineer says 'this is just magic that slows builds'?(mid)
- Your app stores an auth token in SharedPreferences and a security review flags it. Walk through modern Android credential and data-at-rest storage, and the traps in each option.(senior)
- Room complains at compile time about a schema change crashing on existing installs. Explain Room migrations, why you can't just bump the version, and the fallbackToDestructiveMigration trap.(mid)
- A background BroadcastReceiver that used to react to CONNECTIVITY_CHANGE and start work no longer fires on modern Android. What changed across versions, and how do you rearchitect it?(senior)
- What are inline functions in Kotlin, why do higher-order functions benefit from inline, and what do noinline/crossinline exist to solve?(mid)
- Kotlin claims 'null safety', yet your app still throws NullPointerException in production. Where do NPEs still come from, and what do !!, platform types, and lateinit have to do with it?(junior)
- Product wants an in-app 'delete my account and data' flow and per-feature runtime consent. What Google Play and privacy requirements turn this from a nice-to-have into a release blocker, and how do you implement runtime permissions correctly?(senior)
- Why does the guidance say 'prefer DataStore over SharedPreferences' now? What actual problems does SharedPreferences have, and what's the migration nuance?(mid)
- A Compose animation and a scrolling list share a value and the screen stutters only on mid-range devices. Walk through Compose's three phases and how you'd move work to the cheapest phase.(senior)
- A user reports your app crashes only on Android 14 but works on Android 12. Before you can even reproduce it, what does targetSdkVersion vs compileSdkVersion vs minSdkVersion tell you about why version-specific crashes happen?(mid)
- In Kotlin coroutines, what is structured concurrency and coroutineScope, and how does it prevent the leaked-work bugs that plagued raw threads and GlobalScope?(mid)
- Your single-Activity Compose app loses the back stack and re-runs screen setup after the app returns from being killed in the background. What does Navigation Compose actually persist, and where do teams get state restoration wrong?(senior)
- A notification pops up from an app you haven't opened in days, on Android. Walk through what actually happened from the server to the notification appearing.(mid)
- Your phone keyboard predicts the next word before you type it and autocorrects as you go, all offline. How does on-device next-word prediction actually work?(mid)
- You update an app and only a few megabytes download instead of the whole app. How do app stores ship an update as a small patch instead of the full binary?(mid)