Data and AI interview questions

Data and AI interviews test SQL and coding, statistics and machine learning concepts, and ML system design. Expect follow-ups on how you would measure a model, what breaks in production, and why you chose one approach over another.

24 questions below, each one a practice interview: the AI interviewer asks it out loud, follows up on your answer, and sends you a scored feedback report.

Practise free with the AI interviewer

Behavioral questions

Telling a Stakeholder Their Metric Misleads

Behavioral · Medium · 20 min · Free to practise

A behavioral interview for data analysts and data scientists about telling a stakeholder that a number they rely on is misleading.

Be ready to discuss:

  • A time a metric someone senior cared about was giving the wrong picture: what it was, how you noticed and how you proved it.
  • How you raised it, how they reacted at first, and how you handled disagreement or defensiveness.
  • What you proposed instead, and what changed in how the team measured or decided afterward.
  • A time you were the one attached to a flawed number, or got the analysis wrong, and what you learned.

Use the STAR method (situation, task, action, result) with concrete specifics: real numbers, the decision at stake and the outcome.

Practise this question with the AI interviewer

Coding questions

See all coding questions

Two Sum

Coding · Easy · 20 min · Free to practise

Given an array of integers nums and an integer target, return the indices of the two numbers that add up to target.

You may assume exactly one valid answer exists, and you may not use the same element twice.

Example

Input: nums = [2, 7, 11, 15], target = 9
Output: [0, 1]

Discuss your approach out loud before coding. What is the brute-force complexity? Can you do better?

Practise this question with the AI interviewer

Sessionize Clickstream Events

Coding · Medium · 35 min · Free to practise

A product analytics team at an online learning site wants to turn raw clickstream events into sessions.

Write sessionize(events, gapSeconds). Each event is (userId, timestampSeconds); the list is not sorted and may mix users. For each user, events belong to the same session while the time since that user's previous event is at most gapSeconds; a longer gap starts a new session. Return every session as (userId, startTimestamp, endTimestamp, eventCount), sorted by userId, then by startTimestamp.

Example (gapSeconds = 1800)

  • Events: ("u1", 0), ("u1", 600), ("u2", 100), ("u1", 3000), ("u1", 3100), ("u2", 2000)
  • Output: ("u1", 0, 600, 2), ("u1", 3000, 3100, 2), ("u2", 100, 100, 1), ("u2", 2000, 2000, 1)

A gap of exactly gapSeconds stays in the same session. A user with a single event has one session of zero length.

Constraints: up to 1,000,000 events and 100,000 users; timestamps are non-negative integers. Use any language.

Before coding, say how you will group and order the events and what the time and memory cost is. Then discuss how the approach would change if events arrived as a live stream, slightly out of order.

Practise this question with the AI interviewer

Build a Weekly Retention Cohort Table

Coding · Medium · 35 min

A subscription app's growth team wants a weekly retention table built straight from raw data, without an analytics tool.

Write retentionCohorts(signups, activity, asOfDay, numWeeks).

  • signups: list of (userId, signupDay). Days are integers counted from launch (day 0).
  • activity: list of (userId, day), one row per active user-day, in any order. It may contain users with no signup row and days before a user's signup; ignore both.
  • A user's cohort is signupDay // 7. Their week k covers days signupDay + 7k through signupDay + 7k + 6, relative to their own signup.
  • For every cohort that has at least one signup, return (cohortWeek, cohortSize, counts) where counts[k] is the number of cohort members active at least once in their week k, for k from 0 to numWeeks - 1. If any member's week-k window ends after asOfDay, that week is not fully observed: report -1 for it.

Example (asOfDay = 20, numWeeks = 3)

  • Signups: (a, 0), (b, 3), (c, 8)
  • Activity: (a, 2), (a, 9), (b, 3), (b, 12), (c, 8), (c, 20), (x, 5), (a, 15)
  • Output: (0, 2, [2, 2, -1]), (1, 1, [1, -1, -1])

Up to 500,000 signups and 20,000,000 activity rows. Explain your approach and its cost before coding, and say why the -1 rule matters to whoever reads the table.

Practise this question with the AI interviewer

Compute ROC AUC from Scratch

Coding · Medium · 35 min

A team at a lending startup cannot install libraries in its scoring sandbox and needs to compute the ROC AUC of a classifier itself.

Write rocAuc(scores, labels). scores are model outputs (any real numbers, higher means more likely positive) and labels are 0 or 1, the same length. Return the probability that a randomly chosen positive example is scored higher than a randomly chosen negative one, where a tie in score counts as half. If there are no positives or no negatives, the AUC is undefined: signal that clearly instead of returning a number.

Example

  • scores = [0.9, 0.8, 0.8, 0.3, 0.1], labels = [1, 0, 1, 0, 0]
  • Positive-negative pairs: 6. The 0.9 positive beats all three negatives (3); the 0.8 positive ties one negative and beats two (2.5). AUC = 5.5 / 6, about 0.9167.

Constraints: up to 2,000,000 examples, many tied scores. Comparing every positive with every negative is too slow at this size, so aim for O(n log n).

Start from the pairwise definition, then explain how sorting gets you there and how you handle ties. Test with your own edge cases.

Practise this question with the AI interviewer

Implement K-Means Clustering

Coding · Medium · 40 min

A retail analytics team wants to cluster stores by two numbers (say, average basket size and weekly visits) and needs k-means written by hand for an environment with no numeric libraries.

Write kMeans(points, initialCentroids, maxIterations). Points and centroids are lists of 2D coordinates. Repeat until no point changes cluster or maxIterations is reached:

  1. Assign each point to its nearest centroid by Euclidean distance; on a tie, choose the lower centroid index.
  2. Move each centroid to the mean of its assigned points. A centroid with no points keeps its previous position.

Return the final centroids and each point's cluster index.

Example

  • Points: (1,1), (1,2), (2,1), (8,8), (9,8), (8,9); initial centroids (1,1) and (1,2); maxIterations = 10.
  • After the first pass the second centroid moves toward the far group; the run converges to centroids about (1.33, 1.33) and (8.33, 8.33), with clusters [0, 0, 0, 1, 1, 1].

Up to 100,000 points and 50 clusters. Explain the cost per iteration before coding. Afterward, be ready to discuss how you would choose initial centroids and k, why the features' scales matter, and what k-means assumes about cluster shape.

Practise this question with the AI interviewer

SQL: Subscription Churn by Plan

Coding · Medium · 35 min · Free to practise

You are a data analyst at Platewise, a meal-planning app sold as a monthly subscription on three plans. The growth lead has heard that "Premium is bleeding customers" and wants numbers before a pricing meeting.

The tables are on the left of the editor: plans, customers and subscriptions. A customer can hold more than one subscription over time; ended_on is empty while a subscription is still running.

Your interviewer will ask for a few queries in turn, starting with how many subscribers each plan has at the end of June 2026 and building toward June's churn. Write each query in the editor and run it; the database is rebuilt before every run.

Talk through as you go

  • How you define "active" and "churned", and why that definition matters.
  • Edge cases in the data: dates on the boundary, customers who switch plans, people who join and leave in the same month.
  • Whether the result answers the question the growth lead actually has.
Practise this question with the AI interviewer

Resolve Duplicate Customer Records

Coding · Hard · 45 min · Free to practise

A home-services marketplace merged two customer databases and now has duplicate people. You are asked to group records that refer to the same customer.

Each record has id, name, email, phone and zip; any of name, email or phone may be empty. Normalize before comparing:

  • email: trim and lowercase;
  • phone: keep digits only, then the last 10 digits;
  • name: lowercase, remove punctuation, collapse spaces.

Two records match when they share a non-empty email, or share a non-empty phone, or have the same zip and names within an edit distance of 1 (one insertion, deletion or substitution). Matching is transitive: if A matches B and B matches C, all three are one customer. Return the groups as sorted lists of ids, ordered by their smallest id.

Example

  • 1: Ana Souza, ana@ex.com, (555) 010-2000, 30301
  • 2: Anna Souza, (no email), (no phone), 30301
  • 3: J. Okafor, jo@ex.com, 555-010-3000, 60601
  • 4: Jide Okafor, " JO@ex.com", (no phone), 10001
  • 5: Mei Lin, (no email), 5550102000, 94105
  • 6: Mei Lin, (no email), (no phone), 73301
  • Output: [1, 2, 5], [3, 4], [6]

Up to 200,000 records; one zip can hold 5,000 of them. Comparing every pair is too slow: explain how you avoid it before you code.

Practise this question with the AI interviewer

SQL: Seller Order Streaks

Coding · Hard · 40 min

You are an analyst at Tallowmade, a marketplace for handmade goods. The seller-success team wants to reward consistency: sellers who make sales day after day, not only big one-off weeks.

The tables are on the left of the editor: sellers and orders. Refunded orders stay in orders with status = 'refunded', and a seller can have several orders on the same day.

Your interviewer will ask you to rank sellers by revenue, then find each seller's longest run of consecutive days with at least one sale, with the dates it started and ended. The database is SQLite 3.27: window functions such as ROW_NUMBER() and RANK() work.

Talk through as you go

  • What counts as revenue and what counts as a sale day.
  • How you turn individual days into streaks, and how you test that your query is right.
  • Ties, and what the team should do with the result.
Practise this question with the AI interviewer

System Design questions

See all system design questions

Design a Feature Store for Delivery-Time Predictions

System Design · Medium · 40 min

Design the feature platform behind delivery-time estimates at Parcelpine, a grocery delivery company.

Parcelpine delivers about 1.2 million orders a day from 3,000 partner stores. Its model predicts each order's delivery time at checkout and re-predicts it every 30 seconds while the order is in progress, about 800 predictions per second at peak. Features include how busy the store has been in the last 30 minutes, the number of items, the courier's location and current traffic.

The model's error was 4.1 minutes on offline validation but is 7.8 minutes in production. The team suspects the features the model sees in production differ from the ones it was trained on.

Design a feature system that serves fresh features to the model within 20 ms, produces training data that matches exactly what the model would have seen at prediction time, and lets the team find and prevent mismatches like this one. Cover the storage layers, how features are defined and computed once for both training and serving, backfills, and monitoring.

Clarify requirements first, then design end to end.

Practise this question with the AI interviewer

Design a Model Monitoring Platform

System Design · Medium · 40 min · Free to practise

Design the model monitoring platform at Bramblecart, an online home-goods retailer that runs about 60 machine learning models in production.

The models vary widely. Search ranking makes 20,000 predictions per second and learns whether it was right within minutes, from clicks. Demand forecasts run nightly and are checked against sales the next day. A customer churn model scores weekly and only learns its true outcome 60 days later. Across all models there are about 1.5 billion predictions a day. Today, problems are found when a business team complains, usually weeks late.

Design a platform that every model team can plug into. It should catch broken input data, shifts in what the models see and predict, and drops in real performance, including for models whose outcomes arrive late. Cover what to log and where to store it, which checks and statistics to compute and how often, alerting that people will not learn to ignore, dashboards, and how monitoring connects to retraining.

Clarify requirements first, then work through the design end to end.

Practise this question with the AI interviewer

Design Recommendations for a Handmade Goods Marketplace

System Design · Hard · 45 min

Design the recommendation system for Kindlewood Market, an online marketplace for handmade and vintage goods.

Kindlewood has 40 million monthly active buyers, 6 million active sellers and 120 million live listings. Most listings are one of a kind: a vintage lamp sells once and disappears, and about 30% of listings each month are new. You are designing two surfaces: a personalized "Picked for you" feed on the home page and "Similar items" on each listing page. Peak traffic is about 15,000 recommendation requests per second, and each must return in under 200 ms at the 99th percentile.

Cover:

  • What to optimize, and how you would measure success offline and online.
  • Candidate generation and ranking: the stages, the features and models, and the training data.
  • Cold start for new buyers and new listings, and keeping sold items out of results.
  • Serving, storage and freshness at this scale.
  • Feedback loops, and fairness of exposure for small and new sellers.

Start by clarifying requirements, then work through the design end to end, and be ready to defend your trade-offs.

Practise this question with the AI interviewer

Design Real-Time Payment Fraud Scoring

System Design · Hard · 45 min · Free to practise

Design the real-time fraud scoring system for Tallyrun, a payments company that processes card payments for online merchants.

Tallyrun handles about 50 million transactions a day, peaking at 3,000 per second. Each payment must be approved, sent to manual review or declined within 100 ms at the 99th percentile end to end; fraud scoring gets 30 ms of that budget. About 0.1% of transactions are fraudulent, and most fraud is confirmed only when a chargeback arrives, 30 to 90 days later. A team of analysts can review about 15,000 transactions a day.

Cover:

  • The decision flow and how rules and a model work together.
  • The features that matter (for example, how many cards a device has used in the last ten minutes) and how you compute them fresh, within the latency budget.
  • Labels, training data and how you deal with labels arriving months later.
  • Thresholds for approve, review and decline, given the review capacity and the costs of each mistake.
  • Deploying new models safely, monitoring, and what happens when a dependency is slow or down.

Clarify requirements first, then design end to end and defend your trade-offs.

Practise this question with the AI interviewer

Case questions

A Conversion Drop the Week a Campaign Launched

Case · Medium · 25 min · Free to practise

You are a data analyst at Hearthline Home, an online retailer of furniture and home goods. On Monday morning the Chief Marketing Officer forwards you the weekly dashboard: site conversion rate, orders divided by sessions, fell from 3.2% to 2.6% last week. Last week was also the first week of a new paid social media campaign, and the CMO's message reads: "Is the new campaign bringing junk traffic? Should I pull it before we spend another week's budget?"

The CMO needs an answer by the end of the day.

Work out what actually happened to conversion and whether the campaign is to blame. Decide what you need to know about how the metric is measured and what changed last week, ask for the data you need, and test your explanations against it. Then recommend what the CMO should do about the campaign and about the dashboard.

Structure your approach before you dive in, and do the key numbers out loud. All figures are in US dollars.

Practise this question with the AI interviewer

Who Gets the Retention Offer: Churn Risk or Uplift?

Case · Hard · 30 min

You are the lead data scientist at Larkspan, a photo backup and sharing service sold as a $12 monthly subscription. Larkspan has 200,000 subscribers and loses a steady share of them every month.

The retention team has a new churn-prediction model, and the CRM manager wants to use it next month: send a "half price next month" offer to the 10% of subscribers the model rates most likely to cancel. Her slide says the model is "the most accurate we have ever built" and projects about $200,000 of value a month. Last quarter the team also ran a small pilot of the offer.

The head of customer experience asks you to decide before the campaign is scheduled: should Larkspan run this campaign, and if so, who should get the offer?

Work out what you need to know about the model, the offer and the pilot, ask for the data, and put each option on a common footing. Be explicit about uncertainty. End with a clear recommendation and what you would build or test next.

Structure your approach before you dive in. All figures are in US dollars.

Practise this question with the AI interviewer

Read Out a Subscription Price Test

Case · Hard · 30 min

You are the lead data scientist at Paceloft, a running-coach app sold as a monthly subscription. For four weeks, the growth team showed new visitors to the subscription page one of three monthly prices at random: the current $9.99, $12.99 or $14.99. The first month's results are in, and the head of growth is ready to move everyone to $12.99, which earned the most revenue per visitor.

The CEO has asked you for an independent readout before the price changes: which price Paceloft should charge, how sure you are, and what, if anything, should be tested next.

Decide what you need to know beyond the first month's revenue, ask for the data, and work through the economics of each price over a subscriber's lifetime. Be explicit about the assumptions and the uncertainty in your numbers, and about whether this test's results apply to all of Paceloft's customers.

Structure your approach before you dive in, and do the math out loud. All figures are in US dollars.

Practise this question with the AI interviewer

Technical Knowledge questions

See all technical knowledge questions

Statistics for Analysts: Tests, Bias and Confounding

Knowledge · Medium · 20 min

A knowledge interview on the statistics an analyst uses to judge experiments and data, at the level of a data or product analyst with up to a few years of experience.

Be ready to explain, in your own words, and apply to examples:

  • Hypothesis tests and p-values: what a p-value is and is not, significance levels, and the two kinds of error.
  • Statistical power and sample size: why a test can be too small to detect a real effect.
  • Pitfalls in A/B tests: checking results early and repeatedly, testing many metrics at once, and broken randomization.
  • Correlation versus causation: confounding variables and selection bias.
  • Why an overall result can point the opposite way from every segment.

The interviewer will describe a few experiments and datasets with round numbers and ask what you would conclude and what you would check. You will not need to compute anything precisely; reason out loud.

Practise this question with the AI interviewer

Bias, Variance and Regularization

Knowledge · Medium · 20 min · Free to practise

A knowledge interview on why models overfit or underfit and what to do about it, at the level of a data scientist or ML engineer with up to a few years of experience.

Be ready to explain, in your own words, and apply to examples:

  • The bias-variance trade-off: what underfitting and overfitting look like in training and validation error.
  • Reading learning curves and validation curves to decide whether more data, more features or a simpler model will help.
  • L1 and L2 regularization: what each penalty does to the weights, and when you would pick one or combine them.
  • Regularizing models without a weight penalty: tree depth and minimum leaf size, early stopping, dropout.
  • Choosing a regularization strength with cross-validation without fooling yourself.

The interviewer will describe a few models with their training and validation numbers and ask what is going wrong and what you would try next. Reason out loud; no calculation beyond simple arithmetic is needed.

Practise this question with the AI interviewer

Metrics and Thresholds for Imbalanced Classes

Knowledge · Medium · 20 min

A knowledge interview on judging and tuning classifiers when the positive class is rare, at the level of a data scientist or ML engineer with up to a few years of experience.

Be ready to explain, in your own words, and apply to examples:

  • The confusion matrix, precision, recall, the false positive rate and F-scores, and why accuracy misleads when positives are rare.
  • ROC curves versus precision-recall curves: what each shows and which to trust under heavy imbalance.
  • Choosing a decision threshold from the costs of each kind of mistake rather than defaulting to 0.5.
  • Calibration: what it means for a predicted probability to be trustworthy, and how to check it.
  • How resampling and class weights change a model's probabilities, and how to correct for that.

The interviewer will give you a quality-inspection scenario with round numbers and ask you to compute a few metrics out loud and choose a threshold. Simple arithmetic only. All figures are in US dollars.

Practise this question with the AI interviewer

Feature Engineering and Data Leakage

Knowledge · Medium · 20 min · Free to practise

A knowledge interview on building features and validation splits that hold up in production, at the level of a data scientist or ML engineer with up to a few years of experience.

Be ready to explain, in your own words, and apply to examples:

  • Target leakage: features that would not exist, or would carry the answer, at the moment the model makes its prediction.
  • Train-test contamination: fitting scalers, encoders or imputers on all the data, duplicate rows, and the same person appearing on both sides of a split.
  • Choosing a split that matches how the model is used: random, grouped or time-based.
  • Encoding high-cardinality categories such as postal codes or product ids, including target encoding done safely.
  • Treating missing values as information rather than only something to fill in.

The interviewer will describe a few models with suspiciously good or disappointing results and ask you to find the problem and fix it. Simple arithmetic only.

Practise this question with the AI interviewer

Evaluating Retrieval-Augmented LLM Systems

Knowledge · Medium · 20 min

A knowledge interview on measuring and improving a question-answering assistant built on a large language model with retrieval (often called RAG), at the level of a data scientist or ML engineer with up to a few years of experience.

Be ready to explain, in your own words, and apply to examples:

  • How retrieval works: embeddings, chunking documents, keyword versus vector search, combining them and reranking.
  • Retrieval metrics such as recall at k and mean reciprocal rank, and what they need from an evaluation set.
  • Judging generated answers: correctness versus faithfulness to the retrieved sources, and when the assistant should decline to answer.
  • Using a language model as a judge: its known biases and how to check it against human ratings.
  • Splitting an end-to-end failure into a retrieval problem or a generation problem.

The interviewer will describe an internal assistant for a utility company's field technicians, give round numbers from its evaluation and ask where you would invest next.

Practise this question with the AI interviewer

Experiment Design Beyond A/B Basics

Knowledge · Hard · 25 min

A knowledge interview on designing and reading online experiments when the textbook assumptions break, at the level of an experienced data scientist or experimentation lead. It assumes you already know p-values, power and why you should not stop a test early; it goes past them.

Be ready to explain, in your own words, and apply to examples:

  • Interference: why splitting users at random fails in marketplaces and social products, and what cluster, geographic and time-sliced (switchback) designs cost you.
  • Novelty and primacy effects, and how to tell a lasting effect from a temporary one.
  • When the unit you randomize differs from the unit you measure (ratio metrics such as clicks per page view), and how that changes the variance.
  • Using pre-experiment data to reduce variance, and the condition that keeps it unbiased.
  • Effects that differ by segment, guardrail metrics, and long-term holdouts.

The interviewer will describe several experiments at a ride-hailing company, a news app and an online store, with round numbers, and ask what is wrong and what you would do.

Practise this question with the AI interviewer

Causal Inference Without an Experiment

Knowledge · Hard · 25 min · Free to practise

A knowledge interview on estimating cause and effect when you cannot run a randomized experiment, at the level of an experienced data scientist or economist working in industry.

Be ready to explain, in your own words, and apply to examples:

  • Difference-in-differences: the estimate, the parallel-trends assumption and how you would check it.
  • Instrumental variables: what makes a good instrument, and whose effect the estimate describes.
  • Matching and propensity scores: what they can and cannot fix.
  • Regression discontinuity: using a cutoff rule, and what can break it.
  • Synthetic control for a single treated unit, such as one region or one country.

The interviewer will describe policy and product changes at a grocery chain, a software company and a lender, with round numbers, and ask you to pick a method, compute a simple estimate out loud and say what could make it wrong. All figures are in US dollars.

Practise this question with the AI interviewer

Situational questions

A Fairness Gap a Week Before Launch

Situational · Hard · 20 min · Free to practise

You are the data scientist who built a new ranking model for Hirelattice, a US job marketplace. When an employer opens a job posting, the model orders the applicants and the employer sees the top 20 first. It replaces a keyword search and, in offline tests, puts applicants who later get interviews higher in the list.

Launch is in seven days. Sales has promised it to three large clients, and your manager has already presented it to leadership.

During a final check you compare who reaches the top 20. Among applicants who answered an optional demographic survey, women reach the top 20 at about three quarters the rate of men with similar experience. You also notice that applicants with a gap of more than a year in their work history are ranked noticeably lower.

You are meeting your manager tomorrow morning. Explain what you would do and why. This is practice in professional judgement for an interview, not legal advice.

Practise this question with the AI interviewer