Data tech exams: every type of question, and how to practise in Hex
For students facing data science or analytics technical rounds at startups. What the loop looks like, the ten kinds of question, and 15 practice questions on made-up data, each with a worked answer.
New to SQL? Start with SQL from zero. New to Python? Python for data, from zero. Want one take-home worked end to end? A take-home, start to finish.
What a data loop looks like
At startups of 100 to 1,000 people, expect four or five conversations over two to four weeks. Step 3 is where most people are won or lost.
Three loops, as the companies described them
The 10 types of question
Most loops use four or five of these.
Write code
Live, timed, someone watching
Analyse and decide
Open questions, a call at the end
Explain and design
Whiteboard and conversation
1. Live SQL 30 to 60 min
Tests: Turning a business question into a correct query while someone watches. Joins, GROUP BY, window functions, dates, NULLs and ties. Talking while you work.
Example questions
- Each user's third transaction.
- Top two items by spend in every category.
- Users who did step B the day after step A.
- Customers who started but never finished.
- Duplicate charges: same card, merchant and amount within 10 minutes.
A strong answer
- Restates the question and says what one row of the answer is.
- Calls out NULLs and ties before coding.
- Builds it in named steps (CTEs).
- Checks the result: row counts, one row worked by hand.
Common mistakes
- Coding before asking.
- RANK vs DENSE_RANK vs ROW_NUMBER mix-ups.
- COUNT(*) after a LEFT JOIN.
- One giant nested query.
Practise it in Hex
- SQLSQL cell on dataframes, one step per cell
- SQLA second SQL cell that counts rows
- HabitAI assistant off
Try: question 1 to 4 below.
2. Timed online test 60 to 90 min
Tests: Speed and accuracy on tightly defined tasks, and reading carefully under a clock. Often HackerRank or CodeSignal.
Example questions
- At least 25 of 30 pass when each passes with p = 0.7.
- Mean squared error from two lists.
- Join two CSVs, return the top N by a group metric.
- Fill missing values and one-hot encode a column.
A strong answer
- Reads every line of the prompt.
- Takes the easy points first.
- Tests edge cases: hidden tests check them.
Common mistakes
- Sinking 30 minutes into one item.
- Passing the visible examples, failing the hidden ones.
- Never practising without autocomplete.
Practise it in Hex
- PythonOne Python cell per task
- SQLSQL cells for the SQL items
- HabitA phone timer, AI off
Try: question 1, 3, 5, 12 as a mock below.
3. Python and pandas 30 to 60 min
Tests: Data handling: read, merge, groupby, pivot, dates, missing values, a quick plot. Sometimes a plain Python function.
Example questions
- Merge employees and offers; acceptance rate by department.
- Rolling 7-day mean of a daily metric.
- Flag outliers per group with z-scores.
- Reshape long to wide.
- A function returning median and p75 per group.
A strong answer
- Vectorised, no row loops.
- Checks shape and duplicates after every merge.
- Clear names for each step.
Common mistakes
- Many-to-many merges that multiply rows.
- Ignoring warnings.
- Looping over rows.
- NaNs silently dropped in groupby.
Practise it in Hex
- PythonPython cell for the work
- ChartChart cell on the result
- Pythonassert lines as checks
Try: question 5, 6 below.
4. Take-home 1 to 3 hours, then 20 to 30 min walk-through
Tests: End-to-end judgement on messy data: cleaning, choosing what matters, a clear 'so what'. Startups use take-homes more than big firms.
Example questions
- Analyse 30-day active users over time and find one other trend.
- Estimate driver lifetime value and what drives it.
- Here is our data: how would you improve the business?
A strong answer
- Assumptions stated up front.
- A short summary first.
- Two to four charts, each making one point.
- Next steps 'with more time'.
- Code that reruns cleanly.
Common mistakes
- Going over the page or time limit.
- Burying the recommendation.
- No data checks.
- A model where a table would do.
- Not able to defend a choice in the follow-up.
Practise it in Hex
- TextText cell: question and assumptions
- SQLSQL cells for each step
- ChartChart cells
- AppPublish the app, share the link
Try: question 15 below.
5. Metrics and business case 30 to 60 min
Tests: Structured thinking: define success, pick metrics and guardrails, diagnose a change, make a call.
Example questions
- Success metrics for a new marketplace feature.
- How would you measure a feature launch?
- A key metric dropped 10% last week. Why?
- Should we launch X, given these results?
A strong answer
- Clarifies the goal and the user.
- One main metric, two or three supporting, plus guardrails.
- For a drop: data first, then segments, then inside vs outside causes.
- Ends with a decision and who to talk to.
Common mistakes
- Jumping to a model.
- Listing twenty metrics.
- Not checking for a logging bug or a seasonal dip.
Practise it in Hex
- TextText cell: the metric definition
- SQLOne SQL cell per metric
- InputDropdown input to switch segment
Try: question 7, 8 below.
6. A/B tests and statistics 30 to 60 min
Tests: Experiment design and honest reading of results.
Example questions
- Sample size for a test: what do you need?
- Explain a p-value to a product manager.
- What is sample ratio mismatch and how do you test for it?
- Novelty effects; testing many metrics at once.
- Simpson's paradox.
A strong answer
- Hypothesis, main metric, guardrails, unit of randomisation, sample size, full weeks, checks, decision.
- A p-value is the chance of data this extreme if nothing changed. Not the chance nothing changed.
Common mistakes
- Peeking and stopping at p < 0.05.
- Ignoring a lopsided split.
- Reading a pooled result when the mix differs.
- Mixing up 'significant' and 'big enough to matter'.
Practise it in Hex
- PythonPython cell: simulate the test
- TextText cell: the design
- ChartChart of the simulated results
Try: question 9, 10, 11 below.
7. Probability puzzles 5 to 15 min each
Tests: Comfort with basic probability and Bayes, under mild pressure.
Example questions
- At least k of n.
- Exactly three sixes in ten rolls.
- Rare condition, positive test: how likely is it real?
- Expected draws until a match.
A strong answer
- Says the model out loud: independent? with replacement?
- Sanity-checks the size of the answer.
Common mistakes
- Ignoring the base rate.
- Adding probabilities that can both happen.
Practise it in Hex
- PythonPython cell: a million-row simulation to check your formula
Try: question 12 below.
8. ML concepts 30 to 60 min, or quiz items
Tests: Knowing when and why, not just how.
Example questions
- Bias and variance: what do train and test error tell you?
- L1 vs L2.
- Precision, recall, F1: which matters here?
- Class imbalance: why accuracy misleads.
- How would you define the label for a churn model?
A strong answer
- Ties each choice to the cost of each kind of error.
- Raises leakage without being asked.
- Splits by time for time data.
Common mistakes
- Definitions with no use case.
- Accuracy on imbalanced data.
- Tuning on the test set.
Practise it in Hex
- SQLSQL cell: one row per example, features known at the time
- PythonPython cell: time split, metrics
- TextText cell: leakage risks
Try: question 13 below.
9. Data modelling 15 to 45 min
Tests: Designing tables at the right grain so questions are easy to answer later.
Example questions
- Tables for employees, job changes and pay changes, so you can answer 'pay on any date'.
- Fact vs dimension tables.
- Slowly changing dimensions.
- Star vs snowflake.
A strong answer
- Starts from the questions the tables must answer.
- States the grain of each table.
- Keeps history with effective-from and effective-to dates.
- Names the keys.
Common mistakes
- One wide table that overwrites history.
- No stated grain.
Practise it in Hex
- TextText cell: tables, grain, keys
- SQLSQL cell: build the history, query it at a date
Try: question 14 below.
10. Presenting and project deep-dive 20 to 45 min
Tests: Communication, impact and ownership.
Example questions
- Walk us through your take-home.
- Tell us about a project you are proud of.
- Why that approach?
- What would you do differently?
A strong answer
- Context, question, what you did, result with a number, what changed, what you would change.
- A short intro: a highlight reel.
Common mistakes
- Starting with the method.
- No outcome.
- No answer to 'why that approach?'.
Practise it in Hex
- AppApp builder: text and charts only, code hidden
- TextText cell with three findings
- HabitRehearse 10 minutes out loud
Try: question 15, day 14 below.
The practice set: Tallyfield
Made up for practice. Tallyfield, its customers and every number are invented.
Tallyfield is a pay-data startup. Customers upload their staff pay and job offers; Tallyfield sends back market benchmarks. Six small files, with the kind of mess real data has. The script that made them is seeded, so it gives the same files every time.
| File | Rows | What | The mess |
|---|---|---|---|
| companies.csv | 26 | Stage, industry, when they joined Tallyfield | C26 joined in October 2026 |
| employees.csv | 456 | Job, level now, location, gender | 3 missing locations, a few missing genders |
| comp_snapshots.csv | 1,308 | Pay on 3 dates, local currency | 1 duplicated row, missing bonus and equity |
| offers.csv | 677 | Offers sent, Jan 2025 to Nov 2026 | 1 duplicated offer, Remote offers with no band, pending offers |
| pay_bands.csv | 1,296 | Min, mid, max per company, job, level, location, year | Bands change each January |
| fx_rates.csv | 303 | Weekly USD rate for GBP and EUR | Fridays only, so dates do not line up |
companies
- company_id
- industry
- funding_stage
- joined_date
employees
- employee_id
- company_id
- job_family
- level
- location
- gender
comp_snapshots
- employee_id
- snapshot_date
- level
- base_salary
- target_bonus_pct
- equity_annual_value
- currency
offers
- offer_id
- company_id
- job_family, level, location
- base_offered
- sent_date
- status
- used_recommendation
pay_bands
- company_id
- job_family, level, location
- band_min, band_mid, band_max
- effective_date
fx_rates
- rate_date
- currency
- usd_per_unit
How they join
employeescompanieson company_idcomp_snapshotsemployeeson employee_idofferspay_bandson company, job, level, location, yearcomp_snapshotsfx_rateson currency, latest date before
Set up in Hex. Upload the six CSVs in the Files sidebar. Add a Python cell to load them (below). Then add SQL cells with dataframes as the source: Hex calls this dataframe SQL and runs it with DuckDB, so every query here works as written. No Hex? Run the same code on your laptop with pip install duckdb pandas and duckdb.sql(query).df().
import pandas as pd
import numpy as np
dates = ["sent_date", "snapshot_date", "effective_date", "joined_date",
"start_date", "end_date", "rate_date"]
def load(name):
df = pd.read_csv(f"{name}.csv")
for col in df.columns:
if col in dates:
df[col] = pd.to_datetime(df[col])
return df
companies = load("companies")
employees = load("employees")
comp_snapshots = load("comp_snapshots")
offers = load("offers")
pay_bands = load("pay_bands")
fx_rates = load("fx_rates")
for name in ["companies", "employees", "comp_snapshots",
"offers", "pay_bands", "fx_rates"]:
print(f"{name:15s}", globals()[name].shape)Output
companies (26, 6)
employees (456, 8)
comp_snapshots (1308, 7)
offers (677, 10)
pay_bands (1296, 8)
fx_rates (303, 3)The 15 questions
| # | Question | Type | Level | Time |
|---|---|---|---|---|
| 1 | Acceptance rate by job family | Live SQL | Easy | 10 min |
| 2 | Latest salary and compa-ratio | Live SQL | Medium | 15 min |
| 3 | Benchmarks with a privacy rule | Live SQL | Medium | 20 min |
| 4 | Big rises without a promotion | Live SQL | Hard | 25 min |
| 5 | Offers below the band minimum | Python and pandas | Medium | 25 min |
| 6 | Everything in US dollars | Python and pandas | Medium | 20 min |
| 7 | Did offer recommendations work? | Metrics case | Medium | 30 min |
| 8 | Why did acceptance drop? | Metrics case | Medium | 30 min |
| 9 | A p75 that jumped | A/B and statistics | Medium | 15 min |
| 10 | Simpson's paradox in pay | A/B and statistics | Hard | 20 min |
| 11 | Design an A/B test | A/B and statistics | Medium | 25 min |
| 12 | Is the flagged row really wrong? | Probability | Easy | 10 min |
| 13 | Predict whether an offer is accepted | ML concepts | Medium | 25 min |
| 14 | Pay on any date | Data modelling | Medium | 20 min |
| 15 | The take-home: equity in 2026 | Take-home | Medium | 2 hours |
Set a timer for each. Answer out loud or on paper first, then open the worked answer.
Acceptance rate by job family
What was the offer acceptance rate by job family in 2026? Count only offers with a final answer.
Worked answer
1. Think first
- Grain: one row per job family.
- 'Final answer' means accepted or declined. Pending and rescinded offers have no answer yet, so they would drag the rate down.
- Check offer_id is unique first. It is not: O5124 appears twice.
2. The code, and what it printed
dupes-- Check first: is offer_id unique?
SELECT offer_id, COUNT(*) AS copies
FROM offers
GROUP BY offer_id
HAVING COUNT(*) > 1Output
offer_id copies
O5124 2q1SELECT job_family,
COUNT(*) AS decided,
ROUND(100 * AVG(CASE WHEN status = 'accepted'
THEN 1.0 ELSE 0 END), 1) AS accept_pct
FROM (SELECT DISTINCT * FROM offers) AS o
WHERE status IN ('accepted', 'declined')
AND YEAR(sent_date) = 2026
GROUP BY job_family
ORDER BY accept_pct DESCOutput
job_family decided accept_pct
Product 41 85.4
Data 73 82.2
Software Engineering 134 76.1
Sales 97 73.23. Say it in one sentence
In 2026, Product offers were accepted most often (85%) and Sales least (73%), counting only offers with a final yes or no and one copy of the duplicated offer.
Latest salary and compa-ratio
For each employee, find their most recent base salary and their compa-ratio: base divided by the midpoint of the pay band in force on that date.
Worked answer
1. Think first
- Grain: one row per employee.
- Latest snapshot: ROW_NUMBER by date, newest first, keep row 1. QUALIFY saves a subquery.
- Bands change each January, so join on effective_date <= snapshot_date and keep the newest.
- LEFT JOIN, then count who has no band. Leavers' latest snapshot is older; that is fine.
2. The code, and what it printed
compaWITH latest AS (
SELECT s.employee_id, s.snapshot_date, s.level, s.base_salary,
e.company_id, e.job_family, e.location
FROM comp_snapshots s
JOIN employees e USING (employee_id)
QUALIFY ROW_NUMBER() OVER (PARTITION BY s.employee_id
ORDER BY s.snapshot_date DESC) = 1
),
banded AS (
SELECT l.*, b.band_mid,
ROW_NUMBER() OVER (PARTITION BY l.employee_id
ORDER BY b.effective_date DESC) AS rn
FROM latest l
LEFT JOIN pay_bands b
ON b.company_id = l.company_id
AND b.job_family = l.job_family
AND b.level = l.level
AND b.location = l.location
AND b.effective_date <= l.snapshot_date -- band in force then
)
SELECT employee_id, snapshot_date, level, base_salary, band_mid,
ROUND(base_salary / band_mid, 2) AS compa_ratio
FROM banded
WHERE rn = 1
ORDER BY employee_idOutput
employee_id snapshot_date level base_salary band_mid compa_ratio
E1001 2026-06-30 Mid 82400 91000 0.91
E1002 2026-06-30 Junior 41000 39000 1.05
E1003 2025-12-31 Senior 127700 138500 0.92
E1004 2026-06-30 Mid 120600 114000 1.06
E1005 2026-06-30 Mid 61500 64500 0.95
E1006 2026-06-30 Lead 152900 169500 0.90
E1007 2025-12-31 Junior 39500 44500 0.89
E1008 2026-06-30 Lead 99300 101000 0.98
... 452 rowscompa_checkSELECT COUNT(*) AS employees,
COUNT(band_mid) AS with_band,
COUNT(*) - COUNT(band_mid) AS no_band,
MEDIAN(compa_ratio) AS median_compa,
COUNT(*) FILTER (compa_ratio < 0.9) AS below_090,
COUNT(*) FILTER (compa_ratio > 1.1) AS above_110
FROM compaOutput
employees with_band no_band median_compa below_090 above_110
452 449 3 1.0 48 503. Say it in one sentence
The median employee is paid exactly at their band midpoint (1.00); 48 sit below 0.9 and 50 above 1.1, and 3 have no band because their location is missing.
Benchmarks with a privacy rule
Median and 75th-percentile base for Senior Software Engineers in London, June 2026. Only publish a cell with at least 5 companies and 20 employees.
Worked answer
1. Think first
- The rule protects customers: with 2 companies, each could work out the other's pay. It also keeps small, jumpy cells out.
- Count companies with COUNT(DISTINCT company_id), not COUNT(*).
- QUANTILE_CONT is DuckDB's PERCENTILE_CONT.
- Run it for every city, so you can see what the rule hides.
2. The code, and what it printed
q3WITH cur AS (
SELECT e.company_id, e.location, s.base_salary
FROM (SELECT DISTINCT * FROM comp_snapshots) s
JOIN employees e USING (employee_id)
WHERE s.snapshot_date = DATE '2026-06-30'
AND e.job_family = 'Software Engineering'
AND s.level = 'Senior'
)
SELECT location,
COUNT(DISTINCT company_id) AS companies,
COUNT(*) AS employees,
QUANTILE_CONT(base_salary, 0.50) AS p50,
QUANTILE_CONT(base_salary, 0.75) AS p75
FROM cur
WHERE location IS NOT NULL
GROUP BY location
HAVING COUNT(DISTINCT company_id) >= 5
AND COUNT(*) >= 20Output
location companies employees p50 p75
London 12 58 86350.0 91925.0q3_all-- What the HAVING clause hid
SELECT e.location,
COUNT(DISTINCT e.company_id) AS companies,
COUNT(*) AS employees
FROM (SELECT DISTINCT * FROM comp_snapshots) s
JOIN employees e USING (employee_id)
WHERE s.snapshot_date = DATE '2026-06-30'
AND e.job_family = 'Software Engineering' AND s.level = 'Senior'
GROUP BY e.location
ORDER BY employees DESCOutput
location companies employees
London 12 58
Berlin 6 10
Dublin 6 7
New York 3 4
NaN 1 13. Say it in one sentence
London passes the rule, with a median of £86,350 and a p75 of £91,925 from 58 people at 12 companies; Berlin, Dublin and New York are too small to publish.
Big rises without a promotion
Find employees whose base rose more than 15% between two snapshots in a row, with no change of level.
Worked answer
1. Think first
- LAG gives the previous row per employee. Take the previous level too, from the snapshot table, so a promotion is not missed.
- Remove the duplicated snapshot row first, or LAG compares a row with its copy.
- Filter in an outer query: you cannot use a window function in WHERE.
2. The code, and what it printed
q4WITH w AS (
SELECT employee_id, snapshot_date, level, base_salary,
LAG(base_salary) OVER (PARTITION BY employee_id
ORDER BY snapshot_date) AS prev_base,
LAG(level) OVER (PARTITION BY employee_id
ORDER BY snapshot_date) AS prev_level
FROM (SELECT DISTINCT * FROM comp_snapshots)
)
SELECT employee_id, snapshot_date::DATE AS snapshot, level,
prev_base, base_salary,
ROUND(100 * (base_salary / prev_base - 1), 1) AS rise_pct
FROM w
WHERE level = prev_level
AND base_salary > 1.15 * prev_base
ORDER BY rise_pct DESC, employee_idOutput
employee_id snapshot level prev_base base_salary rise_pct
E1360 2026-06-30 Mid 53600 66500 24.1
E1392 2026-06-30 Mid 62300 77300 24.1
E1140 2026-06-30 Mid 54900 68100 24.0
E1229 2026-06-30 Mid 51600 64000 24.0
E1393 2026-06-30 Mid 115300 143000 24.0
E1394 2026-06-30 Mid 73500 91100 23.93. Say it in one sentence
Six people got a rise of about 24% in June 2026 with no level change; I would check each with the customer, since a missing promotion record looks the same.
Offers below the band minimum
Using pandas, flag offers below the band minimum and show the share by location.
Worked answer
1. Think first
- Match each offer to the band for its company, job, level, location and year.
- validate='many_to_one' makes pandas stop if a band is duplicated, so rows cannot multiply.
- indicator=True shows which offers found no band. Look at them before dropping them.
2. The code, and what it printed
o = offers.drop_duplicates().copy()
o["year"] = o["sent_date"].dt.year
b = pay_bands.assign(year=pay_bands["effective_date"].dt.year)
keys = ["company_id", "job_family", "level", "location", "year"]
m = o.merge(b[keys + ["band_min"]], on=keys, how="left",
validate="many_to_one", indicator=True)
print(len(o), "offers in,", len(m), "rows out") # no row explosion
print(m["_merge"].value_counts().to_string())
print(m.loc[m["_merge"] == "left_only",
["offer_id", "company_id", "location"]].to_string(index=False))
m = m[m["_merge"] == "both"].copy()
m["below_min"] = m["base_offered"] < m["band_min"]
by_loc = (m.groupby("location")["below_min"]
.agg(offers="size", below_pct="mean")
.sort_values("below_pct", ascending=False))
by_loc["below_pct"] = (100 * by_loc["below_pct"]).round(1)
print(by_loc)Output
676 offers in, 676 rows out
_merge
both 672
left_only 4
right_only 0
offer_id company_id location
O5402 C05 Remote
O5059 C24 Remote
O5170 C10 Remote
O5607 C09 Remote
offers below_pct
location
New York 136 12.5
London 261 4.2
Dublin 144 2.1
Berlin 131 1.53. Say it in one sentence
12.5% of New York offers were under the band minimum, against 4% or less elsewhere; 4 Remote offers have no band and are left out.
Everything in US dollars
Convert all pay to USD with the FX table, then work out total cash: base times (1 + bonus %).
Worked answer
1. Think first
- FX rates are weekly, snapshots are month-end. merge_asof takes the latest rate on or before each date.
- Which rate? The snapshot date is simplest. A monthly average is fairer for a year-long figure. Say which.
- assert no missing rates. Do not fill a missing bonus with 0: count them and say so.
2. The code, and what it printed
s = comp_snapshots.drop_duplicates().sort_values("snapshot_date")
fx = fx_rates.sort_values("rate_date")
usd = pd.merge_asof(s, fx, left_on="snapshot_date", right_on="rate_date",
by="currency", direction="backward")
assert usd["usd_per_unit"].notna().all(), "a snapshot has no rate"
print("rate used for 2026-06-30:",
usd.loc[usd["snapshot_date"] == "2026-06-30", "rate_date"].max().date())
usd["base_usd"] = usd["base_salary"] * usd["usd_per_unit"]
usd["total_cash_usd"] = usd["base_usd"] * (1 + usd["target_bonus_pct"] / 100)
print("rows with no bonus %:", usd["target_bonus_pct"].isna().sum())
latest = usd[usd["snapshot_date"] == "2026-06-30"]
print(latest.groupby("currency")[["base_usd", "total_cash_usd"]]
.median().round(-2))Output
rate used for 2026-06-30: 2026-06-26
rows with no bonus %: 66
base_usd total_cash_usd
currency
EUR 64100.0 71400.0
GBP 95000.0 102600.0
USD 117000.0 133900.03. Say it in one sentence
Using the rate from the Friday before each snapshot, median total cash in June 2026 was about $71k for euro staff, $103k for sterling and $134k for dollar; 66 rows had no bonus % and are left out of total cash.
Did offer recommendations work?
Tallyfield launched in-product offer recommendations in September 2026. How would you measure success?
Worked answer
1. Think first
- Goal: customers send offers that get accepted, faster, without overpaying.
- Main metric: acceptance rate of offers sent with a recommendation.
- Supporting: days from approval to offer sent; share of offers using a recommendation.
- Guardrails: offers outside the band; cost per hire; support tickets.
- Then a baseline. Watch the mix: the new customer, C26, never used the feature.
2. The code, and what it printed
q7SELECT company_id = 'C26' AS new_customer,
used_recommendation,
COUNT(*) AS decided,
ROUND(100 * AVG(CASE WHEN status = 'accepted'
THEN 1.0 ELSE 0 END), 1) AS accept_pct
FROM (SELECT DISTINCT * FROM offers)
WHERE sent_date >= DATE '2026-09-01'
AND status IN ('accepted', 'declined')
GROUP BY ALL
ORDER BY ALLOutput
new_customer used_recommendation decided accept_pct
False False 37 86.5
False True 30 83.3
True False 36 50.03. Say it in one sentence
So far there is no sign of a lift: among existing customers, offers with a recommendation were accepted 83% of the time against 87% without, on 67 offers; pooling in the new customer would make it look like a 15-point win, which is wrong.
Why did acceptance drop?
The acceptance rate fell from 83% in October to 64% in November. Why?
Worked answer
1. Think first
- Data first: are November offers still pending? Did a new customer join?
- Then segment: customer, job family, level, location.
- Then outside causes: the market, a holiday.
- Quantify each before naming a cause.
2. The code, and what it printed
q8_monthSELECT strftime(sent_date, '%Y-%m') AS month,
COUNT(*) AS sent,
COUNT(*) FILTER (status = 'pending') AS pending,
ROUND(100 * AVG(CASE WHEN status = 'accepted' THEN 1.0
WHEN status = 'declined' THEN 0.0 END), 1)
AS accept_pct
FROM (SELECT DISTINCT * FROM offers)
WHERE sent_date >= DATE '2026-08-01'
GROUP BY month
ORDER BY monthOutput
month sent pending accept_pct
2026-08 31 0 80.0
2026-09 20 0 80.0
2026-10 31 0 83.3
2026-11 64 10 64.2q8_splitSELECT strftime(o.sent_date, '%Y-%m') AS month,
c.joined_date >= DATE '2026-10-01' AS new_customer,
COUNT(*) FILTER (status IN ('accepted', 'declined')) AS decided,
ROUND(100 * AVG(CASE WHEN status = 'accepted' THEN 1.0
WHEN status = 'declined' THEN 0.0 END), 1)
AS accept_pct
FROM (SELECT DISTINCT * FROM offers) o
JOIN companies c USING (company_id)
WHERE o.sent_date >= DATE '2026-10-01'
GROUP BY ALL
ORDER BY ALLOutput
month new_customer decided accept_pct
2026-10 False 30 83.3
2026-11 False 17 94.1
2026-11 True 36 50.03. Say it in one sentence
The drop is mix, not market: a new customer sent 36 offers in November and half were declined, while existing customers were at 94% on 17 decided offers, with 10 still pending.
A p75 that jumped
The 75th percentile for Senior Data roles in Berlin rose 6% between the December 2025 and June 2026 snapshots. Real or noise?
Worked answer
1. Think first
- First question: how many people? Percentiles of 9 or 10 values move a lot.
- Bootstrap: resample the values many times, recompute p75, read the middle 95%.
- Then composition: did a company join the cell?
2. The code, and what it printed
cell = (comp_snapshots.drop_duplicates()
.merge(employees[["employee_id", "company_id",
"job_family", "location"]], on="employee_id"))
cell = cell[(cell["job_family"] == "Data") & (cell["level"] == "Senior")
& (cell["location"] == "Berlin")]
rng = np.random.default_rng(1)
def p75_ci(x, n_boot=5000):
boots = [np.quantile(rng.choice(x, len(x)), 0.75) for _ in range(n_boot)]
return np.percentile(boots, [2.5, 97.5]).round(-2)
for d in ["2025-12-31", "2026-06-30"]:
g = cell[cell["snapshot_date"] == d]
x = g["base_salary"].to_numpy()
print(d, "n =", len(x), "companies =", g["company_id"].nunique(),
"p75 =", np.quantile(x, 0.75), "95% CI", p75_ci(x))
# Same companies only: drop any company not in the earlier snapshot
old = set(cell.loc[cell["snapshot_date"] == "2025-12-31", "company_id"])
same = cell[(cell["snapshot_date"] == "2026-06-30") & cell["company_id"].isin(old)]
print("new companies:", sorted(set(cell["company_id"]) - old))
print("2026-06-30 p75, same companies only:",
np.quantile(same["base_salary"], 0.75))Output
2025-12-31 n = 9 companies = 6 p75 = 73600.0 95% CI [69900. 86900.]
2026-06-30 n = 10 companies = 7 p75 = 77750.0 95% CI [72900. 91300.]
new companies: ['C25']
2026-06-30 p75, same companies only: 76700.03. Say it in one sentence
Mostly noise: p75 went from 73,600 to 77,750, but with 9 and 10 people the 95% ranges overlap heavily, and a new company, C25, joined the cell.
Simpson's paradox in pay
At customer C07, women's median base is higher than men's. Yet men are paid more at every level. How?
Worked answer
1. Think first
- Look at who is at each level. If women are mostly Senior and Lead, their overall median is pulled up by level, not by pay.
- The fair comparison is within level (and job and location).
- Report both the gap within level and the head count by level.
2. The code, and what it printed
c07SELECT e.gender, s.level, s.base_salary
FROM comp_snapshots s
JOIN employees e USING (employee_id)
WHERE e.company_id = 'C07'
AND s.snapshot_date = DATE '2026-06-30' q10_allSELECT gender, COUNT(*) AS people, MEDIAN(base_salary) AS median_base
FROM c07
GROUP BY gender
ORDER BY genderOutput
gender people median_base
F 30 79800.0
M 32 67050.0q10_levelSELECT level,
COUNT(*) FILTER (gender = 'F') AS women,
COUNT(*) FILTER (gender = 'M') AS men,
MEDIAN(base_salary) FILTER (gender = 'F') AS women_median,
MEDIAN(base_salary) FILTER (gender = 'M') AS men_median,
ROUND(100 * (men_median / women_median - 1), 1) AS men_ahead_pct
FROM c07
GROUP BY level
ORDER BY women_medianOutput
level women men women_median men_median men_ahead_pct
Junior 3 12 48300.0 51900.0 7.5
Mid 6 12 65800.0 68550.0 4.2
Senior 12 5 79800.0 84400.0 5.8
Lead 9 3 101300.0 101800.0 0.5
3. Say it in one sentence
Women at C07 are mostly in Senior and Lead roles, so their overall median is higher, but within each level men are paid 0.5% to 7.5% more; the within-level gap is the one to report.
Design an A/B test
Test a new benchmark page layout. The metric is report downloads per account. Design the test.
Worked answer
1. Think first
- Randomise by account, not user: colleagues share reports, so users in one account would mix.
- Main metric: downloads per account per week. Guardrails: page errors, support tickets.
- Sample size: needs the mean and spread. Assume 4 a week, spread 3, from last quarter.
- Run full weeks. Check the split before reading anything.
2. The code, and what it printed
from statistics import NormalDist
z = NormalDist().inv_cdf
# Assumed from last quarter: downloads per account per week
mean, sd = 4.0, 3.0
alpha, power = 0.05, 0.80
def n_per_arm(mde_abs):
return 2 * (z(1 - alpha / 2) + z(power)) ** 2 * sd ** 2 / mde_abs ** 2
for lift in [0.05, 0.10, 0.20]:
print(f"lift {lift:.0%}: {n_per_arm(mean * lift):,.0f} accounts per arm")
# Smallest lift we can see with 200 accounts per arm
mde = (z(1 - alpha / 2) + z(power)) * sd * (2 / 200) ** 0.5
print(f"200 per arm -> smallest lift {mde / mean:.0%}")
# Sample ratio mismatch: we meant 50/50 and got 228 vs 172
a, b = 228, 172
exp = (a + b) / 2
chi2 = (a - exp) ** 2 / exp + (b - exp) ** 2 / exp
p = 2 * (1 - NormalDist().cdf(chi2 ** 0.5))
print(f"SRM chi-square = {chi2:.2f}, p = {p:.4f}")Output
lift 5%: 3,532 accounts per arm
lift 10%: 883 accounts per arm
lift 20%: 221 accounts per arm
200 per arm -> smallest lift 21%
SRM chi-square = 7.84, p = 0.00513. Say it in one sentence
Randomise by account; with about 200 accounts per arm we could only see a lift of about 21%, so either test a bolder change or run longer, and a 228 to 172 split would mean stop and find the bug first.
Is the flagged row really wrong?
5% of uploaded salary rows have a currency error. A validator catches 90% of errors, and wrongly flags 2% of clean rows. A row is flagged. How likely is it really wrong?
Worked answer
1. Think first
- Bayes. Flagged rows come from two places: real errors caught (0.05 x 0.9) and clean rows flagged (0.95 x 0.02).
- Right share = 0.045 / (0.045 + 0.019).
- Check with a simulation: it takes a minute in Python.
2. The code, and what it printed
p_err, catch, false_flag = 0.05, 0.90, 0.02
p_flag = p_err * catch + (1 - p_err) * false_flag
print(f"by formula: {p_err * catch / p_flag:.3f}")
# Check by simulation: a million rows
rng = np.random.default_rng(7)
err = rng.random(1_000_000) < p_err
flag = np.where(err, rng.random(err.size) < catch,
rng.random(err.size) < false_flag)
print(f"by simulation: {err[flag].mean():.3f}")Output
by formula: 0.703
by simulation: 0.7013. Say it in one sentence
About 70%: most flags are real, but nearly a third are clean rows, because clean rows outnumber bad ones 19 to 1.
Predict whether an offer is accepted
Build a model to predict whether a candidate accepts an offer. Which features, what leakage risks, which metric?
Worked answer
1. Think first
- Features known when the offer is sent: offer vs band midpoint, level, location, job family, equity.
- Leakage: anything recorded after the answer, such as start date or negotiation notes.
- Split by time, not at random: train on the past, test on the future.
- Metric: the use is pricing, so calibrated probabilities matter. Check calibration and PR-AUC.
2. The code, and what it printed
f = offers.drop_duplicates()
f = f[f["status"].isin(["accepted", "declined"])].copy()
f["year"] = f["sent_date"].dt.year
bands = pay_bands.assign(year=pay_bands["effective_date"].dt.year)
f = f.merge(bands, on=["company_id", "job_family", "level", "location", "year"],
how="inner", validate="many_to_one")
# A feature you know when the offer is sent
f["offer_vs_mid"] = f["base_offered"] / f["band_mid"]
f["bucket"] = pd.cut(f["offer_vs_mid"], [0, 0.9, 0.97, 1.03, 1.1, 9],
labels=["<0.90", "0.90-0.97", "0.97-1.03",
"1.03-1.10", ">1.10"])
print(f.groupby("bucket", observed=True)["status"]
.agg(offers="size",
accept_pct=lambda s: round(100 * (s == "accepted").mean(), 1)))
# Split by time, not at random
train = f[f["sent_date"] < "2026-07-01"]
test = f[f["sent_date"] >= "2026-07-01"]
print("train", len(train), "test", len(test),
"| accept rate", round((train["status"] == "accepted").mean(), 3),
"vs", round((test["status"] == "accepted").mean(), 3))Output
offers accept_pct
bucket
<0.90 88 59.1
0.90-0.97 157 64.3
0.97-1.03 171 83.0
1.03-1.10 177 89.8
>1.10 52 98.1
train 481 test 164 | accept rate 0.786 vs 0.7743. Say it in one sentence
Offer versus band midpoint is the obvious first feature, since acceptance climbs from 59% under 0.90 to 98% above 1.10; I would train on offers before July 2026, test on the 164 after, and judge it on calibration.
Pay on any date
Design tables so you can answer: what was this person paid on any date?
Worked answer
1. Think first
- Start from the question: one date in, one pay figure out.
- employee: one row per person (id, company, job family, location).
- pay_history: one row per pay period. Columns: employee_id, level, base_salary, currency, effective_from, effective_to (empty for the current row).
- Key: employee_id + effective_from. Never overwrite: a change closes the old row and opens a new one.
- Our snapshots are a stand-in for change dates. LEAD builds effective_to.
2. The code, and what it printed
pay_history-- Turn snapshots into one row per pay period
SELECT employee_id, level, base_salary,
snapshot_date::DATE AS effective_from,
LEAD(snapshot_date::DATE) OVER (PARTITION BY employee_id
ORDER BY snapshot_date) AS effective_to
FROM (SELECT DISTINCT * FROM comp_snapshots)
ORDER BY employee_id, effective_fromOutput
employee_id level base_salary effective_from effective_to
E1001 Mid 78200 2025-06-30 2025-12-31
E1001 Mid 79100 2025-12-31 2026-06-30
E1001 Mid 82400 2026-06-30 NaT
E1002 Junior 38900 2025-06-30 2025-12-31
E1002 Junior 39400 2025-12-31 2026-06-30
E1002 Junior 41000 2026-06-30 NaT
E1003 Senior 126200 2025-06-30 2025-12-31
E1003 Senior 127700 2025-12-31 NaT
... 1307 rowsq14-- What was E1022 paid on 15 March 2026?
SELECT employee_id, level, base_salary, effective_from, effective_to
FROM pay_history
WHERE employee_id = 'E1022'
AND DATE '2026-03-15' >= effective_from
AND (DATE '2026-03-15' < effective_to OR effective_to IS NULL)Output
employee_id level base_salary effective_from effective_to
E1022 Senior 101900 2025-12-31 2026-06-303. Say it in one sentence
Keep one row per pay period with effective-from and effective-to dates, never overwrite, and find pay on a date with a range join; E1022 was on £101,900 as a Senior on 15 March 2026.
The take-home: equity in 2026
Write a one-page note for customers: how did engineering equity change between June 2025 and June 2026?
Worked answer
1. Think first
- Define equity: annual value, converted to USD with the rate on the snapshot date.
- Apply the privacy rule: at least 5 companies and 20 people, or the cell is hidden.
- Cut by funding stage: the obvious question a customer asks.
- Then one chart, a headline, caveats, and a method note.
2. The code, and what it printed
eqWITH s AS (
SELECT DISTINCT * FROM comp_snapshots
WHERE snapshot_date IN ('2025-06-30', '2026-06-30')
AND equity_annual_value IS NOT NULL
)
SELECT c.funding_stage,
YEAR(s.snapshot_date) AS yr,
COUNT(DISTINCT e.company_id) AS companies,
COUNT(*) AS people,
ROUND(MEDIAN(s.equity_annual_value * fx.usd_per_unit), -2)
AS median_equity_usd
FROM s
JOIN employees e USING (employee_id)
JOIN companies c USING (company_id)
ASOF JOIN fx_rates fx
ON fx.currency = s.currency AND fx.rate_date <= s.snapshot_date
WHERE e.job_family = 'Software Engineering'
GROUP BY ALL
ORDER BY ALLOutput
funding_stage yr companies people median_equity_usd
Seed 2025 1 8 15000.0
Seed 2026 2 12 14900.0
Series A 2025 9 68 18000.0
Series A 2026 9 66 13000.0
Series B 2025 13 152 11300.0
Series B 2026 13 147 11700.0
Series C+ 2025 2 7 9100.0
Series C+ 2026 2 7 8200.0ok = (eq["companies"] >= 5) & (eq["people"] >= 20)
wide = eq[ok].pivot(index="funding_stage", columns="yr",
values="median_equity_usd")
wide["change_pct"] = (100 * (wide[2026] / wide[2025] - 1)).round(1)
print(wide)
print("hidden (too few):",
sorted(set(eq.loc[~ok, "funding_stage"])))Output
yr 2025 2026 change_pct
funding_stage
Series A 18000.0 13000.0 -27.8
Series B 11300.0 11700.0 3.5
hidden (too few): ['Seed', 'Series C+']
3. Say it in one sentence
Median engineering equity at Series A companies fell 28% in a year, to $13,000, while Series B held steady at about $11,700; Seed and Series C+ are too small to report.
A two-week plan
About an hour a day. Do each question cold, then check the worked answer, then do it again the next day without looking.
Week 1
Week 2
Exam-day checklist
- Practise with the AI assistant off Hex has one built in. Many exams ban it, and you need to know you can do it alone. Ask what is allowed.
- Know how cells run Hex can rerun the cells below one you change. In Jupyter, cells run in the order you click. Do not reuse a variable name in two cells.
- Assumptions in a text cell, at the top The question in one sentence, then each assumption. Graders read this first.
- Name every result A SQL cell's result is a dataframe with a name. Use clear names, not the default ones.
- Upload files to the project Use the Files sidebar, then read by file name. Paths from your laptop will not work.
- Count rows after every join A second small SQL cell with COUNT(*) catches most join mistakes.
- Publish, then test the link Publish the app, open the link in a private window and check the reviewer can see it.
- Hide the code in the app Show text, key tables and charts. The notebook keeps the code for anyone who wants it.
- Keep a timer Stop at the cap. Write 'with more time, I would...' instead of going over.
- Screen share ready Bigger font, other tabs closed, notifications off.
Practise next
- A take-home, start to finish
- SQL and Python practice
- Data interview questions
- SQL from zero
- Python for data, from zero
- SQL by example: 28 patterns with check-your-answer questions
Sources
What each round tests, how long it takes and the example questions come from these public pages, read in December 2026. The incident.io and Monzo posts date from 2022.
- incident.io: Our data interview process (2022). Full loop, with the take-home brief and a 2-hour cap.
- Monzo: Data hiring at Monzo (2022). Project deep-dive, open take-home, live case with no live coding.
- Square: Revamping data science interviews (2025). Pair programming, case studies, rubrics, multi-part questions.
- Exponent / Aced: The data scientist interview loop. Typical rounds and times; startups favour take-homes.
- DataLemur: SQL interview guide. SQL topics and common mistakes.
- DataLemur: SQL window function questions. Window function question shapes.
- DataLemur: CodeSignal Data Science Framework questions. 90 minutes, 11 questions, what each covers.
- StrataScratch: Driver lifetime value take-home. A real take-home brief with a 2-hour cap.
- Product Data Science Interview: A/B testing chapter. Experiment design questions.
- Interview Handbook: Data science concept questions. Stats and ML concept questions, with a Bayes example.
All data on this page is made up for practice. Every output was produced by running the code shown, with DuckDB 2.0.1, pandas 3.1.2, numpy 2.4.6 and matplotlib 3.11.2. Hex features and menu names change; check Hex's docs if a step looks different.