JNCIA-DevOps Practice Question: An engineer needs to represent an ordered list of IP addresses in a YAML configuration…
An engineer needs to represent an ordered list of IP addresses in a YAML configuration file for a Junos automation playbook. Which valid YAML syntax correctly defines a sequence of items?
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
✓
ip_addresses: - 192.168.1.1 - 192.168.1.2
In YAML, lists or sequences are represented using a hyphen followed by a space (-) at the beginning of each line.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
ip_addresses = {192.168.1.1, 192.168.1.2}
Why it's wrong here
This is Python set or dictionary notation, not YAML; braces with commas are invalid in a YAML block sequence. It would be the right structure when defining a flow-style mapping of key-value pairs, not an ordered list of IP addresses.
- ✗
ip_addresses: [192.168.1.1: 192.168.1.2]
Why it's wrong here
Colons inside flow brackets create a mapping, and the syntax is malformed for a sequence; YAML flow sequences use comma-separated values only. This form suits a flow mapping such as {key: value}, not an ordered list of addresses.
- ✓
ip_addresses: - 192.168.1.1 - 192.168.1.2
Why this is correct
YAML sequences are denoted by a hyphen before each item, indented beneath the parent key. Listing each IP address on its own hyphenated line under 'ip_addresses:' correctly defines an ordered sequence, which is the structure the playbook requires.
- ✗
ip_addresses: * 192.168.1.1 * 192.168.1.2
Why it's wrong here
YAML sequences require a hyphen followed by a space for each entry; asterisks denote aliases referencing anchors, so this parses as invalid syntax. Asterisks are correct when reusing a previously anchored node, not when declaring a fresh ordered list of addresses.
About these practice questions
One of 273 original JNCIA-DevOps 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 →
You might also like
Similar JNCIA-DevOps questions
- You are writing a Python automation script that processes JSON output from a Junos device's 'show interfaces' operationa…
- Which Python function deserializes a JSON-formatted string into a native Python dictionary?
- An automation engineer is writing a Python script that takes a complex nested Python dictionary containing Junos telemet…
- Which TWO features are supported by YAML but are notably absent in standard JSON? (Choose two)
- When serializing complex nested Python dictionaries to JSON, which THREE data types will cause a TypeError unless handle…
Written and reviewed by Johnson Ajibi, MSc IT Security
Security Systems Architect · founder of Courseiva
Last reviewed August 2026 · checked against the official Juniper Networks exam blueprint
This JNCIA-DevOps practice question is part of Courseiva's free Juniper Networks 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 JNCIA-DevOps exam.