Your country

Tools that support it use your country for local currency, number formats, units and paper size. Your choice is saved only in this browser.

Type a name or a two-letter code. Use the up and down arrow keys to move through the countries, Enter to choose one and Escape to close.

Low-Level Design (Object-Oriented Design) Module 15

Case studies: platforms and apps interview questions

Interview questions on “Case studies: platforms and apps”: warm-ups, then what each harder question tests and how a good answer starts.

24 questions: 6 warm-ups and 18 with model answers · Levels: Fresher to staff

Warm-up questions

Short questions with short answers, each answered in full.

  1. Fresher to mid

    Why does a chat application order messages by a sequence number per conversation rather than by timestamps?

    Because clocks disagree and a counter cannot. A phone's clock can be minutes off, so sorting by the sender's time can put a reply before the question it answers, and two servers whose clocks differ by a few milliseconds can do the same with a quick reply. Arrival order differs on every phone, because pushes take different paths. A sequence number is given by one owner, the conversation, when it stores the message, so every phone sorts the same way and can also see a gap: a phone holding 40 and 42 knows that 41 is missing and asks for it. The time is still stored for display next to the message, but never used to order it. One counter per conversation is enough, because no phone needs an order across conversations.

    From the lesson Low-level design: chat application

  2. Fresher to mid

    Why model a kanban board's columns as the states of a workflow, rather than as a status string on each task?

    Answered in the lesson Low-level design: task manager and kanban board

  3. Fresher to mid

    Why does a version store hash an object's type and size together with its content?

    So that an ID names exactly one object of one kind. If only the content were hashed, a file whose bytes happened to equal a tree's encoding would get the tree's ID, and the store could hand back a tree where a file was expected. Hashing a header with the type keeps a blob and a tree with equal bytes apart. The size makes the encoding self-delimiting: a reader knows where the header ends and how many bytes of content follow, so the bytes can be checked against the ID when they are read back. Git hashes the same header before the content: the type, a space, the length and a zero byte. One consequence surprises people: a blob's ID is not the plain SHA-256 of the file, so a checksum tool shows another number.

    From the lesson Low-level design: mini version control

  4. Fresher to mid

    Why does a cricket scorecard design store valid balls rather than overs written as 19.4?

    Answered in the lesson Low-level design: live cricket scorecard

  5. Fresher to mid

    What problem does the Bridge pattern solve in a notification service with several kinds of message and several channels?

    It stops the classes from multiplying. Kinds of message (sign-in codes, order updates, promotions) and channels (SMS, email, push) change for different reasons: a new campaign adds a kind, a new provider adds a channel. With a class for every pair, three kinds and three channels need nine classes, and every new channel adds one per kind. The Bridge splits the two: a notification type decides what to say, how urgent it is and how long it is worth delivering; a channel delivers a short or a long text. The service asks the type for content in the channel's form and hands it to the channel. Three and three then need six classes, and a new channel is one class that every kind can use at once.

    From the lesson Low-level design: notification service

  6. Fresher to mid

    Why does an online exam take each section's deadline from the server's clock, fixed when the section opens?

    Because every candidate must get the same time, and only the server's clock is the same for all of them. A browser's clock can be minutes wrong, and a browser can be changed by the person using it, so a deadline checked there can be moved. Fixing the deadline once, when the section opens, means that nothing the browser does later can move it: a disconnect costs the candidate only the minutes they were away, and a reconnect does not restart the section. The browser still shows a countdown, but each answer from the server corrects it with the seconds left. Code that needs the time asks an injected clock, so tests can move time by hand instead of waiting.

    From the lesson Low-level design: online exam with negative marking

Questions with model answers

What each question tests, the first step of a good answer and the follow-ups to expect.

  1. Mid to senior

    Users report that a message sometimes appears twice for everyone in a group, usually when the sender's phone switches from Wi-Fi to mobile data while sending. Explain how this happens, then design the fix on the phone and on the server.

    What it tests
    Seeing a retry after a lost reply as the cause, idempotent sends keyed by sender and client id, the order of the server's checks, and how long the keys are kept.
    First step
    Draw the send as three steps: the request reaches the server, the server stores and pushes the message, and the reply travels back. If the network changes during the third step, the phone never hears back and sends again. Then ask what the second request could carry that tells the server it has seen this message before.
    Follow-ups

    From the lesson Low-level design: chat application

    Model answer, Pro. Model answers open with any pass; prices are in the notice on this page.

    Opening the model answers with your pass…

    Model answers open with any MySmartCoPilot pass.

    • Pro pass · 1 week₹79$2.99
    • 30 days₹179$5.99
    • 1 year₹1,699$45

    One payment; nothing renews unless you choose to. The price shown is the total you pay: no fees or charges are added at checkout.

    It also opens every other in-depth part in Learn and every Pro tool. Sales are final, except where the law gives you a right to withdraw, for example in the EU and the UK (refund policy).

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 4 minutes
  2. Mid to staff

    A group of 200 shows "read by N" under every message, and its receipts table grows by about two million rows a day. Redesign receipts so that storage stays small and the counts stay correct. What do you give up?

    What it tests
    Cumulative marks instead of a row per message, marks that only move forward, counting readers without a loop over members, late joiners, and what is lost with per-message rows.
    First step
    Check the estimate first: 5,000 messages a day, 199 recipients each, once for delivered and once for read, is about two million rows. Then notice that people read a conversation in order, so one number per member, "read up to seq N", can stand for every read row of that member.
    Follow-ups

    From the lesson Low-level design: chat application

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 4 minutes
  3. Senior to staff

    A chat server holding 50,000 connections restarts. For a minute the new server is overloaded, and afterwards some users report missing messages from around the restart. Explain both problems and design what the phones and the server should do.

    What it tests
    Reconnect storms and jittered backoff, why a successful socket write is not a receipt, filling gaps by sequence number, and sizing the recovery with numbers.
    First step
    Separate the two problems. The overload is 50,000 phones reconnecting in the same instant; the missing messages are pushes written to sockets that died, which nothing told the phones about. Then put a number on the first: how many new connections a second can one server accept, and how long 50,000 take at that rate?
    Follow-ups

    From the lesson Low-level design: chat application

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 4 minutes
  4. Mid to senior

    Asha moves a card to Review. A minute later Ben moves it back to In progress because the review found a bug. Then Asha presses undo. What should happen, and how does your design decide it?

    What it tests
    Undo as a command with a precondition, versions on tasks, keeping the history append-only, and what to tell the person whose undo is refused.
    First step
    Ask what reversing Asha's move would do now. The card is in In progress because Ben put it there, so moving it back to where Asha found it would undo Ben's decision as well. Then name what the board can compare to notice this: the card's version when Asha's move finished, and its version now.
    Follow-ups

    From the lesson Low-level design: task manager and kanban board

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  5. Mid to senior

    A team's In progress column has a limit of 5 but holds 9 cards after a CSV import and two people dragging cards in separate browser tabs. Where did the design go wrong, and how do you make the limit hold on every path?

    What it tests
    Rules in the domain rather than the screen, one entry point for changes, checks that cover creates and imports, and concurrent requests against a count.
    First step
    List every way a card can enter the column: a drag in the screen, a create, an import, an API call, an undo. If the limit is checked in the screen, only the first path is covered. Move the check into the board, behind the one method that every path must call, and then ask what happens when two requests arrive together.
    Follow-ups

    From the lesson Low-level design: task manager and kanban board

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  6. Senior to staff

    Cards are ordered by a floating-point position, and a dropped card gets the midpoint of its neighbours. After many drags, users see two cards swap places on reload. Explain why, then design card order for columns of 5,000 cards.

    What it tests
    Floating-point precision, measuring a failure instead of guessing, the cost of renumbering, and choosing between gapped integers, exact keys and list order.
    First step
    Ask what happens to one gap when cards keep landing in the same place: each drop halves it. Then ask how many halvings a float can take before two neighbours get the same number, and what the database does with a tie. Only then compare the ways to store order by what a drop costs.
    Follow-ups

    From the lesson Low-level design: task manager and kanban board

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  7. Mid to senior

    A repository holds 2 million files in a directory tree about 6 levels deep, and a commit changes one file. How much does the commit write, and how do you find what changed between it and its parent without reading 2 million entries?

    What it tests
    Content-addressed trees, what one change rewrites along its path, comparing snapshots by skipping equal subtree IDs, and the cost of very wide directories.
    First step
    Follow the changed file up to the root: its blob is new, and so is every tree on its path, because each names the changed one below it. Count them. Then ask what two trees with the same ID tell a comparison of the two commits.
    Follow-ups

    From the lesson Low-level design: mini version control

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  8. Senior to staff

    Users delete branches and abandon experiments, and the object store keeps growing. Design garbage collection: which objects may be deleted, and what protects a commit made a minute ago on a detached HEAD, or a branch deleted by mistake?

    What it tests
    Reachability from refs as the liveness rule, marking and sweeping the object graph, a log of past ref values, grace periods, and races with writers.
    First step
    Define live first: an object is live when a branch, a tag, HEAD, the index or a recent entry in a log of past ref values reaches it through commit, tree and blob links. Everything else is garbage, but only after a grace period, because a writer may be about to name a new object.
    Follow-ups

    From the lesson Low-level design: mini version control

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  9. Senior to staff

    Two long-lived branches, main and release, have merged each other several times. Merging release into main now finds two best common ancestors. Explain how that happens, and what your design does instead of picking one at random.

    What it tests
    Best common ancestors in a graph, criss-cross histories, why a time-based or random choice is unsafe, and merging the bases into one tree first.
    First step
    Draw the smallest history that produces it: main and release each make a commit, then each merges the other's commit. Show that neither commit descends from the other, so both are best common ancestors, and say what a three-way merge needs: exactly one base.
    Follow-ups

    From the lesson Low-level design: mini version control

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  10. Mid to senior

    Twenty minutes after a wicket alert went to every subscriber, the scorers find that the ball on which Esha was bowled was a no ball, so she is not out. Your design keeps the scorecard as running totals. What breaks, and how do you redesign it so that a correction is routine?

    What it tests
    Seeing how far one delivery reaches into derived figures, keeping a log of deliveries as the truth, and publishing a correction that every subscriber can apply.
    First step
    List what the wrong ball changed: the wicket count, Esha's line, the fall of wickets, the bowler's wickets, the next batter's figures, the no-ball penalty and the over's count of valid balls. Then ask what would make all of them move together when one delivery is fixed.
    Follow-ups

    From the lesson Low-level design: live cricket scorecard

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  11. Mid to staff

    In a club match the umpire lets an over run to seven valid balls, and the batter is out off the seventh. Your scoring app ends an over after counting six valid balls. What does it show, what should it show, and what do you change?

    What it tests
    Knowing that the umpire's count is final, recording observed facts instead of deriving them, and turning rules the program cannot enforce into warnings.
    First step
    Read Law 17.5.1: the over as counted by the umpire stands. Then follow the seventh ball through an app that counts to six: which over does it land in, whose figures get the wicket, and what happens to every later delivery?
    Follow-ups

    From the lesson Low-level design: live cricket scorecard

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  12. Mid to senior

    Your live score app shows 183/4 while the ground shows 176/4. Updates reach phones through a message queue that delivers at least once. Find the cause, and fix it without making the publisher slower.

    What it tests
    Recognising duplicated deltas, making updates idempotent with full state and a version, and handling corrections and slow clients.
    First step
    Compare the two scores: 7 runs too many, the same wickets. A queue that delivers at least once repeats some messages, so ask what the app does with each update. If it adds the runs, every duplicate adds them again.
    Follow-ups

    From the lesson Low-level design: live cricket scorecard

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  13. Mid to senior

    Customers report getting the same shipping SMS twice, a minute apart, on days when the SMS provider is slow. Explain the cause, then fix it without losing any messages.

    What it tests
    Seeing a retry after a lost reply as the cause, idempotency keys honoured by the provider, keeping retries for temporary failures, and why a dead letter may have been delivered.
    First step
    Ask what the service saw for the first attempt. On a slow day the provider can deliver a message and then answer too late, so the service records a timeout and tries again. The fix cannot be "retry less", because real failures then go undelivered; the second attempt must be recognisable as the same message.
    Follow-ups

    From the lesson Low-level design: notification service

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  14. Mid to staff

    Product asks for quiet hours from 21:00 to 08:00 for every user worldwide, and a cap of three promotions a day. Design both, and decide what happens to sign-in codes, order updates and promotions that arrive during quiet hours.

    What it tests
    Rules evaluated in each user's own time, windows that cross midnight, stated exemptions with reasons, and caps counted by the user's calendar day.
    First step
    Fix whose clock the rule uses: the user's, from their time zone, not the server's or UTC. Then write the window as a rule that crosses midnight, and decide each kind's policy with a reason before any code: a code someone just asked for cannot wait until morning.
    Follow-ups

    From the lesson Low-level design: notification service

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  15. Senior to staff

    Every few days the SMS provider is down for about 30 seconds, and each time a few hundred notifications end up as dead letters. Size a retry policy that rides out such outages, and say what the dead-letter list is for.

    What it tests
    Backoff with jitter sized from the outage's length, the cost in delay, retry ceilings, and dead letters as a work queue with replays that cannot duplicate.
    First step
    Add up the waits the current policy allows. If its attempts and delays add up to less than 30 seconds, every delivery that fails at the start of an outage exhausts its attempts inside it. So the policy must be sized so that its waits, on average, outlast the outages you see.
    Follow-ups

    From the lesson Low-level design: notification service

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  16. Mid to senior

    A candidate's connection drops for the last 4 minutes of a 30-minute section. On reconnecting, the browser replays 9 queued saves: two are for the same question and arrive out of order, and all were made before the deadline by the browser's clock. What does the server keep, and why?

    What it tests
    Idempotent saves with revisions, the server's clock as the only judge of deadlines, and a written policy for answers queued during an outage.
    First step
    Name the two keys of every save: the question and the revision the browser increments. Then say which clock decides the deadline: the server's, never the time a browser attaches. Apply both rules to the nine saves before discussing whether the policy is fair.
    Follow-ups

    From the lesson Low-level design: online exam with negative marking

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  17. Senior to staff

    After the exam closes, one question turns out to have two right options, and the exam's owners decide to accept both for everyone. How do you score 200,000 attempts again and publish ranks that anyone can reproduce?

    What it tests
    Results as a pure function of key, scheme and stored answers, versioned keys, exact arithmetic, and proving that only the intended attempts changed.
    First step
    List what a result depends on: the exam's version, the key, the marking scheme and each attempt's saved answers. If all four are stored, scoring again is the same function with a new key version, not a patch to the totals.
    Follow-ups

    From the lesson Low-level design: online exam with negative marking

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  18. Fresher to senior

    A numeric question's key is 2.35 with a tolerance of 0.05, so 2.30 and 2.40 must both be accepted. Your implementation accepts 2.40 and rejects 2.30. Explain why, and design the check you would ship.

    What it tests
    Binary floating point and decimal input, validation at save time, absolute and relative tolerances, and the edge cases a test should pin down.
    First step
    Write out the two differences as the code computes them, in binary floating point, before changing anything: one lands just under 0.05 and the other just over it. Then ask what the candidate actually typed, a decimal string, and keep it exact.
    Follow-ups

    From the lesson Low-level design: online exam with negative marking

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 2 minutes

All Low-Level Design (Object-Oriented Design) interview questions · The Low-Level Design (Object-Oriented Design) track

Quick answers and tool search

Type to search tools or to get a quick answer, for example 18% of 2500. Use the up and down arrow keys to move through the results, Enter to choose, and Escape to close.