Data Quality and Validation Questions
Ensuring correctness and trust in data: validation rules, constraints, completeness/accuracy/timeliness checks, and quality frameworks. Covers designing validation into pipelines, quality gates before publishing, and handling edge cases and real-world dirty data. Central to any data engineering or analytics role.
Define a set of measurable Service-Level Objectives (SLOs) for data quality on a pipeline that feeds business-critical dashboards: freshness (how stale can the data be), completeness (what fraction of expected records must arrive), and accuracy (how much deviation from a reconciled figure is tolerable). Propose concrete SLI definitions and target thresholds, explain what an error budget means in this context and what happens operationally when it is exhausted, and how you would report SLA compliance to the teams who depend on this data.
Sample Answer
Direct answer
Define measurable Service-Level Objectives (SLOs) for a data-quality pipeline across at least freshness (how stale the data may be), completeness (what fraction of expected records must arrive), and accuracy (how much deviation from a reconciled figure is tolerable), each with a concrete Service-Level Indicator (SLI), a numeric target, and an explicit error budget that defines how much SLO violation is tolerated before it triggers a mandated response.
Structured elaboration
- SLI definitions: freshness SLI = time between an event occurring and it being queryable in the warehouse; completeness SLI = percentage of expected source records present at the SLO evaluation time; accuracy SLI = percentage of partitions passing a reconciliation check within tolerance.
- Targets: pick targets from actual business need, not aspiration (a dashboard used only for a weekly review does not need sub-hour freshness even if it is technically achievable).
- Error budget: an SLO of "99% of partitions freshness under 2 hours" implies a 1% error budget; when that budget is exhausted (too many partitions missed the freshness target this period), the response should be a defined, pre-agreed action (a freeze on non-critical pipeline changes, a mandated root-cause review), not an ad hoc decision made under pressure during the next incident.
- Reporting: report SLA (Service-Level Agreement) compliance, tracked via the SLO/SLI definitions above, on a recurring cadence to the teams who depend on it, and treat a consistently-exhausted error budget as a signal to invest in reliability work, not just as a metric to track. Concretely, this means a weekly SLA scorecard (a dashboard, or an automated email if the consuming teams do not regularly check a dashboard) showing each of the three SLOs' current attainment percentage and remaining error budget for the period, with a simple red/amber/green status per metric, sent to the consuming teams' leads; separately, an error-budget exhaustion (like the freshness example below) triggers an automatic escalation notice the moment it happens, rather than waiting for the next scheduled weekly report to surface it.
Worked example
A customer-analytics pipeline processing 50 million events per day sets: freshness SLI/SLO = 95% of daily partitions available within 3 hours of day-end; completeness SLI/SLO = row count within 2% of the trailing 7-day median; accuracy SLI/SLO = 99% of daily reconciliation checks pass within a 1% tolerance against the source system. If freshness misses its target on 8 of the last 100 partitions (an 8% miss rate against a 5% allowed miss rate), the error budget is exhausted and the team's pre-agreed response, for example pausing new feature rollouts on the ingestion pipeline until the root cause of the freshness misses is found, kicks in automatically rather than being negotiated in the moment. That same week's SLA scorecard reports it concretely: "Freshness: 92% attainment against a 95% target, RED, 160% of this week's freshness error budget used (8 misses against a 5-miss allowance)", alongside "Completeness: 99.6% attainment against a 98% target, GREEN" and "Accuracy: 99.4% attainment against a 99% target, GREEN", sent to the consuming teams' leads, with the RED freshness line being exactly what triggered the automatic escalation notice mid-week rather than waiting for this scheduled report to surface it.
Trade-offs and pitfalls
The most common mistake is setting SLO targets to match whatever the pipeline currently achieves, rather than what the business actually needs; this makes the SLO meaningless as a quality bar (it can never be missed) and defeats the purpose of having an error budget at all. A second common mistake is defining an accuracy SLO without first having a trustworthy reconciliation source to measure against, which produces a target that looks precise but cannot actually be verified.
You receive an unfamiliar dataset from a partner team or a new source you've never seen. What are your first ten actions to profile and validate it before anyone uses it in reports or models? Include the quick checks you'd run first, the deeper validations you'd follow up with, and how you'd document initial findings for stakeholders.
Sample Answer
Direct answer
Ten concrete first actions, roughly in order: confirm row count and schema against what you were told to expect; check dtypes per column; compute null rate and duplicate-row count; look at min/max and a few percentiles for every numeric column; get distinct-value counts and top values for every categorical column; spot-check a sample of raw rows by eye; verify any key or ID column is actually unique if it's supposed to be; check date ranges for anything out-of-bounds (future dates, dates before the business existed); look for an obviously wrong unit or scale (cents vs dollars, seconds vs milliseconds); and write down the three or four things that most surprised you.
Walking through the actions
The first few actions are about trust, not insight: does the file even match the schema you were promised, and does anything look mechanically broken (a column that's supposed to be numeric but parses as text, a primary key with duplicates)? Only once those pass do you move to the "deeper validations": distributions per column, cross-checks between related columns (does end_date ever come before start_date?), and a manual read of 20 to 30 raw rows, which catches things summary statistics hide, like a free-text field that's actually three fields crammed together.
Worked example
A partner team sends a transactions export. Your first ten actions surface: the file has 120,000 rows against an expected ~118,000 (close enough, likely fine); transaction_id is unique as expected; amount ranges from -450 to 9,800, and the negative values turn out to be refunds, not errors, once you check the type column; country has 4 spellings of "United States"; and 3% of rows have a customer_id of exactly 0, which your manual read reveals is a placeholder for guest checkouts, not a missing value. None of that required modeling, just a disciplined first pass.
Documenting findings for stakeholders
The tenth action, writing down what surprised you, only helps the rest of the organization if it turns into an actual artifact someone besides you reads, not notes left in your own scratch file. A concrete version for the transactions export above: post a short message (to the requesting team's channel, or a short doc linked from the ticket that asked for the dataset) with one line per finding, stating what was checked, what was found, and whether it blocks use, before the dataset is used in any report or model. For example: "Row count: 120,000 vs. ~118,000 expected, within normal variance, not a blocker. Amount: ranges from -450 to 9,800; negative values are refunds confirmed via the type column, not data errors, not a blocker. Country: 4 distinct spellings of United States, needs normalization before any country-level rollup, blocks country-level grouping until fixed. customer_id: 3% of rows are exactly 0, confirmed as a guest-checkout placeholder rather than a missing value, not a blocker but should be flagged so downstream users don't mistake it for bad data and drop those rows." A findings summary in this one-line-per-finding, found-plus-blocking-status shape lets the requesting team decide, per finding, whether to use the data as-is, wait for a fix, or work around a known quirk, instead of each downstream consumer rediscovering the same quirks independently after something is already wrong in a report.
Trade-offs and pitfalls
Time-box this: a "first ten actions" pass is meant to take an hour or two, not a day. If a check surfaces something that needs deeper investigation (like the guest-checkout placeholder above), note it and move on rather than resolving it inline, so you get through the full breadth of checks before diving deep on any one of them. The other pitfall is skipping the manual row-by-row read because it feels unscientific: automated summary statistics won't catch a genuinely weird encoding the way ten minutes of eyeballing raw rows will.
You must communicate a recurring data-quality issue and its business impact to executive stakeholders who were not involved in diagnosing it. Prepare the structure of that communication: a plain-language problem statement, the magnitude of impact, a root-cause summary, a remediation plan with timelines and owners, and the residual risk that remains after the fix. What would you include, and deliberately leave out, to build confidence without overwhelming a non-technical audience?
Sample Answer
Direct answer
A communication about a recurring data-quality issue to executive stakeholders needs a plain-language problem statement, the magnitude of impact, a root-cause summary, a remediation plan with timelines and named owners, and the residual risk that remains after the fix, deliberately leaving out implementation-level technical detail that does not change the decision the executive audience needs to make.
Structured elaboration
- Problem statement: one or two sentences, in business terms, no jargon, stating what happened and what it affects.
- Magnitude: a specific, quantified number (dollars, percentage, duration), not a vague qualifier like "significant," since a specific number is what lets an executive calibrate how much attention this genuinely deserves relative to everything else competing for their time.
- Root-cause summary: enough detail to establish that the cause is understood and the fix is targeted at the real problem, not a full technical post-mortem; the goal is to build confidence that this is being handled competently, not to teach the audience the underlying engineering.
- Remediation plan: concrete dates and named owners, not "we're working on it," since vague timelines are what erode confidence fastest with an executive audience.
- Residual risk: explicitly state what will NOT be fully resolved by this fix, and why, rather than implying the problem is entirely closed; an executive who later discovers an unmentioned residual risk on their own loses more trust than one who was told about it up front.
Worked example
"We identified a recurring issue in [pipeline] that has been undercounting [metric] by approximately 3% since [date], affecting [specific reports/decisions]. Root cause: [one-sentence summary]. We are deploying a fix by [date], owned by [name/team], and will backfill corrected historical figures by [date]. Residual risk: this fix addresses the specific bug found, but the underlying pipeline lacks automated regression testing for this class of error; we recommend a follow-up investment of [scope] to close that gap and prevent a similar issue recurring in a different form." This gives the executive everything needed to decide whether they are satisfied with the response or want to push for the follow-up investment, without requiring them to understand the technical root cause in detail.
Trade-offs and pitfalls
The instinct to lead with reassurance ("it's fixed, don't worry") rather than with the honest magnitude and residual risk is the most common way this kind of communication backfires: if a related issue resurfaces later, or if the residual risk that was omitted turns out to matter, the credibility cost of appearing to have understated the problem the first time is far higher than the short-term discomfort of stating it plainly up front.
You are asked to design an organization-wide data-quality program covering people, process, and technology: roles (such as data stewards), policies and standards, tooling choices (a framework like Great Expectations or dbt tests), training, and success KPIs. Propose a phased rollout (pilot, scale, sustain) with measurable milestones for a six-month horizon, and explain how you would drive adoption across teams that do not report to you.
Sample Answer
Direct answer
An organization-wide data-quality program needs to cover people (roles like data stewards with clear accountability), process (policies, standards, and an incident-response playbook), and technology (a chosen tooling stack), rolled out in phases (pilot, scale, sustain) with measurable milestones, since attempting a company-wide rollout all at once, without a proven pilot, is the most common way this kind of initiative fails.
Structured elaboration
- Pilot phase (roughly months 1-2): select one or two high-visibility, high-pain pipelines as the pilot, implement the full program (stewardship, standards, tooling) end-to-end for just those, and use the pilot to prove the model works and generate a concrete before/after story to build momentum with.
- Scale phase (roughly months 3-4): expand from the pilot to the next tier of critical pipelines, using lessons learned (what tooling choices worked, what process friction showed up) to refine the approach before it becomes standard practice everywhere.
- Sustain phase (roughly months 5-6 and beyond): make the standards and tooling the default for new pipelines going forward, establish ongoing training and onboarding for new team members, and define success KPIs that are tracked continuously rather than only during the initial rollout.
- Tooling choices: the technology leg is not just "pick a tool," it is picking the tool whose friction matches how the organization already works. For a team already heavily invested in dbt-based SQL transformations, dbt tests (the built-in and dbt-native
unique,not_null,accepted_values,relationshipstests, plus custom SQL-based tests) are the lower-friction choice: they live alongside the existing models, run in the samedbt testinvocation the team already uses, and require no new language or deployment surface. For an organization needing richer, cross-language validation (Python-based pipelines, non-dbt sources, or a need for a structured, queryable validation report rather than a pass/fail test run), Great Expectations is the better fit: it is a standalone Python framework that produces a structured "data docs" report and integrates with a wider range of data sources than a SQL-only tool can. The right call is decided by which cost the team can least afford, the friction of adopting a new tool outside their existing stack, or the limitation of a SQL-only tool when the pipeline is not SQL-only, not by which tool is abstractly "better." - Driving adoption across teams that do not report to you: this is fundamentally an influence problem, not an authority one; the pilot's concrete, quantified success story (a real incident prevented, a real cost saved) is usually the most effective adoption lever, more so than a mandate from above, because it gives other team leads a self-interested reason to opt in rather than a compliance obligation to resent.
Worked example
A six-month program: months 1-2 pilot the full program on the two pipelines that generated the most incidents last quarter, producing a concrete result (for example, a measured 80% reduction in data-quality-related incident tickets for those two pipelines); months 3-4 use that result to recruit three more team leads to adopt the same standards and tooling voluntarily, refining the onboarding process based on friction the pilot teams reported; months 5-6 make the validated tooling the default for any new pipeline going forward and establish a recurring quarterly review of the program's KPIs (incident rate, time-to-detection, percentage of critical datasets with defined quality checks) to the leadership team.
Trade-offs and pitfalls
The failure mode this phased approach specifically avoids is a mandated, all-at-once rollout with no proven pilot: teams asked to adopt an unproven process purely by directive tend to comply minimally and revert as soon as attention moves elsewhere, whereas teams who see a peer team's concrete, quantified success story are far more likely to adopt genuinely and sustain it. The trade-off is speed, a pilot-first approach is slower to reach full coverage than a mandate, but it is far more likely to actually stick once it gets there.
Compare strategies for handling missing values in a dataset used for reporting or modeling: dropping rows, simple statistical imputation (mean/median/mode), model-based imputation (KNN, MICE), an explicit "missing" category, and leaving values as-is for models that support NaNs natively. For each, describe the bias it can introduce into aggregates or downstream inference, and how the right choice depends on whether missingness is completely random, random conditional on other fields, or informative in its own right.
Sample Answer
Direct answer
Dropping rows, simple statistical imputation, model-based imputation, an explicit "missing" category, and leaving values as-is each introduce a different kind and amount of bias into downstream aggregates, and the right choice depends on how much data would be lost, whether the missingness itself carries information, and whether the consuming model or report can handle an explicit missing indicator natively.
Structured elaboration
- Dropping rows: unbiased only if missingness is completely random (MCAR); if missingness correlates with anything else in the data (MAR) or with the missing value itself (MNAR), dropping rows systematically removes a non-representative subset and biases every downstream aggregate, not just the missing column's own statistics.
- Simple statistical imputation (mean/median/mode): preserves sample size but artificially shrinks variance (every imputed value is identical, collapsing the natural spread) and can distort correlations between the imputed column and everything else, since the imputed value carries no relationship to the other fields in that row.
- Model-based imputation (KNN, MICE): KNN (K-nearest-neighbors imputation) fills a missing value using the average of that same field across the most similar other rows, similar meaning close on the other, non-missing features; MICE (Multiple Imputation by Chained Equations) iteratively models each incomplete column as a function of all the other columns, cycling through columns and refitting until the imputed values stabilize. Both better preserve relationships between features than simple imputation, since the imputed value is informed by similar records, but are more expensive to compute, harder to explain to a non-technical stakeholder, and can still introduce circularity risk if not done carefully.
- Explicit "missing" category: for categorical features, adding "missing" as its own valid category rather than imputing a value preserves the actual information (that it was missing) rather than manufacturing a value; for numeric features the closest analog is a paired missing-indicator flag alongside an imputed value. The bias this introduces into aggregates is different in kind from the other strategies: instead of shifting a mean or proportion, it changes what the aggregate is computed over. A "percentage of customers in category X" computed with missing kept in as its own bucket correctly reflects the true unknown rate, while the same statistic computed after silently excluding or imputing the missing rows will read differently, so any downstream aggregate has to decide explicitly whether "missing" counts as its own segment or gets excluded from the denominator, and getting that decision wrong is itself a source of bias.
- Leaving values as-is: only viable for models that natively handle NaN (some tree-based models do); for reporting and most other modeling contexts, this simply propagates missingness downstream unresolved. The bias risk here is not inside the model itself (a tree-based model can legitimately split on "is this value missing", which is often genuinely informative under MNAR) but in any aggregate computed outside that model: a plain
AVG()orSUM()over a column with NaNs left in typically skips those rows by default in most SQL and pandas implementations, which is silently equivalent to a row-drop strategy for that one aggregate even though no row was actually removed from the dataset, so "leaving as-is" defers the bias decision to whatever tool happens to compute the next aggregate, rather than eliminating it.
Worked example
Under MCAR (missing completely at random), mean imputation on a numeric column leaves the mean of the column mathematically unchanged (since the missing values were a random subsample, imputing the mean does not shift it) but understates the true variance, since every imputed value contributes zero deviation from the mean. Under MNAR, for example high-income respondents disproportionately skip an income question, mean imputation using only the observed (systematically lower-income) values produces a biased-downward mean estimate for the full population, and no amount of more sophisticated imputation on the observed data alone can fully correct this without an external signal about the true relationship between income and the propensity to skip the question. To make this concrete with an illustrative (invented for this example, not measured) population: suppose 100 survey respondents have a true full-population mean income of $60,000, and the 20 who skip the income question happen to average $92,000 while the 80 who answer average $52,000; the underlying arithmetic is internally consistent, (80 x $52,000 + 20 x $92,000) / 100 = ($4,160,000 + $1,840,000) / 100 = $60,000. Mean imputation only ever sees the 80 observed rows, so it fills each of the 20 missing values with $52,000, the observed mean, and the reported overall mean stays at $52,000, $8,000 short of the true $60,000, with nothing in the observed data alone signaling that a gap exists.
Trade-offs and pitfalls
The critical, easy-to-skip step is diagnosing which missingness mechanism (MCAR, MAR, MNAR) is actually present before picking a strategy, since the same imputation method that is nearly harmless under MCAR can introduce serious, hard-to-detect bias under MNAR. Treating imputation as a purely mechanical, one-size-fits-all step, applied without first checking whether missingness correlates with anything else in the data, is the single most common way this class of decision goes wrong.
Unlock Full Question Bank
Get access to all 32 Data Quality and Validation interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.