JNCIA-DevOps: Juniper Networks Certified Associate – Automation (2021) — Question 3
As part of an application to manage network devices, you must query hundreds of network devices and return the unique set of IP prefixes blocked by configured firewall filters. To accomplish this task, you will require a mutable data type that contains unordered, unique elements.
Which Python data type will fulfill these requirements?
Answer options
- A. dictionaries
- B. lists
- C. tuples
- D. sets
Correct answer: D
Explanation
The correct answer is D, sets, as they are designed to hold unique, unordered elements in Python, making them perfect for this task. Lists and tuples (options B and C) allow duplicates and maintain order, which isn't suitable for this requirement. Dictionaries (option A) are key-value pairs and do not directly fulfill the need for a unique collection of elements.