JNCIA-DevOps: Juniper Networks Certified Associate – Automation (2021) — Question 6
Click the Exhibit button.
>>> print(hardware_count)
{"˜MX960':10, "˜SRX300': 22, "˜QFX5100': 4}
Referring to the exhibit, what is the correct method to retrieve the value associated only with "MX960"?
Answer options
- A. hardware_count.keys()
- B. hardware_count.values()
- C. hardware_count[0]
- D. hardware_count["MX960"]
Correct answer: A
Explanation
The correct answer is D, as it directly accesses the value associated with the key 'MX960'. Option A retrieves all keys, option B returns all values, and option C attempts to access an index that does not apply to dictionaries in Python.