Courseiva

EX294 Transform data with filters and plugins Practice Question

An administrator needs to combine two dictionaries, `base_config` and `user_config`, where keys in `user_config` should override keys in `base_config`, and nested dictionaries should be merged recursively. Which filter syntax achieves this?

⚠ Common exam trap

A common mix-up: candidates confuse `recursive=True` with `deep=True` (which does not exist) or assume that the default `combine` behavior (shallow merge) is sufficient for nested dictionaries, leading them to pick option B or C.

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

✓

{{ base_config | combine(user_config, recursive=True) }}

The `combine` filter in Ansible with `recursive=True` merges two dictionaries, with `user_config` overriding `base_config`, and recursively merges nested dictionaries. This matches the requirement exactly, as `recursive=True` ensures that nested structures are combined rather than replaced outright.

Answer analysis

Option-by-option breakdown

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

  • ✓

    {{ base_config | combine(user_config, recursive=True) }}

    Why this is correct

    The recursive=True parameter merges nested dictionaries key-by-key rather than replacing the whole sub-dictionary, while user_config values take precedence over base_config at each level. Without it, combine would overwrite entire nested blocks, losing base_config keys the stem requires to be preserved.

  • ✗

    {{ base_config | combine(user_config, deep=True) }}

    Why it's wrong here

    No such parameter 'deep'; correct parameter is 'recursive'.

  • ✗

    {{ base_config | combine(user_config) }}

    Why it's wrong here

    Without deep=True, combine() performs a shallow merge, so nested dictionaries are replaced wholesale rather than merged recursively, losing base_config sub-keys. The plain filter is tempting because it correctly overrides top-level keys, which suits flat dictionaries where no nested merging is required.

  • ✗

    {{ base_config | combine(user_config, list_merge='replace') }}

    Why it's wrong here

    list_merge='replace' governs how colliding lists are handled, not nested dictionaries, so recursion still does not occur without deep=True. It is tempting because it appears to add merge control, and it is the right choice when the requirement concerns list values rather than nested dictionary keys.

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 →

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.