Skip to content
Tech Interview Prep

Real Interview Questions for the Backend Software Engineer at Spotify

New

Practice MCQs

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

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

MCQ-1A Spotify backend service computes the longest run of distinct characters in a track title with a sliding window, and the scan is at `left = 0`, `right = 3` on `abcabcbb`. The window `abc` holds indices 0 to 2, and the hash map records `last['a'] = 0`, `last['b'] = 1` and `last['c'] = 2`. The character at `right` is `a`, which repeats inside the window and must leave it before the window extends again. What should `left` be set to?
Difficulty: Easy
MCQ-2A log holds three users' visits, each sorted by time: user X visits `home`, `home`, `home`, `cart`; user Y visits `home`, `home`, `home`; user Z visits `home`, `cart`, `pay`. The team keys a hash map on the three-site tuple and adds one to a tuple's count for each user whose visits contain it in order, with gaps allowed, counting each user at most once. What count does the most frequent tuple reach?
Difficulty: Medium
MCQ-3The upload service for playlist cover images keeps the byte size of every upload from the last 10 minutes so an auditor's dashboard can show the exact median size and the live count. About 40,000 uploads arrive per minute, so the window holds roughly 400,000 sizes, and the median is read once per second. Expired sizes are removed by value, and many uploads share the same size. Which structure should hold the window?
Difficulty: Medium
MCQ-4A playlist-image upload service records the processing time of each chunk and reports the mean of the last 4 chunks. It keeps them in a fixed-size queue with a running sum so each call is O(1). Chunk times in ms arrive as 12, 24, 36, 48, then 62 after one chunk is retried. The sum is decremented when the oldest value leaves the queue. What mean does the service report after 62 arrives?
Difficulty: Medium
MCQ-5A Spotify backend job reads the array `[1, 3, -1, -3, 5, 3, 6, 7]` and reports the median of every window of 3 consecutive values, in order from left to right. Which list of medians does the job output?
Difficulty: Medium
MCQ-6A playback service reports the mean of track-start latencies from the last five seconds. Samples arrive at 0, 2, 4, 6 and 8 seconds with values 120, 180, 90, 150 and 300 ms, and each report must be computed without rescanning older samples. What mean does the service report at t = 8 s?
Difficulty: Medium
MCQ-7A playlist API pod's p99 latency rose from 180 ms to 2.1 s at 14:04, four minutes after a 14:00 deploy. Database query p99 is still 60 ms, pod CPU is 35%, and the error count is zero. Trace spans show 1.9 s of each slow request waiting to check out a `db` connection. Which diagnosis should the on-call engineer confirm before changing anything?
Difficulty: Medium
MCQ-8A playback service receives a 200-byte state update from each device every 5 seconds over mobile links that drop about 3% of packets. The dashboard must show a position no more than 15 seconds stale. Which transport setting keeps that bound?
Difficulty: Medium
MCQ-9A friends feed must show a new listen within 30 seconds. One artist account has 4 million followers and emits a listen event about every 3 minutes, while a typical user has 150 followers and emits about 20 events an hour. Roughly 300,000 clients have the feed open at peak. Which delivery design keeps the 30-second bound without millions of writes per event?
Difficulty: Medium
MCQ-10A Spotify playlist endpoint builds its cache key by lowercasing parameter names, stable-sorting them by name, and joining with `&`, keeping every value of a repeated parameter. A client sends `/v1/playlists?Market=US&fields=name&sort=asc&fields=owner&market=SE`. Which cache key does the service produce?
Difficulty: Medium
MCQ-11A redirect resolver on an edge worker has 128 KB of memory and follows short-link chains where each hop is a node pointing to its target URL. A bad rule makes hop 7 point back to hop 2, and chains can run to 50,000 hops of 2 KB URLs. Which cycle check should the resolver use?
Difficulty: Hard
MCQ-12A shared playlist's queue is a singly linked list of nodes N1 to N8 in play order. A concurrent insert sets N8's next pointer to N4, creating a cycle. Cycle detection starts a slow pointer and a fast pointer both at N1, moving one node and two nodes per step. After how many steps do the two pointers first land on the same node, and which node is it?
Difficulty: Medium

Curated: · Written: · Reviewed: