Netflix Entry-Level Mobile Developer Interview Preparation Guide
Netflix's entry-level mobile developer interview process evaluates fundamental mobile development skills, problem-solving ability, platform-specific knowledge, and cultural fit. The process begins with a recruiter screening, followed by a technical phone screen combining live coding and basic design thinking, and concludes with four onsite interviews focusing on mobile coding challenges, API integration scenarios, system design fundamentals for mobile applications, and behavioral assessment aligned with Netflix's 'Freedom & Responsibility' culture.
Interview Rounds
Recruiter Screening
What to Expect
Initial conversation with Netflix recruiter to assess background, motivation, and fit. This round combines both the initial recruiter screen and potential recruiter follow-up call. The recruiter will review your resume, discuss your mobile development experience, clarify your familiarity with iOS, Android, or cross-platform frameworks, and confirm you understand the role and Netflix's culture. For entry-level candidates, they assess coachability, eagerness to learn new platforms or tools, and general communication skills.
Tips & Advice
Be authentic about your experience level—entry-level candidates are expected to have foundational knowledge, not mastery. Clearly articulate which mobile platform(s) you're strongest in and express genuine interest in learning others if needed. Research Netflix's mobile app and mention specific features you admire (e.g., offline download capability, personalization on smaller screens). Ask thoughtful questions about the team structure and what success looks like in the first 90 days. Avoid overstating your expertise; honesty about gaps demonstrates maturity.
Focus Topics
Learning Agility and Adaptability
Share a specific example where you learned a new mobile platform, framework, or tool quickly (e.g., transitioning from Android to Flutter, learning SwiftUI). Emphasize how you approached unfamiliar challenges.
Practice Interview
Study Questions
Understanding of Netflix's Business and Mobile Experience
Demonstrate familiarity with Netflix's streaming service, mobile app features (playback, offline downloads, personalized recommendations), and why mobile is critical to Netflix's business.
Practice Interview
Study Questions
Motivation for Netflix and Specific Role Fit
Articulate why you're interested in Netflix specifically and why mobile development excites you. Connect your goals to Netflix's scale and innovation in streaming.
Practice Interview
Study Questions
Mobile Development Background and Experience
Clearly communicate your hands-on experience with iOS (Swift/Objective-C), Android (Kotlin/Java), or cross-platform frameworks (React Native/Flutter). Prepare to discuss 2-3 mobile projects you've built, their complexity, and what you learned.
Practice Interview
Study Questions
Technical Phone Screen
What to Expect
Remote technical assessment combining a live coding exercise with a brief mobile design discussion. You'll be given a mobile development challenge (e.g., build a simple feed component, implement caching for API responses, or handle asynchronous operations). The interviewer assesses code clarity, problem-solving approach, and ability to communicate your thought process. This round typically lasts 60 minutes: ~45 minutes coding, ~15 minutes for design discussion or follow-up questions.
Tips & Advice
Choose your strongest mobile platform and language for this round—communicate this preference when scheduling. Think aloud as you solve; interviewers value understanding your reasoning more than silence followed by a perfect solution. Ask clarifying questions about requirements (e.g., 'Should this component support landscape rotation?' or 'What's the expected data volume?'). Write clean, readable code with meaningful variable names and comments. If you get stuck, explain your approach, acknowledge the challenge, and ask for hints—entry-level candidates aren't expected to solve everything perfectly. After coding, be ready to discuss trade-offs (e.g., performance vs. memory, offline-first vs. always-online).
Focus Topics
Mobile UI Development and Layout
Ability to create responsive layouts that work across device sizes. Understanding of constraints, auto-layout (iOS) or layout managers (Android), and basic mobile UX principles like safe areas and gestures.
Practice Interview
Study Questions
Algorithm and Data Structure Basics
Comfort with common algorithms (searching, sorting, traversal) and data structures (arrays, dictionaries, linked lists, queues, stacks). Problems typically relate to mobile scenarios (e.g., filtering a user list, caching strategy).
Practice Interview
Study Questions
Debugging and Problem-Solving Approach
Ability to debug using platform-native tools (Xcode, Android Studio), read logs, set breakpoints, and systematically isolate issues. Comfort reasoning about why code might fail.
Practice Interview
Study Questions
Core Mobile Development Fundamentals
Solid grasp of iOS (Swift, UIKit/SwiftUI, lifecycle) OR Android (Kotlin, Activities/Fragments, lifecycle) fundamentals. Understand async programming (callbacks, promises, coroutines), state management, and basic memory management concepts.
Practice Interview
Study Questions
API Integration and Asynchronous Data Handling
Practical experience making network requests, parsing JSON/XML, handling errors, and managing asynchronous responses. Familiarity with popular networking libraries (URLSession, Retrofit, Axios, fetch API).
Practice Interview
Study Questions
Onsite Interview Round 1: Mobile Coding Challenge
What to Expect
First of four onsite rounds. Focused on mobile-specific coding problem under time pressure (~90 minutes). You'll implement a feature or solve a mobile development problem (e.g., build a paginated feed, implement a search with debouncing, handle offline sync). Interviewer assesses code quality, architectural thinking, and ability to handle mobile-specific concerns like lifecycle, background execution, or memory constraints. This round emphasizes clean code, edge-case handling, and communication of your approach.
Tips & Advice
Before you start coding, spend 5-10 minutes asking clarifying questions and outlining your approach on a whiteboard or shared doc. For entry-level, interviewers expect you to demonstrate understanding of the problem before diving in. Write modular, testable code—show you can break problems into smaller pieces. Handle error cases explicitly (null checks, network timeouts, permission denials). If you run out of time, articulate what you'd do next rather than leaving code incomplete. After coding, be ready to discuss optimizations or trade-offs (e.g., 'This currently loads all data in memory; for large datasets, I'd implement pagination or lazy loading'). Show your work on a mobile device or emulator if possible to demonstrate the solution in action.
Focus Topics
Testing and Code Quality Practices
Familiarity with unit testing frameworks (XCTest, JUnit, Jest), writing testable code with dependency injection, and understanding why some code is harder to test. Basic knowledge of mocking and stubbing for API calls.
Practice Interview
Study Questions
Responsive and Adaptive UI Implementation
Hands-on experience building layouts that adapt to different screen sizes, orientations, and safe areas. Knowledge of tools like constraint-based layout, stack views, or responsive design patterns.
Practice Interview
Study Questions
Mobile Performance Optimization: Rendering and Memory
Ability to identify and resolve common mobile performance issues: excessive layout re-renders, memory leaks, battery drain from background tasks. Familiarity with profiling tools (Instruments on iOS, Android Profiler) and best practices.
Practice Interview
Study Questions
Platform-Specific Lifecycle and State Management
Deep understanding of your chosen platform's lifecycle (iOS: View Controller lifecycle, app delegate, scene delegate; Android: Activity lifecycle, Fragment lifecycle, ViewModel). Knowledge of how to preserve state across configuration changes and background suspension.
Practice Interview
Study Questions
Networking and Data Persistence in Mobile Apps
Experience with REST APIs, JSON parsing, caching strategies (in-memory, local storage), and handling network failures gracefully. Understanding of when to use local databases (SQLite, Realm, Core Data) vs. in-memory caches.
Practice Interview
Study Questions
Onsite Interview Round 2: Mobile Development Problem Solving
What to Expect
Second coding round with a different interviewer. This round focuses on real-world mobile development scenarios and architectural decisions. You might tackle problems like: implementing an offline-first architecture, handling complex animations, managing concurrent API requests, or implementing deep linking. This round assesses your ability to think beyond simple CRUD operations and consider production-grade concerns. Interviewers evaluate code structure, design patterns, and pragmatic trade-offs.
Tips & Advice
This round often includes more ambiguity—the problem statement may be vague, and you'll need to clarify requirements and propose a reasonable scope. Show your thought process explicitly: 'I could approach this with pattern X or Y; here are the trade-offs.' For entry-level, don't hesitate to acknowledge knowledge gaps ('I haven't used this library, but here's how I'd research it') and propose solutions anyway. Discuss alternative approaches if time allows—this demonstrates flexibility and learning mindset. If the problem touches an unfamiliar domain (e.g., AR, geolocation), ask for guidance and show you can learn quickly. Connect your solution to Netflix's scale and challenges ('This pattern would help us handle millions of concurrent downloads').
Focus Topics
Dependency Injection and Testability
Understanding of why injecting dependencies (services, repositories, API clients) improves testability and flexibility. Practical use of DI frameworks or manual injection patterns.
Practice Interview
Study Questions
Mobile Security Fundamentals
Basic security awareness: secure credential storage (Keychain, Keystore), HTTPS enforcement, certificate pinning, input validation, and why storing sensitive data in SharedPreferences/UserDefaults is risky.
Practice Interview
Study Questions
Concurrency and Multithreading in Mobile
Practical knowledge of threading models (iOS: GCD, Operation queues; Android: Coroutines, Threads). Understanding of main thread vs. background threads, race conditions, deadlocks, and thread-safe operations.
Practice Interview
Study Questions
Architectural Patterns for Mobile Apps (MVVM, MVP, MVI, Clean Architecture)
Familiarity with at least one architectural pattern and why it helps testability, separation of concerns, and maintainability. Entry-level understanding: pattern basics, not deep expertise.
Practice Interview
Study Questions
Offline-First and Sync Architecture Patterns
Understanding of offline-first design: local-first operations, conflict resolution, eventual consistency, and sync strategies. Familiarity with patterns like background sync, retry logic, and progress tracking for large uploads/downloads.
Practice Interview
Study Questions
Onsite Interview Round 3: Mobile Systems Design and Architecture
What to Expect
This round introduces system design thinking adapted for mobile platforms. Rather than distributed systems at enterprise scale, the focus is on mobile app architecture. You might design a feature like a video recommendations feed, an offline download manager, a push notification system, or a data sync service for mobile. You'll discuss API contracts, local data storage strategy, caching layers, performance constraints, and offline behavior. The interviewer probes your ability to balance functionality, performance, battery life, and data usage. For entry-level candidates, the focus is on foundational design thinking, not sophisticated distributed systems architecture.
Tips & Advice
Start by clarifying requirements and constraints specific to mobile: 'How much data can we store locally? What's the expected battery impact? Should this work offline?' Sketch your design on a whiteboard or shared doc—boxes for components, arrows for data flow. Discuss the choice between online-first vs. offline-first, caching strategies (in-memory, disk), and how you'd handle state synchronization. For entry-level, you're not expected to design Netflix-scale infrastructure, but you should reason about trade-offs intelligently. If you don't know a specific technology (e.g., 'I haven't used Firebase'), propose a solution anyway and explain how you'd evaluate tools. Be concrete: 'I'd use CoreData on iOS because it integrates well with SwiftUI and provides change notifications,' not vague: 'I'd store data locally.' Acknowledge limitations: 'This approach works for 10k items; for millions, we'd need pagination or a server-side solution.'
Focus Topics
Scalability and User Growth Considerations
At entry-level: basic awareness of how mobile design choices scale with user growth and data volume. Understanding of when to move from simple solutions to more complex architectures (e.g., from in-memory cache to database, from polling to real-time subscriptions).
Practice Interview
Study Questions
Performance and Resource Constraints in Mobile Design
Considering mobile constraints: battery life, bandwidth, CPU, memory, and thermal limits. Discussing impact of design choices on these metrics (e.g., frequent background sync drains battery; large images drain bandwidth).
Practice Interview
Study Questions
Offline-First Design and Synchronization Logic
Designing systems that work offline and sync when connectivity returns. Discussing conflict resolution, retry strategies, and user feedback for pending operations.
Practice Interview
Study Questions
Local Data Storage and Caching Strategy
Evaluating options for persisting data on device (in-memory cache, file system, SQLite/Core Data/Realm, encrypted storage). Discussing cache invalidation, expiration, and conflicts between local and server state.
Practice Interview
Study Questions
Mobile App Architecture: Frontend and Backend Interaction
Designing the contract between mobile client and backend APIs. Understanding of REST principles, API versioning, request/response payloads, error handling, and how design decisions at API level impact mobile implementation.
Practice Interview
Study Questions
Onsite Interview Round 4: Culture Fit and Behavioral
What to Expect
Final onsite round assessing alignment with Netflix's core values: 'Freedom & Responsibility,' bias for action, continuous improvement, and collaboration. The interviewer uses behavioral questions (often STAR-formatted) to understand your work style, how you handle ambiguity, your learning agility, and how you've navigated challenges. For entry-level candidates, the focus is on demonstrating coachability, ownership of problems (even small ones), learning from mistakes, and communication with peers. This round often includes questions about your biggest learning, a time you failed, and how you've contributed to team velocity.
Tips & Advice
Prepare 3-4 concrete stories using the STAR format that showcase your learning, ownership, and collaboration. For entry-level, stories don't need to be massive projects; even small wins (e.g., 'I refactored a feature to improve test coverage,' 'I debugged a tricky device-specific issue') demonstrate the right mindset. Emphasize the learning: 'I didn't know X, so I researched and built it.' Show how you've asked for help appropriately and acted on feedback. When asked about weaknesses, be honest about an area you're growing ('I'm still building expertise in low-level memory management') and show concrete steps you're taking ('I've been reading blog posts and experimenting with Instruments'). Avoid canned responses; interviewers value authenticity. Ask thoughtful questions about the team's culture and expectations for remote/async work. Close with genuine enthusiasm for Netflix's mission and the role.
Focus Topics
Resilience and Learning from Failures
A story where you failed or encountered a significant setback (e.g., shipping a bug, a feature didn't perform as expected, a design choice had unintended consequences). Focus on what you learned, how you adapted, and what you'd do differently.
Practice Interview
Study Questions
Handling Ambiguity and Bias for Action
Stories showing that you don't wait for perfect information before moving forward. Examples of making pragmatic decisions with incomplete context, proposing solutions, and iterating based on feedback.
Practice Interview
Study Questions
Collaboration and Communication with Peers
Examples of working effectively with teammates, communicating progress clearly, asking for help appropriately, and giving/receiving feedback. For entry-level: stories about code reviews, pair programming, or working within a team structure.
Practice Interview
Study Questions
Ownership and Accountability on Technical Challenges
Demonstrating that you take ownership of problems, see them through to resolution, and don't make excuses. Stories showing: tackling bugs independently, taking responsibility for mistakes, and following up on issues even after initial fix.
Practice Interview
Study Questions
Learning Agility and Growth Mindset
Concrete examples of learning new technologies, platforms, or approaches quickly. Stories showing: encountering unfamiliar problems, researching solutions, implementing them, and reflecting on what you learned.
Practice Interview
Study Questions
Frequently Asked Mobile Developer Interview Questions
Compare Android Keystore and iOS Keychain for securely storing small secrets such as API tokens. Discuss usage patterns, hardware-backed keys, biometric protection options, limitations such as backup behavior, and how you would design token storage for a cross-platform app.
Sample Answer
Brief comparison
- Android Keystore: stores keys (asymmetric/symmetric) non-exportable, backed by Keymaster; optional StrongBox on supported devices. Use via Jetpack Security (EncryptedSharedPreferences / MasterKey).
- iOS Keychain: stores items (data) with fine-grained accessibility attributes; keys can be backed by Secure Enclave (private keys non-exportable) and synced via iCloud Keychain if allowed.
Usage patterns
- Android: generate a MasterKey in Keystore, encrypt tokens with AES-GCM and store ciphertext in EncryptedSharedPreferences or SQLite.
- iOS: store token data directly in Keychain with kSecAttrAccessible... flags (e.g., WhenPasscodeSetThisDeviceOnly) or wrap with a Secure Enclave key.
Hardware-backed & biometrics
- Android: hardware-backed when Keymaster/StrongBox available. Biometric gating via BiometricPrompt + setUserAuthenticationRequired/userAuthenticationValidityDuration on key.
- iOS: Secure Enclave for keys; biometric access control via kSecAccessControlCreateWithFlags with .biometryCurrentSet / .devicePasscode for Touch/Face ID (LAContext).
Limitations / backups
- iOS: Keychain items marked as non-synchronizable and device-only (ThisDeviceOnly) are not backed up or synced; default Keychain items may be included in encrypted iCloud backups or iCloud Keychain sync.
- Android: Keystore keys are tied to device/user and typically not included in backups. Auto Backup may include encrypted ciphertext if you store it in files; MasterKey marked for device-only prevents restore—be explicit. StrongBox keys survive less often across factory resets.
Design for cross-platform app
- Principle: store short-lived access tokens encrypted on device; keep long-lived refresh tokens server-side when possible.
- Use platform idiomatic secure storage:
- Android: Jetpack Security (MasterKey + EncryptedSharedPreferences).
- iOS: Keychain with kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly and kSecAttrSynchronizable=false.
- For biometric-protected tokens: store ciphertext encrypted with a keystore/keychain key requiring user auth; prompt BiometricPrompt/LAContext to unlock before use.
- Handle backups/migration: treat device-only keys as non-backup; implement refresh flow so tokens can be reissued after restore. Provide explicit account re-authentication path.
- Fallbacks: detect hardware support; if unavailable, use OS-backed but user-passcode protected key and shorter lifetimes.
This approach balances usability, platform capabilities, and safety: non-exportable keys, biometric gating when needed, and server-side refresh to minimize exposure.
An app that runs on user devices needs a feature that calls a vendor API requiring a secret key. How do you avoid shipping that key in the client while still delivering the feature, and what do you do if the key leaks?
Sample Answer
The idea in plain words
Anything shipped inside an app on a user's device can be extracted by that user: strings, obfuscated or not, can be read from the binary or seen by watching the app's network traffic. So a secret key must not be in the client. The feature is delivered by moving the secret-holding call to a server you control: the app calls your backend, your backend attaches the key and calls the vendor.
The approach
-
Add a backend endpoint (a thin proxy: a small server-side relay that forwards one kind of request on the app's behalf) for just this feature. The app calls
POST /v1/translateon your server; the server adds the vendor key from its secret store (the protected place the server reads its secrets from, such as environment variables injected at deploy time or a vault) and calls the vendor. The key never leaves the server.An illustrative exchange, with an invented vendor host and parameter names, showing where the key sits. The app sends no vendor key, only the user's own session token:
POST /v1/translate HTTP/1.1 Host: api.yourapp.example Authorization: Bearer <user session token> Content-Type: application/json {"text": "Good morning", "target": "fr"}Your server checks the session, applies its limits, then makes its own call to the vendor, where the secret is added:
POST /translate HTTP/1.1 Host: api.vendor.example Authorization: Bearer <VENDOR_SECRET_KEY, read from the server's secret store> Content-Type: application/json {"text": "Good morning", "target": "fr", "model": "fixed-on-the-server"}The vendor's reply is passed back to the app as
200 OKwith only the field the app needs, such as{"translation": "Bonjour"}. TheAuthorizationheader with the secret exists only on the second hop. -
Authenticate the app's caller to your backend, using the user's session or token, so only signed-in users can spend your quota. Where available, add app attestation (a platform service that gives your server evidence the request comes from a genuine, unmodified app install); treat it as a signal that raises the cost of abuse, not as proof.
-
Do not make the proxy a generic pipe. Expose only the operations the feature needs, validate and size-limit inputs, fix the vendor model or parameters on the server, and strip what the vendor does not need. An open relay (a proxy that forwards whatever it is given, to wherever it is told) lets anyone use your key through your server.
-
Rate-limit and budget per user and per device (and in total), since the vendor charges you. Return 429 with Retry-After when exceeded: 429 is the HTTP status code for Too Many Requests, and the
Retry-Afterheader tells the client how many seconds to wait before trying again. Illustratively, a user who has used 100 of 100 daily calls, with 18,000 seconds (5 hours) left in the window, getsHTTP/1.1 429 Too Many RequestswithRetry-After: 18000and a short JSON body saying the daily limit was reached. -
Prefer vendor-issued short-lived, scoped client tokens if the vendor offers them: your server mints a scoped client token (one limited to named operations, for example translate only, so a stolen copy can do little) valid for minutes, and the app talks to the vendor directly with it. This keeps heavy traffic (for example uploads) off your servers. The long-lived secret stays on the server.
-
Check whether the key is meant to be public. Some vendors issue a restricted "publishable" key that is safe in a client because it can do only limited things (and can be restricted by app identity or domain). A secret key that can create charges or read data is not that.
Worked scenario (assumed numbers)
Assume the vendor bills per call and a normal user makes about 20 calls a day. A per-user cap of 100 calls a day is 5 times normal use (100 / 20 = 5): generous for real users, and a stolen account can cost at most 100 calls a day. Without a cap, one script using the leaked key is bounded only by the vendor's own limits.
If the key leaks
- Rotate: create a new key at the vendor and deploy it to the server. Because the app never held the key, no app update is needed and old app versions keep working. That is the main operational payoff of the proxy.
- Revoke the old key at the vendor as soon as the new one is live (or immediately if abuse is under way, accepting a short outage).
- Review vendor usage logs and billing for the exposure window; ask the vendor to credit fraudulent usage if their terms allow.
- Find the leak path (repository history, logs, a build artifact, a crash report) and fix it; scan history for other secrets.
- Add detection: alerts on spend or request spikes, and secret scanning in CI.
If the design had embedded the key in the app, rotation would require shipping a new app version and waiting for users to update, while the old key stays valid until you revoke it and break every old install. That asymmetry is the reason to take the proxy route.
Trade-offs
The proxy adds a hop (latency, a service to run and scale) and makes your server a rate-limit and cost control point. For low volume this is trivial; for heavy payloads, short-lived tokens avoid proxying the bytes.
Common mistakes
- Believing obfuscation or splitting the key into pieces protects it. It slows casual reading only.
- Authenticating the proxy with another static secret in the app, which moves the problem.
- A proxy that forwards arbitrary vendor paths.
- No per-user limits.
Give me an example of a time you received tough feedback or criticism right after something went wrong operationally, like after an outage. How did you manage your reaction in the moment, and what did you do afterward to rebuild trust?
Sample Answer
Direct answer
In the moment, my first job is to actually listen to the criticism rather than start explaining or defending myself before I've fully heard it, even when the instinct to justify is strong. Afterward, rebuilding trust isn't about the conversation where I received the feedback, it's about visibly acting differently going forward in the specific way the feedback pointed at.
Structured elaboration
- Managing the reaction in the moment: the instinct right after an outage, already stressed, is to explain the context and mitigating factors as soon as criticism starts. I've learned to let the person finish first, genuinely hear the specific complaint, and only then respond, since jumping in early to explain often lands as defensiveness even when that isn't the intent.
- Separating the valid signal from the delivery: tough feedback right after an outage often arrives with real frustration attached. The useful move is extracting the actual substance, what specifically should have gone differently, rather than reacting to the tone it arrived in.
- Not over-apologizing either: there's a version of managing the reaction that overcorrects into excessive self-criticism, which doesn't address the substance any better than defensiveness does; the goal is a level, accurate acknowledgment, not performing contrition.
- Rebuilding trust afterward: the actual trust repair happens in what changes afterward, doing the specific thing the feedback pointed at differently next time, not in how gracefully the original conversation went.
Worked example
Right after an outage I'd contributed to, my manager gave me direct, pointed feedback in a one-on-one: that I'd been slow to escalate once it became clear I was stuck, and that the delay had made the outage longer than it needed to be. My first instinct was to explain the reasoning that had made sense to me in the moment, that I'd thought I was close to a fix. I held off on that and let them finish first, and once I actually listened past my own defensiveness, the specific point was fair: I had, in fact, kept trying alone for longer than made sense given how the situation was unfolding.
I acknowledged the specific point directly rather than the vaguer "I hear you, I'll do better," and said what I'd concretely do differently: escalate earlier next time I'm stuck past a set point, rather than continuing to push alone. The actual trust rebuilding happened over the incidents that followed, not in that conversation. In the very next incident where I got stuck, I escalated well before I would have previously, and I made a point of telling my manager afterward that I'd deliberately applied the earlier feedback, which is what actually closed the loop for them, seeing the specific behavior change rather than just hearing that I'd taken the feedback well.
Trade-offs and pitfalls
The common failure mode is treating receiving feedback well as the whole task, being gracious and non-defensive in that one conversation and considering it handled. Without a visible change in behavior afterward, gracious listening reads as agreeable in the moment and forgotten a week later, which damages trust more than a defensive reaction followed by real change would. The other trap is swinging to excessive self-criticism, which can feel like taking it seriously but doesn't actually engage with the specific, actionable substance of the feedback any better than dismissing it does.
On iOS, describe how to use BGTaskScheduler to schedule background processing that saves state or completes work when the app is backgrounded or terminated. Explain expiration handling, scheduling constraints, and how to coordinate BGTask with state restoration and user-visible notifications.
Sample Answer
Brief approach
Describe registration, scheduling, handling the task when launched, expiration handling, constraints, rescheduling, and coordinating with state restoration and user notifications.
Register & schedule
- Add identifiers to Info.plist under BGTaskSchedulerPermittedIdentifiers.
- Register at app launch (didFinishLaunching):
import BackgroundTasks
BGTaskScheduler.shared.register(forTaskWithIdentifier: "com.example.app.process", using: nil) { task in
self.handleBackgroundProcessing(task: task as! BGProcessingTask)
}
- Schedule a processing task (e.g., after important work completes):
let req = BGProcessingTaskRequest(identifier: "com.example.app.process")
req.requiresNetworkConnectivity = true // constraint
req.requiresExternalPower = false
req.earliestBeginDate = Date().addingTimeInterval(15*60) // 15m
try? BGTaskScheduler.shared.submit(req)
Handle the task & expiration
- In handler, start work on a background queue, restore minimal state, begin cancellable work, and set task.expirationHandler to cancel/clean up and persist state.
func handleBackgroundProcessing(task: BGProcessingTask) {
let operation = MyLongRunningOperation()
task.expirationHandler = {
operation.cancel()
saveMinimalState()
task.setTaskCompleted(success: false)
}
operation.completionBlock = {
saveFinalState()
task.setTaskCompleted(success: !operation.isCancelled)
scheduleNextProcessing()
}
OperationQueue().addOperation(operation)
}
Key points:
- Always call task.setTaskCompleted(success:).
- Use expirationHandler to persist minimal state and stop work promptly.
- Keep work idempotent and resumable (store checkpoints in file/CoreData/Keychain).
Scheduling constraints & best practices
- BGProcessingTask is for CPU/network-heavy work and may run when app terminated; BGAppRefreshTask is for short refreshes.
- Use requiresNetworkConnectivity/requiresExternalPower and earliestBeginDate.
- System decides runtime; treat scheduling as opportunistic — don’t rely on strict timing.
- Reschedule each time task runs to keep eligibility.
State restoration coordination
- Persist checkpoints frequently (atomic writes).
- On next app launch or BG task run, read checkpoints and resume.
- Use lightweight state restoration APIs for UI when user re-opens app; don’t block BG tasks for UI restoration.
User-visible notifications
- If task failure impacts user, post a local notification after graceful shutdown (request permission earlier).
- Avoid spamming; aggregate state changes and only notify for important outcomes.
This demonstrates safe, resumable background processing with correct expiration handling, constraints, state persistence, and user communication.
List and compare the primary client-side storage options available on iOS and Android (e.g., UserDefaults / SharedPreferences, NSCache, SQLite / Core Data / Realm / Room, file storage, keychain/keystore). For each option describe: typical use cases, durability guarantees, performance characteristics, size limits, and security trade-offs. Provide decision criteria for choosing one over another.
Sample Answer
Overview
Below are primary client-side storage options on iOS and Android with use cases, durability, performance, size and security trade‑offs, plus decision criteria.
UserDefaults / SharedPreferences
- Typical use: small app settings, flags, lightweight preferences.
- Durability: persisted to disk; survives restarts and backups (may be cleared on uninstall).
- Performance: very fast for small payloads; synchronous API can block UI if abused.
- Size: intended for < few KB; not for large blobs.
- Security: plaintext; use keychain/keystore for secrets.
NSCache / In-memory cache
- Typical use: transient in-memory caches (images, computed data).
- Durability: not durable; can be evicted anytime (memory pressure).
- Performance: fastest (RAM).
- Size: limited by memory and system eviction.
- Security: in-memory only; still accessible if device compromised.
File storage (Documents/Files / internal storage)
- Typical use: larger blobs, downloaded files, logs, exported data.
- Durability: persistent, included/excluded from backups depending on location.
- Performance: depends on file size and I/O patterns; use streaming for large files.
- Size: limited by device storage; consider quotas.
- Security: plaintext unless encrypted; use file protection APIs (iOS) or encrypted file APIs.
SQLite / Core Data / Room
- Typical use: structured relational data, complex queries, indexing.
- Durability: durable on disk, transactional.
- Performance: good for structured queries; indexing improves reads; writes can block without background threading.
- Size: scales to many MBs/GBs as device permits.
- Security: plaintext DB by default; can use SQLCipher or platform file encryption.
Core Data (Apple) specifics
- Higher-level ORM, object graph, change tracking; good for complex models and performance tuning.
Realm
- Typical use: reactive, object-oriented local DB with simpler APIs.
- Durability: durable, ACID.
- Performance: high read/write performance, built for mobile.
- Size: similar to SQLite; depends on data.
- Security: supports encryption; must manage keys securely.
Keychain / Keystore
- Typical use: small secrets, tokens, credentials.
- Durability: persistent and survives app reinstalls if properly configured; protected by device security.
- Performance: slower (secure enclave access), designed for small items.
- Size: small items (credentials, keys).
- Security: highest on device; hardware-backed where available.
Decision criteria
- Secrets → Keychain/Keystore.
- Tiny config/flags → UserDefaults/SharedPreferences.
- Transient cache → NSCache / in-memory.
- Structured relational data/complex queries → SQLite/Room/Core Data.
- Object-oriented, reactive DB → Realm.
- Large files/blobs → File storage (consider streaming, encryption).
- Need encryption/compliance → use encryption at rest (SQLCipher/File encryption) + secure key storage in Keychain/Keystore.
- Consider performance: prefer in-memory for hot reads, asynchronous DB I/O for writes, index DBs for queries.
Choose by data size, access patterns (read-heavy vs write-heavy), durability needs, security/compliance, and complexity of queries/relationships.
For a mobile app that streams large media concurrently and performs background processing, design an architecture to prevent UI jank, avoid memory leaks, and be battery efficient. Address thread pool sizing, scheduling background work (iOS background tasks and Android WorkManager), lifecycle-aware cancellation, segmenting large buffers, and cache eviction strategies.
Sample Answer
Clarify goals
Prevent UI jank, avoid memory leaks, and be battery efficient while streaming large media and doing background processing on iOS and Android.
High-level architecture
- Separate layers: UI thread (main) → Playback & rendering pipeline (media APIs) → Worker pool for network/IO & CPU tasks → Disk-backed segmented cache → Scheduler (platform background APIs).
- Use platform media players (AVPlayer/ExoPlayer) for efficient decoding; do heavy parsing/analysis off-main.
Thread-pool sizing
- CPU-bound tasks: thread count = max(1, cores - 1) to keep main responsive.
- I/O-bound tasks (network, disk): thread count = min( 2 * cores, 16 ). Use async IO where possible (URLSession/OkHttp async, Kotlin coroutines with Dispatcher.IO).
- Use separate pools for short-lived tasks vs long-running jobs to avoid starvation.
Scheduling background work
- iOS: BGProcessingTask / BGAppRefresh for deferred processing; register tasks with identifiers, request expiration handlers and respect background time. Use background URLSession for uploads/downloads.
- Android: WorkManager with constraints (NetworkType.UNMETERED, BatteryNotLow). Use setExpedited for urgent short work; use foreground service with notification for long streams.
Lifecycle-aware cancellation
- Android: tie coroutines to LifecycleScope/ViewModelScope; cancel jobs in onCleared/onStop as appropriate. Use WorkManager cancellation APIs for scheduled work.
- iOS: use Combine/async-await Tasks tied to view controllers or use OperationQueue with Operation.isCancelled checks; cancel BG tasks on expiration and when UI no longer needs results.
- Always check cancellation points inside heavy loops and release references.
Segmenting large buffers
- Stream into fixed-size segments (e.g., 256KB–2MB) to avoid large contiguous allocations.
- Use pooled ByteBuffer / Data buffers with reuse; on Android use ByteBuffer pool, on iOS reuse Data via NSMutableData or use mmap for disk-backed segments.
- Keep only needed segments in memory; load ahead minimally (adaptive prefetch based on playback rate and network).
Cache & eviction strategy
- Disk-first cache with index + segment files; in-memory LRU for hot segments.
- Eviction: size-based + age-based + access-frequency (LRU with TTL). E.g., memory cap = X MB (per-device class), disk cap = Y GB.
- Persist metadata to quickly reconstruct cache on restart.
- Evict low-priority content first; avoid synchronous deletions on main thread.
Battery & network efficiency
- Batch background work, respect Doze/Low Power modes, prefer Wi‑Fi or unmetered constraints.
- Backoff retry with exponential jitter; use TCP keepalive and reuse connections (HTTP/2).
- Use platform power APIs: Android JobScheduler/WorkManager constraints, iOS background tasks scheduling windows.
Observability & safety
- Instrument metrics: task queue depth, cache hit rate, memory pressure, idle/busy threads.
- Use strict ownership patterns, weak refs for UI callbacks, and automated leak detection (Memory Profiler, Instruments).
This design keeps UI work on main only, limits threads to optimal counts, uses platform schedulers, cancels work with lifecycle hooks, segments buffers to control memory, and relies on disk-backed caches with LRU eviction for battery- and memory-efficient streaming.
Design a real-time presence system (online/idle/offline) that works globally with low latency and tolerates network partitions. Discuss multi-region replication strategy, region-local authoritative presence, TTLs and heartbeats, conflict resolution for presence events, eventual consistency windows, and techniques to reduce cross-region traffic.
Sample Answer
Clarify goals & constraints
I’d build a globally distributed presence service giving low-latency reads from nearest region, tolerating partitions, and returning eventual-consistent presence (online/idle/offline) to mobile clients.
High-level approach
- Region-local authoritative presence: each client connects to nearest region (via DNS/GSLB). That region is authoritative for that client’s presence writes.
- Multi-region replication: use async, per-user log-based replication (append-only presence stream) to other regions via WAN CDC with sequence numbers and monotonically increasing timestamps (vector or Lamport-ish).
TTLs & heartbeats
- Mobile client sends lightweight heartbeat (e.g., every 30s) or OS push-triggered. Server sets TTL on presence state = heartbeat interval * factor (e.g., 3x). If TTL expires, state becomes offline locally.
Conflict resolution
- Use authoritative-region wins for concurrent writes; include (region-id, counter, wall-clock) metadata. Resolve by highest counter then latest timestamp, falling back to authoritative region for that user.
Eventual consistency window
- Expect propagation latency (50–300ms intra-region, 200–1000ms cross-region). Surface “maybe-stale” UI (e.g., spinner or “last updated”) and optimistic UI: show local authoritative state immediately, then update when replicas arrive.
Reduce cross-region traffic
- Only replicate deltas (state change events), batch events, compress heartbeats into ephemeral leases, and use interest lists (subscribe only to friends/presence channels). Edge caching: read from nearest region; fallback to cached state during partitions.
Mobile-specific notes
- Minimize battery: use adaptive heartbeat (foreground vs background), rely on push notifications to wake and update state. Show graceful degradation on network loss (mark “connection lost” vs offline).
Describe Kotlin coroutines' Dispatchers.IO, Dispatchers.Main, and Dispatchers.Default. For an app that downloads images and decodes them, specify which dispatcher you would use for network download, for image decoding, and for updating the UI, and justify each choice based on blocking vs CPU-bound characteristics.
Sample Answer
Direct answer
A coroutine is a lightweight unit of work that can pause without holding a thread and resume later; a function marked suspend is one that may pause this way, and while it is paused its thread is free to run other work. A dispatcher decides which thread (or threads) a coroutine runs on. For an app that downloads and decodes images: run the network download on Dispatchers.IO (blocking work that mostly waits), the image decoding on Dispatchers.Default (CPU-bound work), and the UI update on Dispatchers.Main (the single UI thread). Switch between them with withContext(...) (launch and async start new coroutines inside a scope, the object that owns them and cancels them together, such as viewModelScope on Android, which is cancelled when the screen's ViewModel is cleared; withContext instead moves the current coroutine to another dispatcher for one block), which suspends the caller, runs the block on the new dispatcher, and returns the result. The rule behind all three choices: put work that waits on IO, work that computes on Default, and work that touches UI objects on Main.
The three dispatchers
| Dispatcher | Backing threads | Meant for | Wrong use |
|---|---|---|---|
Dispatchers.Default | Shared pool; the maximum number of threads equals the number of CPU cores, with a minimum of two | CPU-bound work: decoding, parsing, sorting, hashing. It is also what launch and async use when neither you nor the enclosing scope supplies a dispatcher (a scope such as viewModelScope supplies Dispatchers.Main.immediate, so launches inside it start on the main thread) | Blocking calls: a thread sleeping on a socket is a core's worth of capacity wasted |
Dispatchers.IO | Shared pool that creates threads on demand; defaults to a limit of 64 threads or the number of cores, whichever is larger | Blocking I/O: network, files, databases | CPU-heavy loops: they would compete for the same threads as the I/O waits |
Dispatchers.Main | One thread, the app's UI thread (on Android it comes from the kotlinx-coroutines-android artifact) | Updating views and UI state; short work only | Anything slow: it blocks drawing and input |
Dispatchers.IO and Dispatchers.Default share threads. The kotlinx.coroutines documentation says that withContext(Dispatchers.IO) while already on Default typically does not cause a real thread switch, because the implementation tries to keep execution on the same thread. So the cost of switching between them is small, and the two are separated by their parallelism limits, not by separate thread pools.
Per-stage choice and justification
- Network download:
Dispatchers.IO. The download is a blocking call. While it waits, the thread does no computation, so you want many of them parked at once.IOallows up to 64 (or the core count if larger), far more thanDefaultcould ever give you. - Image decoding:
Dispatchers.Default. Decoding keeps a core busy the whole time. More threads than cores adds only context switching, so the pool sized to the number of cores is the right fit. Running decoding onIOwould let 64 decodes fight over a handful of cores. - Updating the UI:
Dispatchers.Main. Views may only be touched from the UI thread, and the code there should be tiny (set the bitmap), otherwise the screen stutters.
suspend fun loadImage(url: String): Bitmap {
val bytes = withContext(Dispatchers.IO) { download(url) } // waits on the network
return withContext(Dispatchers.Default) { decode(bytes) } // computes
}
// in the UI layer, on Dispatchers.Main (for example viewModelScope.launch):
imageView.setImageBitmap(loadImage(url)) // runs back on Main
In numbers: on a machine with 14 cores, Default runs at most 14 threads and IO at most 64 (the larger of 64 and the core count); on a 2-core phone, Default has 2 and IO still has 64. Android's guidance is that suspend functions should be main-safe, meaning safe to call from the main thread: the function that does blocking work is responsible for moving itself off the main thread with withContext, so callers never need to know. It also says not to hardcode dispatchers, but to inject them (as constructor parameters with defaults), so tests can substitute a test dispatcher.
Runnable check on the JVM
The program below (Kotlin 2.0.21, kotlinx-coroutines 1.9.0, run on JDK 21) cannot use the real Dispatchers.Main, which needs an Android or Swing artifact, so a single thread named main-standin plays the UI thread. It runs the three stages in order, then tests a claim from the table: how many blocking tasks each dispatcher can hold at the same time. It starts cores + 1 tasks that each wait until all have started; that can only succeed if the dispatcher can run cores + 1 threads at once. Step by step: runBlocking is the entry point that blocks main until the coroutines inside finish (a program needs one to start coroutines from plain code). allBlockedTogether creates a CountDownLatch set to n, a counter that threads wait on until it has been counted down n times. Each of n coroutines, launched on the dispatcher under test, counts the latch down once and then blocks on it (up to 2 seconds) like a thread stuck on a network read. The caller waits up to 1 second for the count to reach zero: it reaches zero only if all n coroutines are running at the same moment. Then cancelAndJoin() cancels each coroutine and waits for it to end. Two small helpers appear in the stage lines: Thread.currentThread().name.substringBefore('-', "?") keeps the text of the thread name before its first dash (DefaultDispatcher-worker-3 becomes DefaultDispatcher, and "?" is the fallback when there is no dash), and the Thread.sleep(50) stands in for a blocking network wait.
import kotlinx.coroutines.*
import java.util.concurrent.CountDownLatch
import java.util.concurrent.Executors
import java.util.concurrent.TimeUnit
fun decode(bytes: ByteArray): Long { // CPU-bound stand-in for image decoding
var h = 0L
repeat(2_000_000) { i -> h = h * 31 + bytes[i % bytes.size] }
return h
}
fun main() = runBlocking {
// Stand-in for Dispatchers.Main (only exists with an Android or Swing artifact): one named thread.
val mainExecutor = Executors.newSingleThreadExecutor { Thread(it, "main-standin") }
val mainThread = mainExecutor.asCoroutineDispatcher()
val stages = mutableListOf<String>()
val bytes = withContext(Dispatchers.IO) { // blocking download
stages += "download on ${Thread.currentThread().name.substringBefore('-', "?")}-pool"
Thread.sleep(50) // blocking call: parks a thread, not CPU
ByteArray(1024) { it.toByte() }
}
val bitmap = withContext(Dispatchers.Default) { // CPU-bound decode
stages += "decode on ${Thread.currentThread().name.substringBefore('-', "?")}-pool"
decode(bytes)
}
withContext(mainThread) { // UI update
stages += "update on ${Thread.currentThread().name}"
}
println(stages)
println("decoded value is deterministic: $bitmap")
// How many blocked threads can each dispatcher hold at once?
val n = Runtime.getRuntime().availableProcessors() + 1
suspend fun allBlockedTogether(d: CoroutineDispatcher): Boolean {
val latch = CountDownLatch(n)
val jobs = List(n) { launch(d) { latch.countDown(); latch.await(2, TimeUnit.SECONDS) } }
val ok = latch.await(1, TimeUnit.SECONDS) // true only if all n were running at once
jobs.forEach { it.cancelAndJoin() }
return ok
}
println("cores+1 = $n blocking tasks at once on Dispatchers.Default: ${allBlockedTogether(Dispatchers.Default)}")
println("cores+1 = $n blocking tasks at once on Dispatchers.IO: ${allBlockedTogether(Dispatchers.IO)}")
mainExecutor.shutdown()
}
[download on DefaultDispatcher-pool, decode on DefaultDispatcher-pool, update on main-standin]
decoded value is deterministic: -3386939593423404480
cores+1 = 15 blocking tasks at once on Dispatchers.Default: false
cores+1 = 15 blocking tasks at once on Dispatchers.IO: true
The output was identical in repeated runs (the container had 14 CPUs, so cores + 1 is 15; on another machine the number differs). Default prints false on any machine with two or more cores, because its limit is the core count and cores + 1 is one more than that. On a one-core machine its limit is the minimum of two, which equals cores + 1, so that line prints true there. IO prints true as long as cores + 1 is at most 64. The stage line shows download and decode both on DefaultDispatcher worker threads (the shared pool: IO and Default threads carry the same name prefix) and the UI step on the dedicated thread. The last two lines are the real difference: Default could not run 15 blocked tasks at once because its limit is the core count, while IO could.
Trade-offs and pitfalls
- Blocking inside
Default. A blocking call onDefaultholds one of only a few threads; enough of them stall all CPU work in the app. The experiment above is that starvation in miniature. withContext(Dispatchers.Main)from an already-main coroutine does no useful work; do not scatter it. Put the switch at the boundary of the function that needs it.- Many concurrent blocking operations for one resource:
Dispatchers.IO.limitedParallelism(n)gives a view with its own limit for that resource (for example 4 connections to one database), and the documentation says such views are not restricted by the 64 limit ofIOitself. - Cancellation.
withContextcreates a child scope: if the calling coroutine is cancelled (for example the screen closes) before the block starts, the block finishes immediately with aCancellationException(the exception Kotlin uses to unwind a cancelled coroutine; it is treated as normal, not as a failure). A blocking call that never checks for cancellation, such as oneThread.sleepor a blocking read, keeps running until it returns, so prefer cancellable APIs. - Do not decode on
Main"because it is only a thumbnail". Many small stalls add up to dropped frames. - Many images at once. Launch one coroutine per image; the dispatchers bound the real parallelism, so 200 queued downloads do not create 200 threads.
For a mobile feature that also needs to be usable with VoiceOver or TalkBack, how do you incorporate accessibility checks into your testing strategy? What can be validated automatically, and what still needs manual verification?
Sample Answer
I’d test accessibility at three levels: semantic checks, interaction checks, and real screen-reader verification.
What I can automate:
- Every interactive element has a meaningful label, hint, or content description.
- Focusable elements are exposed in a sensible order.
- Buttons and controls have the right traits and are large enough to tap.
- State changes are announced or at least reflected in accessible text.
- Accessibility scanners can catch obvious issues like missing labels or low-contrast text.
What still needs manual review:
- Whether VoiceOver or TalkBack reads the screen naturally.
- Whether the focus order matches the visual and task flow.
- Whether dynamic updates, modal dialogs, and errors are announced at the right time.
- Whether the feature is usable with only the screen reader, no sighted assistance.
I’d build the automated checks into CI and include accessibility in the definition of done, but I’d still do at least one manual pass on a real device before release. Automation finds regressions; humans catch usability problems.
Given a sorted array, remove duplicates in-place so each value appears once and return the new length, using O(1) extra space (you cannot allocate a second array). Then extend it: given two sorted arrays where the first has enough trailing free space, merge the second into it in-place without an auxiliary buffer.
Sample Answer
Direct answer
Both parts use a two-pointer, write-in-place pattern. For deduplication, a slow pointer marks where the next unique value should be written while a fast pointer scans ahead; since the array is already sorted, duplicates are always adjacent, so comparing the current value only to the last-written value is enough. For the in-place merge, walk both arrays from their ends backward, writing the larger of the two remaining candidates into the last free slot each time, so the write never overwrites a value that still needs to be read.
Structured elaboration
Deduplication. slow tracks the index of the last unique value written; fast scans every element. Whenever nums[fast] differs from nums[slow], advance slow and copy nums[fast] there, so the prefix nums[:slow+1] always holds the unique values seen so far.
In-place merge. Given nums1 with real data in its first m slots and n more slots of trailing free space, and nums2 with n elements, use three pointers: i at the last real element of nums1 (index m-1), j at the last element of nums2 (index n-1), and k at the last slot overall (index m+n-1). At each step, whichever of nums1[i] or nums2[j] is larger gets written to position k, and that source pointer along with k both move one step back. The loop only needs to run until j is exhausted: once every element of nums2 has been placed, whatever remains at the front of nums1 is already smaller than everything placed so far and already sits in correct sorted position.
Writing from the back is what makes this safe without an auxiliary buffer: writing from the front would overwrite nums1 entries before they have been read and compared, which is exactly what the trailing free space is meant to avoid needing.
Worked example
def remove_duplicates(nums: list[int]) -> int:
if not nums:
return 0
slow = 0
for fast in range(1, len(nums)):
if nums[fast] != nums[slow]:
slow += 1
nums[slow] = nums[fast]
return slow + 1
def merge_sorted_inplace(nums1: list[int], m: int, nums2: list[int], n: int) -> None:
i, j, k = m - 1, n - 1, m + n - 1
while j >= 0:
if i >= 0 and nums1[i] > nums2[j]:
nums1[k] = nums1[i]
i -= 1
else:
nums1[k] = nums2[j]
j -= 1
k -= 1
if __name__ == "__main__":
arr = [1, 1, 2, 2, 2, 3]
n = remove_duplicates(arr)
print(n, arr[:n])
nums1 = [1, 2, 3, 0, 0, 0]
nums2 = [2, 5, 6]
merge_sorted_inplace(nums1, 3, nums2, 3)
print(nums1)
Running this prints 3 [1, 2, 3] and then [1, 2, 2, 3, 5, 6].
Complexity
remove_duplicates: time O(n), one pass over the array with O(1) work per element; space O(1) extra, since the array is modified in place with only the slow index as bookkeeping.
merge_sorted_inplace: time O(m+n), since each of the m + n elements is written into its final position exactly once; space O(1) extra, since it writes directly into nums1's existing trailing free space using only three index pointers as bookkeeping.
Edge cases
- Empty input to
remove_duplicates(nums == []): the function returns 0 immediately via its explicitif not numscheck, without touchingsloworfast. merge_sorted_inplacewithn == 0(nothing innums2): the loop conditionwhile j >= 0is false immediately, sonums1's first m elements are left untouched, which is already correct.merge_sorted_inplacewithm == 0(nums1starts with no real data): every element written comes fromnums2, and the loop still terminates correctly oncejis exhausted.
Trade-offs & pitfalls
A naive merge written from the front would need a temporary buffer, since it would overwrite nums1 entries before they are compared, defeating the point of the trailing free space. In deduplication, a common bug is comparing the current value to the last value the fast pointer saw rather than the last value actually written by the slow pointer; that breaks as soon as a run of duplicates is longer than two.
Want to create your own tailored preparation guide using our deep research?
Get Started for FreeInterview-Ready Courses
Visual-first, interactive, structured learning paths
Browse Mobile Developer jobs
AI-enriched listings across hundreds of company career pages
Explore Jobs