Sample questions
Question 1Easy
In A >> B, which task runs first?
- Both at once
- A
- Neither
- B
Answer: B. A
Explanation
The >> operator sets B downstream of A.
Step-by-step solution
- A >> B means A is followed by B.
- So A runs first, then B.
- Therefore, task A runs first.
- Final answer: B (A).
Why the other options are wrong
- A. A >> B means B waits for A, so the two tasks never run at the same time.
- C. Neither runs first is wrong; A >> B sets an order in which A comes before B.
- D. B is the task that runs second, because A >> B makes B depend on A.
Tip: In A >> B, A always runs first.
Question 2Easy
Why can an Airflow DAG not contain a cycle?
- The scheduler could never find a valid order
- Cycles would make tasks run twice as fast
- Python does not allow loops in any code
- Cycles use too much memory in the database
Answer: A. The scheduler could never find a valid order
Explanation
With A → B → A, neither task can start first, so a run could never complete.
Step-by-step solution
- A cycle means tasks depend on each other endlessly.
- No task can start without another task starting first.
- The scheduler cannot find a valid order to execute tasks.
- This makes the DAG impossible to run properly.
- Final answer: A (The scheduler could never find a valid order).
Why the other options are wrong
- B. Cycles do not make tasks faster; a cycle makes the schedule impossible to complete.
- C. Python allows loops; the rule is about task dependencies in the DAG, not Python syntax.
- D. Memory use in the database is not the reason; the scheduler cannot order a cycle.
Tip: Always check for cycles when designing DAGs.
Question 3Easy
In Airflow, a DAG represents:
- A dashboard that shows business metrics
- A single SQL query that runs in the warehouse
- Tasks and their dependencies, with no cycles
- A cluster of machines that run Spark jobs
Answer: C. Tasks and their dependencies, with no cycles
Explanation
Directed acyclic graph: edges define order, and cycles are not allowed.
Step-by-step solution
- A DAG stands for Directed Acyclic Graph.
- Edges show the order of task execution.
- Cycles are not allowed in a DAG.
- Tasks and their dependencies form a DAG.
- Final answer: Tasks and their dependencies, with no cycles.
Why the other options are wrong
- A. A dashboard showing business metrics is a BI tool, not an Airflow DAG.
- B. A single SQL query is one task at most; a DAG is a set of tasks and their dependencies.
- D. A cluster of machines running Spark is infrastructure; a DAG is a graph of tasks.
Question 4Easy
- A database table that stores DAG runs
- A person who watches the dashboards each night
- A cycle in the graph between two tasks
- A template for a unit of work, such as running SQL
Answer: D. A template for a unit of work, such as running SQL
Explanation
Instantiating an operator in a DAG creates a task.
Step-by-step solution
- An operator is a template for one kind of work, such as running SQL or a Python function.
- When an operator is placed in a DAG, it becomes a task.
- An operator is not a table, a person or a cycle.
- The correct answer is option D: a template for a unit of work, such as running SQL.
Why the other options are wrong
- A. DAG runs are recorded in the metadata database, not in operators.
- B. An operator is a code object, not a person who watches dashboards.
- C. A DAG has no cycles, and an operator is not a cycle.
Tip: Operator means what to do; a task is an operator placed in a DAG.
Question 5Medium
Heavy code (such as an API call) at the top level of a DAG file is a problem because:
- It turns the DAG into a cycle automatically
- Top-level code is never executed by Airflow at all
- It makes the DAG run on every worker machine at once, in parallel
- The scheduler runs it every time it parses the file
Answer: D. The scheduler runs it every time it parses the file
Explanation
DAG files are parsed frequently; expensive top-level work slows scheduling for every DAG.
Step-by-step solution
- Airflow parses DAG files often.
- Top-level code runs each time Airflow parses the file.
- Heavy code like API calls slows down parsing.
- This makes the scheduler run it every time it parses the file.
- The scheduler runs it every time it parses the file.
Why the other options are wrong
- A. Top-level code does not turn a DAG into a cycle; the trouble is repeated execution during parsing.
- B. Airflow does execute top-level code, and it runs every time the file is parsed.
- C. Top-level code is not run on every worker at once; the problem is repeated parsing by the scheduler.
Tip: Avoid heavy code at the top level of DAG files to prevent repeated execution during parsing.
Question 6Medium
An Airflow pool with 3 slots is attached to tasks that query a fragile database. What does it do?
- Limits those tasks to 3 running at once
- Gives each task 3 CPU cores to use
- Runs each task on 3 workers at once
- Retries each task 3 times on failure
Answer: A. Limits those tasks to 3 running at once
Explanation
Pools cap concurrency for a shared resource across DAGs.
Step-by-step solution
- An Airflow pool has a fixed number of slots.
- Tasks in the pool take slots when running.
- With 3 slots at most 3 tasks run at once.
Why the other options are wrong
- B. Pools do not assign CPUs.
- C. They do not duplicate runs.
- D. Retries are set per task.
Tip: Pool = concurrency cap.
Question 7Medium
A cleanup task must run whether its upstream tasks succeeded or failed. Which trigger rule fits?
- one_failed
- all_success
- all_done
- none_skipped
Answer: C. all_done
Explanation
all_done fires once every upstream task has finished, in any state.
Step-by-step solution
- All_done runs after all upstream tasks finish, no matter their outcome.
- It ensures cleanup happens regardless of success or failure.
- This matches the requirement for the cleanup task.
- So the correct trigger rule is all_done.
- Final answer: C (all_done).
Why the other options are wrong
- A. one_failed runs only when an upstream task fails, so cleanup would be skipped after a success.
- B. all_success runs only if every upstream task succeeds, so cleanup would be skipped after a failure.
- D. none_skipped only checks for skipped upstream tasks, so it does not guarantee cleanup after failures.
Tip: Use all_done for tasks that must run after all previous tasks finish, regardless of success or failure.
Question 8Medium
Why should Airflow tasks be idempotent?
- It lets tasks share memory with each other
- Retries and backfills can then rerun them safely
- The metadata database requires it for storage
- Idempotent tasks run without a scheduler
Answer: B. Retries and backfills can then rerun them safely
Explanation
A rerun for the same interval should produce the same output, not duplicates.
Step-by-step solution
- A rerun for the same interval should produce the same output.
- Retries and backfills rerun tasks, sometimes many times.
- An idempotent task overwrites its result instead of adding duplicates, so reruns are safe.
- The correct answer is option B: retries and backfills can rerun them safely.
Why the other options are wrong
- A. Airflow tasks share data through XCom or storage, not shared memory.
- C. The metadata database does not need idempotent tasks.
- D. Tasks still need a scheduler; idempotence is about safe reruns, not running without one.
Tip: Design each task to overwrite its own interval's output rather than append to it.
Question 9Hard
Many long-waiting sensors fill all worker slots and block other tasks. Which setting addresses this?
- Changing the trigger rule to all_done
- Reschedule mode, which frees the slot between checks
- Setting retries to zero on every sensor
- Raising every sensor's timeout to several days so none of them fail
Answer: B. Reschedule mode, which frees the slot between checks
Explanation
In reschedule mode the sensor releases its worker between pokes instead of sleeping in it.
Step-by-step solution
- Reschedule mode frees slots between checks, allowing other tasks.
- Sensors release workers instead of blocking them.
- This prevents long waits and task blockage.
- Slots are available for new tasks during sensor checks.
- Final answer: Reschedule mode, which frees the slot between checks.
Why the other options are wrong
- A. Changing the trigger rule controls when a task runs after upstream tasks; it does not free sensor slots.
- C. Zero retries do not free slots; a sensor still holds its slot while it waits.
- D. Longer timeouts keep sensors holding slots for days, which makes the blocking worse.
Tip: Use reschedule mode to avoid sensor slot blocking.
Question 10Hard
A task uses datetime.now() to choose which day's data to load. What goes wrong when you backfill last month?
- Each run loads all days in the month at once
- Backfills refuse to start for any task that imports the datetime module
- The DAG becomes cyclic and cannot be parsed
- Every backfill run loads today's data instead of its own day
Answer: D. Every backfill run loads today's data instead of its own day
Explanation
Runs should use the interval provided by the orchestrator so that each processes its own period.
Step-by-step solution
- datetime.now() uses current date, not backfill date.
- Backfill runs use today's date instead of target day.
- So every run loads today's data instead of its own day.
- This causes all backfill runs to load same day's data.
- Final answer: Every backfill run loads today's data instead of its own day.
Why the other options are wrong
- A. The code picks one day per run, so runs do not each load the whole month at once.
- B. Backfills do not refuse to start because of an import; importing datetime is allowed.
- C. The DAG does not become cyclic; calling datetime.now() creates no dependency loop.
Tip: Use scheduler-provided dates instead of datetime.now() for accurate backfilling.
Practise all 20 questions free
The full question bank with timed practice, progress tracking and Vidya, your AI tutor. Free, no ads.
Open this topic in the app →