


















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



















1. In an AWS-based ETL pipeline, which service is primarily responsible for orchestrating the sequence of extract, transform, and load tasks? A) Amazon S B) AWS Glue C) Apache Airflow D) Amazon RDS Answer: C Rationale: Apache Airflow is a workflow orchestration platform used to programmatically author, schedule, and monitor pipelines. While AWS Glue can run Spark ETL jobs, Airflow coordinates the dependencies between tasks across services. 2. When using Apache Airflow, what is the purpose of a DAG? A) To define the connection string to the database B) To represent the directed acyclic graph of tasks and their dependencies C) To store the transformed data D) To encrypt credentials Answer: B Rationale: A DAG (Directed Acyclic Graph) in Airflow defines the tasks and the order in which they run. It ensures there are no circular dependencies, meaning the pipeline flows in one direction. 3. A data engineer needs to trigger an Airflow DAG automatically every day at midnight. Which parameter should be configured? A) catchup B) schedule_interval
C) retries D) email_on_failure Answer: B Rationale: The schedule_interval (or schedule in newer Airflow versions) defines how often the DAG runs. Setting it to @daily or a cron expression (0 0 * * *) triggers the pipeline at midnight.
4. Which Airflow operator is best suited for executing a Python function that performs a data transformation? A) BashOperator B) PythonOperator C) S3KeySensor D) PostgresOperator Answer: B Rationale: The PythonOperator calls a Python callable, making it ideal for custom transformation logic embedded within the pipeline code. 5. In the context of data quality tests within Airflow, what does the SQLColumnCheckOperator do? A) It creates a new column in the table B) It runs data quality checks against specific columns of a table (e.g., null checks, distinct counts) C) It encrypts column data D) It drops columns with bad data Answer: B Rationale: The SQLColumnCheckOperator accepts a column_mapping dictionary to define checks like null_check or min/max values for individual columns, failing the task if thresholds are breached. 6. A pipeline extracts data from an S3 bucket into Redshift. Where should the data quality check occur to prevent bad data from reaching the final analytics table? A) After the data is fully loaded into the production table
B) To check the data type of a single column C) To schedule the DAG D) To connect to the database Answer: A Rationale: SQLTableCheckOperator is used for table-level checks where the logic might involve aggregations or multiple columns, such as COUNT(*) > 0 or total_discounts <= total_gross.
10. In a Python-based ETL script running via Airflow, which library is most commonly used for data manipulation and transformation? A) NumPy B) Pandas C) Matplotlib D) Django Answer: B Rationale: Pandas is the standard Python library for structured data manipulation, offering DataFrame objects that make filtering, joining, and aggregating data straightforward. 11. What does the on_failure_callback parameter in an Airflow task allow you to do? A) Retry the task immediately B) Define an action (like sending a Slack alert) when the task fails C) Skip the task D) Change the schedule Answer: B Rationale: The on_failure_callback is a callable that executes when a task fails, often used to trigger notifications via Slack, email, or PagerDuty. 12. Which data quality check would detect if a sale_amount column contains negative values? A) null_check
B) unique_check C) min check with greater_than condition D) max check with less_than condition Answer: C Rationale: A min check with a greater_than: 0 condition ensures that the minimum value in the column is above zero, thereby catching negative amounts.
13. When orchestrating an ETL pipeline that spans multiple AWS services, why is idempotency important for the transform tasks? A) It makes the pipeline run faster B) It ensures that re-running a task produces the same result without duplicating data C) It reduces the cost of S3 storage D) It encrypts the data Answer: B Rationale: Idempotency guarantees that if a task is retried (due to a failure), it won't create duplicate records or corrupt the target table, which is critical for data integrity in production pipelines. 14. Which Airflow feature helps handle temporary network blips by automatically re-running a failed task after a delay? A) depends_on_past B) retries and retry_delay C) catchup D) pool Answer: B Rationale: Setting retries to a positive integer and configuring retry_delay allows Airflow to automatically attempt the task again after a specified time, improving resilience against transient errors. 15. A data engineer is writing a Python function to clean a string column by stripping whitespace. Where should this logic be placed in an Airflow DAG? A) In the DAG definition file outside any operator
C) Amazon Kinesis D) Amazon Athena Answer: B Rationale: AWS Glue is a serverless data integration service that makes it easy to discover, prepare, and combine data for analytics, using Spark for ETL jobs.
19. When a data quality test fails in Airflow, what is the default behavior regarding downstream tasks? A) Downstream tasks run anyway B) Downstream tasks are skipped or marked upstream_failed C) The entire DAG is deleted D) The database is rolled back Answer: B Rationale: By default, if a task fails, Airflow will not execute its downstream dependencies, preventing bad data from propagating further down the pipeline. 20. What is the purpose of the {{ ds }} template variable in Airflow? A) It represents the current system date and time B) It represents the logical date of the DAG run (execution date) C) It is a password D) It counts the number of rows Answer: B Rationale: {{ ds }} is the DAG run's logical date in YYYY-MM-DD format. It is commonly used to process the correct partition of data for that specific run. 21. Which Python library is typically used to interact with AWS S3 from an Airflow PythonOperator? A) psycopg B) boto C) requests D) sqlalchemy Answer: B
Rationale: boto3 is the Amazon Web Services (AWS) SDK for Python, allowing developers to create, configure, and manage AWS services like S3 programmatically.
22. In a data quality framework, what does a "freshness" check verify? A) That the data is encrypted B) That the data was updated within an expected time window C) That the data has no nulls D) That the data type is correct Answer: B Rationale: Freshness checks compare the timestamp of the latest record to the current time to ensure the pipeline is delivering timely data (e.g., data is no older than 2 hours). 23. Which operator would you use to pause a DAG until a specific file arrives in an S3 bucket? A) PythonOperator B) S3KeySensor C) BashOperator D) EmailOperator Answer: B Rationale: Sensors are a special type of operator that wait for a condition to be met. S3KeySensor polls S3 until a specified key exists before allowing downstream tasks to run. 24. When defining a SQLColumnCheckOperator for a user_id column, which check ensures no duplicate user IDs exist? A) null_check B) distinct_check with a condition that distinct count equals row count C) min D) max Answer: B (or unique_check) Rationale: The unique_check (or a distinct_check with appropriate conditions) verifies
Rationale: Writing a custom SQL check that counts rows with invalid status values and asserts the count is zero is a standard way to enforce accepted values.
28. What is the primary benefit of using AWS Glue Data Catalog in conjunction with an ETL pipeline? A) It provides a centralized repository to store metadata and table definitions for data stored in S3, Redshift, etc. B) It stores the actual data C) It runs the Airflow DAGs D) It visualizes the data Answer: A Rationale: The Glue Data Catalog acts as a Hive-compatible metastore, allowing various AWS services (Athena, Redshift Spectrum, Glue ETL) to query the same data definitions without duplication. 29. Which Airflow feature allows you to limit the number of concurrent tasks running across all DAGs to prevent overwhelming a database? A) max_active_runs B) concurrency (at the DAG level) and pools C) retries D) priority_weight Answer: B Rationale: Pools are used to limit the execution parallelism on arbitrary sets of tasks. They are essential for managing resource consumption on external systems. 30. In a Python data quality check, if you are checking for null values in a Pandas DataFrame column, which method is appropriate? A) df['col'].isnull().sum() B) df['col'].sum() C) df['col'].count() D) df['col'].max() Answer: A
Rationale: isnull().sum() returns the count of missing values in the column, which can then be compared to a threshold (e.g., must be 0).
31. What does the SQLCheckOperator do in Airflow? A) It runs a SQL query that returns a single row, and fails if any value evaluates to False B) It checks the SQL syntax C) It creates a table D) It drops a table Answer: A Rationale: The SQLCheckOperator is the most generic SQL check. It expects a query that returns a single row, and the task fails if any value in that row is falsy (e.g., 0, False, empty). 32. When configuring a data quality test for row count, why might you set both a minimum and a maximum threshold? A) To check the data type B) To detect both unexpected data loss (too few rows) and unexpected duplication (too many rows) C) To speed up the query D) To reduce storage costs Answer: B Rationale: A minimum threshold catches missing data (e.g., an extract failed), while a maximum threshold catches issues like accidental cartesian joins or duplicate loads that inflate the row count. 33. Which AWS service is a serverless compute option that can be triggered by S events to run a Python transformation? A) Amazon EC B) AWS Lambda C) Amazon RDS D) AWS Glue (Job) Answer: B
Rationale: Anomaly detection compares current metrics (like row count or average) against historical norms to flag unexpected deviations that static thresholds might miss.
37. In the context of the SQLColumnCheckOperator , what happens if a check has equal_to: 0 for a null_check? A) The task passes if there are zero nulls, and fails if there are any nulls B) The task fails if there are zero nulls C) It checks for the number 0 in the column D) It drops the nulls Answer: A Rationale: null_check counts the number of nulls. equal_to: 0 asserts that the count must be exactly zero for the check to pass. 38. Which Python built-in library is useful for parsing and formatting dates in an ETL pipeline? A) datetime B) math C) random D) os Answer: A Rationale: The datetime module (along with dateutil or pendulum) is used to parse strings into date objects, perform timezone conversions, and format dates for database insertion. 39. Why is it important to define a schema for the data being loaded into Redshift or a similar warehouse? A) To enforce data types and constraints, preventing corrupt data from being loaded B) To make the data look nice C) To reduce the number of columns D) To slow down queries Answer: A Rationale: Schema enforcement ensures that columns have the correct data types (e.g.,
integers, timestamps) and constraints (like NOT NULL), catching type mismatches before they enter the warehouse.
40. In Airflow, what is a "sensor" primarily used for? A) To transform data B) To wait for a specific condition (like a file arriving or a partition existing) before proceeding C) To load data D) To delete data Answer: B Rationale: Sensors are long-running tasks that poll for a condition (time, file, database record) and succeed once that condition is met, enabling event-driven pipeline patterns. 41. Which SQL function would you use to check for duplicate records based on a combination of columns? A) COUNT(DISTINCT col1, col2) B) SUM(col1) C) AVG(col1) D) MAX(col1) Answer: A Rationale: Counting distinct combinations of the columns and comparing it to the total row count (or using a GROUP BY ... HAVING COUNT(*) > 1 query) identifies duplicates. 42. When an Airflow task fails due to a data quality check, what is a recommended immediate action for the on-call engineer? A) Ignore it and hope it fixes itself B) Investigate the Airflow task logs to see which specific check failed and why C) Delete the DAG D) Turn off all alerts Answer: B Rationale: The Airflow task logs contain the detailed output of the check (e.g., the actual row count vs. the threshold), which is essential for diagnosing the root cause.
A) Data is perfectly clean B) An extract or upstream dependency failed, resulting in no data being loaded C) The data is encrypted D) The table is full Answer: B Rationale: A sudden drop to zero rows is a classic symptom of a failed extract, a broken source query, or a missed file drop, rather than a legitimate business scenario.
47. In the SQLTableCheckOperator , what is the check_statement expected to return? A) A string B) A boolean (or a value that resolves to a boolean) indicating success C) A float D) A table Answer: B Rationale: The check_statement is a SQL expression (e.g., COUNT(*) > 0) that must evaluate to true for the check to pass. 48. Which AWS service provides a query service over data in S3 using standard SQL, often used for ad-hoc validation of raw data? A) Amazon Athena B) Amazon RDS C) AWS Glue (Crawler) D) Amazon ElastiCache Answer: A Rationale: Amazon Athena allows you to run SQL queries directly against data stored in S3 without loading it into a database, making it useful for quick data exploration and validation. 49. What is the primary risk of not implementing data quality tests in an ETL pipeline? A) The pipeline runs too fast B) Corrupt or incorrect data reaches dashboards and machine learning models, leading
to bad business decisions C) The storage costs increase D) The code becomes too clean Answer: B Rationale: Without tests, silent data corruption (e.g., schema changes, unexpected nulls, duplication) can propagate undetected, eroding trust in the data platform.
50. In a Python function that transforms data, what is a "pure" function? A) A function that has no side effects and returns the same output for the same input B) A function that only uses integers C) A function that writes to a database D) A function that prints to the console Answer: A Rationale: Pure functions are deterministic and side-effect-free, making them easier to test, debug, and parallelize within an ETL pipeline. 51. Which Airflow operator would you use to run a COPY command in Redshift to load data from S3? A) PythonOperator B) S3ToRedshiftOperator C) BashOperator D) PostgresOperator Answer: B Rationale: The S3ToRedshiftOperator is specifically designed to handle the authentication and execution of the Redshift COPY command from an S3 source. 52. What does a "schema validation" data quality test check for? A) That the column names and data types match the expected schema B) That the data is encrypted C) That the rows are sorted D) That the primary key exists Answer: A
Rationale: Completeness ensures that critical fields are populated (e.g., missing_count(customer_id) = 0), preventing downstream analysis from being skewed by missing data.
56. Which Python library is commonly used to write unit tests for transformation functions in an ETL pipeline? A) pytest B) flask C) django D) boto Answer: A Rationale: pytest is a mature testing framework for Python that allows developers to write small, readable tests for functions, ensuring transformation logic works as intended before deployment. 57. What happens if an Airflow task has retries=3 and it fails on the first attempt? A) The DAG fails immediately B) Airflow will wait for the retry_delay and then attempt the task again, up to 3 times C) It skips to the next task D) It sends an email only Answer: B Rationale: Airflow will automatically retry a failed task up to the number specified by retries, with a delay defined by retry_delay, before finally marking it as failed. 58. Which AWS service is used to send alerts (e.g., email or SMS) when a CloudWatch alarm is triggered? A) Amazon SNS B) Amazon SQS C) AWS Lambda D) Amazon Kinesis Answer: A
Rationale: Amazon Simple Notification Service (SNS) is a pub/sub messaging service used to fan out notifications to email, SMS, or HTTP endpoints when an alarm fires.
59. In the context of an ETL pipeline, what is "data lineage"? A) The encryption of data B) The ability to track the origin and movement of data through the pipeline C) The speed of data transfer D) The storage cost Answer: B Rationale: Data lineage provides visibility into how data flows from source to destination, which is crucial for debugging data quality issues and compliance audits. 60. When defining a SQLColumnCheckOperator for a numeric column, which check would catch values that are unexpectedly high (e.g., a price of $1,000,000 instead of $100)? A) min check with a lower bound B) max check with an upper bound C) null_check D) distinct_check Answer: B Rationale: A max check with a less_than or leq_to condition sets an upper limit, flagging any values that exceed the expected maximum. 61. What is the purpose of the start_date in an Airflow DAG? A) It defines when the DAG should start being scheduled (the first logical date) B) It defines when the DAG was created C) It is the date of the data D) It is the end date Answer: A Rationale: The start_date is the anchor point for the scheduler. The first DAG run will be scheduled for the first interval after this date.