Data Cleaning Exercises

Interview questions

Data quality trade-offs

Delete, fix, flag or quarantine, and how to defend the choice. Try answering out loud before opening the model answer.
  1. junior

    1. For an invalid row, compare deleting, fixing, flagging and quarantining.

    What it tests: Vocabulary of data quality actions.

    Model answer and scoring

    Deleting loses information and hides problems. Fixing is fine only with a rule that makes the correct value certain (like trimming padding). Flagging keeps the row in the data with a marker, good for legitimate but unusual values. Quarantining removes the row from clean data but keeps it, with a reason, for someone to fix.

    Strong answers

    • Clear criteria for each action.

    Red flags

    • Treats deletion as the default.
  2. mid

    2. Why shouldn't amounts be stored as floating point, and what do you use instead?

    What it tests: Exact arithmetic for money.

    Model answer and scoring

    Binary floating point can't represent most decimal fractions exactly, so sums drift (0.1 + 0.2 isn't 0.3). For money I use a decimal type with a declared scale, such as DECIMAL(12,2) in SQL and decimal.Decimal in Python, or integer cents. Rounding happens only where the rules say, with a stated mode.

    Strong answers

    • Decimal or integer cents, explicit rounding.

    Red flags

    • Rounds floats at the end.

    Practise it: Sum amounts by currency, without converting

  3. mid

    3. Amounts arrive as 1.234,50 and 1,234.50 in the same column. How do you parse them?

    What it tests: Locale-aware parsing.

    Model answer and scoring

    I need each row's locale: with de-DE the dot groups thousands and the comma is the decimal, with en-US it's the reverse. I validate each value against its locale's pattern (groups of exactly three digits) and quarantine rows with a missing or unknown locale instead of guessing.

    Strong answers

    • Per-row locale with validation.

    Red flags

    • Removes all punctuation.

    Practise it: Sum amounts by currency, without converting

  4. senior

    4. Your pipeline works on the sample file. How do you gain confidence it will work on new data?

    What it tests: Testing beyond the visible data.

    Model answer and scoring

    I write the rules from the specification, not from the values I happen to see; test on hand-made edge cases (empty strings, missing keys, boundary values, ties); run on another batch; and check reconciliation and exception counts for surprises. A rule that only handles the visible values usually fails the next batch.

    Strong answers

    • Edge cases, new batches, reconciliation.

    Red flags

    • "It matched the sample."
  5. junior

    5. When should you flag a suspicious value instead of removing it?

    What it tests: Preserving the population.

    Model answer and scoring

    Almost always when the value could be real, such as a very large sale. Flagging keeps the data and lets someone with context decide.

    I remove only values proven wrong by a rule, and keep them in an exception report.

    Strong answers

    • Defaults to flag.
    • Removes only rule failures.

    Red flags

    • Deletes outliers automatically.

    Practise it: Flag large transactions, keep refunds

  6. mid

    6. Strict validation rejects 15% of rows. The business needs the data. What are your options?

    What it tests: Balancing strictness and usefulness.

    Model answer and scoring

    Keep the strict rule and report exceptions; relax a rule after the owner agrees it was too strict; or accept rows with a quality flag so users can filter.

    I quantify each option's effect on the key numbers and let the owner choose.

    Strong answers

    • Several options with impact.
    • Owner decides.

    Red flags

    • Silently relaxes rules.

    Practise it: Validate quantities and prices against ranges

  7. senior

    7. Should a cleaning rule that fixes typos with fuzzy matching run automatically?

    What it tests: Automation risk.

    Model answer and scoring

    Only for low-risk fields with high-confidence matches, with a log of every change. For identities, money or categories that drive decisions, fuzzy changes go to review.

    I'd measure precision on a labelled sample before enabling it.

    Strong answers

    • Risk-based automation.
    • Measures precision; logs changes.

    Red flags

    • Turns it on everywhere.

    Practise it: Map channels with an approved dictionary

  8. mid

    8. What data quality metrics would you track for a recurring feed?

    What it tests: Monitoring.

    Model answer and scoring

    Row counts per delivery, exception rate by rule, share of missing values in key fields, uniqueness of keys, and freshness.

    I'd alert on sudden changes, because a drift usually means a source change.

    Strong answers

    • Volume, validity, completeness, uniqueness, freshness.
    • Alerts on change.

    Red flags

    • Only checks that the file arrived.
  9. junior

    9. Why should cleaning steps be reversible?

    What it tests: Reproducibility.

    Model answer and scoring

    Rules can be wrong. If raw data stays untouched and steps are code, I can fix a rule and rebuild instead of trying to undo edits.

    It also lets reviewers see exactly what changed.

    Strong answers

    • Raw stays immutable; steps as code.

    Red flags

    • Edits the source file directly.
  10. senior

    10. How do you decide how much cleaning is enough?

    What it tests: Fitness for purpose.

    Model answer and scoring

    Enough is when the remaining issues don't change the decision the data supports. I test the sensitivity of the key numbers to the remaining problems.

    I document the known limitations instead of chasing perfection.

    Strong answers

    • Fitness for purpose.
    • Sensitivity check.

    Red flags

    • Aims for perfect data.

Model answers are original study material for practice. They are not employer-endorsed and don't guarantee an outcome.