200-901 Infrastructure and Automation Practice Question
A developer is creating a YANG data model for a new interface feature. The model must allow the user to choose from a predefined set of values for the 'duplex' leaf. Which YANG statement should be used to restrict the values to 'full', 'half', and 'auto'?
⚠ Common exam trap
Cisco often tests the distinction between YANG's 'choice' statement (which selects among different schema branches) and the 'enumeration' type (which restricts a single leaf's value), leading candidates to mistakenly choose 'choice' when they need a value restriction.
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
✓
type enumeration { enum full; enum half; enum auto; }
The 'type enumeration' statement in YANG defines a leaf that can only take one of the explicitly listed enum values. By specifying 'enum full;', 'enum half;', and 'enum auto;', the developer restricts the 'duplex' leaf to exactly those three predefined strings, which matches the requirement.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
choice duplex-options { case full; case half; case auto; }
Why it's wrong here
A choice statement selects between structurally different case branches, not a set of scalar values, so it cannot constrain the duplex leaf's content. It is tempting because choice does enumerate named alternatives, and it would be correct where each option carries distinct child nodes rather than a single enumerated value.
- ✗
type string;
Why it's wrong here
A plain string type accepts any character sequence, so 'full', 'half' and 'auto' cannot be enforced and invalid values pass validation. It is tempting because string is the default textual type, and it would suffice where free-form text is genuinely required, such as a description leaf with no constrained vocabulary.
- ✗
type leafref { path '/other:duplex-list'; }
Why it's wrong here
A leafref references an existing leaf's value elsewhere in the data tree; it does not define an allowed value set. Leafref would be correct when one leaf must mirror another node's value, whereas restricting duplex to full, half or auto requires an enumeration type listing those values.
- ✓
type enumeration { enum full; enum half; enum auto; }
Why this is correct
The enumeration type restricts the duplex leaf to a fixed, predefined set of named values, which is exactly the constraint the model requires. Unlike a string pattern or union, enumeration rejects any value outside full, half and auto, giving schema-level validation.
Go deeper
Related to this question
About these practice questions
Courseiva writes every 200-901 question from scratch — 975 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or 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 200-901 practice question is part of Courseiva's free Cisco 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 200-901 exam.