Resources
Interview prep for data and AI roles
Scenario-based questions of the kind asked in real engineering interviews, with practical answers you can adapt to your own experience.
How to answer
A simple frame for any scenario question
- 01Clarify
Ask about scale, latency, data quality and constraints before you design.
- 02Structure
Walk through the flow end to end in a few clear steps.
- 03Trade-offs
Name the options you rejected and why.
- 04Failure modes
Say what breaks first and how you would detect it.
- 05Measure
Define the metric that proves the fix worked.
Data engineering
Pipeline reliability, performance and trust in the data.
01A daily pipeline loaded duplicate rows after a retry. How do you fix it and stop it recurring?
Make the load idempotent so a rerun produces the same result. Upsert with MERGE on a business key, or overwrite the target partition for the run date, instead of blindly appending. Land data in a staging table first, then swap or merge. If duplicates already exist, deduplicate with ROW_NUMBER() over the key ordered by ingestion time. Add a uniqueness check so the next duplicate fails the run rather than reaching a dashboard.
02A Spark job is slow because a few tasks run far longer than the rest. What do you check?
This usually points to data skew. Open the Spark UI and compare task durations within the slow stage. Common fixes are broadcasting the small side of a join, salting the hot keys, enabling adaptive query execution skew handling, or repartitioning on a better key. Also look for avoidable shuffles and wide collects to the driver.
03Design an incremental load from an operational database into a lakehouse.
Use change data capture, or a reliable updated-at watermark if CDC is not available. Land raw changes unchanged in a bronze layer, then merge into a cleaned silver table. Store the watermark in a control table, re-read a small lookback window to catch late data, and carry delete flags so removals are applied. Keep backfills as a separate, parameterised run.
04An upstream team changed a column type without warning. How should the pipeline behave?
Fail loudly on breaking changes and tolerate additive ones. Keep the raw layer immutable so you can reprocess, use schema evolution or a rescued-data column for new fields, and agree a data contract with the producer. Alert the owner with the failing field so the fix is quick.
05How do you show stakeholders that a dataset can be trusted?
Automate checks for freshness, volume, nulls, uniqueness, accepted values and referential integrity, plus reconciliation totals against the source. Tools such as dbt tests or Great Expectations run these on every load. Publish the results, track lineage, and agree an SLA so people know what to expect.
GenAI and RAG
Retrieval quality, evaluation and keeping answers grounded.
01A RAG assistant sounds confident but gets answers wrong on company documents. Where do you start?
Separate retrieval failures from generation failures. Check whether the right passages were retrieved at all, for example with recall at k on a labelled question set. If not, improve chunking, metadata, hybrid keyword and vector search, and add a reranker. If the right context was retrieved, tighten the prompt to answer only from the context, require citations, and let the model say it does not know.
02How do you choose chunk size and overlap?
Start from the structure of the content, such as headings and sections, rather than a fixed number. A few hundred tokens with modest overlap is a common baseline, but the right value is whatever scores best on your own retrieval evaluation. Parent-document retrieval helps when small chunks match well but need more surrounding context.
03How do you evaluate a RAG system before and after release?
Build a golden set of real questions with expected sources. Measure retrieval with recall at k and MRR, and generation with faithfulness to the retrieved context and answer relevance, using tools such as RAGAS or DeepEval alongside human review. Run the set in CI as a regression gate, and in production trace requests and collect user feedback.
04How do you reduce hallucinations in practice?
Ground answers in retrieved sources and show citations. Abstain when retrieval confidence is low. Constrain outputs with a structured schema, keep temperature low for factual tasks, and add a verification step for high-risk claims. Then measure the change on your evaluation set rather than trusting a single example.
05Latency and cost are too high. What do you change first?
Route simple requests to a smaller model, cache repeated prompts and results, send fewer but better chunks by reranking, trim the prompt, and stream the response. Measure tokens and latency per step so you fix the largest contributor first.
Agentic AI
Tool use, safety, observability and when to use agents at all.
01When would you use an agent instead of a fixed workflow?
Use a fixed workflow when the steps are known in advance, because it is cheaper, faster and more predictable. Use an agent when the next step depends on intermediate results and cannot be scripted. Start with the simplest design that works and add autonomy only where it earns its cost.
02How do you stop an agent from taking a harmful action?
Give each tool the least privilege it needs, validate every tool argument, and use allowlists. Require human approval for irreversible or high-impact actions, cap steps and spend, run risky code in a sandbox, and keep an audit log of every call.
03What is MCP and why would a team adopt it?
The Model Context Protocol is an open standard for connecting AI applications to tools and data through servers that expose tools, resources and prompts. It reduces one-off integrations because any compatible client can use the same server. It does not replace authentication, scoping and review of what each tool can do.
04An agent loops or keeps choosing the wrong tool. How do you debug it?
Trace every step with an observability tool so you can see the model input, tool call and result at each turn. Set a maximum number of iterations and clear stop conditions, rewrite tool names and descriptions so they are unambiguous, and give the agent fewer tools. Evaluate the full trajectory, not just the final answer.
05How do you defend against prompt injection from retrieved documents or tool output?
Treat retrieved and tool content as untrusted data, never as instructions. Keep privileged actions behind explicit approval, limit what tools can do, and filter or flag suspicious output. No single control removes the risk, so layer them and test with adversarial examples.
Next step
Practice with mentors who do this work.
Our programs include mock interview loops and project reviews for data, GenAI and agentic AI roles.