Skip to content
Tech Interview Prep

Real Interview Questions for the Software Engineer at Shopify

New

Practice MCQs

Answers count toward the Software Engineer and overall leaderboards; your latest answer to each question is the one that counts.

25 questions · Flow follows Relevance until this set has a learning order.

MCQ-1A rover starts at `(4, 2)` on a 5 by 5 grid with coordinates 0 to 4, facing east, and receives one forward move. Another rover occupies `(0, 2)`. What final state should the simulator report for the moving rover?
Difficulty: Easy
MCQ-2A gift-exchange service for five participants must produce a uniformly random assignment where nobody draws themselves, and every valid derangement must be equally likely. The current code generates one random permutation and swaps any self-draws with a random other recipient. Which replacement guarantees the required distribution?
Difficulty: Hard
MCQ-3A local URL shortener validates each URL, hashes it to a fixed 6-character base62 code, and appends the mapping to a JSON file. Two different validated URLs hash to the same code, and printed cards require every code to stay 6 characters. What should the shortener do when the second URL arrives?
Difficulty: Medium
MCQ-4A gift-exchange service caches recipient lookups in a capacity-3 LRU cache keyed by giver, with list order LRU to MRU. It runs `put A`, `put B`, `put C`, `get A`, then `put D`, where `get` counts as use. Which entry is evicted on the final put and what is the remaining LRU-to-MRU order?
Difficulty: Easy
MCQ-5An autocomplete trie stores counts at each terminal node for product (95), program (120), profile (80) and promise (30), inserted in the order promise, profile, product, program. A query for prefix `pro` with limit 2 must return the most frequent completions. Which pair and ordering should it return?
Difficulty: Medium
MCQ-6An account's `SearchHistory` class stores autocomplete frequencies from `record(term)`. It receives `record(" Shoe ")`, `record("shoe")`, and `record("")` in that order, and must keep one canonical entry per term. What state should it hold after those calls?
Difficulty: Medium
MCQ-7A bank service generates a transfer ID before sending a debit to a payment gateway, which applies it but loses the response and then returns `503` under load. The gateway deduplicates by that ID, so reusing it is safe while a new ID would debit again. Which retry decision avoids a duplicate debit without hammering the gateway?
Difficulty: Medium
MCQ-8A webhook service delivers `order.paid` events to a merchant endpoint that deduplicates by event ID. The endpoint applies an event but times out before acknowledging it, and it handles other deliveries normally with no ordering requirement across events. Which retry strategy should the service use for this delivery?
Difficulty: Medium
MCQ-9A photo service stores uploads in an in-memory tree where `/photos` contains `raw` and `approved`, and `raw` contains its own `approved`. The current directory is `/photos/raw` and the user runs `cd ../approved`. What should the new current directory be?
Difficulty: Easy
MCQ-10An in-memory filesystem has `/docs/report.txt` and `/docs/sub`, with current directory `/docs/sub`. The invariant is that the current directory must always name an existing directory. A user runs `remove /docs`. What should the filesystem do?
Difficulty: Medium
MCQ-11A warehouse router plans routes on a 100 by 100 grid where entering a cell costs between 0.5 and 5 depending on terrain, with orthogonal moves only. It must return an exact shortest path for each of many queries within 50 ms, and no admissible heuristic is available. Which algorithm should it use?
Difficulty: Medium
MCQ-12A robot moves orthogonally on a 3 by 3 table shown as `S . # / . # . / . . G`, where `#` blocks a cell and `G` is the goal. What is the length of the shortest path from `S` to `G` in moves?
Difficulty: Easy
MCQ-13A candidate spent three years building payment reconciliation for small retailers, chose a platform team to learn high-volume checkout, and now applies to Shopify to work on merchant tools at scale. At the interview they are asked `Why do you want this job?` Which answer best fits this candidate's actual path?
Difficulty: Easy
MCQ-14A `Cart` class holds items and one discount code, and `total()` is called after adding two $50 items, applying a 10% code, then removing one item. Tax is 8% on the discounted subtotal of items still in the cart. What should `total()` return?
Difficulty: Medium
MCQ-15A validator receives `s = "([)]"` from a template parser and must decide whether it is balanced. It pushes each opener and pops only when the closer matches the stack top. What should it return for this input?
Difficulty: Medium
MCQ-16A log parser must find the first non-repeating character in `stressful` for a routing key, scanning left to right and counting every character before choosing. What should it return?
Difficulty: Medium
MCQ-17An undirected graph has edges A-B, A-C, B-D, C-D, and D-E. A BFS starts at `A`, marks a node visited only when it is dequeued, and enqueues every unvisited neighbour of the dequeued node. How many times is `D` enqueued before it is first dequeued?
Difficulty: Medium
MCQ-18A dependency graph has edges `A->B`, `B->C`, `C->B` and `C->D`, and a recursive DFS from `A` must return a topological order or report a cycle. The current DFS has no visited tracking and never returns on this graph. What adaptation lets it terminate and report the cycle?
Difficulty: Medium
MCQ-19A library branch holds one title in two copies at the same branch, both in general circulation with no holds pending. One copy is on a take-home loan and the other sits on the shelf. A member at that branch requests a take-home loan of that title. What should the circulation service do?
Difficulty: Easy
MCQ-20A flash sale offers 100 units of one SKU to 5,000 simultaneous checkout requests across multiple app servers sharing one database. Overselling even one unit is unacceptable, and checkout latency must stay low during the spike. Which inventory check should each request use?
Difficulty: Medium
MCQ-21A word guessing game uses secret `planet` with six attempts, where each new letter costs one attempt, repeated guesses are free, and input is lowercased before checking. The player enters `P`, then `l`, then `P` again, then `x`. What is the game state after the fourth entry?
Difficulty: Medium
MCQ-22A candidate began by automating stock counts in a family bakery's spreadsheet, taught themselves SQL to reconcile supplier invoices, and now maintains an open-source inventory import tool. At a Shopify interview they are asked `How did you get into tech?` Which origin story best fits this candidate's actual path?
Difficulty: Easy
MCQ-23A checkout team grew traffic 50% last quarter but orders only 10%, as p95 latency rose 400ms to 900ms and conversion fell 3.0% to 2.2%. Next quarter traffic is forecast to grow 20% from existing campaigns, the paid budget caps traffic at that forecast, a latency fix restoring 3.0% conversion takes six weeks, and no new hires are approved. What plan best reaches the 40% order-growth target?
Difficulty: Hard
MCQ-24A pull request refactors checkout totals for readability and passes the existing suite, but it changes rounding on discounted orders and no test covers that case. The checkout path cannot be feature-flagged, there is no rollback plan, and a peak sale starts tomorrow. Should it go to production now?
Difficulty: Medium
MCQ-25A simulator applies alternating moves `X0 O1 X2 O5 X3 O6 X4 O7 X8` on a row-major 3x3 board, checking rows, columns and diagonals after each move. The board is full after the final move. What result should it report?
Difficulty: Medium

Curated: · Written: · Reviewed: