Data Engineering Fundamentals Q&A
Breadth questions that open most interviews. Answer each in under a minute, then go one level deeper.
Quick Navigation
- General Concepts
- SQL & Databases
- Big Data Technologies
- Data Warehousing & ETL
- Cloud Platforms
- Python & Spark
- Data Modeling
- Stream Processing
- Data Quality & Governance
- Scenario-Based Questions
General Concepts
What is data engineering?
Answer: The practice of designing, building, and maintaining systems for collecting, storing, and analyzing large data volumes through pipelines and storage optimization.
What are the main responsibilities of a data engineer?
- Designing and building data pipelines
- Maintaining data warehouses and lakes
- Ensuring data quality and consistency
- Optimizing storage and query performance
- Collaborating with data scientists and analysts
- Implementing data security measures
Data engineer vs data scientist - what's the difference?
| Aspect | Data Engineer | Data Scientist |
|---|---|---|
| Focus | Infrastructure, pipelines | Analysis, modeling |
| Skills | SQL, Spark, ETL, Cloud | ML, Statistics, Python |
| Output | Data systems | Insights, predictions |
| Analogy | Plumber | Chef |
What is a data pipeline?
Answer: A series of processes that move data from sources to destinations, involving extraction, transformation, and loading steps. Can be batch (scheduled) or streaming (real-time).
What are common challenges in data engineering?
- Handling large volumes efficiently (scale)
- Ensuring data quality and consistency
- Managing real-time vs batch processing trade-offs
- Integrating diverse data sources
- Maintaining security and compliance
- Handling schema evolution
SQL & Databases
What is normalization? Why use it?
Answer: Organizing data to reduce redundancy and improve integrity by breaking tables into smaller, related ones using foreign keys.
- 1NF: Atomic values, no repeating groups
- 2NF: 1NF + no partial dependencies
- 3NF: 2NF + no transitive dependencies
SQL vs NoSQL - when to use each?
| Aspect | SQL | NoSQL |
|---|---|---|
| Schema | Fixed, predefined | Flexible, schema-less |
| Scaling | Vertical | Horizontal |
| ACID | Strong | Eventual consistency |
| Use Case | Transactions, reporting | High scale, unstructured |
Use SQL when: ACID matters, complex queries, structured data Use NoSQL when: Scale > consistency, schema flexibility, high write throughput
What is database indexing?
Answer: Creating data structures (B-trees, hash indexes) for faster data retrieval without scanning entire tables.
- Pros: Faster reads
- Cons: Slower writes, storage overhead
- Best for: Frequently queried columns, WHERE/JOIN clauses
Explain ACID properties.
- Atomicity: All or nothing - transaction completes fully or not at all
- Consistency: Database remains valid after transaction
- Isolation: Concurrent transactions don’t interfere
- Durability: Committed changes persist
What are window functions? Give examples.
Answer: Functions that operate across a set of rows related to the current row.
-- Running total
SUM(amount) OVER (ORDER BY date)
-- Rank within partition
RANK() OVER (PARTITION BY department ORDER BY salary DESC)
-- Previous row value
LAG(value, 1) OVER (ORDER BY date)
Big Data Technologies
What is Apache Spark? Why is it popular?
Answer: A fast, in-memory distributed data processing engine supporting batch, streaming, ML, and SQL workloads. Why popular:
- 100x faster than MapReduce (in-memory)
- Unified API for batch + streaming
- Rich ecosystem (MLlib, GraphX, Spark SQL)
- Multiple language support (Python, Scala, Java, R)
Spark vs Hadoop MapReduce?
| Aspect | Spark | MapReduce |
|---|---|---|
| Speed | In-memory, fast | Disk-based, slower |
| Ease | High-level APIs | Low-level, verbose |
| Use Cases | ML, streaming, interactive | Batch only |
| Fault Tolerance | RDD lineage | Replication |
What is Apache Kafka?
Answer: A distributed streaming platform for publishing/subscribing to record streams with fault-tolerant storage. Key concepts:
- Topics: Categories of messages
- Partitions: Parallelism within topics
- Consumer Groups: Load balancing reads
- Retention: Configurable message storage
What is data partitioning?
Answer: Dividing datasets into smaller parts for better performance and parallelism. Types:
- Range: By value ranges (e.g., date)
- Hash: By hash of key (even distribution)
- List: By categorical values (e.g., region)
How do you handle data skew in Spark?
- Salting: Add random prefix to skewed keys
- Broadcast join: For small dimension tables
- AQE: Enable Adaptive Query Execution
- Repartition: Redistribute data evenly
- Custom partitioner: Based on data distribution
Data Warehousing & ETL
What is a data warehouse vs data lake?
| Aspect | Data Warehouse | Data Lake |
|---|---|---|
| Data Type | Structured | All types |
| Schema | Schema-on-write | Schema-on-read |
| Users | Business analysts | Data scientists |
| Cost | Higher (storage + compute) | Lower (storage cheap) |
| Query Speed | Fast (optimized) | Varies |
Explain the ETL process.
- Extract: Retrieve data from source systems (APIs, DBs, files)
- Transform: Clean, validate, convert, aggregate, enrich
- Load: Insert into target system (warehouse, lake)
ETL vs ELT:
- ETL: Transform before loading (traditional)
- ELT: Load raw, transform in target (modern, cloud-native)
What are Slowly Changing Dimensions (SCD)?
| Type | Behavior | History? | Use Case |
|---|---|---|---|
| SCD-1 | Overwrite | No | Corrections |
| SCD-2 | New row with dates | Full | Customer history |
| SCD-3 | New column | Limited | Previous value only |
| SCD-4 | Separate history table | Full | Performance + history |
What is a data mart?
Answer: A subset of a data warehouse focused on a specific business line or department (e.g., sales mart, HR mart). Faster queries, simpler for end users.
Star schema vs Snowflake schema?
| Aspect | Star | Snowflake |
|---|---|---|
| Dimensions | Denormalized | Normalized |
| Joins | Fewer | More |
| Query Speed | Faster | Slower |
| Storage | Higher | Lower |
| Maintenance | Easier | More complex |
Cloud Platforms
Compare AWS, Azure, GCP data services.
| Service | AWS | Azure | GCP |
|---|---|---|---|
| Storage | S3 | Blob Storage | Cloud Storage |
| Warehouse | Redshift | Synapse | BigQuery |
| ETL | Glue | Data Factory | Dataflow |
| Streaming | Kinesis | Event Hubs | Pub/Sub |
| Lake | Lake Formation | Data Lake | BigLake |
What is Amazon S3?
Answer: Object storage service providing scalable, durable storage.
- Storage classes: Standard, IA, Glacier
- Use cases: Data lakes, backups, static hosting
- Key features: 11 9s durability, versioning, lifecycle policies
What is Databricks?
Answer: Unified analytics platform built on Spark, offering:
- Lakehouse: Combines lake + warehouse
- Delta Lake: ACID on data lakes
- Unity Catalog: Governance and security
- MLflow: ML lifecycle management
What is serverless computing?
Answer: Cloud execution model where provider manages infrastructure. Examples:
- AWS Lambda, Azure Functions, GCP Cloud Functions
- BigQuery, Athena, Synapse Serverless Pros: No infrastructure management, pay-per-use Cons: Cold starts, execution limits, vendor lock-in
Python & Spark
Why is Python popular for data engineering?
- Easy to learn and read
- Rich data libraries (Pandas, NumPy, PySpark)
- Strong community and ecosystem
- Great for prototyping and production
- API integration capabilities
What is PySpark?
Answer: Python API for Apache Spark enabling distributed data processing using familiar Python syntax.
from pyspark.sql import SparkSession
spark = SparkSession.builder.appName("example").getOrCreate()
df = spark.read.parquet("data.parquet")
result = df.groupBy("category").agg({"amount": "sum"})
Pandas vs PySpark - when to use each?
| Aspect | Pandas | PySpark |
|---|---|---|
| Data Size | GB (single machine) | TB/PB (distributed) |
| Processing | In-memory | Lazy evaluation |
| API | DataFrame | DataFrame (similar) |
| Use When | < 10GB, local | > 10GB, cluster |
What is lazy evaluation in Spark?
Answer: Transformations are not executed immediately; Spark builds a DAG (Directed Acyclic Graph) and only executes when an action is called.
- Transformations (lazy): map, filter, select, groupBy
- Actions (trigger): count, collect, write, show
Explain Spark's execution model.
- Driver: Coordinates execution, holds SparkContext
- Executors: Run tasks on worker nodes
- Stages: Groups of tasks between shuffles
- Tasks: Smallest unit of work (one partition)
Data Modeling
What is dimensional modeling?
Answer: Technique for organizing data in warehouses for easy querying, using:
- Fact tables: Measures/metrics (sales amount, quantity)
- Dimension tables: Context (who, what, when, where)
What is the grain of a fact table?
Answer: The level of detail in each row. Define grain first, then design around it.
- One row per order
- One row per order line item
- One row per customer per day
Explain Data Vault 2.0.
Answer: Enterprise modeling pattern with:
- Hubs: Business keys (e.g., customer_id)
- Links: Relationships between hubs
- Satellites: Attributes over time
Pros: Flexible, auditable, handles change Cons: Complex queries, needs BI layer on top
What is a surrogate key?
Answer: System-generated unique identifier (auto-increment, UUID) vs natural key (business key like SSN). Why use surrogate?
- Business keys can change
- Enables SCD tracking
- Better performance (integer vs string)
Stream Processing
Batch vs stream processing?
| Aspect | Batch | Streaming |
|---|---|---|
| Latency | Hours | Seconds/minutes |
| Complexity | Lower | Higher |
| Use Case | Reports, ML training | Alerts, real-time dashboards |
| Tools | Spark batch, dbt | Kafka, Flink, Spark Streaming |
What is exactly-once processing?
Answer: Guarantee that each record is processed exactly one time, not lost or duplicated. How to achieve:
- Idempotent writes
- Transactional producers/consumers
- Checkpointing
Explain watermarks in streaming.
Answer: Mechanism to handle late-arriving data by tracking event-time progress.
df.withWatermark("event_time", "10 minutes")
“I’ve seen all events with timestamp <= watermark. Later events may be dropped.”
Lambda vs Kappa architecture?
| Lambda | Kappa | |
|---|---|---|
| Layers | Batch + Speed + Serving | Streaming only |
| Complexity | Two codebases | One codebase |
| Reprocessing | Batch layer | Replay from log |
| Use Case | When batch ≠ stream logic | When unified logic works |
Data Quality & Governance
How do you ensure data quality?
- Validation: Schema checks, type enforcement
- Testing: Unit tests, integration tests
- Profiling: Statistics, distributions
- Monitoring: Anomaly detection, alerts
- Governance: Ownership, documentation
- Tools: Great Expectations, dbt tests, Soda
What is data lineage?
Answer: Tracking data flow from source to destination, showing transformations at each step. Benefits:
- Impact analysis (what breaks if source changes?)
- Debugging (where did bad data come from?)
- Compliance (prove data handling for audits)
What is GDPR and how does it affect data engineering?
Answer: EU regulation on data privacy requiring:
- Right to deletion: Must be able to delete user data
- Data minimization: Only collect what’s needed
- Consent: Clear opt-in required
- Breach notification: Report within 72 hours
Engineering impact: Audit logs, deletion pipelines, encryption
Scenario-Based Questions
How would you design a real-time fraud detection system?
Key points:
- Kafka for event ingestion
- Feature store (Redis) for real-time lookups
- ML model for scoring
- Rules engine for known patterns
- Sub-100ms latency requirement
- Exactly-once semantics
How would you migrate a legacy data warehouse to cloud?
Key points:
- Assess current state, dependencies
- Parallel run both systems
- Validate data match (row counts, checksums)
- Incremental migration (table by table)
- Rollback plan
- Documentation and training
A pipeline fails every Monday - how do you debug?
Key points:
- Check logs from Monday failures
- Look for patterns (time, data volume, sources)
- Consider: weekend batch jobs, data accumulation
- Monday-specific business events
- Resource contention from other Monday jobs
How do you handle schema evolution?
Key points:
- Use schema-on-read formats (Parquet, Avro)
- Schema registry (Confluent)
- Backward/forward compatibility
- Versioning and migration scripts
- Default values for new fields
How do you optimize a slow Spark job?
Steps:
- Check Spark UI for bottlenecks
- Look for data skew (one task much longer)
- Check for shuffle spill (disk I/O)
- Verify partition pruning
- Consider broadcast joins for small tables
- Enable AQE (Adaptive Query Execution)
- Tune memory/executor settings
References
- DataExpert-io/data-engineer-handbook - 42k+ stars
- danielbeach/data-engineering-practice - Hands-on exercises
- GeeksforGeeks Data Engineer Questions
- StrataScratch - SQL practice