Apache Airflow Fundamentals

Question bank

Astronomer logo

Apache Airflow Fundamentals

AF3-F

42 Apache Airflow Fundamentals questions with the correct answer and a written explanation, organised across 5 exam domains.

42 questions
5 domains
Foundation level

Question index

Jump straight to any question. Answers and explanations are inline.

Airflow Core Concepts

11 questions in this domain

  1. Question 1Single Choice

    Which component of Apache Airflow is responsible for interpreting DAG definitions and managing task dependencies?

    • ASchedulerCorrect answer
    • BExecutor
    • CWeb Server
    • DWorker

    Why this is the answer

    The Scheduler interprets DAG definitions, manages dependencies, and decides when tasks should run based on schedules and triggers. Executors only delegate tasks; Web Server provides UI; Workers execute task code.

  2. Question 2Multiple Select

    Which two components in Airflow's architecture are required for task execution to occur?

    • AExecutor
    • BWorkerCorrect answer
    • CSchedulerCorrect answer
    • DWeb Server

    Why this is the answer

    The Scheduler prepares and queues tasks; the Worker actually runs the task code. The Executor is only a bridge; the Web Server is optional for execution.

  3. Question 3Interactive

    Analyze this configuration snippet and identify the executor type that will be used.

    • ASequentialExecutor
    • BLocalExecutorCorrect answer
    • CCeleryExecutor
    • DKubernetesExecutor

    Why this is the answer

    The configuration sets core.executor to 'LocalExecutor' (shown in the code block). No broker URL is provided, so Celery/K8s are not possible. Sequential is not set.

  4. Question 4Single Choice

    What does the bitshift operator >> in a DAG definition indicate?

    • Atask2 runs before task1
    • Btask1 depends on task2
    • Ctask2 depends on task1Correct answer
    • DNo dependency, it's a syntax error

    Why this is the answer

    The bitshift operator >> sets the downstream task to depend on the upstream. So task1 >> task2 means task2 depends on task1.

  5. Question 5Multiple Select

    Which two statements are true about a DAG Run in Airflow?

    • AA DAG Run is created for every data interval that ends after start_date if catchup=TrueCorrect answer
    • BA DAG Run always appears immediately after the DAG file is parsed
    • CEach DAG Run has its own execution_date which is the start of the data intervalCorrect answer
    • DA DAG Run state is the same as the state of its first task instance

    Why this is the answer

    DAG Runs are created when the schedule interval passes (or manually). The execution_date is the beginning of the data interval. Runs are not created immediately after parsing. The DAG Run state is a summary of all tasks, not just the first.

  6. Question 6Interactive

    Given this DAG snippet, what will be the trigger rule for task3 if we want it to run as soon as any one of task1 or task2 succeeds?

    • Aall_success
    • Bone_successCorrect answer
    • Call_done
    • Done_failed

    Why this is the answer

    The trigger_rule='one_success' makes the downstream task run as soon as any upstream task succeeds. all_success requires all to succeed; all_done runs regardless of outcome; one_failed runs if any fails.

  7. Question 7Single Choice

    What is the main difference between a DAG and a DAG Run?

    • AA DAG Run is the blueprint; a DAG is an execution
    • BA DAG is static; a DAG Run is a runtime instanceCorrect answer
    • CA DAG Run contains tasks; a DAG contains operators
    • DThey are synonyms

    Why this is the answer

    A DAG is the static workflow definition written in Python; a DAG Run is a specific execution of that DAG for a particular data interval.

  8. Question 8Multiple Select

    Which two methods can create a new DAG Run in Airflow?

    • AAutomatic scheduling based on schedule_intervalCorrect answer
    • BManual trigger via the Web UI or CLICorrect answer
    • CAutomatic creation when a DAG file is parsed
    • DTriggered by any task that completes successfully

    Why this is the answer

    DAG Runs are created either automatically by the scheduler when the schedule interval passes, or manually via UI/CLI. Parsing a DAG file alone does not create a run; task completion does not trigger a new run.

  9. Question 9Interactive

    Based on this DAG configuration, what will be the execution_date for the first scheduled DAG Run?

    • A2024-01-01 00:00:00
    • B2024-01-02 00:00:00Correct answer
    • C2024-01-01 01:00:00
    • D2024-01-02 01:00:00

    Why this is the answer

    For a @daily schedule with start_date=2024-01-01, the first DAG Run is created after the data interval ends, i.e., at 2024-01-02 00:00:00, with execution_date=2024-01-01 00:00:00 (start of the interval).

  10. Question 10Single Choice

    What is the default trigger rule for a task in Airflow?

    • Aall_successCorrect answer
    • Bone_success
    • Call_done
    • Dnone_failed

    Why this is the answer

    The default trigger rule is 'all_success', meaning all upstream tasks must succeed before the downstream task starts. Other rules must be explicitly set.

  11. Question 11Multiple Select

    Which two statements are correct regarding the use of XComs in Airflow?

    • AXComs are stored in a metadata database tableCorrect answer
    • BXComs are ideal for passing large dataframes between tasks
    • CXComs can be pulled from a different DAG by specifying dag_idCorrect answer
    • DXComs persist across DAG runs indefinitely

    Why this is the answer

    XComs are stored in the 'xcom' table of the metadata database. They are meant for small data; large data should be stored externally. They can be pulled across DAGs using the dag_id parameter. They do not persist indefinitely; they can be cleared.

DAG Authoring and Scheduling

11 questions in this domain

  1. Question 12Single Choice

    What is the purpose of the `with DAG(...) as dag:` statement in Airflow?

    • AIt creates a DAG object and automatically assigns tasks defined inside the block to that DAG.Correct answer
    • BIt defines the schedule interval for the DAG.
    • CIt sets default_args for all tasks in the DAG.
    • DIt adds tags to the DAG for UI filtering.

    Why this is the answer

    The context manager ensures tasks within the block are associated with the DAG without needing explicit dag=dag parameter.

  2. Question 13Multiple Select

    Which statements about `default_args` in Airflow are correct? (Select all that apply)

    • AIt is a dictionary passed to the DAG constructor.Correct answer
    • BIt sets default parameters for all tasks within that DAG.Correct answer
    • CTask-level arguments always override the corresponding default_args.Correct answer
    • DIt must contain the 'start_date' parameter.

    Why this is the answer

    default_args is an optional dict; start_date is required but can be set elsewhere. Task parameters have higher precedence.

  3. Question 14Interactive

    In the provided code, which parameter is used to add searchable metadata labels to the DAG in the Airflow UI?

    • AtagsCorrect answer
    • Bdefault_args
    • Cdag_id
    • Dschedule_interval

    Why this is the answer

    Tags are a list of strings that appear as filterable labels in the Airflow UI; they do not affect execution.

  4. Question 15Single Choice

    What type of task dependency is created by `task1 >> [task2, task3]`?

    • AFan-out (parallel downstream tasks)Correct answer
    • BFan-in (synchronization point)
    • CLinear (sequential chain)
    • DConditional branching

    Why this is the answer

    Fan-out means one upstream task triggers multiple downstream tasks that can run in parallel.

  5. Question 16Multiple Select

    Which statements about cron-based scheduling in Airflow are true? (Select all that apply)

    • AThe schedule parameter accepts standard cron strings like '0 5 * * 1'.Correct answer
    • B@daily is equivalent to '0 0 * * *'.Correct answer
    • CCron scheduling aligns to calendar boundaries.Correct answer
    • DCron expressions can specify seconds.

    Why this is the answer

    Cron has 5-6 fields; seconds are not standard. @daily maps to midnight. Cron aligns to wall-clock time.

  6. Question 17Interactive

    Given the TaskFlow code below, what is automatically created when `return_value` is passed to another task?

    • AAn XCom that establishes an implicit dependencyCorrect answer
    • BA bitwise shift operator dependency
    • CA manual set_downstream() call
    • DA separate DummyOperator dependency

    Why this is the answer

    TaskFlow automatically pushes return values to XCom and creates dependencies when passed as arguments to other decorated functions.

  7. Question 18Single Choice

    What is the default value of the `retries` parameter in an Airflow task?

    • A0Correct answer
    • B1
    • C3
    • DInfinite

    Why this is the answer

    The default retries parameter is 0; tasks fail permanently unless retries is explicitly set to a positive integer.

  8. Question 19Multiple Select

    Which of the following are valid schedule types in Airflow? (Select all that apply)

    • ACron expression stringCorrect answer
    • Bdatetime.timedelta objectCorrect answer
    • CList of Dataset objectsCorrect answer
    • DSQLAlchemy query

    Why this is the answer

    Airflow supports cron, timedelta, and dataset-driven scheduling. SQLAlchemy query is not a schedule type.

  9. Question 20Interactive

    In the code snippet, which scheduling approach is used for the DAG?

    • AData-aware scheduling with a DatasetCorrect answer
    • BCron-based weekly schedule
    • CTimedelta scheduling
    • DNo schedule (manual only)

    Why this is the answer

    The schedule is a list containing a Dataset URI, which triggers the DAG when the dataset is updated.

  10. Question 21Single Choice

    What does the `expand()` method in TaskFlow API allow you to do?

    • ACreate multiple parallel task instances from a single task definition at runtimeCorrect answer
    • BDefine a fixed number of tasks at parse time
    • CManually push data to XCom
    • DSet default_args for the task

    Why this is the answer

    expand() enables dynamic task mapping: it fans out to N parallel instances based on an iterable resolved at runtime.

  11. Question 22Multiple Select

    Which of the following are key characteristics of an idempotent Airflow task? (Select all that apply)

    • ARepeated execution always results in the same final stateCorrect answer
    • BIt typically uses upsert (MERGE) operationsCorrect answer
    • CIt avoids duplicate data when retried or re-runCorrect answer
    • DIt requires `depends_on_past=True`

    Why this is the answer

    Idempotent tasks can be safely re-run; they often use upsert or partition overwrites. depends_on_past is unrelated.

Execution and Production Deployment

8 questions in this domain

  1. Question 23Single Choice

    Which executor runs tasks as subprocesses on the scheduler host?

    • ALocalExecutorCorrect answer
    • BCeleryExecutor
    • CKubernetesExecutor
    • DSequentialExecutor

    Why this is the answer

    LocalExecutor runs tasks as subprocesses on the scheduler host, leveraging multiprocessing.

  2. Question 24Multiple Select

    Which two executors require a metadata database that supports multiple concurrent connections?

    • ALocalExecutorCorrect answer
    • BCeleryExecutorCorrect answer
    • CKubernetesExecutor
    • DSequentialExecutor

    Why this is the answer

    LocalExecutor and CeleryExecutor require a database like PostgreSQL or MySQL that supports multiple concurrent connections.

  3. Question 25Interactive

    Given the following Dockerfile snippet, which Airflow configuration is being set?

    • Acore.parallelismCorrect answer
    • Bcore.dag_concurrency
    • Ccore.max_active_runs
    • Dcore.worker_concurrency

    Why this is the answer

    The environment variable AIRFLOW__CORE__PARALLELISM sets the global parallelism limit for the scheduler.

  4. Question 26Single Choice

    What is the default executor when using SQLite as the metadata database?

    • ASequentialExecutorCorrect answer
    • BLocalExecutor
    • CCeleryExecutor
    • DKubernetesExecutor

    Why this is the answer

    The SequentialExecutor is the default executor when SQLite is used as the metadata database.

  5. Question 27Multiple Select

    Which of the following are valid ways to set environment variables in an Astronomer deployment?

    • AUsing the Astro CLI command astro deployment variable setCorrect answer
    • BDirectly editing the Dockerfile ENV directiveCorrect answer
    • CBy modifying the running container's environment file
    • DThrough the Astronomer UI under Deployment > VariablesCorrect answer

    Why this is the answer

    Environment variables can be set via the Astro CLI, the Dockerfile ENV command, or the Astronomer UI.

  6. Question 28Interactive

    What does the following Airflow metric indicate? pool.starving > 0

    • ATasks are waiting for pool slotsCorrect answer
    • BThe scheduler is overloaded
    • CWorkers are idle
    • DDatabase connections are exhausted

    Why this is the answer

    A positive value for pool.starving indicates that tasks are queued because no pool slots are available.

  7. Question 29Single Choice

    Which executor provides strong resource isolation by creating a Kubernetes Pod for each task?

    • AKubernetesExecutorCorrect answer
    • BCeleryExecutor
    • CLocalExecutor
    • DSequentialExecutor

    Why this is the answer

    KubernetesExecutor creates a unique Pod for each task instance, providing strong resource isolation.

  8. Question 30Multiple Select

    Which of the following are part of the Astro project structure?

    • Adags/Correct answer
    • Bplugins/Correct answer
    • Cairflow.cfg
    • DDockerfileCorrect answer

    Why this is the answer

    An Astro project contains dags/, plugins/, Dockerfile, requirements.txt, packages.txt, and airflow_settings.yaml.

Operators, Hooks, and Connections

8 questions in this domain

  1. Question 31Single Choice

    Which built-in operator is designed to execute a Python callable?

    • APythonOperatorCorrect answer
    • BBashOperator
    • CPostgresOperator
    • DKubernetesPodOperator

    Why this is the answer

    The PythonOperator executes a Python callable via the python_callable parameter.

  2. Question 32Multiple Select

    Which of the following operators support Jinja templating in their command or SQL parameters?

    • ABashOperatorCorrect answer
    • BPostgresOperatorCorrect answer
    • CPythonOperator
    • DKubernetesPodOperator

    Why this is the answer

    BashOperator and PostgresOperator have templatable fields (bash_command, sql). PythonOperator does not template its callable; KubernetesPodOperator does not support templating.

  3. Question 33Interactive

    In the provided code snippet, what type of object does get_records return?

    • AA list of tuplesCorrect answer
    • BA list of dictionaries
    • CA pandas DataFrame
    • DA single string

    Why this is the answer

    get_records returns a list of tuples, each tuple representing a row.

  4. Question 34Single Choice

    Which method of storing connections has the highest precedence in Airflow?

    • ASecret BackendCorrect answer
    • BEnvironment Variables
    • CConnections UI
    • DAll have equal precedence

    Why this is the answer

    Secret Backends are checked first, overriding environment variables and UI connections.

  5. Question 35Multiple Select

    Which of the following are common built-in Hooks in Airflow?

    • APostgresHookCorrect answer
    • BS3HookCorrect answer
    • CGCSHookCorrect answer
    • DKubernetesHook

    Why this is the answer

    PostgresHook, S3Hook, and GCSHook are listed as common built-in Hooks. KubernetesHook is not mentioned in the document.

  6. Question 36Interactive

    What is the purpose of the template_fields attribute in the custom operator?

    • AEnables Jinja templating for the parameterCorrect answer
    • BMakes the parameter mandatory
    • CAutomatically pushes the parameter to XCom
    • DDefines a default value for the parameter

    Why this is the answer

    template_fields tells Airflow which parameters should be processed through Jinja templating.

  7. Question 37Single Choice

    Which operator should you use to execute a command-line utility that requires dependencies not installed on the Airflow worker?

    • AKubernetesPodOperatorCorrect answer
    • BBashOperator
    • CPythonOperator
    • DPostgresOperator

    Why this is the answer

    KubernetesPodOperator launches a Pod with a custom image, providing full isolation.

  8. Question 38Multiple Select

    Select the supported methods for storing and managing Airflow connections.

    • AConnections UICorrect answer
    • BEnvironment VariablesCorrect answer
    • CSecret BackendsCorrect answer
    • DDirect database editing

    Why this is the answer

    Airflow supports Connections UI, environment variables, and Secret Backends. Direct database editing is not a supported management method.

Security, Governance, and Best Practices

4 questions in this domain

  1. Question 39Single Choice

    What is the default authentication method for Apache Airflow?

    • APassword-based (local database)Correct answer
    • BLDAP
    • COAuth
    • DSAML

    Why this is the answer

    The default Airflow authentication is password-based using a local database with hashed passwords.

  2. Question 40Multiple Select

    Which Airflow roles can manage connections and variables through the UI?

    • AAdminCorrect answer
    • BOp
    • CUser
    • DViewer

    Why this is the answer

    Only the Admin role has full access to manage connections, variables, and other configurations in the UI.

  3. Question 41Interactive

    Examine the configuration snippet and determine the missing authentication backend.

    • Aairflow.api.auth.backend.sessionCorrect answer
    • Bairflow.api.auth.backend.default
    • Cairflow.api.auth.backend.ldap
    • Dairflow.api.auth.backend.oauth

    Why this is the answer

    For production, the auth_backend must be set to 'airflow.api.auth.backend.session' to enforce RBAC authentication.

  4. Question 42Single Choice

    Where are audit logs stored in Apache Airflow by default?

    • ALog table in metadata databaseCorrect answer
    • BTask log files on worker nodes
    • CScheduler log files
    • DExternal remote storage

    Why this is the answer

    Audit logs are stored in the 'log' ORM model within the Airflow metadata database.

Frequently asked questions

Everything about the Apache Airflow Fundamentals question bank and how to use it.