Courseiva

EX294 Transform data with filters and plugins Practice Question

Which TWO filters are commonly used for list manipulation in Ansible? (Select exactly two.)

⚠ Common exam trap

Candidates often confuse filters that operate on strings (like `regex_replace`) or single values (like `default` and `ternary`) with those designed for list iteration, leading them to select incorrect options that are not list-specific.

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

✓

`map`

The `map` filter is specifically designed for list manipulation in Ansible, allowing you to apply a transformation (such as extracting a specific attribute) to every element in a list. Option D is correct because the `select` filter is used to filter list items based on a condition, returning only those elements that match. Both are core Jinja2 filters commonly used in Ansible playbooks for processing lists.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    `default`

    Why it's wrong here

    default supplies a fallback value when a variable is undefined or empty; it does not iterate, filter, or reshape list contents. It tempts because it is ubiquitous in role variable files, and it would be correct for guarding optional variables, but list manipulation needs filters such as map, select, flatten, or unique.

  • ✓

    `map`

    Why this is correct

    The map filter applies a function to every element of a list, returning a transformed list of equal length. It is a core Jinja2 list-manipulation filter in Ansible, satisfying the stem by enabling element-wise transformation within playbooks and templates.

  • ✗

    `ternary`

    Why it's wrong here

    ternary returns one of two values based on a boolean condition, so it selects between scalars rather than transforming list elements. It tempts because it appears in conditional task examples, and it would be correct for toggling a setting, but list manipulation requires filters such as map, select, or unique.

  • ✓

    `select`

    Why this is correct

    The select filter tests each list element against a condition, returning only those that pass. It is a standard Jinja2 list-manipulation filter in Ansible, satisfying the stem by enabling filtering of lists within playbooks and templates.

  • ✗

    `regex_replace`

    Why it's wrong here

    regex_replace performs string substitution on text, returning a modified string rather than transforming list elements or structure. It tempts because it appears in Jinja2 templating examples, and it would be correct when rewriting a hostname or path pattern, but list manipulation requires filters such as map, select, or unique.

About these practice questions

This EX294 question is part of Courseiva's 392-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

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.