Courseiva
Python And PyEZhardMultiple ChoiceObjective-mapped

JNCIA-DevOps Python And PyEZ Practice Question

You are rendering a Jinja2 template in Python that includes a loop over a list of VLANs. Which Jinja2 block syntax correctly iterates over a list named 'vlan_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

{% for vlan in vlan_list %} ... {% endfor %}

Jinja2 uses {% for item in list %} ... {% endfor %} syntax for iteration.

Answer analysis

Option-by-option breakdown

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

  • {{ for vlan in vlan_list }} ... {{ endfor }}

    Why it's wrong here

    Incorrect. Double braces are for printing expressions, not control blocks.

  • [for vlan in vlan_list] ... [endfor]

    Why it's wrong here

    Incorrect. Square brackets are not used for Jinja2 control blocks.

  • {% for vlan in vlan_list %} ... {% endfor %}

    Why this is correct

    Correct. The percent-brace syntax defines control structures like loops.

  • <% for vlan in vlan_list %> ... <% endif %>

    Why it's wrong here

    Incorrect. This mimics Mako syntax, not Jinja2.

Visual reference

Switch VLAN 10 Sales (192.168.10.0/24) PC-A PC-B VLAN 20 HR (192.168.20.0/24) PC-C PC-D Router VLANs isolate traffic — inter-VLAN routing requires a Layer 3 device

About these practice questions

One of 307 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 →

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 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.