Mobile Engineer interview questions & answers

20 Mobile Engineer interview questions with complete model answers, spanning Technical, Behavioral, System design, Product & growth, Coding. The bank holds 86 Mobile Engineer questions in total, tagged by round and difficulty.

BehavioralMediumMobile Engineer

1. What challenges did you face while building a feature, and how did you solve them?

Model answer

  1. Situation — On a restaurant-discovery feature, we wanted to show nearby restaurants and refresh the list as the customer moved around. The feature crossed several boundaries: location permissions and device settings, network availability, backend ranking, and a UI that needed to remain responsive on a wide range of Android devices. A technically correct result could still feel broken if the app prompted for location too early or showed an empty screen during a slow request.
  2. Task — I owned the Android implementation and was responsible for making the experience useful when location was denied, unavailable, or slow, while keeping the feature performant and respecting user privacy.
  3. Action
  • I worked with product and design to define permission behavior before implementation. We requested location only after the user entered the nearby experience, explained the value first, and preserved a manual location-search path when permission was denied.
  • I modeled the screen as explicit states—loading, content, empty, permission denied, and recoverable error—instead of relying on a single loading flag. That prevented a network failure from being mistaken for “no restaurants nearby.”
  • I kept location acquisition and API calls off the main thread, debounced map movement, and cancelled superseded requests. This avoided rendering stale results when a user moved the map quickly.
  • I added request identifiers and location bounds to responses so the UI could ignore results for an older viewport. I also used a short-lived cache for repeat views, with a clear refresh path rather than presenting cached data as live.
  • I tested permission changes through Android settings, poor connectivity, and different screen sizes. I shared the edge cases with backend and QA early so that API behavior and test coverage matched the customer flow.
  1. Result — The feature shipped without blocking the non-location discovery path, and we saw fewer empty-screen failures in the rollout cohort. The implementation also gave support and analytics clearer distinctions between denied permission, unavailable location, and genuine zero-result searches. I learned to treat permissions, network uncertainty, and UI state as part of the feature design—not cleanup work after the happy path.
BehavioralMediumMobile Engineer

2. What was the toughest feature you built?

Model answer

  1. Situation — The toughest feature I built was a live order-tracking experience for a food-delivery app. Customers needed to understand whether their order was being prepared, picked up, or approaching, while restaurant and delivery-partner updates could arrive late, out of order, or not at all. The feature mattered because uncertainty during a delayed order drove support contacts and reduced customer trust.
  2. Task — I owned the Android experience, including the order-state UI and its integration with backend updates. The main constraint was to make tracking feel current without draining battery or letting inconsistent events send the customer backwards in the journey.
  3. Action
  • I first mapped the order lifecycle with product, backend, and operations teams. We agreed on a small set of customer-facing states and explicitly defined transitions for cancellations, reassignment, and delayed updates.
  • I treated server state as authoritative. The app applied updates only when their order version was newer, and fetched a fresh snapshot after reconnecting instead of assuming it had received every event.
  • I used a push update path for timely changes and a bounded polling fallback while the tracking screen was active. I stopped polling when the screen was backgrounded and used backoff during network failures to limit battery and server load.
  • I separated the state reducer from the UI so duplicate or out-of-order events could be tested deterministically. I added tests for reconnects, missing updates, and transitions such as courier reassignment.
  • I worked with design to show an honest fallback when live location was unavailable rather than displaying a stale marker as current. I also added analytics for time spent in each state and tracking errors.
  1. Result — We launched incrementally and monitored crash-free sessions, tracking freshness, and order-related support contacts. In the first few weeks, the share of sessions with a stale tracking state fell by about 30%, and support contacts about delivery progress declined by roughly 10% in the rollout cohort. The biggest lesson for me was that live features are primarily a correctness and recovery problem; animation and map polish only help once the underlying state is trustworthy.
BehavioralMediumMobile Engineer

3. Why did you choose a particular architecture for your project?

Model answer

  1. Situation — On a food-discovery Android app, our restaurant feed was becoming difficult to change: UI code, network calls, and filtering logic were concentrated in a few large classes. A team of five engineers worked on the app, and feed changes were frequent, so regressions and slow reviews were starting to affect delivery.
  2. Task — I owned proposing an architecture that made the feed easier to test and extend without adding unnecessary abstraction or slowing down the user experience.
  3. Action
  • I first mapped the responsibilities and dependencies in the existing flow. The key problem was that the UI directly depended on networking and data-format details, which made both UI tests and API changes harder.
  • I proposed a feature-oriented structure with a presentation layer using ViewModels, a domain layer for core use cases, and a data layer for repositories and API/cache implementations. I kept the boundaries pragmatic: I did not create an interface for every class, only where we needed a meaningful substitution or test seam.
  • I made the ViewModel expose observable UI state, so rendering and loading/error states were explicit. The repository owned the decision to use cached restaurant data while a refresh was in progress.
  • I introduced the pattern on the feed feature first, then documented the conventions and reviewed an example with the team before expanding it. That let us validate the design without forcing a risky rewrite of the whole app.
  • I also kept RecyclerView concerns at the presentation boundary: stable item IDs and diff-based updates, while the domain layer remained independent of Android views.
  1. Result — The team could test feed behavior without launching the UI or making real network calls, and new feed changes became easier to review because responsibilities were clearer. In that project, we reduced the typical feed change from several files with tangled responsibilities to a small, predictable set of changes, and cut regressions found in QA over the next release cycle. I learned to choose architecture based on the problems a team actually has, and to prove a pattern on one feature before applying it broadly.
BehavioralMediumMobile EngineerTechnical Interview 1

4. What is your favorite project that you have worked on?

Model answer

  1. Situation — My favorite project was improving the order-tracking experience in a food-delivery app. Customers were opening the screen repeatedly because the order status could feel stale, especially during the handoff from restaurant preparation to delivery. I was the mobile engineer responsible for making that experience clearer and more resilient, while coordinating with backend and design teams.
  2. Task — I wanted customers to understand what was happening without relying on constant manual refreshes. The constraint was that mobile clients could not assume a continuous network connection or perfectly ordered status updates.
  3. Action
  • I mapped the order states with product and backend partners, then agreed on a small, explicit state model for accepted, preparing, picked up, and delivered. That helped us avoid presenting ambiguous backend transitions as definite promises.
  • I proposed updating the screen from server events when available, with a refresh fallback when the app resumed or connectivity returned. I treated the server as the source of truth rather than trying to infer delivery progress locally.
  • I added handling for delayed and out-of-order updates so an older event could not move the UI backwards. I also designed clear loading, stale-data, and retry states instead of leaving the customer with a spinner.
  • I worked with design to make the next expected step prominent and to keep the screen useful with accessibility labels and without relying only on color.
  • I helped QA build test cases for dropped connections, backgrounding the app, and rapid state changes, then used pilot feedback to fix confusing wording before a broader rollout.
  1. Result — The rollout reduced repeated manual refreshes and improved customer feedback about tracking clarity; in the pilot, we also saw fewer support contacts asking for basic order-status updates. I valued the project because it combined mobile reliability with a very tangible customer problem. It taught me that a trustworthy, explicit status is better than a flashy live interface that can’t explain uncertainty.
BehavioralMediumMobile EngineerTechnical Interviews

5. If you wanted to remove a third-party library from an application, how would you convince your project manager to do so in non-technical terms?

Model answer

  1. Situation — On a mobile app team, I found that a third-party library was adding maintenance and release risk without providing enough value for how little we used it. The project manager cared about delivery dates and customer impact, not the library’s implementation details.
  2. Task — I needed to make the case for removing it in terms of business outcomes, while showing that the change could be made safely and would not derail the roadmap.
  3. Action
  • I started with the impact rather than the technology: the library was increasing upgrade work, and changes to it could delay app releases or introduce defects. I translated the effort into a simple estimate of engineering time and release risk.
  • I compared three options: keep it, replace it with a smaller alternative, or use built-in platform capabilities. I included the cost and risks of each, including the one-time migration effort.
  • I proposed a small proof of concept and a staged rollout. For example, we could migrate one low-risk feature first, verify that customers saw no difference, then remove the dependency from the rest of the app.
  • I addressed the project manager’s likely concern directly: I suggested scheduling the work alongside related maintenance, setting a time limit, and agreeing on a fallback if the proof of concept exposed unexpected problems.
  • I presented success measures in plain language: fewer hours spent on upgrades, no increase in crashes or support reports, and no delay to the planned release. I asked for agreement on those measures before asking for the work to be prioritized.
  1. Result — The discussion became a decision about cost, risk, and timing—not a debate about code. In this example, the team approved a small trial, confirmed the feature still worked as expected, and then removed the library in a planned release. I’d report the actual savings and quality results after measuring them; the key lesson is to make the trade-off visible and offer a low-risk way to validate the change.
CodingMediumMobile EngineerTechnical Interview 1

6. Implement an isOverlapping function that returns whether two NSRange values overlap.

Model answer

function isOverlapping(rangeA, rangeB) {
  const validRange = ({ location, length }) =>
    Number.isSafeInteger(location) &&
    Number.isSafeInteger(length) &&
    location >= 0 &&
    length >= 0;

  if (!validRange(rangeA) || !validRange(rangeB)) {
    throw new TypeError("Ranges must have non-negative safe-integer location and length values");
  }

  // Empty half-open ranges, such as [4, 4), overlap nothing.
  if (rangeA.length === 0 || rangeB.length === 0) return false;

  // BigInt keeps endpoint arithmetic exact, including near Number's safe limit.
  const aStart = BigInt(rangeA.location);
  const aEnd = aStart + BigInt(rangeA.length);
  const bStart = BigInt(rangeB.location);
  const bEnd = bStart + BigInt(rangeB.length);

  // NSRange-style ranges are half-open: [location, location + length).
  return aStart < bEnd && bStart < aEnd;
}

console.log(isOverlapping({ location: 2, length: 4 }, { location: 5, length: 3 })); // true
console.log(isOverlapping({ location: 2, length: 3 }, { location: 5, length: 3 })); // false
  • Treat each range as half-open: [location, location + length). Ranges that only touch at an endpoint do not overlap.
  • The strict comparisons also make any zero-length range non-overlapping.

Complexity: Time O(1); space O(1).

CodingMediumMobile EngineerTechnical Interview 1

7. Given a root UIView and a target UIView, find all UIViews at the same depth as the target.

Model answer

function viewsAtTargetDepth(root, target) {
  if (!root || !target) return [];

  // Find the target's depth using breadth-first traversal.
  const queue = [[root, 0]];
  let targetDepth = null;

  for (let head = 0; head < queue.length; head++) {
    const [view, depth] = queue[head];
    if (view === target) {
      targetDepth = depth;
      break;
    }

    for (const subview of view.subviews ?? []) {
      queue.push([subview, depth + 1]);
    }
  }

  // A target outside the root's view hierarchy has no matching depth.
  if (targetDepth === null) return [];

  // Collect every view at that depth.
  const result = [];
  for (let head = 0; head < queue.length; head++) {
    const [view, depth] = queue[head];
    if (depth === targetDepth) result.push(view);
  }

  return result;
}
  • This models UIView nodes with a subviews array; in Swift, the same traversal uses view.subviews and object identity (===).
  • The root is at depth 0. If the target is not a descendant of the root, the function returns an empty array.

Complexity: Time O(n), space O(n), where n is the number of views visited.

CodingMediumMobile EngineerTechnical Interview 1

8. Given a non-empty string containing only digits, determine the total number of ways to decode it using the mapping A → 1, B → 2, …, Z → 26.

Model answer

function countDecodings(digits) {
  if (typeof digits !== "string" || digits.length === 0 || !/^\d+$/.test(digits)) {
    throw new Error("Expected a non-empty string containing only digits");
  }

  // dp[i] is the number of ways to decode the first i digits.
  const dp = new Array(digits.length + 1).fill(0);
  dp[0] = 1;

  for (let i = 1; i <= digits.length; i++) {
    // A single digit is valid only when it is 1 through 9.
    if (digits[i - 1] !== "0") {
      dp[i] += dp[i - 1];
    }

    // A pair is valid when its numeric value is between 10 and 26.
    if (i >= 2) {
      const pair = Number(digits.slice(i - 2, i));
      if (pair >= 10 && pair <= 26) {
        dp[i] += dp[i - 2];
      }
    }
  }

  return dp[digits.length];
}

console.log(countDecodings("226")); // 3: BBF, BZ, VF
  • At each position, count a valid one-digit decode and, when possible, a valid two-digit decode.
  • A zero cannot be decoded alone; it must be part of 10 or 20.

Complexity: Time O(n), space O(n).

CodingMediumMobile EngineerTechnical Interview 1

9. Write an Array extension that removes consecutive duplicates.

The full question

Write an Array extension that removes consecutive duplicates. For example, ["a", "a", "a", "a", "b", "c", "c", "a", "a", "d", "e", "e", "e", "e"] should produce ["a", "b", "c", "a", "d", "e"], and [1, 1, 2, 3, 3, 2, 1, 1, 4, 4, 5, 5, 5] should produce [1, 2, 3, 2, 1, 4, 5].

Model answer

function removeConsecutiveDuplicates(array, equals = Object.is) {
  if (array.length === 0) return [];

  const result = [array[0]];

  for (let i = 1; i < array.length; i++) {
    // Keep an item only when it differs from the previous input item.
    if (!equals(array[i], array[i - 1])) {
      result.push(array[i]);
    }
  }

  return result;
}

console.log(
  removeConsecutiveDuplicates([
    "a", "a", "a", "a", "b", "c", "c", "a", "a", "d", "e", "e", "e", "e"
  ])
); // ["a", "b", "c", "a", "d", "e"]

console.log(
  removeConsecutiveDuplicates([1, 1, 2, 3, 3, 2, 1, 1, 4, 4, 5, 5, 5])
); // [1, 2, 3, 2, 1, 4, 5]
  • Compare each item with its immediate predecessor; this removes runs without removing later, non-consecutive repeats.
  • The optional equality function lets callers define equality for their element type.

Complexity: Time O(n); space O(n) for the returned array.

CodingMediumMobile EngineerTechnical Interview 2

10. How would you determine whether two linked lists intersect?

Model answer

// Each node has a `next` property. The lists are assumed to be acyclic.
function getIntersectionNode(headA, headB) {
  let pointerA = headA;
  let pointerB = headB;

  // Each pointer traverses both lists, so both cover the same total length.
  // If the lists intersect, the pointers meet at the shared node;
  // otherwise, both reach null.
  while (pointerA !== pointerB) {
    pointerA = pointerA === null ? headB : pointerA.next;
    pointerB = pointerB === null ? headA : pointerB.next;
  }

  return pointerA; // The shared node, or null if there is no intersection.
}
  • Compare node identity, not node values: distinct nodes can contain equal values.
  • Switching each pointer to the other list's head equalizes the total distance traveled, including any shared suffix.
  • Complexity: O(m + n) time and O(1) extra space.
Product & growthMediumMobile Engineer

11. What are some real-world use cases for custom views?

Model answer

Clarify & scope

I’d use a custom view when a Zomato experience needs a visual or interaction pattern that standard widgets cannot deliver cleanly. The goal is not to make every screen bespoke; it is to make important, reusable interactions clearer and more consistent.

User segments & pain points

I’d prioritize diners who make quick decisions on small screens, especially while comparing restaurants or tracking an order. They need key information—such as price, rating, delivery progress, and availability—to be easy to scan and interact with.

Goals & success metrics

The product goal is to reduce friction in the task the component supports. I’d measure task completion and time to complete, then use interaction errors or abandonment as guardrails. For example, a status component should improve order-status comprehension without increasing accessibility issues or rendering time.

Solutions

  • Order tracking timeline: A reusable component can show stages such as confirmed, preparing, and on the way, with a clear current state and accessible text labels.
  • Restaurant rating or offer indicator: A compact custom component can combine a visual rating, offer badge, or delivery estimate while preserving consistent layout across restaurant cards.
  • Food customization control: A specialized selector can make choices such as spice level or add-ons easier to understand than a generic list of toggles.

Recommendation: I’d start with the order-tracking timeline if research shows customers have trouble understanding delivery progress. It has a clear user outcome and can be reused across order surfaces. I’d first check whether standard Android or Compose components can meet the need; a custom implementation is justified only if it meaningfully improves clarity or interaction.

Prioritization & trade-offs

I’d rank candidates by user impact, reuse, and implementation effort. A custom view can improve fidelity and reuse, but it also adds ownership costs: measurement, drawing, accessibility semantics, state handling, and testing. I’d keep business logic outside the component so it remains reusable and straightforward to validate.

MVP, measurement & rollout

I’d ship the smallest version for one order-tracking surface, test it with assistive technology and a range of screen sizes, and compare task completion and comprehension against the existing UI. After monitoring crashes, rendering performance, and user feedback, I’d expand it to other surfaces if the result is positive.

Product & growthMediumMobile EngineerProfile Selection

12. What feature would you add to the Zomato app?

Model answer

Clarify & scope

I’d add a Dietary Confidence feature to Zomato: help people identify dishes that fit their dietary needs and understand what is known—or not known—about their ingredients. I’d start with delivery menus in a few high-volume cities rather than trying to solve ingredient transparency for every restaurant at once.

User segments & pain points

I’d focus first on people with serious allergies, then include users avoiding ingredients for religious, ethical, or lifestyle reasons. Menu labels like “healthy” or “veg” don’t answer practical questions such as whether a dish contains peanuts, dairy, or egg. Missing information can make a customer abandon the order—or make a risky choice.

Goals & success metrics

My North Star would be the completed-order rate among customers who set dietary preferences. I’d track menu-to-cart conversion, preference-filter usage, and customer-reported confidence. Guardrails would include allergy-related complaints, cancellations, restaurant burden, and the rate of incorrect or unverified ingredient claims.

Solutions

  1. Let customers set ingredient exclusions and dietary preferences once, then filter menus and flag matching dishes.
  2. Show ingredient and allergen details supplied or confirmed by restaurants, with a clear “not confirmed” state when information is missing.
  3. Offer a lightweight restaurant workflow to review ingredient tags and confirm substitutions before a customer places an order.

Recommendation: Start with the second and third ideas, plus basic preference filters. I would never imply that a dish is safe when its information is unverified. Clear uncertainty is more trustworthy than a confident but unsupported label.

Prioritization & trade-offs

I’d prioritize verified information and a small set of high-impact filters over broad personalization. Coverage will be limited initially, but incorrect allergen information has a much higher downside than an incomplete catalog. The restaurant workflow should be quick and optional, with incentives to complete profiles.

MVP, measurement & rollout

Pilot with a small set of restaurants that can verify ingredients. Compare the experience with a control group, measuring conversion and confidence alongside complaint and correction rates. Expand only when verification quality is strong; if errors rise, pause expansion and fix the data workflow before adding more coverage.

Product & growthHardMobile EngineerTake-home assignment

13. What should Mozilla do about AMP?

Model answer

Clarify & scope

I’d treat AMP as a user-experience and open-web question, not a yes-or-no browser compatibility decision. AMP can make pages load quickly on mobile, but its distribution through Google’s cache and the use of separate AMP URLs can weaken publisher control and make it harder for users to know which site they’re visiting. Mozilla should preserve access to content while giving users more choice and promoting performance improvements that work across the open web.

User segments & pain points

I’d prioritize mobile readers on slow or expensive connections. They need pages that load quickly, use little data, and behave reliably; they also need to trust who is serving the page and be able to reach the publisher’s canonical site. Publishers and developers matter too, but I’d judge decisions by their effect on readers first.

Goals & success metrics

The North Star would be successful, trusted content consumption on mobile, not the number of AMP pages Firefox blocks or converts. I’d track time to usable content, page-load success, data transferred, and reader engagement, segmented by network quality and whether the page is AMP or standard HTML. Guardrails would include site compatibility, crashes, privacy, and user reports that pages are missing content or unexpectedly changing URLs.

Solutions

  1. Keep AMP pages working in Firefox. Breaking or degrading them would punish readers more than it would change publisher incentives.
  2. Improve performance for the web generally: invest in Firefox Android loading, caching, efficient rendering, and standards-based web capabilities. Share performance guidance with publishers and support interoperable standards rather than a Mozilla-specific format.
  3. Give users clear, optional control when an AMP page is served from a cache—for example, a way to navigate to the publisher’s canonical URL when it is available. Make this transparent and reversible; don’t silently rewrite pages or promise that every conversion will work.

Recommendation: Support AMP as content, but don’t make AMP the solution Mozilla advocates for. Focus Mozilla’s engineering and advocacy on fast, interoperable web pages and user choice.

Prioritization & trade-offs

I’d prioritize general mobile performance first: it benefits readers regardless of publisher or format. A canonical-link control is a smaller, opt-in follow-up. Automatic AMP-to-HTML rewriting might offer more control, but it risks breaking pages, adding maintenance burden, and confusing users about the source of content.

MVP, measurement & rollout

Start with a Firefox Android performance baseline and a small usability study of readers on constrained networks. Prototype an optional canonical-link action, test compatibility across a representative set of AMP pages, then roll it out behind a preference or experiment. Compare performance and successful reading against a control group, monitor the guardrails, and expand only if users gain control without losing speed or reliability.

System designHardMobile EngineerSystem design interview

14. Design an image-loading library similar to Glide.

Model answer

1. Requirements & scale

I’d design a mobile image-loading library that gives app teams a small API while handling caching, decoding, concurrency, cancellation, and lifecycle behavior. The library should make scrolling feeds smooth on customer and dasher apps, even with flaky networks and repeated image requests.

  • Functional: Load remote or local images into UI targets; support placeholders, errors, transformations, sizing, and request cancellation.
  • Non-functional: Avoid main-thread network/decode work, limit memory, reuse work for duplicate requests, and keep images correct across URL or content changes.
  • Assumption: A busy app session may display 100 images/minute, with a burst of 10 simultaneous requests. At 200 KB per original image, that is up to 20 MB/minute without resizing or caching. A 10x increase in image views should mostly increase cache and CDN throughput, not client CPU cost.
  • Correctness: Cache identity must include the content version and transformations; otherwise users can see stale or incorrectly sized images.

2. High-level architecture

flowchart TD
  subgraph Client
    UI["App UI and Image Target"]
    LIB["Image Loading Library"]
    UI -->|"request and lifecycle"| LIB
  end
  subgraph EdgeCDN["Edge / CDN"]
    CDN["Image CDN"]
  end
  subgraph LoadBalancer["Load Balancer"]
    LB["Image API Load Balancer"]
  end
  subgraph APIServices["API / Services"]
    API["Image Metadata API"]
    TRANS["Transform Service"]
  end
  subgraph Cache["Cache"]
    MC["Memory LRU Cache"]
    DC["Disk HTTP Cache"]
    CC["CDN Cache"]
  end
  subgraph Datastores["Datastores"]
    META["Image Metadata Store"]
    OBJ["Original Image Object Store"]
  end
  subgraph MessageQueue["Message Queue"]
    Q["Transform Job Queue"]
  end
  subgraph Workers["Workers"]
    W["Resize and Encode Workers"]
  end
  LIB -->|"memory lookup"| MC
  LIB -->|"disk lookup"| DC
  LIB -->|"cache miss HTTPS"| CDN
  CDN --> CC
  CDN -->|"miss or metadata request"| LB
  LB --> API
  API -->|"metadata"| META
  API -->|"original or variant"| OBJ
  API -->|"new variant request"| Q
  Q -->|"transform job"| W
  W --> TRANS
  TRANS --> OBJ
  OBJ -->|"image response"| CDN
Diagram

3. API design

The primary interface is a library API rather than a network API:

  • ImageLoader.load(source).into(target) — start a request and attach it to a UI target.
  • .placeholder(asset), .error(asset), .size(width, height), .transform(name, params), and .priority(value) — configure rendering and resource use.
  • target.clear() or lifecycle cancellation — cancel work and detach callbacks.
  • For a DoorDash-style image service, GET /v1/images/{image_id}?w={w}&h={h}&fit={fit}&format={format} returns a cacheable variant with ETag, Cache-Control, and content type. Prefer immutable, versioned URLs for uploaded content.

4. Data model & storage

  • Memory cache: Bounded LRU keyed by canonical source URL or image ID, content version, target dimensions, transformation parameters, and output format. Account for decoded bitmap bytes, not compressed file size.
  • Disk cache: Bounded HTTP response cache for encoded bytes, using HTTP validators and an eviction policy. Store temporary files then atomically rename after a successful complete download.
  • Metadata: images(image_id, owner_id, version, original_key, width, height, content_type, created_at) in a durable metadata store. Store originals and generated variants in object storage, with CDN distribution in front.
  • Partitions: Partition metadata by image ID; variants use a deterministic key derived from image version and normalized transformation parameters. Keep private image authorization distinct from public CDN caching.

5. Deep dive

The key design is a single-flight request pipeline that coalesces identical requests while separating network bytes, decoded images, and UI delivery. Canonicalize the request first; check memory cache; then disk cache; then issue or join one in-flight network request. Decode off the main thread near the requested display size, apply transformations, and only then place the result in memory cache. Post the final target update to the UI thread only if the target still represents that request.

sequenceDiagram
  participant UI as UI Target
  participant L as Loader
  participant M as Memory Cache
  participant D as Disk Cache
  participant N as Network and CDN
  participant X as Decode Worker
  UI->>L: load URL, size, transform
  L->>L: canonicalize cache key
  L->>M: lookup decoded image
  alt memory hit
    M-->>L: image
  else miss
    L->>D: lookup encoded bytes
    alt disk hit
      D-->>L: bytes
    else miss
      L->>N: fetch or join in-flight request
      N-->>L: encoded bytes and validators
      L->>D: atomically store bytes
    end
    L->>X: downsample and transform off main thread
    X-->>L: decoded image
    L->>M: insert under byte budget
  end
  L-->>UI: deliver if request token still matches
Diagram

Each target gets a request token. Rebinding a recycled list cell cancels its old subscription and changes the token; a late response is discarded rather than drawing the previous restaurant’s image. Cancellation should stop underlying work only when no subscribers remain. Failures use bounded retries for transient errors, never retry permanent 4xx responses blindly, and fall back to the configured error drawable. Decode dimensions should respect target size and device density; decoding a 4000×3000 image for a 100×100 thumbnail wastes substantial memory.

6. Scale, bottlenecks & trade-offs

  • Client resource control: Use a bounded thread pool, request priorities, and separate limits for network and decode work. Pause or lower priority for off-screen targets. Use memory pressure callbacks to trim caches and avoid retaining UI contexts.
  • Cache behavior: Memory cache is fastest but volatile; disk cache survives process restarts but costs storage and I/O; CDN cache reduces origin bandwidth but needs correct versioning and privacy rules. A short TTL is suitable for mutable avatars; immutable versioned menu images can use long-lived caching.
  • Server scale: Serve common variants from CDN. Generate predictable sizes on upload or lazily with queued, deduplicated transform jobs. Protect the origin with rate limits and request coalescing; bound dimensions and transformation parameters to prevent cache-key explosion.
  • Failure modes: Handle offline mode, partial downloads, corrupt bytes, expired authorization, disk-full conditions, and process death. Never expose a partially written cache entry. Track cache hit rates, decode latency, request cancellation, memory usage, and blank-image rate.
  • Trade-offs: Prefetching improves scroll smoothness but can waste bandwidth; make it viewport-aware and cancellable. Aggressive disk caching helps repeat views but uses storage and can serve stale content; use versioned keys and eviction. Prefer a small stable public API while keeping executors, cache policy, and transport injectable for app-specific testing.
System designHardMobile EngineerTechnical Interview 2

15. Design an iOS app for booking a cab, including the booking, payment, and feedback screens.

Model answer

1. Requirements & scale

Functional requirements

  • Let a rider set pickup and destination, choose a ride type, see an estimate, and book.
  • Show driver assignment and trip progress; support cancellation and payment.
  • Collect a rating and optional feedback after the trip.
  • Handle retries, app suspension, flaky networks, and payment-provider callbacks safely.

Non-functional requirements

  • Keep booking actions responsive and prevent duplicate bookings or charges.
  • Protect location and payment data; meet local privacy and payment requirements.
  • Recover the correct trip state when the app restarts or returns from the background.

Estimate: Assume 1 million daily active riders and 2 bookings per rider per month: about 2 million trips/month, or 0.8 trips/second on average. At a 50x peak, booking traffic is about 40 requests/second; quote and location-update traffic may be 10–20x higher. At roughly 5 KB of durable trip metadata per trip, trip records add about 10 GB/month before indexes and replication. Live locations are transient and should not be stored as trip history.

2. High-level architecture

The iOS app owns fast, resilient presentation and local state; backend services remain authoritative for quotes, assignment, trip status, payments, and feedback.

flowchart TD
  subgraph Client
    App[iOS app]
    UI[Booking payment feedback screens]
    Local[Local trip state]
    App --> UI
    UI --> Local
  end
  subgraph Edge
    CDN[CDN assets]
    Gateway[API gateway]
  end
  subgraph LoadBalancer
    LB[Regional load balancer]
  end
  subgraph Services
    BFF[Mobile BFF]
    Trip[Trip service]
    Dispatch[Dispatch service]
    Pay[Payment service]
    Feedback[Feedback service]
    Notify[Realtime notification service]
  end
  subgraph Cache
    Redis[Redis quotes and trip state]
  end
  subgraph Datastores
    SQL[Trip and payment SQL]
    Events[Trip event store]
    Blob[Feedback media object store]
  end
  subgraph MessageQueue
    Queue[Trip and payment events]
  end
  subgraph Workers
    Worker[Notification and reconciliation workers]
    Provider[Payment provider]
  end
  App -->|assets| CDN
  App -->|HTTPS API| Gateway
  App -->|trip updates| Notify
  Gateway --> LB
  LB --> BFF
  BFF -->|quote and booking| Trip
  Trip -->|driver match| Dispatch
  BFF -->|payment methods| Pay
  BFF -->|rating| Feedback
  Trip --> Redis
  Trip --> SQL
  Pay --> SQL
  Feedback --> SQL
  Feedback --> Blob
  Trip -->|trip events| Queue
  Pay -->|payment events| Queue
  Queue --> Worker
  Worker -->|push and reconcile| Notify
  Pay -->|authorize or capture| Provider
  Notify -->|status updates| App
Diagram

3. API design

  • GET /v1/quotes?pickup=...&dropoff=... — return fare range, ETA, and available ride types.
  • POST /v1/trips — create a booking with ride type, locations, quote ID, payment method, and an Idempotency-Key.
  • GET /v1/trips/{tripId} — restore authoritative trip and payment state after reconnect or app relaunch.
  • POST /v1/trips/{tripId}/cancel — request cancellation; return any applicable fee.
  • POST /v1/trips/{tripId}/payment-method — select or update the method before the allowed payment state.
  • POST /v1/trips/{tripId}/feedback — submit rating, tags, and optional comment; accept an idempotency key.

Use authenticated HTTPS. Stream trip status over a WebSocket when available, with push notifications and polling as fallbacks.

4. Data model & storage

  • SQL: Trip(trip_id, rider_id, status, pickup, dropoff, quote_id, fare, version, created_at), Payment(trip_id, provider_ref, status, amount, idempotency_key), and Feedback(trip_id, rating, tags, comment_ref). Partition large trip tables by region and time; index rider ID plus creation time. Enforce one feedback record per trip.
  • Redis: short-lived quotes and hot trip snapshots, with TTLs. Treat it as a cache, not the source of truth.
  • Event log and queue: append trip/payment status changes for downstream notifications, analytics, and reconciliation. Store optional feedback media in object storage behind a short-lived upload URL.
  • Keep card details with a tokenized payment provider; the app and trip database store only a provider token/reference.

5. Deep dive

The key design point is making booking and payment safe across retries and asynchronous driver matching. The app shows explicit states: quote, booking pending, driver assigned, in trip, payment pending/complete, and feedback submitted. A versioned trip snapshot plus server events prevents stale updates from moving the UI backward.

sequenceDiagram
  participant App as iOS app
  participant API as Mobile BFF
  participant Trip as Trip service
  participant Pay as Payment service
  participant Queue as Event queue
  participant Driver as Dispatch service
  App->>API: Create trip with idempotency key
  API->>Trip: Validate quote and create pending trip
  Trip->>Pay: Authorize payment if required
  Pay-->>Trip: Authorization result
  Trip->>Queue: Publish trip requested
  Trip->>Driver: Request matching
  Driver-->>Trip: Driver assigned
  Trip-->>App: Trip snapshot and version
  App->>API: Submit feedback after completion
  API->>Trip: Verify completed trip
  Trip-->>App: Feedback accepted
Diagram

Persist the idempotency key and its result so a timeout followed by a retry returns the original trip. Use a transactional outbox when writing a trip and publishing its event, avoiding a committed booking with a lost dispatch message. Payment webhooks are also idempotent; reconciliation workers resolve delayed or contradictory provider results. If payment authorization fails, do not dispatch; show a recoverable payment error. If matching times out, expose cancellation or retry without creating another trip.

For iOS, build the screens from a shared trip state model, with separate booking, payment, and feedback view models. Keep navigation state-restorable, validate inputs locally, and make loading, empty, error, and accessibility states first-class. Never optimistically claim a booking or payment succeeded before the server confirms it.

6. Scale, bottlenecks & trade-offs

  • Run stateless API services across availability zones; replicate SQL and fail over by region. Route a trip to a home region to preserve ordered writes, while allowing cached reads elsewhere.
  • Dispatch and location updates are likely hotter than booking writes. Partition their streams by geographic cell and trip ID; apply backpressure and coalesce frequent location updates.
  • Prefer strong consistency for trip creation, payment state, and feedback uniqueness. Use eventual consistency for analytics and notifications. During a regional outage, fail safely rather than confirm an unpersisted booking.
  • WebSockets provide timely updates but consume connections; push and polling are fallbacks. Cache quotes only briefly and revalidate price at booking, trading some speed for fare correctness.
  • A provider outage can delay payment confirmation. Show a pending state, reconcile asynchronously, and prevent a second charge rather than guessing success.
TechnicalEasyMobile EngineerTechnical Interview 2

16. Do you know about the TDD approach?

Model answer

Yes. Test-driven development (TDD) is a short feedback loop in which I write a test before implementing the behavior, then use that test to guide the smallest useful change.

  1. Red — write a failing test. Start with a specific expected behavior, including an edge case. For example, for a decoder, test that "226" returns 3 and "06" returns 0. Confirm the test fails for the intended reason, rather than because the test setup is broken.
  2. Green — implement the minimum. Add only enough production code to make the new test pass. Run the focused test, then the relevant broader suite.
  3. Refactor — improve safely. Simplify or restructure the code while keeping tests green. Add tests for newly discovered boundary cases and regressions.
  4. Repeat at the right level. I use unit tests for isolated logic, integration tests for component boundaries, and a smaller set of UI or end-to-end tests for important user journeys.
flowchart LR
    A[Write a failing test] --> B[Run test and confirm failure]
    B --> C[Implement the smallest change]
    C --> D[Run tests and confirm success]
    D --> E[Refactor with tests passing]
    E --> A
Diagram

In mobile development, I’d keep business logic testable outside UIKit where practical, inject dependencies such as network clients, and avoid making tests depend on timing or live services. TDD is a tool, not a rule: it works especially well for logic with clear expected outcomes, while exploratory UI work may need prototypes first. The important discipline is a fast, reliable feedback loop and tests that protect behavior rather than merely mirror implementation.

TechnicalEasyMobile Engineer

17. What are custom views, and when should you create them?

Model answer

A custom view is a UI component whose drawing, layout, or interaction behavior I implement because standard Android widgets do not meet the product or design requirements. I can create one by extending View for a drawable component, or ViewGroup when I need to measure and arrange child views. With Jetpack Compose, the equivalent is often a reusable composable; I would choose based on the app’s UI stack.

I’d create a custom view when:

  1. The visual form is specialized — for example, a rating meter, a map marker, or a compact delivery-status timeline.
  2. The interaction is specialized — such as a gesture-driven control or a chart with custom touch handling.
  3. The component must be reused consistently across screens and standard widgets would require brittle workarounds.
  4. The platform provides no suitable widget, or combining existing widgets would make performance or accessibility difficult to manage.

Before building one, I’d check whether a standard widget or Compose component can meet the need. A custom view adds responsibility for measurement, drawing, state restoration, accessibility, and testing. I’d also avoid putting business logic or network calls inside it: the view should render state and emit user actions, while the screen or view model owns application behavior.

In short, I create a custom view when it provides a clear improvement in usability, consistency, or performance that standard components cannot deliver cleanly.

TechnicalEasyMobile EngineerTechnical Interview 2

18. What is the difference between a class and a struct?

Model answer

In Swift, the key distinction is value semantics versus reference semantics.

  • Struct: A value type. Assignment or passing it to a function creates an independent value, so changes to one copy do not affect another. Structs do not support inheritance. They are a good default for models such as coordinates or immutable menu-item data.
  • Class: A reference type. Assignment copies the reference, so multiple variables can point to the same instance and observe its mutations. Classes support inheritance and identity checks with ===.
  • Mutability: A let struct value cannot have its properties changed; a let class reference cannot be reassigned, but the referenced instance may still be mutable if its properties allow it.
  • Memory nuance: A struct is not guaranteed to live on the stack, and a class is not simply “a pointer on the stack.” Storage depends on where values are held and compiler optimizations. Classes are reference-counted; a struct that contains a class reference can still share referenced state.
struct Address { var city: String }
var first = Address(city: "Mumbai")
var second = first
second.city = "Pune"
// first.city remains "Mumbai"

class Cart { var itemCount = 0 }
let a = Cart()
let b = a
b.itemCount += 1
// a.itemCount is now 1; a and b refer to the same instance
TechnicalEasyMobile Engineer

19. What is a Retrofit Converter Factory?

Model answer

A Retrofit Converter.Factory tells Retrofit how to turn an HTTP ResponseBody into a Kotlin/Java type, and how to turn a request value into a RequestBody.

flowchart LR
    A[HTTP response body] --> B[Converter Factory]
    B --> C[App model]
    D[Request model] --> E[Converter Factory]
    E --> F[HTTP request body]
Diagram
  • You register factories on Retrofit.Builder, for example MoshiConverterFactory.create() or GsonConverterFactory.create().
  • Retrofit asks the registered factories, in order, for a converter that supports the requested type. The first matching factory is used, so ordering matters when factories can handle overlapping types.
  • A factory can provide a response converter, a request converter, or both. For example, a JSON converter maps response JSON to a data class and serializes a data class for a request.
  • Use a custom factory when the API uses a format or mapping that existing converters do not handle. It should handle supported types explicitly and return null for types it does not support.
  • It is separate from an OkHttp interceptor: converters handle body serialization, while interceptors handle request/response behavior such as headers, logging, or retries.
TechnicalEasyMobile Engineer

20. What are Retrofit interceptors?

Model answer

Retrofit is an HTTP client abstraction; interceptors are provided by its underlying OkHttp client. They inspect or modify requests and responses as they pass through the network stack.

  1. Application interceptors run once for a logical call. They are useful for common headers, request logging, and response handling.
  2. Network interceptors run at the network exchange level. They can inspect the actual network request and response, but have more restrictions and may run differently around redirects or retries.
  3. An interceptor receives a request, can create a modified request, and passes it onward with chain.proceed(request). It can also inspect the returned response.
  4. Common uses include authentication headers, correlation IDs, caching directives, and debug logging. I would avoid logging credentials or sensitive personal data.
  5. Interceptors are not a substitute for per-endpoint parameters when a value belongs to one specific API call. For that, Retrofit’s @Header or @HeaderMap is clearer.
flowchart LR
    A[Retrofit service call] --> B[OkHttp application interceptor]
    B --> C[OkHttp network interceptor]
    C --> D[HTTP server]
    D --> C
    C --> B
    B --> A
Diagram

Practice these out loud, don't memorise them

Reading an answer is not the same as being able to give one under pressure. ChannelPulse plays the interviewer, asks the follow-ups, and scores each answer with feedback and a model answer so you can hear the gap between what you said and what lands.

Get ChannelPulse Browse all questions