Sure, I'd be happy to help you create a coding exam for data engineers. Here's a sample exam that covers various topics relevant to data engineering:
Data Engineering Coding Exam
Duration: 3 hours
Instructions:
- This exam consists of three parts: data modeling, data processing, and data infrastructure.
- You may use any programming language or tool of your choice, but please specify which one you are using.
- Show your work and provide comments to explain your thought process and design decisions.
- You may use any online resources, but please do not copy and paste code without understanding it.
Part 1: Data Modeling (30 points)
You are given a dataset of user activity on a music streaming platform. The dataset contains the following columns:
- user_id: unique identifier for each user
- song_id: unique identifier for each song
- artist_id: unique identifier for each artist
- session_id: unique identifier for each session (a session is a continuous period of user activity)
- timestamp: date and time of the activity
- activity_type: type of activity (e.g., play, pause, skip, etc.)
Design a data model to store this data in a relational database. Your data model should support the following queries:
- Find the top 10 most played songs in the past week.
- Find the average session length for each user in the past month.
- Find the number of unique artists listened to by each user in the past year.
Part 2: Data Processing (40 points)
You are given a dataset of weather observations from various weather stations around the world. The dataset contains the following columns:
- station_id: unique identifier for each weather station
- timestamp: date and time of the observation
- temperature: temperature in degrees Celsius
- humidity: relative humidity as a percentage
- wind_speed: wind speed in kilometers per hour
- wind_direction: wind direction in degrees
Write a data processing pipeline to clean and transform the data for analysis. Your pipeline should:
- Filter out any observations with missing or invalid data.
- Convert the timestamp to a datetime object and extract the date, hour, and minute.
- Calculate the average temperature, humidity, and wind speed for each hour of the day for each station.
- Store the processed data in a format suitable for analysis (e.g., CSV, Parquet, etc.).
Part 3: Data Infrastructure (30 points)
Design a data infrastructure to support real-time data processing and analysis for a ride-hailing service. The service generates the following data streams:
- Ride requests: user_id, pickup_location, dropoff_location, timestamp
- Ride assignments: driver_id, user_id, pickup_location, dropoff_location, timestamp
- Ride completions: driver_id, user_id, pickup_location, dropoff_location, timestamp, fare
Your infrastructure should support the following requirements:
- Real-time data processing and analysis with low latency.
- High availability and fault tolerance.
- Scalability to handle increasing data volume and velocity.
- Data security and privacy.
Describe your proposed architecture, including the technologies and tools you would use, and explain how it meets the requirements.
Grading:
- Part 1: 30 points (10 points for each query)
- Part 2: 40 points (10 points for each step in the pipeline)
- Part 3: 30 points (10 points for each requirement)
Good luck!