Skip to content
tezvyn:
Menu

Lifecycle

49 bites tagged Lifecycle: interview questions with model answers, and 60-second explainers.

Test yourself: Top 30 Lifecycle interview questions →Multiple choice, with the correct answer and why it is correct on every question. Free, no sign-in.
React Native2 min read

Managing camera lifecycle in Vision Camera

Bind the isActive prop to screen focus via useIsFocused and to app state, so the camera stops when blurred or backgrounded.

React Native1 min read

Cancelling fetch with AbortController

Pass an AbortController signal to fetch and call abort() on unmount to avoid wasted work, race conditions, and state updates on gone components.

React Native1 min read

Gesture Responder System lifecycle

A single view becomes the responder for a touch; onStartShouldSetResponder claims it at touch start, onMoveShouldSetResponder claims it on movement, then grant, move, and release callbacks fire.

MLOps & Infrastructure1 min read

Stages of an end-to-end ML pipeline

Ingest, validate, preprocess and feature engineer, train, evaluate against a baseline, then register and package for deployment, with gates between stages.

Databases & Architecture1 min read

Pooled connection lifecycle and close() semantics

Borrow from pool, use, then close() returns it to the pool rather than tearing down the socket.

Cloud Platforms1 min read

Lifecycle storage tiering for compliance logs

Hot tier for 7-day query window, lifecycle rules transitioning to infrequent-access then archive, expiration at one year.

iOS & Swift1 min read

React to location authorization changed in Settings

Implement locationManagerDidChangeAuthorization, which fires on launch and whenever status changes, read authorizationStatus, and start updates when authorized.

iOS & Swift1 min read

Describe the iOS app lifecycle and SceneDelegate methods

Not running, inactive, active, background, suspended; SceneDelegate handles sceneDidBecomeActive, sceneWillResignActive, sceneDidEnterBackground, sceneWillEnterForeground.

Android & Kotlin2 min read

How does a ViewModel survive configuration changes and what is its scope?

The framework retains ViewModels in a store scoped to an Activity or Fragment across config changes, clearing them only when the owner finishes for good.

Android & Kotlin2 min read

What is the difference between a started service and a bound service?

Started services run until stopped via startService with no caller interface; bound services expose an IBinder and destroy when all clients unbind.

Vue, Angular & Svelte2 min read

Explain Svelte Action update and provide a reactive CSS example

Tests Svelte actions beyond initial mount. Strong answers explain update re-runs when parameters change, give a CSS custom properties example, and contrast with destroy. Red flag: suggesting the action re-runs from scratch or using reactive statements.

Vue, Angular & Svelte2 min read

What is a Svelte Action? Write a simple logging action.

Define a function receiving the node, log a message, and optionally return destroy.

Vue, Angular & Svelte2 min read

Fetch data on first render and manage loading and error states

Tests lifecycle awareness and separation of concerns. Strong answer: use mount hook (onMounted, ngOnInit, onMount), hold reactive data/loading/error states, and render conditional UI branches. Red flag: calling fetch directly in template or render function.

Vue, Angular & Svelte2 min read

Implement auto-cleanup reactive logic in Vue's Composition API and Svelte

Vue pairs onMounted with onUnmounted or watchEffect cleanup; Svelte uses $store auto-subscription or onDestroy.

Vue, Angular & Svelte2 min read

What is ngOnInit's purpose and why prefer it over the constructor?

Tests Angular lifecycle timing and input binding. Strong answer: ngOnInit runs once after inputs are initialized, but the constructor instantiates the class before bindings exist.

iOS & Swift2 min read

How do AppDelegate and SceneDelegate responsibilities differ?

AppDelegate owns process events (launch, push); SceneDelegate owns per-window lifecycle and UI.

iOS & Swift2 min read

UIViewController lifecycle states: network vs geometry updates

Tests UIViewController lifecycle states and separation of data vs layout. Strong answers list loadView to viewDidDisappear, start network in viewDidLoad or viewWillAppear, and geometry in viewDidLayoutSubviews. Red flag: network calls inside layout methods.

Flutter & Dart2 min read

Explain the lifecycle of a State object

List initState through dispose, emphasizing didUpdateWidget reacts to parent config changes.

Android & Kotlin2 min read

Explain cold, warm, and hot app startups and three cold-start optimizations

Cold means no process; warm means process lives but activity recreates; hot means activity resumes. Three fixes: lazy-load deps, trim Application.onCreate, defer blocking I/O.

Android & Kotlin2 min read

What is the difference between viewModelScope and lifecycleScope?

This tests scope ownership across configuration changes. viewModelScope survives rotation because it lives in ViewModel, while lifecycleScope dies with UI; use former for logic and latter for UI tasks. Never launch data loads in lifecycleScope.

Android & Kotlin1 min read

Explain Hilt scoping: @Singleton vs @ActivityRetainedScoped

Tests Hilt component lifecycles. Answer: @Singleton lives for the app process; @ActivityRetainedScoped survives config changes via ActivityRetainedComponent but dies when the activity finishes.

Android & Kotlin2 min read

How do you share a ViewModel across multiple Fragments?

Tests ViewModel scoping and Fragment communication. A strong answer names activityViewModels or navGraphViewModels, warns about Activity memory retention and hidden coupling, and suggests a parent Fragment or data flow alternative.

Android & Kotlin1 min read

What is a ViewModel and what lifecycle problem does it solve?

Tests config-change survival: ViewModel outlives Activity recreation so state survives rotation. Strong answer notes it holds non-serializable data and separates concerns, but does not survive process death.

Android & Kotlin2 min read

What happens to a bound service during config changes and multiple clients?

Tests bound service reference counting. Config change destroys the Activity binding; if no other clients exist, the service stops. Multiple clients keep it alive until the last unbind. Red flag: assuming the service survives config changes without a rebind.

Get Lifecycle 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.

Get it on Google PlayiPhone app coming soon