Data Engineering interview questions: pipeline quality, observability & data validation

Reviewed by Mark Dickie · Last updated

10 questions on this page you can answer and see marked on the spot. Go to the first one

Data engineering pipeline quality is the practice of ensuring data moving through ingestion, transformation, and storage layers meets correctness, completeness, and freshness expectations. For a pipeline-quality interview, expect questions on schema validation, freshness SLOs, anomaly detection on volume and distribution, and the tooling that makes these checks observable. You should be able to distinguish between data tests (assertions against values or schema) and pipeline tests (assertions against orchestration behavior), and know where tools like Great Expectations, dbt tests, Soda, and Deequ fit. Interviewers also probe how you alert on anomalies without drowning teams in false positives, how you partition checks by freshness tiers, and how you trace a metric anomaly back to an upstream schema change or backfill.

What does a data engineering observability interview test?

An observability round checks whether you can instrument a pipeline end to end and reason about what the signals mean. The table below maps the four signal families interviewers ask about.

Signal familyWhat it measuresCommon toolsTypical interview question
FreshnessTime since last successful run or last new recordAirflow sensors, DAG-level SLAsHow do you detect a stalled upstream feed before downstream models break?
Volume / completenessRow count vs. rolling baseline or expected windowdbt tests, Soda checks, custom SQLWhat alert threshold would you set so a 5% daily dip is noise but a 40% drop is not?
Distribution / anomalyMean, null rate, cardinality, quantile driftGreat Expectations, Deequ, Monte CarloHow do you catch a silent schema change that keeps types but shifts value distributions?
SchemaColumn presence, type, nullabilitydbt schema.yml, Gx ExpectTableColumnsToMatchSetHow do you version a breaking schema change across a shared downstream model?

How do you design a data validation strategy?

  1. Identify the critical path. Start from the dashboards or ML features that consume the pipeline, then work backward to the source tables whose errors would break them.
  2. Define tiered SLOs. Not every table needs a one-minute freshness alert. Tier SLAs by downstream impact so one off-schedule feed does not page the whole team.
  3. Write assertions close to the transform. Put dbt tests or Great Expectations suites on the model where the data is shaped, not only at the source landing zone.
  4. Set anomaly baselines on a trailing window. Compare today's row count and null rates to a rolling median, not a fixed number, so seasonal patterns do not trigger false alerts.
  5. Route alerts by severity. Hard failures block downstream runs; soft anomalies write to an observability dashboard and a Slack channel for triage.
  6. Make failures debuggable. Store the failing rows, the check that failed, and a link to the run in the alert payload so the on-call engineer can start diagnosis without querying the warehouse first.

Key facts

  • Tarmac's Data Engineering interview questions cover 25 questions at difficulty 1–5 of 5.
  • Tarmac tracked 2,329 job postings asking for Data Engineering in November 2026.
  • Roles asking for Data Engineering advertise a median base salary of £75,000, across 724 job postings as of November 2026.
  • Tarmac last reviewed these Data Engineering interview questions on 14 October 2026.

At a glance

Questions25
Difficulty1–5 of 5
FormatsTrue / false, Short answer, Fill in the blank, Multiple choice, Find the bug, Code output, Multiple answer

What you'll review

  1. data validation testing pipelines

Practice questions

Try one before you open the answer. Pick an option and press Check; it's marked on the spot.

In a data pipeline, a schema validation check is used to verify that incoming records match an expected structure — such as column names and data types — before the data is loaded downstream.#

Options

Show answer

True. Schema validation in a data pipeline checks that incoming records conform to an expected structure — column names, data types, and constraints — so that malformed data is caught before it reaches downstream consumers.

Why:

Schema validation confirms that incoming data conforms to a predefined schema: expected column names, data types, and constraints. This catches structurally incompatible records early so they don't propagate downstream and cause silent errors in dependent tables or analytics.

In a data pipeline, what is data validation, and what kinds of rules does it check on incoming records before they are loaded into downstream tables?#

Show answer

Data validation checks incoming data against defined quality rules, such as schema conformity, nullability, value ranges, and uniqueness, so that bad records are caught before they reach downstream systems.

Why:

Data validation means running explicit checks on incoming records against expected rules (schema, null constraints, value ranges, uniqueness) before loading, so invalid or unexpected data is caught early instead of propagating to tables, dashboards, or models. A strong answer names both the purpose (catching bad data before it propagates) and concrete rule types.

In a data engineering pipeline, what is the purpose of data validation checks, and what kinds of rules do they typically enforce?#

Show answer

Data validation checks verify that ingested data conforms to defined quality rules before it reaches downstream systems. Typical rules include schema conformance (expected column names), column data types, nullability constraints, allowed value ranges, and uniqueness of keys.

Why:

Data validation checks verify that ingested data conforms to expected quality rules before it reaches downstream systems, so bad records are caught before they corrupt consumers. The typical rules are structural and content-level: column names and schema, data types, nullability, allowed value ranges, and uniqueness. Encrypting sensitive columns is a security concern, scheduling runs is orchestration, and aggregating raw events into dashboards is transformation, so none of those count as validation.

In dbt Core 1.x, the built-in generic test that fails when any non-null value in a column appears in more than one row is named _____. It is declared in a model's YAML file under the column, and null checks are a separate built-in test named not_null.#

Show answer

In dbt Core 1.x, the built-in generic test that fails when any non-null value in a column appears in more than one row is named unique. It is declared in a model's YAML file under the column, and null checks are a separate built-in test named not_null.

Why:

dbt Core ships four generic data tests: unique, not_null, accepted_values and relationships. The unique test checks that no non-null value in a column appears in more than one row, and it ignores nulls, which are handled separately by not_null. The blank therefore takes the single term unique, the name used as the YAML key. The prompt pins the tool (dbt Core 1.x) and the null behavior, so no synonym is needed.

Which data validation test checks that a column contains no missing values?#

Options

Show answer

The not-null test checks that a column contains no missing values. It asserts that every row has a non-null value in that column, which flags gaps in the data. Uniqueness, schema, and range tests check different properties and do not guard against nulls.

Why:

A not-null test asserts that every row in the target column has a non-null value, so it directly catches missing values. A uniqueness test checks for duplicate values, a schema test checks column types and structure, and a range test checks that values fall within bounds. None of those specifically guard against missing values.

In a data pipeline using Great Expectations (v0.18+), you need to verify that every row in the orders table has a non-null value in the order_id column. Which built-in expectation enforces this constraint? Give its name.#

Show answer

Use expect_column_values_to_not_be_null on the order_id column; it fails validation if any row has a null value there. (In the GX 1.x Python API this is the ExpectColumnValuesToNotBeNull class.)

Why:

The built-in expectation expect_column_values_to_not_be_null checks that no value in the specified column is null, which is exactly the constraint required for order_id. Uniqueness checks such as expect_column_values_to_be_unique detect duplicates rather than nulls, while expect_column_values_to_be_in_set and expect_column_values_to_match_regex validate membership and pattern conformance and do not address null detection.

In a dbt schema.yml file (dbt Core v1.7), the built-in generic test that verifies every value in a column is distinct is named _____, and the built-in generic test that ensures a column's values exist as a foreign key in another model is named _____.#

Show answer

In a dbt schema.yml file (dbt Core v1.7), the built-in generic test that verifies every value in a column is distinct is named unique, and the built-in generic test that ensures a column's values exist as a foreign key in another model is named relationships.

Why:

dbt ships with four built-in generic tests: unique (all values in a column are distinct), not_null (no nulls), accepted_values (values belong to an allowed set), and relationships (referential integrity, where each value in the child column exists in the parent model's column). The unique test covers the distinctness constraint, and relationships covers the foreign-key constraint.

Consider the following Python snippet from a data validation step in an ETL pipeline. The pipeline should fail the load stage when the user_id column contains any null values, but currently it never raises an error even when nulls are present. Identify the buggy line (1-based line numbers).#

import pandas as pd

def validate_user_ids(df: pd.DataFrame) -> None:
    nulls = df[df['user_id'].isna()]
    if len(nulls) == 0:
        raise ValueError('user_id contains null values')
Show answer

The bug is on line 5.

Why:

The buggy line is the if len(nulls) == 0: condition on line 5. The filter on line 4 correctly selects the rows where user_id is null, so nulls holds those rows. The condition len(nulls) == 0 is True only when no nulls were found, so the ValueError is raised exactly when the data is clean, and never when nulls are present. Changing the comparison to len(nulls) > 0 (or if not nulls.empty:) makes the error fire when nulls exist.

Which statement correctly describes the purpose of data freshness monitoring in a data observability tool such as Monte Carlo?#

Options

Show answer

Data freshness monitoring checks whether new data has arrived in a table within an expected time window, alerting when the table is stale or delayed. It compares the most recent load or event timestamp against the current time and historical patterns, so a broken upstream pipeline gets flagged. It does not check nulls, duplicates, or value distributions, which are separate data-quality dimensions.

Why:

Freshness monitoring tracks how recent the data in a table is, typically by comparing the maximum load-time or event-time timestamp against the current time and against historical arrival patterns. If no new data lands within the expected window, the tool alerts that an upstream pipeline may be broken. The option about NULL values describes completeness checks, the option about repeated primary-key values describes uniqueness checks, and the option about value distributions describes distribution monitoring. Those are separate data-quality dimensions, so none of them is the purpose of freshness monitoring.

In the Great Expectations data validation framework, what is the name of the reusable, named collection of individual Expectations (such as expect_column_values_to_not_be_null or expect_column_values_to_be_between) that together define the expected properties of a dataset?#

Show answer

Expectation Suite. It is a named, reusable collection of individual Expectations that together capture the expected properties of a dataset and serve as the core artifact for data-quality rules.

Why:

Great Expectations distinguishes its components precisely. An Expectation Suite is a named, reusable collection of individual Expectations, each such as a not-null check or a range check, that together define the expected properties of a dataset. It is the core artifact that captures data-quality rules, and it is what a validation run evaluates a batch of data against.

In a batch ETL pipeline, a schema validation check that verifies every column's data type matches the expected schema is sufficient on its own to guarantee that the data satisfies all business rules (such as value-range constraints, referential integrity, and uniqueness) specified in the data contract. True or false?#

Options

Show answer

Schema validation alone does not guarantee business-rule compliance in a batch ETL pipeline. A schema check only confirms structure, such as column names, data types, and nullability. Value-range limits, referential integrity, and uniqueness need separate data-quality checks on top of schema validation to satisfy a data contract.

Why:

Schema validation verifies structural conformance: column names, data types, and nullability. It does not enforce business-rule constraints such as value ranges, referential integrity, uniqueness, or cross-column relationships. Those require additional column-level and multi-column data-quality checks layered on top of schema validation, so a passing schema check alone cannot guarantee contract compliance.

You need to write a data-quality check for an ETL pipeline. The orders table should always satisfy these rules: the order_id column is a unique primary key, the status column only contains the values 'pending', 'shipped', or 'delivered', and the created_at column is never null. Which of the following is a valid assertion the check should make?#

Options

Show answer

A valid data-quality assertion for the orders table checks that order_id is unique, status is in ('pending','shipped','delivered'), and created_at is not null. Each check directly encodes one business rule as a testable condition, so the pipeline can fail when any rule is violated.

Why:

A data-quality assertion must encode each business rule as a testable condition on the dataset. The rule that order_id is a unique primary key becomes a uniqueness check, the rule restricting status to pending, shipped, or delivered becomes a membership check against that allowed set, and the rule that created_at is never null becomes a NOT NULL check. Only the assertion combining these three conditions covers all three stated rules. The other options each contradict one of the rules: allowing arbitrary status strings ignores the allowed set, allowing null created_at ignores the NOT NULL rule, and allowing duplicate order_id values breaks the primary key uniqueness.

A nightly batch pipeline sometimes completes successfully but loads 40% fewer rows into the warehouse than the source contains, and downstream consumers only notice days later. Name the check that, at the end of each run, compares the row count in the loaded target against the row count obtained independently from the source, and fails the run when the gap exceeds a configured threshold.#

Show answer

A source-to-target row count reconciliation. After the load completes, the check compares the number of rows landed in the warehouse for the batch against a count obtained independently from the source system, and fails the run when the difference exceeds a configured threshold.

Why:

The failure described is a silent volume shortfall that occurs somewhere between extraction and the warehouse, so the check must compare the number of rows that actually landed in the target against an expected count taken independently from the source. That comparison is a source-to-target row count reconciliation, and it fails the run when the gap exceeds a threshold, which surfaces the loss in the same run instead of days later. Because it checks the final loaded state, it catches drops during extraction, transformation, or load alike. Null checks, schema validation, and latency monitoring do not measure whether the expected number of rows arrived.

What does the following Python code print?#

def validate_volume(actual, expected, tolerance_pct):
    if expected == 0:
        return "PASS" if actual == 0 else "FAIL"
    lower = expected - expected * tolerance_pct / 100
    upper = expected + expected * tolerance_pct / 100
    if actual < lower:
        return "FAIL"
    if actual > upper:
        return "FAIL"
    return "PASS"

print(validate_volume(95000, 100000, 5))
Show answer
PASS
Why:

The call passes actual=95000, expected=100000, tolerance_pct=5. Because expected is non-zero, the early return is skipped. The bounds are computed as lower = 100000 - 5000.0 = 95000.0 and upper = 100000 + 5000.0 = 105000.0; these multiplications and divisions are exact in floating point. The first check, 95000 < 95000.0, is False because the comparison is strict, so the lower boundary is accepted. The second check, 95000 > 105000.0, is also False. Neither failure branch runs, so the function returns "PASS", which the print statement outputs. The boundary is inclusive because both checks use strict inequalities.

A nightly ETL job loads a source table into your data warehouse. Yesterday a source-system upgrade silently changed a column's data type from INTEGER to VARCHAR. Which data-validation check should you add to the pipeline to catch this before bad data is loaded?#

Options

Show answer

A schema-validation step at the ingestion boundary is the check to add. It compares incoming column names and data types against a stored contract and fails the run on a mismatch, so a silent INTEGER-to-VARCHAR change is caught before any rows are written to the warehouse.

Why:

A type change from INTEGER to VARCHAR is a schema drift event, so it must be detected by comparing the incoming column names and types against a known contract at the ingestion boundary; the pipeline then fails before any rows are written. Row-count reconciliation, statistical outlier detection, and primary-key uniqueness checks all run after the data is already in the warehouse, and none of them inspects the declared column types, so none of them catches this change before loading.

A data engineer wrote the following Python validation function to check a batch of records for missing required fields and duplicate IDs before loading into a warehouse. What exactly does the script print when run? Trace the code step by step and report the exact output printed.#

def validate(records):
    required = ['id', 'name', 'email']
    missing = 0
    duplicates = 0
    seen_ids = set()
    for row in records:
        if any(row.get(f) is None for f in required):
            missing += 1
        if row['id'] in seen_ids:
            duplicates += 1
        else:
            seen_ids.add(row['id'])
    return {'missing': missing, 'duplicates': duplicates}

records = [
    {'id': 1, 'name': 'Alice', 'email': '[email protected]'},
    {'id': 2, 'name': None, 'email': '[email protected]'},
    {'id': 1, 'name': 'Charlie', 'email': '[email protected]'},
    {'id': 3, 'name': 'Diana', 'email': None},
]

print(validate(records))
Show answer
{'missing': 2, 'duplicates': 1}
Why:

The function loops over the four records. Record 1 has every required field non-None, so missing stays at 0; id 1 is not yet in seen_ids, so it is added. Record 2 has name set to None, so missing becomes 1; id 2 is new and is added. Record 3 has all fields present, so missing is unchanged; its id 1 is already in seen_ids, so duplicates becomes 1 and the set is not changed. Record 4 has email set to None, so missing becomes 2; id 3 is new and is added. The function returns a dict with missing equal to 2 and duplicates equal to 1, and print displays it as {'missing': 2, 'duplicates': 1}.

In a production data pipeline that uses a data-validation framework such as Great Expectations, Deequ, or Soda, which of the following are standard practices for maintaining data quality observability? Select all that apply.#

Options

Pick every one that applies.

Show answer
  • Defining declarative, executable checks that encode business rules and schema constraints as assertions evaluated on each batch of data
  • Persisting validation results as metrics over time so quality trends can be tracked across pipeline runs
Why:

Declarative, executable checks that encode business rules and schema constraints as assertions evaluated on each batch are a common mechanism across these tools, even though each names its artifacts differently (Great Expectations expectation suites, Deequ constraints within checks, Soda SodaCL checks). Storing validation results as metrics over time lets teams track quality across runs and spot regressions, which is standard observability practice. Running validation only in production is an anti-pattern because checks should shift left and run at multiple stages so bad data is caught before it reaches production or downstream consumers. Muting failures so runs never surface quality problems removes the feedback signal that observability exists to provide, so it is not a standard practice.

You operate a Spark ETL pipeline that reads from Kafka, aggregates events into a daily fact table, and writes partitioned Parquet to S3. Over the past month, total_revenue in downstream dashboards has been drifting downward. No code was deployed, and existing tests (schema validation and row-count reconciliation against the upstream source table) all pass. Which pair of observability checks would detect this kind of value-level corruption that the existing tests cannot?#

Options

Show answer

Column-level distribution checks on the value column (null rate, min/max, percentiles) combined with a SUM reconciliation between source and target detect value-level drift. Schema validation and row-count reconciliation cannot catch this, because the rows and columns stay structurally intact while the values inside them change.

Why:

Schema validation and row-count reconciliation both pass, so the problem is not structural change or row-level loss; it is value-level corruption inside existing rows. Distribution checks on the event_value column detect shifts in null rate and percentiles, and a SUM(event_value) reconciliation between source and target detects aggregate value divergence that row counts cannot show. Freshness and file-size checks monitor pipeline health and storage, not content. Primary-key uniqueness targets duplicate rows, which matching row counts already rule out. Dashboard latency and Kafka consumer lag address performance and delivery throughput, and neither detects wrong values when row counts are correct.

A team is building a streaming pipeline: CDC events land in Kafka topics, a stream processor (Flink or Spark Structured Streaming) consumes them, applies light transformations, and writes to a partitioned data lake. Which of the following are well-established, practical data quality validation and observability strategies for this architecture? Select all that apply.#

Options

Pick every one that applies.

Show answer

Schema registry enforcement on Kafka topics, per-window column statistics compared against baselines, and dead-letter queues with failure-volume alerting are well-established validation and observability strategies for streaming pipelines. Each catches bad data at a different stage: ingestion, content drift, or per-record failures. Full-table reconciliation after every micro-batch is prohibitively expensive at that cadence.

Why:

The three well-established strategies are enforcing schema compatibility at the topic level with a schema registry (rejects malformed or incompatible records at ingestion), computing windowed column-level statistics such as null rate and distinct-count ratio against baselines to detect anomalies (a standard streaming observability pattern), and routing failing records to a dead-letter queue with volume-based alerting (a standard error-handling pattern in stream processors). Full-table reconciliation after every micro-batch is not practical because the source is a changelog rather than a static snapshot, the destination is continuously appended to, and full scans at micro-batch cadence are prohibitively expensive; incremental or watermark-based checks are the streaming-appropriate alternative. Silently dropping records with null keys without logging or metrics removes all visibility into data loss, so it is the opposite of observability.

The following Python function implements a completeness validation check for a batch of records loaded by a data pipeline. It computes a completeness ratio using the worst-performing required field and a 95% pass threshold. What does it print when run?#

records = [
    {"id": 1, "name": "Alice", "email": "[email protected]"},
    {"id": 2, "name": "Bob", "email": None},
    {"id": 3, "name": None, "email": "[email protected]"},
    {"id": 4, "name": "Dave", "email": None},
]

required_fields = ["name", "email"]
threshold = 0.95

max_nulls = 0
for field in required_fields:
    null_count = sum(1 for r in records if r.get(field) is None)
    max_nulls = max(max_nulls, null_count)

completeness = (len(records) - max_nulls) / len(records)
passed = completeness >= threshold
print({"passed": passed, "null_count": max_nulls, "completeness_ratio": completeness})
Show answer
{'passed': False, 'null_count': 2, 'completeness_ratio': 0.5}
Why:

There are 4 records. For the name field, only record 3 has None (1 null). For the email field, records 2 and 4 have None (2 nulls). The loop keeps the worst null count, so max_nulls = max(1, 2) = 2. Then completeness = (4 - 2) / 4 = 0.5. Since 0.5 is less than 0.95, the passed flag is False. The printed dict is {'passed': False, 'null_count': 2, 'completeness_ratio': 0.5}.

You are designing the data quality validation and observability layer for a production batch ETL pipeline. The pipeline ingests daily vendor CSV files, transforms them into a dimensional model, and serves a BI tool. Describe the key practices you would implement for production-grade data validation testing and pipeline observability, covering ingestion validation, data quality checks, freshness monitoring, and alerting/observability.#

Show answer

At ingestion, I would validate each vendor CSV against a versioned schema contract before any transformation: check column names, order, types, and required fields, and quarantine files that show schema drift instead of loading them. Inside the pipeline, I would add layered data quality tests at each stage: null checks on required keys, range and validity checks on measures, uniqueness constraints on natural keys, and referential integrity between facts and dimensions, with failing rows routed to a quarantine table and counted. For freshness, I would track the expected arrival time of each vendor file and alert when a delivery is missing or late against its SLA, and I would also alert on the dataset's last successful load time so stale data is never served silently. For observability, I would record test pass/fail rates, row-count and volume anomaly signals, and run metadata, surface data lineage from source files to BI models, and expose dashboards and alerts to both engineering and BI stakeholders with clear ownership and runbooks.

Why:

This is an open design question, so it stays a short answer graded on coverage rather than a single key. A strong answer covers all four areas named in the prompt: schema and contract validation at ingestion to stop vendor structure drift before it reaches the dimensional model; layered data quality checks (nulls, ranges, uniqueness, referential integrity) at each stage with quarantining of bad rows; freshness monitoring against vendor delivery SLAs so missing or late files are caught rather than silently serving stale data; and observability through test pass/fail metrics, volume anomaly detection, lineage, and stakeholder-facing dashboards and alerts. Answers that name concrete mechanisms for each area, rather than generic statements about quality, demonstrate the depth expected at this level.

A data team ingests a daily vendor Parquet export into Snowflake through a Spark batch pipeline. Their checks are: (1) CI contract tests against a checked-in sample file that assert column names, types, and not-null constraints; (2) dbt tests run after load, including not-null, unique, accepted_values on key columns, and a custom check that the daily row count is within ±10% of the prior day; (3) a observability platform that monitors null rates and volume anomalies on loaded tables. No distribution-drift monitoring is configured on categorical columns. The vendor feed includes a numeric lifetime_spend column alongside customer_tier. The vendor then adds the value 'diamond' to customer_tier for a new product line, without documentation. The dbt accepted_values test fails, and the team adds 'diamond' to the allowed list and reruns. Two weeks later a revenue dashboard shows a 40% undercount. The investigation finds that the vendor also redefined 'gold' from customers with more than $10,000 lifetime spend to customers with more than $5,000. The column name, type, and the value 'gold' are unchanged, the total row count is the same, and the share of 'gold' rose from 20% to 35% while 'silver' fell by a matching amount. All existing tests and monitors still pass. In two to four sentences, explain the root cause of the missed failure, explain why adding 'diamond' to the allowed list does not address it, and describe a prevention strategy that would catch a redefinition like this before it reaches downstream tables.#

Show answer

The root cause is that the validation stack verified structure, membership, and aggregate volume but never the business meaning of each enum value, so a redefinition of 'gold' passed every check. Adding 'diamond' to accepted_values only silenced a real signal that the upstream logic had changed and does not restore any semantic check. The prevention is a versioned data contract that documents each tier's business definition and cross-field invariants, such as tier = 'gold' implies lifetime_spend >= 10000 and tier = 'silver' implies lifetime_spend < 10000, enforced as a reconciliation gate that blocks promotion to downstream tables when the invariants fail. A distribution-drift monitor on customer_tier would also flag the shift from 20% to 35% gold, but it reports only that a proportion moved, not why, so it complements rather than replaces the invariant gate.

Why:

The root cause is that the validation stack checked structure (column names, types, nullability), per-value membership (accepted_values), and aggregate volume and null rates, but nothing encoded what each enum value means. The vendor redefined 'gold' from more than $10,000 lifetime spend to more than $5,000. The column name, type, and accepted value set were all unchanged, and the row count was unchanged, so every existing check passed. The 'diamond' failure was a genuine signal that the vendor's upstream logic had changed, but adding it to accepted_values only silenced that signal. The prevention that addresses the root cause is a versioned data contract that states each tier's business definition and cross-field invariants, enforced as a reconciliation gate before data is promoted to downstream tables. Because the scenario states the feed includes a numeric lifetime_spend column, a check such as 'tier = gold implies lifetime_spend >= 10000' can be written and would fail on the redefined population. A distribution-drift monitor on customer_tier would also have surfaced the shift from 20% to 35% gold, so it is a useful complementary detector. However, it reports only that a proportion moved, not that the definition changed, so it does not by itself prevent the issue or explain it.

A data-quality observability pipeline applies four row-level validation rules to a batch of records, aggregates each rule into a per-rule pass ratio, and then classifies the pipeline state. Classification uses both per-rule thresholds (strict < comparison) and a weighted overall score. What does this code print when run with the given data?#

records = [n    {“id”: 1, “value”: 100, “status”: “active”},n    {“id”: 2, “value”: None, “status”: “active”},n    {“id”: 3, “value”: 200, “status”: “inactive”},n    {“id”: 4, “value”: 50, “status”: “active”},n    {“id”: 5, “value”: None, “status”: “inactive”},n]nnrules = {n    “completeness”: lambda r: r[“value”] is not None,n    “validity”:      lambda r: r[“status”] in (“active”, “inactive”),n    “freshness”:     lambda r: r[“id”] % 2 == 0,n    “uniqueness”:    lambda r: r[“id”] != 3,n}nnweights    = {“completeness”: 2, “validity”: 1, “freshness”: 1, “uniqueness”: 1}nthresholds = {“completeness”: 0.7, “validity”: 1.0, “freshness”: 0.5, “uniqueness”: 0.9}nnndef evaluate(records, rules):n    results = {}n    for name, rule in rules.items():n        passes = [rule(r) for r in records]n        total  = len(passes)n        passed = sum(1 for p in passes if p)n        results[name] = passed / total if total else 0.0n    return resultsnnndef classify(results, weights, thresholds):n    failed_rules = sorted(n        name for name, score in results.items()n        if score < thresholds.get(name, 1.0)n    )n    total_weight = sum(weights.values())n    weighted = sum(weights[n] * results[n] for n in results) / total_weightn    if weighted < 0.8 and failed_rules:n        return “critical”, round(weighted, 3), failed_rulesn    elif failed_rules:n        return “warning”, round(weighted, 3), failed_rulesn    else:n        return “ok”, round(weighted, 3), []nnresults = evaluate(records, rules)nstatus, score, failed = classify(results, weights, thresholds)nprint(results)nprint(status, score, failed)
Show answer
{'completeness': 0.6, 'validity': 1.0, 'freshness': 0.4, 'uniqueness': 0.8}ncritical 0.68 ['completeness', 'freshness', 'uniqueness']
Why:

Tracing all 20 rule evaluations: completeness checks value is not None (3 of 5 pass → 0.6), validity checks status membership (all 5 pass → 1.0), freshness uses id % 2 == 0 (2 of 5 pass → 0.4), uniqueness flags id == 3 (4 of 5 pass → 0.8). Three rules fail their thresholds: completeness (0.6 < 0.7), freshness (0.4 < 0.5), and uniqueness (0.8 < 0.9). Validity does NOT fail because the comparison is strict < and its score equals its threshold exactly at 1.0. The weighted score is (2×0.6 + 1×1.0 + 1×0.4 + 1×0.8) / 5 = 3.4 / 5 = 0.68, which rounds to 0.68. Since 0.68 < 0.8 AND there are failed rules, the classify function returns 'critical'.

A data pipeline ingests daily financial transactions from an upstream OLTP system. Existing validation includes schema enforcement (column names and types via a schema registry), NOT NULL constraints on all fields, and range checks (revenue > 0). One day all checks pass, but the downstream revenue dashboard shows a 40% drop versus the prior baseline. The cause: during a refactoring, the upstream team changed the revenue unit from cents to dollars, but only for the one source feeding about 40% of the day's rows, so those rows' revenue values were divided by 100. No field was renamed or re-typed, and the total row count is unchanged. Which validation strategy would detect this silent failure?#

Options

Show answer

Statistical distribution monitoring of the revenue field detects this silent unit change. Comparing the mean, standard deviation, and percentiles against a historical baseline reveals that a large share of values collapsed by roughly 100x, even though names, types, nullability, positivity, and row counts all still pass.

Why:

The failure is semantic: field names, types, nullability, positivity, and the total row count are all unchanged, so schema enforcement, NOT NULL checks, range checks, and row-count reconciliation all pass. Schema registry compatibility rules govern structural evolution, not the meaning of values, so they cannot see a unit change. A uniqueness constraint on transaction IDs checks key duplication, which is unaffected by value scale. Statistical distribution monitoring does catch it: about 40% of rows now carry values roughly 100 times smaller, so the revenue mean falls by about 40% and the lower percentiles collapse relative to the historical baseline, far beyond a threshold such as 3 standard deviations, which flags the drift on that day's load.

Related interview questions

Job market

See data-engineering salaries and hiring demand from live job postings.

Practise these until they stick

That's every question we hold on this topic, and the page marks what you pick. What it can't do is remember. A free account keeps every answer, and what you miss comes back until it's right: after a day, then at longer gaps.

Start with this topic

Free · the whole bank · 100 answers per 30 days, each marked with written feedback

Interview booked? Practise the job ad instead

What moved, monthly

One email a month when the bulletin comes out: what moved in the markets we track, and the new question topics we published. Confirm your address to join. Unsubscribe any time.