Courseiva
mediumMultiple Select

350-401 Practice Question: Which two statements about Python data structures…

Which two statements about Python data structures used in network automation are true? (Choose two.)

⚠ Common exam trap

The trap is mixing up mutability and ordering properties: candidates often forget tuples are immutable, sets are unordered, and strings are immutable.

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

✓

Dictionaries are used to store key-value pairs such as device IP, username, and password.

Option B is correct because dictionaries store data as key-value pairs, making them ideal for mapping attributes like device IP, username, and password to a device, and they are widely used in network automation for structured device inventories. Option D is correct because lists are ordered, mutable sequences that preserve element order and support indexing and iteration, so they work well for holding multiple device names to loop over. Option A is wrong because tuples are immutable, so they cannot be modified easily and are not suited for credentials that need updating. Option C is wrong because sets are unordered and do not support indexing, so they cannot retrieve elements by position. Option E is wrong because strings are immutable, not mutable, and a single string is a poor structure for storing multiple device configurations.

Answer analysis

Option-by-option breakdown

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

  • ✗

    Tuples are commonly used to store device credentials because they can be modified easily.

    Why it's wrong here

    Tuples are immutable, so stored credentials cannot be altered after creation; rotation would require rebuilding the tuple. The temptation is that tuples group related fixed values, which suits constant data such as a device's fixed IP and port pair, but credentials change and belong in a mutable structure.

  • ✓

    Dictionaries are used to store key-value pairs such as device IP, username, and password.

    Why this is correct

    Dictionaries map unique keys to values, so a device's IP, username and password can be stored as named fields and retrieved by key. This satisfies the stem's requirement for storing key-value pairs in automation data structures.

  • ✗

    Sets are ordered and allow indexing to retrieve specific elements.

    Why it's wrong here

    Sets in Python are unordered and unindexed, so indexing raises TypeError; membership testing and deduplication are their purpose. The temptation is that sets store unique elements, which suits tracking distinct device hostnames or VLAN IDs, but ordering and positional retrieval belong to lists and tuples.

  • ✓

    Lists are ordered and can be used to store multiple device names for iteration.

    Why this is correct

    Lists preserve insertion order and permit duplicate entries, so device hostnames can be stored and iterated sequentially with a for loop. This satisfies the stem's requirement for ordered storage supporting iteration across multiple devices, unlike dictionaries, which are key-value mappings, or sets, which are unordered and reject duplicates.

  • ✗

    Strings are mutable and ideal for storing multiple device configurations.

    Why it's wrong here

    Python strings are immutable, so any configuration edit creates a new object rather than modifying in place; lists of strings hold multiple configurations. The temptation is that strings store text, which suits a single configuration line or command, but bulk mutable storage requires lists.

About these practice questions

This 350-401 question is part of Courseiva's 1,923-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. 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 September 2026 · checked against the official Cisco exam blueprint

This 350-401 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 350-401 exam.