Mobile
Frontend for mobile: native iOS (Swift, SwiftUI) and Android (Kotlin, Compose), from app lifecycle to store release.
Preparation Q&A
Mobile fundamentals · 4
What are the main states of a mobile app lifecycle, and why do they matter?
Basic · 1ptExpected answer
Not running, foreground/active, background, suspended/stopped, terminated. The OS can pause or kill the app at any time, so save state and release resources when going to the background, and restore when coming back.
Why must long-running work never run on the main (UI) thread?
Basic · 1ptExpected answer
The main thread draws the UI and handles touches. Blocking it freezes the app, and the OS may kill it (ANR on Android, watchdog on iOS). Do network, disk and heavy work in the background and update the UI back on the main thread.
How do you handle an unreliable network in a mobile app?
Intermediate · 2ptExpected answer
Show loading, error and retry states; set timeouts; cache data locally so the app works offline; retry with backoff; queue writes and sync later; and handle a request finishing after the user has left the screen.
How do you release a mobile app safely, given users update slowly?
Advanced · 3ptExpected answer
Beta testing (TestFlight / internal testing tracks), phased or staged rollout, crash and analytics monitoring, feature flags to switch features off remotely, and keep the backend compatible with old app versions — optionally a forced-update check for critical fixes.
iOS · 7
What is an optional in Swift, and what are safe ways to unwrap it?
Basic · 1ptExpected answer
A value that may be
nil(String?). Unwrap withif let/guard let, optional chaining (a?.b), or??for a default. Avoid force unwrapping!because it crashes on nil.What is the difference between a struct and a class in Swift?
Basic · 1ptExpected answer
Structs are value types (copied on assignment, no inheritance); classes are reference types (shared instance, inheritance, deinit). Prefer structs for models; SwiftUI views are structs.
Explain `@State`, `@Binding` and `@Observable` / `@StateObject` in SwiftUI.
Intermediate · 2ptExpected answer
@Stateis simple local state owned by a view.@Bindinggives a child read-write access to a parent’s state.@Observable(orObservableObjectwith@StateObject/@ObservedObject) holds reference-type model state shared across views; the view owning it creates it once.How do you make a network request with async/await and update the UI safely?
Intermediate · 2ptExpected answer
Use
try await URLSession.shared.data(from:), decode withJSONDecoderinto aCodabletype, catch errors, and update UI state on the main actor (@MainActor). Start it from.task {}so it is cancelled when the view disappears.What is a retain cycle and how do you avoid one with closures?
Intermediate · 2ptExpected answer
Two objects hold strong references to each other, so neither is freed (memory leak). Common with closures capturing
self. Break it with[weak self](orunownedwhen the lifetime is guaranteed) andweakdelegates.What problems do actors and `@MainActor` solve in Swift concurrency?
Advanced · 3ptExpected answer
Actors protect their mutable state so only one task touches it at a time, preventing data races.
@MainActorguarantees code runs on the main thread, which UI updates require. The compiler enforces these rules (Sendable checking).Explain certificates, provisioning profiles and how an app gets onto TestFlight.
Advanced · 3ptExpected answer
A signing certificate proves the developer’s identity; a provisioning profile ties the app ID, certificate, devices and capabilities (entitlements) together. Archive with a distribution profile, upload to App Store Connect, then distribute to testers via TestFlight after processing (and beta review for external testers).
Android · 7
How does Kotlin handle null safety?
Basic · 1ptExpected answer
Types are non-null by default;
String?may be null. Use safe calls?., the Elvis operator?:for defaults, andlet.!!throws if null and should be avoided.What happens to an Activity on a configuration change such as rotation, and how do you keep data?
Basic · 1ptExpected answer
The Activity is destroyed and recreated. Keep UI state in a
ViewModel(survives configuration changes) and useSavedStateHandle/rememberSaveablefor state that must survive process death.What is recomposition in Jetpack Compose, and why hoist state?
Intermediate · 2ptExpected answer
When state read by a composable changes, Compose re-runs that composable to update the UI. Hoisting moves state up to the caller so composables are stateless, reusable and testable, with one source of truth (state down, events up).
Describe MVVM on Android: what belongs in the ViewModel and what in the repository?
Intermediate · 2ptExpected answer
The UI observes state from the ViewModel and sends it events; the ViewModel holds UI state (e.g.
StateFlow) and logic, and survives configuration changes. The repository owns data access (network, Room database) and hides where data comes from.What is structured concurrency with coroutines, and why use `viewModelScope`?
Intermediate · 2ptExpected answer
Coroutines are started in a scope and are cancelled with it, so work never outlives its owner.
viewModelScopecancels its coroutines when the ViewModel is cleared, preventing leaks and wasted work. UseDispatchers.IOfor blocking I/O.Explain cold vs hot flows, and the difference between `StateFlow` and `SharedFlow`.
Advanced · 3ptExpected answer
A cold
Flowstarts producing for each collector when collected; a hot flow emits regardless of collectors.StateFlowalways has a current value and replays the latest to new collectors (UI state).SharedFlowcan have no value and configurable replay (one-off events).How do you sign and release an app on Google Play, and how does a staged rollout help?
Advanced · 3ptExpected answer
Build an Android App Bundle (AAB) signed with the upload key (Play App Signing holds the app signing key), bump
versionCode, upload to a testing track, then production. A staged rollout releases to a percentage of users first so crashes can be caught and the rollout halted.