EX294 Transform data with filters and plugins Practice Question
Exhibit
Refer to the exhibit.
- name: Parse CSV
hosts: localhost
vars:
csv_data: "name,age\nAlice,30\nBob,25"
tasks:
- name: Convert to list of dicts
set_fact:
parsed: "{{ csv_data | community.general.parse_csv }}"
- debug:
var: parsedThe playbook uses the community.general.parse_csv filter. Assuming the collection is installed, what is the type and structure of the 'parsed' variable?
⚠ Common exam trap
Watch out — candidates often confuse `parse_csv` with `split` or `regex_replace` filters, assuming it returns raw strings or a single dictionary, rather than understanding it returns a list of dictionaries with header-based keys.
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
✓
A list of dictionaries: [{'name': 'Alice', 'age': '30'}, {'name': 'Bob', 'age': '25'}]
The `community.general.parse_csv` filter in Ansible parses CSV content into a list of dictionaries, where the first row is treated as headers and subsequent rows become dictionaries with those headers as keys. Option A correctly describes this output: a list of dictionaries with keys 'name' and 'age' and corresponding string values.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
A list of dictionaries: [{'name': 'Alice', 'age': '30'}, {'name': 'Bob', 'age': '25'}]
Why this is correct
The community.general.parse_csv filter converts CSV text into a list of dictionaries, using the header row as keys and each subsequent row as values. Fields remain strings, so age appears as '30' rather than an integer, matching the structure shown.
- ✗
A single string: 'Alice,30\nBob,25'
Why it's wrong here
parse_csv parses the input into structured records; it does not echo the raw CSV text back unchanged. A single string is what you would hold before applying the filter. The option mistakes the filter's input for its output, ignoring that parsing produces rows.
- ✗
A list of strings: ['name,age', 'Alice,30', 'Bob,25']
Why it's wrong here
The filter splits each line into fields and returns dictionaries, not the original comma-separated lines as strings. A list of raw strings is what splitting on newlines alone would yield. The option omits the field-name mapping that parse_csv performs.
- ✗
A dictionary: {'Alice': '30', 'Bob': '25'}
Why it's wrong here
parse_csv returns a list of dictionaries, one per data row, not a single dictionary keyed by name. A name-to-age mapping would require additional transformation after parsing. The option confuses the filter's row-oriented output with a lookup structure the playbook never builds.
Go deeper
Related to this question
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 →
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.