Data Quality interview question

Data ScienceData QualityData Engineeringeasy

A retailer exports product reviews to CSV with the columns review_id, product_id, rating, review_text, created_at and loads them into a staging table that types every column as text and ignores extra fields. Afterwards some rows hold text such as ' fast delivery' in created_at, others lack their last fields, and the table has 103,400 rows although the source holds 100,000 reviews. One raw line reads 9001,P-17,5,Great fit, fast delivery,2026-05-02. What is the most likely cause and fix?

  1. AThe file was decoded with the wrong character set, so accented letters in the reviews broke the parser; re-reading it as UTF-8 restores the original column boundaries and the expected row count.
  2. BReview texts hold unquoted commas and line breaks: commas shift later fields and newlines split records into extra rows; export with proper CSV quoting and reject rows with the wrong field count.
  3. CThe export was retried and appended duplicate records, which explains the extra 3,400 rows; deduplicating on review_id removes them, and the misaligned fields then disappear along with the duplicates.
  4. DTyping every column as text caused the drift; a typed schema with rating as INTEGER and created_at as TIMESTAMP will make the parser place each value in its correct column.
Show the answer and explanation

Correct answer: B, Review texts hold unquoted commas and line breaks: commas shift later fields and newlines split records into extra rows; export with proper CSV quoting and reject rows with the wrong field count.

Explanation Data Quality

CSV is only safe when every field that contains the delimiter, a quote or a line break is quoted (RFC 4180): wrap the field in double quotes and double any inner quote. Free text such as reviews, addresses or chat messages breaks naive exports in two ways:

  • Embedded delimiter: Great fit, fast delivery becomes two fields, so fast delivery lands in created_at and the real date becomes an extra field, which this loader silently drops.
  • Embedded newline: a review written over two lines is split into two records, one missing its trailing fields and one with text in its leading fields. That is where the extra 3,400 rows come from.

Correctly quoted, the line reads 9001,P-17,5,"Great fit, fast delivery",2026-05-02.

Fixes:

  1. Export with proper quoting, or use a format with explicit structure (Parquet, Avro, JSON Lines) for free text.
  2. Make the load strict: reject or quarantine rows whose field count differs from the header instead of ignoring extra fields.
  3. Reconcile row counts with the source system and check that typed columns parse (dates in created_at, integers 1–5 in rating).

Why the alternatives fail: an encoding error garbles characters (for example 'ü' instead of 'ü') but does not move column boundaries. Duplicates would repeat complete, well-formed records rather than shift fields. A typed schema makes the misaligned rows fail to load, but it cannot move values back into the right columns.

Interview tip: treat "rows loaded = rows in source" and "every row has N fields" as non-negotiable pipeline checks; lenient loaders hide exactly this class of error.

Practice it as a quiz

Answer this and the other free questions with instant grading, streaks and weak-topic tracking, or unlock all 4,000 questions.

More Data Science questions

  1. A loyalty system stores points as pts = np.array([1201, 350, 85], dtype=np.int64). For a 1.5× points campaign, a notebook runs boosted = pts 1.5 and then pts…
  2. A bank automatically offers a premium card to customers with an internal score of 700 or higher. You compare customers just above and just below 700 to…
  3. An online grocer's eight baskets in a pilot region have values 12, 15, 18, 22, 30, 41, 55 and 1,007. In PostgreSQL, what do PERCENTILE_CONT(0.5) WITHIN GROUP…
  4. What is an A/B test (an online controlled experiment)?
  5. In product analytics, what is meant by a north star metric?