EX294 Transform data with filters and plugins Practice Question
A playbook defines the variable `packages` as a list of dictionaries, each containing `name` and `version` keys. You need to build a new list of strings in the form `name-version` for use in a log message. Which filter combination produces this result?
⚠ Common exam trap
The trap here is assuming `map('join', '-')` alone can combine two fields from the same dictionary, when it only joins elements within one list.
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
✓
{{ packages | map(attribute='name') | zip(packages | map(attribute='version')) | map('join', '-') | list }}
Building `name-version` strings from a list of dictionaries requires extracting both attributes separately and then pairing them. The `zip` filter aligns the two extracted lists element-wise, and `map('join', '-')` converts each pair into a hyphenated string. Filters like `combine`, `dict2items`, and `selectattr` operate on different data shapes and do not produce the desired formatted strings.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
{{ packages | map(attribute='name') | zip(packages | map(attribute='version')) | map('join', '-') | list }}
Why this is correct
This expression extracts the `name` and `version` attributes from each dictionary, pairs them positionally with `zip`, then joins each pair with a hyphen using `map('join', '-')`. The final `list` materializes the result. It produces exactly the `name-version` strings required in the correct order.
- ✗
{{ packages | selectattr('name') | map('join', '-') | list }}
Why it's wrong here
`selectattr('name')` filters the list to entries that have a truthy `name` attribute, but it does not transform each entry into a string. Applying `join` to dictionaries is invalid because `join` expects a list of strings. This approach neither extracts the fields nor formats them correctly.
- ✗
{{ packages | map('combine') | list }}
Why it's wrong here
`combine` merges dictionaries rather than formatting strings from list elements. Applied through `map` to a list of dictionaries, it would attempt to merge them into one dictionary, not produce `name-version` strings. This does not match the requirement of generating formatted strings for logging.
- ✗
{{ packages | map('dict2items') | map('join', '-') | list }}
Why it's wrong here
`dict2items` converts each dictionary into a list of key/value dictionaries, not a flat pair of strings. Joining those items with a hyphen would not yield `name-version` because each element is itself a dictionary, not a scalar. This expression produces unusable output for the logging requirement.
About these practice questions
One of 392 original EX294 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
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.