200-901 Software Development and Design Practice Question
A developer is working on a Python script that must read a JSON configuration file containing device credentials. The script needs to parse the file and access the value of the key 'username'. Which Python standard library module and function should be used?
⚠ Common exam trap
Many exam-takers confuse json.load() with json.loads(), where the former reads from a file and the latter from a string.
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
✓
json.load()
The json.load() function is the correct choice because it reads a file object and returns a Python dictionary, allowing immediate access to the 'username' key. The other options either parse strings, handle different formats, or are not part of the standard library for JSON parsing.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
configparser.ConfigParser().read()
Why it's wrong here
configparser is designed for INI-style configuration files, not JSON. It cannot parse JSON syntax and would fail or misinterpret the structure. The scenario requires parsing JSON, so configparser is the wrong tool. Using it would lead to errors when trying to access the 'username' key from a JSON-formatted file.
- ✗
json.loads()
Why it's wrong here
json.loads() parses a JSON string, not a file object. If the developer already read the file contents into a string, loads() could work, but the stem specifies reading a JSON configuration file directly. Using loads() would require an extra step of reading the file first, making it less direct and potentially error-prone.
- ✓
json.load()
Why this is correct
The json module's load() function reads a file object and deserializes JSON data into a Python dictionary. This directly allows access to the 'username' key. It is the standard, correct approach for parsing a JSON file in Python, handling the conversion from JSON text to native Python objects seamlessly.
- ✗
yaml.safe_load()
Why it's wrong here
yaml.safe_load() is used for YAML files, not JSON. While YAML is a superset of JSON in many cases, the standard library does not include yaml; it requires the PyYAML package. The scenario explicitly mentions a JSON file, so using a YAML parser would be inappropriate and introduce an unnecessary dependency.
Go deeper
Related to this question
About these practice questions
One of 975 original 200-901 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
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 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.