Real Interview Questions for the Software Engineer at Walmart Global Tech
NewPractice MCQs
Answers count toward the Software Engineer and overall leaderboards; your latest answer to each question is the one that counts.
MCQ-1A Walmart pricing service runs an in-memory cache capped at 3 entries, with a 60-second TTL on every entry and LRU eviction. It writes keys A, B and C at 0, 1 and 2 seconds, reads A at 10 seconds, then writes D at 20 seconds, when no entry has expired. Which key does the cache drop to store D?
Answer to see the discussion.
MCQ-2A wallet service charges cards through a queue with at-least-once delivery. Each charge carries an idempotency key that the payment processor keeps in Redis with a 24-hour TTL. A worker can crash after the processor charges the card but before it acks, and the broker may redeliver after an outage of any length. A customer's charge was redelivered 40 days after the first attempt and charged twice. Which change stops the duplicate?
Answer to see the discussion.
MCQ-3Two threads share `int counter = 0` and `boolean turn = true`. Thread A has `mine = true` and thread B has `mine = false`, and both run `while (counter < 5000) { if (turn == mine) { counter++; turn = !turn; } }`. On HotSpot with the JIT enabled, B spins without ever seeing A's flip, so the counter stops at 1. Which change makes the two threads alternate strictly until the counter reaches 5000?
Answer to see the discussion.
MCQ-4A scheduler keeps tasks in a min-heap ordered by run time, with ties broken by insertion order. Tasks are added in this order: A at t=5, B at t=2, C at t=9, D at t=2. executeAll pops and runs every task, then clears the heap. What runs in the first call, and what does a second executeAll with no new tasks do?
Answer to see the discussion.
MCQ-5A checkout service must find two line items whose prices sum to 5 cents. Prices arrive as `[4, 3, 2, 1]`, and among tied pairs it must return the smallest i, then the smallest j. Which indices should it return?
Answer to see the discussion.
MCQ-6A row of plants has pesticide levels `[6,5,8,4,7,10,9]`. Each day, every plant with more pesticide than its left neighbour dies, using the row as it stood at the start of that day, and the first plant never dies. How many days pass until no plant dies?
Answer to see the discussion.
MCQ-7A UPI-like service debits the payer's account in the payer bank's ledger database, then calls the payee bank's credit API over HTTP. The credit call times out after the debit has committed, and the payee bank deduplicates on a request reference it stores. Which change keeps every rupee accounted for while the payee's credit may or may not have applied?
Answer to see the discussion.
MCQ-8A checkout service shares one map of SKU to reserved quantity across 8 request threads. The table has 16 buckets, and two threads insert different SKUs that both hash to bucket 5 while that bucket is empty. Which operation does `ConcurrentHashMap` perform for the first insert into bucket 5?
Answer to see the discussion.
MCQ-9A Spring Boot 3.3 service has its main class `OrderApplication` in package `com.walmart.orders`, annotated only with `@SpringBootApplication`. `OrderService` needs a `@Service` `PriceCalculator` that lives in `com.walmart.pricing`, and a `@Component` `AuditFilter` lives in `com.walmart.orders.audit`. What does startup do?
Answer to see the discussion.
MCQ-10A store inventory service keeps on_hand for one SKU in Postgres and receives 400 checkout requests per second for it while 3 units remain. Each request reads on_hand in one statement, checks it in the app, then writes the decrement in a second statement, and each Postgres round trip takes 5 ms. Two requests read 1 and both commit, leaving on_hand at -1, and p99 must stay under 50 ms. Which change keeps stock from going negative?
Answer to see the discussion.
MCQ-11An order service keeps one status per order in a single orders row. The payment, warehouse and carrier services each write to it directly, with no ordering between them. The carrier's DELIVERED event (sequence 9 for this order) arrives before the warehouse's PICKED event (sequence 6), and the row ends as PICKED with the order marked undelivered. Which change keeps the row correct for any arrival order?
Answer to see the discussion.
MCQ-12A checkout service calls `gateway.charge(order)` and must not change when a wallet payment method is added. `PaymentGateway` builds a map from `methodCode` to `PaymentStrategy` at startup, and each order carries a string such as `UPI` or `BANK_TRANSFER`. Which change makes wallet orders work without touching the caller?
Answer to see the discussion.
MCQ-13A file sync service stores each directory as a tree node with a children map. The directory /media/2024 holds 1,200,000 entries and sits four levels below root. Clients list directories at 6,000 requests per second, and users rename whole subtrees about once a minute while p99 must stay under 50 ms. Which design meets both constraints?
Answer to see the discussion.
MCQ-14A parcel service assigns 300 new parcels per second at peak to 40,000 active delivery partners. Partners sit in 80 geo cells of 500 partners each, and each parcel is scored only against partners in its own cell. How many partner comparisons per second does the cell design perform at peak?
Answer to see the discussion.
MCQ-15A music app caches track metadata in an LRU map with capacity 2, built from a hash map and a doubly linked list so that get and put are O(1). The app runs put(101), put(205), get(101), put(205) with refreshed metadata, then put(330). Which entry does the final put evict?
Answer to see the discussion.
MCQ-16A checkout service calls a fraud API synchronously before confirming each order. That call adds 400 ms at p99 to checkout, and the fraud API is unavailable for 2% of requests. The service must answer 99% of checkouts within 300 ms and stay available for 99.9% of orders. Which design meets both targets?
Answer to see the discussion.
MCQ-17A search suggestion service caches up to 50,000 entries in an LRU built from a hash map from key to node and a singly linked list, most recent entry at the head. Every hit must move its node to the head, and hits fall uniformly across all 50,000 positions. What does one hit cost in list node visits?
Answer to see the discussion.
Curated: · Written: · Reviewed: