r/dataengineeringjobs • u/ThePirate-98 • 6h ago
Technical Interview Questions - AI & Data Engineering
Every technical question interviewers asked across 23 distinct interviews, grouped by topic with duplicates merged. Behavioural, HR. A tag in brackets says which interview a question came from when the context matters (e.g. [Adobe], [L'Oréal], [Target], [McD]). Questions that came up in three or more interviews are marked (repeat); those are the ones to drill first.
FYI: Actual question given to AI to generate the questions clearly
Live coding problems
SQL
transaction(t_id, business_day, sales): for August only, newest day first, show per day the transaction count, total sales and max sale. Then: only sales > 1000; then: only days with > 100 transactions (WHERE vs HAVING). [McD]sales_table(transaction_id, sales_dollars, sales_units, product_id, sales_date, store_number): for each sales date, return the product with the highest total sales. Follow-up:sales_dollarsis a unit price, so total = dollars × units. [Data Engineer 3](date, amount)with many invoices per day: find the date with the third-highest total sales. Write it another way. What isQUALIFY? [Data Pipeline]- One row per day: a 7-day rolling sum (6 previous days + current). [Data Pipeline]
purchases(purchase_id, customer_id, purchase_date, product_id, amount): list the last 3 purchases per customer. [L'Oréal]employee_checkins(emp_id, checkin_date, hours_worked): add a column with how many more/fewer hours than the previous day. Trick: what doesLAGreturn when a date (01-04) is missing? (It takes the previous row, not the previous date.) [Inspire]- Users who logged in on 3 or more consecutive days (gaps-and-islands:
date - row_number). Walk throughrnandgrpvalues by hand; explaindate_sub(login_date, rn). [Big Data, Scala] - Given rows, write the RANK and DENSE_RANK values by hand. [Sapient]
- Optimize a given order query: which column would you index, and why
order_date? [Senior SWE] - Design an order-management schema (SQL or NoSQL) from a list of fields. [Senior SWE]
Python
- Write a function returning the second-largest element of a list. [McD]
- Flatten a nested dict into dot-separated keys (
{"A":{"B":{"C":10}}}→{"A.B.C":10}). Isisinstancereally required? [Inspire] - Given an input and expected output, write the transform; explain it. [Sapient]
PySpark / Spark SQL
- Latest record per customer by
updated_at(window + row_number). [Inspire] - Employee login/logout events: compute session hours per day. Interviewer challenged: why group by when there's one login/logout per day? What does casting a timestamp to
longgive (seconds)? Why divide by 3600? [AWS] - Delta
MERGEfrom bronze: cast a text source ID to int inside the merge (no new DataFrame); on match update only thenamecolumn, insert all on no-match. [AWS] - Review a PySpark script (two reads, joins, aggregations, two writes) and optimize it; follow-up: the S3 input is 2 TB — what changes and which Databricks configs? [Adobe]
- Word count on a single text — why use
parallelizehere? [Senior SWE] - Spark SQL problems from a given schema. [Senior SWE, Sapient]
mapvsflatMapon the same function and list — type the output of each. [Sapient]- Spark Scala: total spend per user per day. [Target]
Scala
List[Option[String]]of phone numbers →List[String]withoutNone; whyflatMap? [Big Data]- Code appends to a
Listin a loop over 10 M records — concerns and redesign (List is immutable; prepend + reverse, orListBuffer). [Big Data] - Write a user-defined higher-order function (not map/flatMap), e.g. apply an add/multiply op to a list. [Spark Scala]
Code review: read real code aloud, find the bugs [AI Data Engineer]
The interviewers pushed hard against generic answers. Name the line, the bug and the fix.
SQL: DAU, new users and 7-day rolling active users for a health app (CTEs
users,events,daily; eventsLEFT JOINusers;WHERE country IN (...)). Symptom: numbers too high in some countries, too low around midnight UTC.- Read each CTE aloud and summarize it for a non-technical listener.
- What single change fixes the inflated counts without adding a CTE? (Accepted:
COUNT(DISTINCT user_id).) - Does the events → users LEFT JOIN expand rows? (No: users has one row per user.) Is a NULL check needed? (No guest users exist.)
- The midnight-UTC dip still needs explaining: dates cast from UTC timestamps, not local time.
- How would you test this query with no baseline? Which keyword shows the plan (
EXPLAIN)? How do you sanity-check billion-row tables cheaply?
Python ETL (hourly S3 JSON →
users.parquet**)**- List the critical bugs: hardcoded AWS keys,
read_jsonwithoutlines=True,drop_duplicates("user_id")without sorting byupdated_at,astype(int)on a nullable ID, a single static output path. - Why sort before
drop_duplicates? - How do you make the job idempotent and safe to rerun? Does
to_parqueton one path create duplicates? (No, it overwrites, so other dates are lost.) - If you partition by date, what is the risk? Rerun the same day: same data every time?
- What is the danger of
pd.to_datetime(...).dt.dateonupdated_atandbirth_date? - What data-quality tests would you add?
- List the critical bugs: hardcoded AWS keys,
PySpark incremental lakehouse job (raw JSON → filter
event_time >= current_date() - 1 day→ cast,dropDuplicates(event_id)→overwrite+partitionBy(event_date)to silver)- Explain what the job does.
- What causes data loss or incomplete data? (Late events fall outside the 1-day window; static partition overwrite.)
- Is the write the only source of inconsistency? (Also non-deterministic dedup and filtering on run time instead of data time.)
- What Spark performance problems does this job have, as opposed to Spark in general?
Take-home pipeline build, done live in 50 min with an AI assistant [AI Data Engineer]
- Patient-dropout feature pipeline on S3 + Athena: 10 M rows/day; events arrive 1–2 days late; resends duplicate
event_id; data lands by 5 AM with a 7 AM SLA. - Output: exactly one row per active patient per day, even with zero activity (NULL, not 0). Columns:
avg_steps_7d,avg_app_sessions_7d,avg_adherence_7d. - A new optional field (
device_type) appears mid-stream. Keep 12 months of history. - Deliverables: local pandas/Polars code, an Airflow DAG, a README, tests, and a hand-off to
predict.py. - This round was rescheduled. Come with Python, Airflow and your AI coding assistant already installed and logged in.
SQL concepts
- What are analytical (window) functions, and where do you use them? How do they differ from aggregate functions? When would you use SUM as an aggregate vs as a window function?
- RANK vs DENSE_RANK. (repeat)
- What is
QUALIFY? - UNION vs UNION ALL.
- How does
LAGbehave when dates are missing? - Idempotent loads, SCD implementations, all types of keys, referential integrity (flagged as "the important SQL concepts" for the Inspire role).
- Have you used other databases (Oracle, SQL Server) and found BigQuery syntax different?
Python and Scala concepts
Python
- Local vs global variables — when to use each.
- List, dict, tuple basics.
- Lambda functions — have you used them?
- Why do we use DataFrames?
- Decorators — explain, give a use case, how to use them.
- Shallow copy vs deep copy.
- What does
isinstance()do? Is it needed here? requestslibrary — which function would you use, and would you use it for SFTP at all? (Answer: no —paramikofor SFTP.)- Have you used Python notebooks?
Scala
- Do you use Scala or PySpark day to day? Advantages / main features of Scala.
- What is a higher-order function and how does it work? Give an example.
- Why is
Listappend in a loop slow? (immutable singly-linked list)
Spark / PySpark
Core concepts
- What is lazy evaluation / lazy transformation?
- What is a DataFrame transformation in PySpark? Give common examples. What transformations have you worked on?
- RDD vs Dataset vs DataFrame — when to use each? What are RDDs?
mapvsflatMap. (repeat)repartitionvscoalesce— when to use each.- What happens internally when a Spark job runs (driver, DAG, stages, tasks)?
- What does
parallelizedo, and why use it on a single text?
Performance and debugging
- Give 4–5 Spark optimization techniques. (repeat)
- Tricks to optimize joins (broadcast, bucketing, salting, etc.).
- How do you handle skewed data?
- A job that normally runs 1 h has taken 2.5 h for 2–3 days, then fails. How do you debug and optimize it? [Sapient]
- A job suddenly slows after data scales — what do you check (shuffle size, executor memory, GC overhead, join strategy)? [Target]
- Major causes of Spark performance issues.
- How do you identify which step is slow using the Spark UI / history server?
- How does resource contention work (YARN FIFO)?
- Which configs would you change to reduce garbage collection?
- After adding partitioning, how do you prove the job got faster?
- How do you decide the number of partitions?
- 2 TB input file: how to optimize, and which config enables partitioning while preserving record order? [Adobe]
Operations
- How do you submit a Spark job from Airflow (SparkSubmitOperator, EMR step operator, Bash operator + key file)?
- How did you solve production failures and restart jobs?
Databricks and Delta Lake
- Which features have you used?
- Explain a project where you used Databricks extensively.
- Medallion architecture — have you used it, what does it do?
- What is a Lakehouse architecture?
- What is Unity Catalog?
- Scenario: gold-layer average monthly sales for one vendor (Amazon) look too low while others are fine. Which Databricks utility lets you trace gold → silver → bronze (lineage) to find the source table, and how do you add validation and notify the upstream team? [AWS]
- Does
VACUUMdelete the_delta_logfiles? Can you still time-travel after a vacuum? - Does Z-ordering help on a low-cardinality column? What about partitioning it?
- Have you used (and how do you enable) a specific Databricks query feature? (name inaudible in transcript)
MERGE INTO: cast IDs inside the merge, update only selected columns.
Deep-dive round (Databricks on AWS) [AWS Data Engineer 2]
The interviewer said they expect you to know "everything in and out" about Databricks: the permission model, infrastructure, data and the latest features.
- What was your last Databricks project, when was it, what was your role, and which features did you use? (repeat)
- How do you pull Redshift data into Databricks? And tables from the Glue Data Catalog?
- Unity Catalog: you grant permissions at catalog level. Are they inherited by schemas and objects below it? Are there exceptions?
- You created a schema and made me the owner. When can you still change its permissions? Which higher privileges would let you?
- Account admin vs metastore admin vs workspace admin.
- Everyone builds a medallion architecture. What extra can you offer a client that sets you apart?
- SCD Type 2 in silver from 500 GB in bronze, where the source re-sends full history plus new rows every day. A MERGE scans everything, so what is the efficient approach? Can Change Data Feed (CDF) help here?
- Schema evolution is on. A column arrives as int on day 1, string on day 2, int on day 3. Does it fail? What happens to the values? Is string → int even possible?
- Have you used Databricks Asset Bundles (DABs)?
- Workflows: job A must run only after B (scheduled 1 PM) and C (scheduled 3 PM) both finish, without starting C early. How do you set up the dependency?
- Streaming tables: enrich a streamed PIN code with details from a static lookup table. How? Can you broadcast-join streaming data?
GCP: BigQuery, Dataflow, Dataproc, Pub/Sub
BigQuery
- Partitioning vs clustering — how each helps optimize queries. (repeat)
- Which column types can you partition on? Can you partition on a string? Maximum number of partitions per table? Maximum number of clustering columns (4)?
- Why cluster on
store_idwhen it has low cardinality? Would you partition or cluster on it in a warehouse that allowed either? (Interviewer's point: uneven store sizes make partitions skewed; clustering spreads data evenly.) [Data Pipeline] - A daily transformation query scans 1 TB (~$7 per run). How do you optimize it? [McD]
- BigQuery best practices in general; how to optimize BigQuery performance.
- How does BigQuery handle large-scale processing differently from a traditional RDBMS?
- How do you handle incremental updates? If you use a source timestamp, how do you actually write to the table — INSERT or MERGE?
- Ways to load data into BigQuery (Python client, load jobs, etc.).
- Materialized view vs standard view. How do you control refresh when the base table changes a lot? Name the parameter (
max_staleness). [L'Oréal] - IAM: which roles do you need to run
SELECT *on a table in a project? (BigQuery Job User+BigQuery Data Viewer; Data Viewer can be granted at table level.) [L'Oréal] - Have you used BigQuery ML? Which algorithm?
- Policy tags / column masking: how did you decide which columns to mask and with which tag? Was it automated? [Data Engineer 4]
- Parquet in GCS: external table vs BigLake — how is metadata maintained? Why is Parquet faster, and what metadata does it store? [Data Pipeline]
Dataflow and Dataproc
- Key difference between Dataproc and Dataflow; when to choose Dataproc for large datasets. (repeat)
- Why Dataproc for Spark streaming — what trade-offs are you taking?
- How do you handle late-arriving data in a Dataflow streaming pipeline?
- Why use Dataproc/PySpark for transforms when Cloud Run with Python could do it?
Pub/Sub and serverless
- How do you get exactly-once processing with Pub/Sub + Dataflow?
- How does Pub/Sub handle message ordering? Is ordering guaranteed across subscriptions?
- Pub/Sub redelivers a message — what happens, and what dedup/merge logic do you use? [Target]
- Why Pub/Sub over Kafka?
- Have you used Cloud Functions? How comfortable are you with Pub/Sub?
- Ingesting 2.5–3 M records/day from an API: which GCP service (Cloud Run)? What CPU/memory config? Where do you store API secrets (Secret Manager)? How do you deploy it? [Data Engineer 4]
Architecture
- Explain a typical GCP data pipeline architecture; how do you design a scalable pipeline?
- What backfill strategies do you use?
- Walk through your current project: source, processing, end consumer. (repeat)
Streaming: Kafka and Spark Structured Streaming
Kafka
- What is a Kafka topic? How does it differ from a message queue?
- How does Kafka handle out-of-order messages within a partition?
- How do you choose the number of partitions? How do too many partitions affect performance?
- How do you handle messages larger than
max.message.bytes? - How do you migrate messages to another topic while changing the partitioning scheme?
- A topic is receiving delayed messages — how do you debug and fix it?
Spark Structured Streaming
- How do you read from Kafka in Spark Structured Streaming?
- Processed data is corrupted and you need to re-read everything from Kafka: what offset config? Does
startingOffsets = earliestwork alone, or do you also need to clear the checkpoint? - Can you join two streams from the same Kafka in one query? (Interviewer believed not; stream-stream joins are in fact supported with watermarks — worth knowing.)
- How does Structured Streaming guarantee fault tolerance (offset tracking, checkpoints)?
- What is watermarking?
AWS: Glue, S3, Lambda, Redshift
- Which AWS services have you worked with? Are you comfortable with AWS questions or only GCP?
- In a Glue job, how do you read a Glue Data Catalog table?
- Partner A and B drop files into separate S3 buckets: design the end-to-end Glue flow that lands curated data in another S3 location for analytics.
- S3 storage classes.
- Upload/download files to S3 with the AWS SDK.
- Restrict an S3 bucket to your VPC or EC2 instance only.
- Lambda: what is a throttling error? Default concurrency limit (1,000 per region)? How do you handle timeouts?
- What is a DLQ, and how do you configure one?
- Integrating third-party APIs with AWS services.
- Redshift distribution styles (KEY, ALL, EVEN, AUTO) — distributed across what (nodes/slices)?
- Given a huge fact table, a 365-row date dimension and a small store dimension: pick a distribution style and sort key for each.
- Fact distributed on
store_id, sorted oncustomer_id, queries filter oncustomer_id: doesn't that hit every node? How do you fix it? What is the sort key for, then?
Azure, ADF and Snowflake
- Are you familiar with Azure? How quickly can you be productive on Azure + Snowflake + Airflow coming from GCP? (repeat)
- Have you used Snowflake?
- Ingesting from ADLS Gen2 into Snowflake: Snowpipe or
COPY INTO? Why Snowpipe when nothing here is real-time? [Inspire] - Syntax of
COPY INTO(create a stage first, then file format,ON_ERROR, etc.). - ADF scheduling: files arrive 4×/day (every 6 h) and an API once at end of day — which triggers? One pipeline or two? Can both run in a single pipeline?
- A source file suddenly has 10 columns instead of 20 — how do you validate before the Copy activity? (Expected: Get Metadata + If Condition, not Databricks.)
- How would you connect directly to an SFTP source from a Databricks notebook? (paramiko) — and the simpler ADF way (SFTP linked service + Copy activity).
- Target of the Copy activity (ADLS Gen2).
- Fivetran / Census: how do you monitor connector performance and handle schema evolution? [Adobe]
Airflow, dbt and orchestration
- How comfortable are you with Airflow? How did you create and schedule DAGs?
- Which operator submits a Spark job (SparkSubmitOperator, EMR step operator, BashOperator)?
- Airflow Variables — what are they and where are they stored?
- How do you handle different time zones when scheduling? (
pendulumlibrary.) - Cloud Composer vs self-managed Airflow (infra differs, DAGs identical).
- A task that normally takes 10 min has been running 4 h — what do you do first? (Pause/cancel it, then investigate.)
- Have you used dbt or another SQL transformation tool? Why dbt instead of plain BigQuery SQL?
- What is Dataform, and how does it differ from dbt?
- Have you used GCP Workflows (instead of Composer)?
Pipeline design and data quality scenarios
- Batch to dashboard: client sends batch data → GCS → BigQuery → Looker. What do you propose? [McD]
- Daily delta load with Airflow + GCS + BigQuery. If you copy a partition and 5 of today's 10 rows are updates to yesterday's rows, how do you update them? (MERGE / incremental.) [Data Pipeline]
- A huge CSV (lakhs/crores of rows) fails to load into BigQuery — how do you recover?
- A few corrupted / schema-mismatched rows arrive at random counts. How do you drop them and load the rest without hard-coding
max_bad_records? (Expected: load everything as strings, split and validate column counts, route bad rows aside.) - Daily MERGE into a large history table: how do you update only what changed? [Data Engineer 3]
- Normal volume is 10 GB/day; today 50 TB arrived. First suspect? Root cause: millions of duplicate rows with sequential transaction IDs — how do you change the code to catch this next time? [Data Engineer 3]
- Pulling a huge, constantly changing source: how do you load raw then incrementally into BigQuery, keep it in sync, and meet SLAs? [Data Engineer 4]
- Airflow DAG design: CSVs from a file server (4×/day) + an end-of-day JSON API → Snowflake; aggregate transactions per store/day, reconcile against the API, alert on mismatch. List the tasks, operators, schedule, API ingestion, alerting and DQ checks. Then do it in ADF too. [Inspire]
- Item-level cost master arrives as an Excel file, sometimes late, wrong or missing products. Join it to receipt data, update the master, and restate past data. [McD client]
- How do you ensure data quality and consistency across batch and streaming pipelines? Which tool, or SQL checks? Where do they run? (repeat)
- Your claim "detected and root-caused a 3–5% revenue discrepancy": how was it detected if nothing failed? What did you check first, and what was the fix? (The interviewer pushed back that the client found it, not you.) [Inspire]
- Have you cleaned up a project with erroneous code?
- How do you handle schema evolution?
- What standards or conventions must every pipeline have?
- How do you handle CI/CD for data pipelines? Which framework do you use for unit tests?
Data modeling and warehousing
- What data design have you done? Have you built ER diagrams or followed a lead's model?
- How comfortable are you with data modeling? (repeat)
- What schema types exist in a warehouse (star, snowflake, galaxy)?
- What do you consider when designing warehouse schemas (AWS or GCP)?
- Customer, orders and sales tables: design the model. Is an order a fact or a dimension? Where do order details (product bought) go? [Data Engineer 4]
- Raw and curated layers in Snowflake; you have only the curated data dictionary. How do you build the source-to-target mapping without guessing? What goes into your data profiling? [Inspire]
- Which data architecture did your warehouse use?
Software engineering, Git and Terraform
- SOLID principles with practical examples (name all five).
- Types of design patterns (creational, structural, behavioural) with 2–3 examples each.
- DRY (and similar principles shown on screen).
git rebase,git cherry-pick,git pullvsgit fetch(pull = fetch + merge).terraform validate— what does it do? What does thelifecycleblock do?- Agile: walk through a user story from creation to delivery; who writes requirements; do you have a Scrum Master?
GenAI, BI tools and NoSQL
GenAI
- Describe an ML project, POC or model you built.
- Are you aware of LLMs? RAG? The retrieval part of RAG? LangChain? [Globant]
- Natural-language-to-SQL with an LLM: what tool are you using, and what challenges do you face? [L'Oréal]
- Do you use LLM tools in your daily work?
BI
- Build a daily-refreshing pie chart of the last 3 months: transactions/day, sales, top-10 users. [McD]
- Did you build Looker dashboards or only feed data to them? What is LookML? What are explores, views and models?
NoSQL
- Have you used Cassandra, MongoDB or a cloud NoSQL store?
- Structure of a MongoDB document and collection. How long have you used MongoDB?
ML in production [AI Data Engineer]
- Describe your hands-on AI/ML project work, specifically.
- Have you moved an ML model from experiment to production? What were the steps?
- How do you collaborate with software engineers, data scientists and other stakeholders?
- How do you measure whether your data work succeeded? Which indicators do you use?