mediumMultiple ChoiceObjective-mapped
200-901 Practice Question: Refer to the exhibit
Exhibit
{
"id": "N_12345",
"name": "Main Office",
"timeZone": "America/New_York",
"tags": ["production", "primary"],
"netflow": {
"enabled": false,
"collectorPort": 2055,
"collectorIp": "10.0.0.1"
}
}Refer to the exhibit. A Python script parses this JSON response to check if NetFlow is enabled on the network. Which code snippet correctly checks the NetFlow status?
⚠ Common exam trap
Cisco often tests the difference between JSON boolean values and their string representations, trapping candidates who treat `true`/`false` as strings instead of Python booleans, and also tests safe dictionary access methods versus direct key access that can raise exceptions.
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
✓
if response['netflow'].get('enabled', False):
It uses the `.get()` method with a default value of `False` to safely access the `enabled` key within the `netflow` dictionary. This handles cases where the key might be missing or the value is `False`, avoiding a `KeyError` and correctly evaluating the boolean condition. In JSON, the `enabled` field is typically a boolean, so checking truthiness directly is the proper approach.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
if response['netflow'].get('enabled', False):
Why this is correct
Safely checks for the 'enabled' key with a default of False.
- ✗
if response['netflow']['enabled'] == 'true':
Why it's wrong here
The value is a boolean false, not the string 'true'.
- ✗
if response.netflow.enabled:
Why it's wrong here
This syntax is invalid for a dict; it would cause an AttributeError.
- ✗
if response['netflow']['enabled']:
Why it's wrong here
This would raise a KeyError if 'netflow' or 'enabled' key is missing.
Go deeper
Related to this question
About these practice questions
This 200-901 question is part of Courseiva's 989-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 →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
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.