Skip to content
Tech Interview Prep

Real Interview Questions for the Data Engineer at Spotify

New

Practice MCQs

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

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

MCQ-1A Spotify playlist name is stored on three asynchronously replicated copies in Stockholm, Dublin and New York. Stockholm sets the name to `Roadtrip` at t=0.0 s and Dublin sets it to `Road Trip Mix` at t=0.4 s, each on its local copy. Replication lag is 2 s, each replica stamps writes with its own clock, and no further writes arrive. Once replication drains, what do the three replicas hold?
Difficulty: Medium
MCQ-2A follow store for Spotify playlists runs as three replicas: two in Stockholm and one in Dublin, with the write primary in Stockholm. A fibre cut isolates the Dublin replica for 40 minutes. Product requires that a follow never appears saved on one device and missing on another, and Dublin listeners must still load their libraries. Which decision does CAP force for Dublin during the partition?
Difficulty: Medium
MCQ-3A play-event pipeline ingests 300,000 events per second, each record with 40 columns, and lands them in a data lake. The nightly job reads only track_id and ms_played to compute per-track totals, and the ingest path cannot wait on file rewrites. Which storage choice fits both paths?
Difficulty: Medium
MCQ-4A nightly job rewrites the 2024-05-06 partitions of a Hive-backed play events table in Spotify's lake. It fails after writing 60% of the new files, and an analyst's dashboard query runs at the same moment. What does the analyst see if the table is an Iceberg table?
Difficulty: Easy
MCQ-5A Spotify batch job counts streams per `track_id` over 2 TB of daily play events, running 300 mappers and 40 reducers. Each mapper emits one (`track_id`, 1) pair per event, and the reduce step needs every pair for a track in one place to produce its total. Which step forces data across the network, and what does it do?
Difficulty: Easy
MCQ-6Spotify's play log holds these rows sorted by timestamp, with two users interleaved: `u1` plays A, `u2` plays B, `u1` plays B, `u1` plays C, `u2` plays C, `u1` plays A, `u1` plays B, `u1` plays C. A job slides a window of three over each user's own events and counts sequences in a hash map. Which result is correct?
Difficulty: Medium
MCQ-7A weekly job builds a Top 50 playlist per country from the previous ISO week, Monday 2024-05-06 to Sunday 2024-05-12 UTC, and runs at 03:00 UTC on 2024-05-13. In country SE the 50th and 51st tracks both have 1,204 streams. Product requires exactly 50 tracks per playlist, no repeated tracks, and the same playlist when the job is rerun. Which ranking expression and filter does this?
Difficulty: Medium
MCQ-8A nightly CTE joins play_events (3,000,000 rows, one per play, keyed by user_id) to user_devices, which holds exactly one row per user per device the user has signed in on. Users average two devices, so each play matches once per device, and the join output is materialized before SUM(ms_played) is grouped by user_id. Which change keeps the job within memory and returns each user's true total?
Difficulty: Medium
MCQ-9A daily job left joins `play_events` (1,000,000 rows, one per play, with `user_id` and `track_id`) to `recommendation_impressions` on `user_id` and `track_id` to set `wasRecommended`. Impressions carry no `play_id`, and a user can be shown the same track several times a day, so the impressions table has 1,400,000 rows. Which change returns exactly one output row per play with the flag set correctly?
Difficulty: Medium
MCQ-10Spotify's `listens_daily` table holds one row per user and UTC `listen_date`, but a retried load wrote user 77's 2024-05-06 row twice. User 77's active dates are 2024-05-05, 05-06, 05-06 and 05-07. The job groups rows by `listen_date` minus `ROW_NUMBER() OVER (PARTITION BY user_id ORDER BY listen_date)` and keeps groups of three or more rows. What does it return for user 77?
Difficulty: Hard
MCQ-11A Spotify ingestion job validates rule strings such as `([)]` before loading them, with indexes starting at 0. Checker A keeps a stack of open brackets and pops on each close. Checker B keeps only an integer depth that rises on open and falls on close. What does each checker report for `([)]`?
Difficulty: Medium
MCQ-12A Spotify data engineer adds a helper that computes a Fibonacci-style score, `f(n) = f(n-1) + f(n-2)` with `f(0) = 0` and `f(1) = 1`, and calls it once for `f(30)` in Python 3.12. The helper uses the naive recursive definition with no caching, and each call to the function counts as one call. How many calls does that single invocation of `f(30)` make, including the top-level call?
Difficulty: Medium
MCQ-13A Spotify job marks a listener session as skip-heavy when any 6 consecutive plays contain at least 5 skips. One user's 12 plays arrive in order as flags `0,1,1,0,1,1,1,0,0,1,1,0` (1 means skipped). The job makes one pass per user and updates the count as the window slides. What is the largest skip count any 6-play window reaches, and where?
Difficulty: Medium
MCQ-14A Spotify Data Engineer job must return the top K tracks by play count from 50 million rows in one pass, with memory held to K candidates at a time. Which structure does the job keep while it scans the rows?
Difficulty: Medium
MCQ-15A rolling-active-users job reports distinct users over the trailing 7 days for each of 365 dates. Each day's play partition holds 50 million raw rows, and the job recomputes every date with COUNT(DISTINCT user_id) over its 7 partitions. How many raw rows does the job read across the year?
Difficulty: Medium
MCQ-16Spotify's `song_streams` table has one row per stream with `user_id`, `track_id` and a UTC `stream_ts`. On 2024-05-06, user 12 has 4 rows across tracks A and B, user 40 has 3 rows on track A, and user 77 has 2 rows on track A. The DAU dashboard runs `SELECT COUNT(*)` over that day's rows. What should DAU be for the day, and which aggregate computes it?
Difficulty: Easy
MCQ-17A Spotify pipeline counts play events in 60-second event-time windows. The watermark is the largest event time seen minus 90 seconds, and allowed lateness keeps a window's state until the watermark passes its end plus 60 seconds. A buffered event stamped 12:00:45 arrives when the largest event time seen is 12:03:40. What happens to that event?
Difficulty: Medium

Curated: · Written: · Reviewed: