Courseiva

EX294 Transform data with filters and plugins Practice Question

A template must emit a comma-separated string of hostnames from a list variable `web_nodes`, sorted alphabetically, for use in a configuration file. Which expression produces that string?

⚠ Common exam trap

The trap here is applying filters in the wrong sequence, so the join collapses the list before sorting can order its elements.

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

✓

{{ web_nodes | sort | join(',') }}

The order of filters matters: sorting must happen while the data is still a list, then joining converts it to a string. Applying join before sort would sort characters, and filters like unique or flatten do not impose alphabetical order. Only sorting the list first and then joining with a comma delimiter meets the requirement.

Answer analysis

Option-by-option breakdown

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

  • ✗

    {{ web_nodes | unique | join(',') }}

    Why it's wrong here

    The `unique` filter removes duplicate entries but does not order the results. The resulting string would preserve the original encounter order of the hostnames, which may not be alphabetical. Since the requirement explicitly asks for alphabetical sorting, this expression omits the necessary ordering step and can produce a differently ordered string.

  • ✗

    {{ web_nodes | flatten | join(',') }}

    Why it's wrong here

    The `flatten` filter collapses nested lists into a single-level list. Since `web_nodes` is already a flat list of hostnames, flattening changes nothing, and no sorting occurs. The joined string therefore retains the original list order rather than the alphabetical order the scenario requires.

  • ✓

    {{ web_nodes | sort | join(',') }}

    Why this is correct

    The `sort` filter returns a new list ordered alphabetically, and `join` concatenates its elements using the comma delimiter. Chaining them yields a single string with hostnames in sorted order separated by commas, which is exactly the format the configuration file expects. Both filters are standard Ansible/Jinja2 filters available in templates.

  • ✗

    {{ web_nodes | join(',') | sort }}

    Why it's wrong here

    Here `join` runs first, collapsing the list into one string. The `sort` filter then operates on a string, which in Jinja2 sorts the individual characters rather than hostnames. The output would be a jumbled sequence of characters, not a sorted comma-separated hostname list, so the configuration file would contain meaningless data.

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 →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official Red Hat exam blueprint

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.