nerdexam
CiscoCisco

350-401 · Question #412

350-401 Question #412: Real Exam Question with Answer & Explanation

The correct answer is B: for interface in netconf_data["GigabitEthernet"]: if interface["enabled"] != 'true': print(interface["description"]). Option B is correct because it iterates through all GigabitEthernet interfaces and checks if the 'enabled' field is NOT equal to 'true' (as a string), which effectively filters for disabled interfaces only, then prints their descriptions. In NETCONF/YANG data parsed from XML, boo

Submitted by anjalisingh· Mar 6, 2026Network Automation and Programmability - Parsing and filtering structured network data using Python (relevant to CCNP/DevNet/ENCOR automation objectives)

Question

Refer to the exhibit. Which Python code snippet prints the descriptions of disabled interfaces only? A. B. C. D.

Options

  • Afor interface in netconf_data["GigabitEthernet"]: if interface["enabled"] != 'false': print(interface["description"])
  • Bfor interface in netconf_data["GigabitEthernet"]: if interface["enabled"] != 'true': print(interface["description"])
  • Cfor interface in netconf_data["GigabitEthernet"]: if interface["disabled"] != 'true': print(interface["description"])
  • Dfor interface in netconf_data["GigabitEthernet"]: print(interface["enabled"]) print(interface["description"])

Explanation

Option B is correct because it iterates through all GigabitEthernet interfaces and checks if the 'enabled' field is NOT equal to 'true' (as a string), which effectively filters for disabled interfaces only, then prints their descriptions. In NETCONF/YANG data parsed from XML, boolean values are typically represented as strings ('true' or 'false'), so comparing against the string 'true' is the appropriate approach.

Topics

#NETCONF#Python scripting#network automation#data parsing

Community Discussion

No community discussion yet for this question.

Full 350-401 PracticeBrowse All 350-401 Questions