EX294 Transform data with filters and plugins Practice Question
Which TWO filters can be used to conditionally select elements from a list based on a test? (Select exactly two.)
⚠ Common exam trap
Candidates often confuse `map` with `select` because both iterate over lists, but `map` transforms elements while `select`/`reject` filter them based on a test.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
reject
In Ansible, the `reject` filter removes elements from a list that match a given condition, effectively selecting only those that do not match. The `select` filter does the opposite: it keeps elements that match the condition. Both are used for conditional selection from a list based on a test, making C and D correct.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
map
Why it's wrong here
The map filter transforms each list element, returning a same-length list, so it cannot drop elements failing a test. It is tempting because map is commonly paired with select in Ansible loops, but it would be correct when you need to apply a transformation to every element rather than filter.
- ✗
combine
Why it's wrong here
The combine filter merges two dictionaries into one, operating on hashes rather than lists, so it cannot conditionally select list elements. It is tempting as a general data-manipulation filter, but it would be correct when you need to merge configuration dictionaries, such as combining default and override variables.
- ✓
reject
Why this is correct
The reject filter removes list elements matching the supplied test, returning the remaining items. It performs conditional exclusion rather than selection, which is why it pairs with select as one of the two test-based list filters in Ansible.
- ✓
select
Why this is correct
The select filter returns only list elements for which the supplied test evaluates true, performing conditional selection. It is the counterpart to reject, which excludes matches, so it directly satisfies the requirement for test-based element selection.
- ✗
flatten
Why it's wrong here
The flatten filter collapses nested lists into a single-level list, preserving every element, so it cannot apply a test to drop items. It is tempting because it manipulates list structure, but it would be correct when you need to normalise nested lists before iterating over them.
Go deeper
Related to this question
About these practice questions
Courseiva writes every EX294 question from scratch — 392 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This EX294 practice question is part of Courseiva's free Red Hat certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the EX294 exam.