Data engineering interview questions: Set 1 (Junior)
Set 1: 30 junior data engineering interview questions with explanations, on SQL, data modelling, Spark, Kafka, lakehouse, pipelines, data quality, cloud and…
The
userstable has 10 rows, andemailis NULL in 3 of them. What does this return? SQL · EasySELECT COUNT(*), COUNT(email) FROM users;- 10, 10
- 10, 7
- 7, 7
- 7, 10
You want only the customers with more than 5 orders. The query groups orders by customer and counts them. Which clause keeps only the groups whose count is above 5? SQL · Easy
- WHERE
- GROUP BY
- HAVING
- ORDER BY
There are 3 customers. Customer 1 has 2 orders, customer 2 has 1 order and customer 3 has none. How many rows does this return? SQL · Easy
SELECT c.id, o.order_id FROM customers c LEFT JOIN orders o ON o.customer_id = c.id;- 3
- 4
- 5
- 6
A star schema has one central table of sales events and several tables that describe them (customers, products, dates). Where do numbers you add up, such as order amount and quantity, belong? Data modelling · Easy
- In a dimension table, next to the product details
- In a bridge table between orders and products
- In a staging table, before loading
- In the fact table
Your source system identifies customers by
customer_code. In the warehouse’s customer dimension you add a separate columncustomer_key= 1, 2, 3… What is this column called? Data modelling · Easy- A natural key: the business id from the source
- A surrogate key: an id made by the warehouse with no business meaning
- A composite key built from every column
- A foreign key pointing to the fact table
A 1 TB table has 100 columns. A query reads only 2 of them. Why is the query much faster when the table is stored as Parquet instead of CSV? Storage & formats · Easy
- Parquet stores each column separately, so only those 2 columns are read from disk
- Parquet files are compressed, so the whole table downloads faster
- Parquet files have a primary-key index
- Parquet loads the table into memory first
A large
eventstable is stored in one folder per day:event_date=2026-11-01/,event_date=2026-11-02/and so on. A query asks for one day. Why is this layout faster? Storage & formats · Easy- It makes the files compress better
- The query opens only that day’s folder and skips all the others
- It stops duplicate rows from being written
- It makes every write atomic
In PySpark you write
df2 = df.filter(df.age > 30).select("name"). When does Spark actually read the data? Spark · Easy- As soon as filter() is called
- As soon as select() is called
- Only when an action such as count(), show() or write runs
- When the SparkSession is created
In Spark, transformations build a plan and actions run it. Which of these is an action? Spark · Easy
- filter()
- withColumn()
- select()
- count()
A Kafka topic has 4 partitions. Two consumers join the same consumer group to read it. How is the work shared? Streaming & Kafka · Easy
- Each consumer reads 2 of the partitions, so every message is handled by one of the two
- Both consumers read all 4 partitions, so every message is handled twice
- The first consumer reads everything and the second waits as a backup
- Messages go to whichever consumer asks first, in any order
In an ELT pipeline (Extract, Load, Transform), where does the cleaning and reshaping happen? Pipelines & orchestration · Easy
- On a separate ETL server, before loading
- Inside the warehouse, after the raw data is loaded
- Inside the source database
- Inside the BI tool
In dbt you attach tests to columns. Which test fails when the same
order_idappears twice in the orders table? Data quality · Easy- not_null
- accepted_values
- unique
- freshness
Why do data lakes keep their files in object storage such as Amazon S3, Google Cloud Storage or Azure Blob Storage? Cloud · Easy
- It is the fastest way to update single rows
- It is cheap and durable, grows without managing disks, and is separate from compute
- It runs SQL transactions by itself
- It needs no compute engine to answer queries
A record from an API is loaded into a Python dictionary. It has no
emailkey. What does this print? Python · Easyrow = {"id": 7, "city": "Pune"} print(row.get("email", "missing"))- missing
- None
- KeyError
- An empty string
A customer table holds phone numbers. Analysts only need to count customers per city and never need the phone number itself. What is the right setup? Governance & security · Easy
- Give analysts full access; they are trusted employees
- Mask or hide the phone column for analysts, and give full access only to the few people who need it
- Delete phone numbers from the source system
- Encrypt the warehouse disks, which protects the column
The
emptable has three salaries: 100, 100 and 200. What is in columnr, in salary order? SQL · MediumSELECT salary, RANK() OVER (ORDER BY salary) AS r FROM emp;- 1, 1, 2
- 1, 2, 3
- 1, 1, 3
- 1, 2, 2
Table
ahas 3 different rows and tablebhas 3 different rows. Exactly one row is in both tables. What does this return? SQL · MediumSELECT COUNT(*) FROM ( SELECT * FROM a UNION SELECT * FROM b ) t;- 6
- 5
- 4
- 3
A customer moves from Pune to Delhi in June. Analysts must report each sale under the city the customer lived in when the sale happened: January sales under Pune, July sales under Delhi. How do you store the customer’s city? Data modelling · Medium
- Overwrite the city with Delhi (SCD Type 1)
- Add a previous_city column (SCD Type 3)
- Add a new row for the Delhi version, with valid-from and valid-to dates (SCD Type 2)
- Rebuild the customer table from the source every night
A daily load ran successfully for 1 March. A retry ran it again for 1 March, and now that day’s rows appear twice. Which property was the job missing? Pipelines & orchestration · Medium
- Exactly-once delivery
- Atomicity
- Isolation
- Idempotency: running it again gives the same result
Kafka splits a topic into partitions. Which ordering does Kafka guarantee to consumers? Streaming & Kafka · Medium
- Across the whole topic
- Within each consumer group
- Within each partition only
- No ordering at all
A Spark join runs as 200 tasks. 199 finish in about a minute; one runs for 40 minutes. What is the most likely cause? Spark · Medium
- Too few executors in the cluster
- The driver is out of memory
- One join key has far more rows than the others, and all of them go to one task
- The broadcast join timed out
A shuffle is when Spark moves rows between machines over the network. Which operation causes one? Spark · Medium
- filter()
- withColumn()
- groupBy().agg()
- select()
Delta Lake and Apache Iceberg are called table formats. The data inside is still Parquet files. What do they add? Storage & formats · Medium
- A faster compression codec
- A transaction log listing which files make up each version, giving atomic commits, schema checks and time travel
- A row-based layout for faster inserts
- An in-memory cache for queries
A daily load finished on time but inserted 0 rows, because the upstream export was empty. Which check would have caught it? Data quality · Medium
- A not_null test on the id column
- A unique test on the id column
- A row-count check against the usual daily volume
- A schema check on the column names
Your app runs on a production Postgres database. Why not run heavy analytics queries (scanning months of orders) directly on it? System design · Medium
- Postgres cannot run GROUP BY on large tables
- Long scans take CPU and disk away from the app’s users, and row storage is slow for wide aggregations
- Analytics queries lock the tables, so the app can no longer write
- Postgres cannot run window functions
A Spark job running on a cloud cluster must read one S3 bucket. What is the right way to give it access? Cloud · Medium
- Put an access key and secret in the job’s code
- Make the bucket public
- Attach a role to the cluster that can only read that bucket
- Use the cloud account’s root credentials
What does this print? Python · Medium
def add(x, items=[]): items.append(x) return items add(1) print(add(2))- [2]
- [1, 2]
- [1]
- An error
A mobile app sends click events. When a phone is offline, its clicks arrive hours later. You must count clicks per hour correctly. Which time should decide each click’s hour? Streaming & Kafka · Hard
- The time the click reaches the processing job
- The click’s own timestamp, with a watermark that waits a while for late clicks
- The time Kafka stored the click
- The click’s Kafka offset
Airflow runs a daily DAG for a day only after that day has ended: the run for 1 January starts just after midnight on 2 January. A daily DAG has
start_date1 January andcatchup=True(run every missed day). It is switched on at 08:00 on 10 January. How many runs start straight away? Pipelines & orchestration · Hard- 1
- 10
- 0
- 9
You need every insert, update and delete from a 500-million-row Postgres orders table each day, without slowing the production database. What do you use? System design · Hard
- A full SELECT * dump every night
- A query for rows whose updated_at is after the last run
- Triggers that copy every change into an audit table
- Change data capture that reads the database’s own change log (write-ahead log), for example with Debezium
Other sets
- Set 2 · Junior: 30 questions (14 easy, 13 medium, 3 hard), paid
- Set 3 · Mid-level: 30 questions (7 easy, 16 medium, 7 hard), free
- Set 4 · Mid-level: 30 questions (6 easy, 17 medium, 7 hard), paid
- Set 5 · Senior: 30 questions (0 easy, 9 medium, 21 hard), free
- Set 6 · Senior: 30 questions (0 easy, 9 medium, 21 hard), paid