300-435 · Question #35
Refer to the exhibit. An engineer creates a Python scripts using ncclient to display interface information. The code must be completed so that it can be tested. Which expression completes the…
The correct answer is B. intf_config. Assuming the intf variable is a dictionary representing a single interface, and its state is stored under a key literally named intf_config, then intf['intf_config'] would retrieve the state.
Question
Options
- Aintf_info
- Bintf_config
- Cintf_get
- Dintf_config[0]
How the community answered
(31 responses)- A3% (1)
- B87% (27)
- C3% (1)
- D6% (2)
Why each option
Assuming the `intf` variable is a dictionary representing a single interface, and its state is stored under a key literally named `intf_config`, then `intf['intf_config']` would retrieve the state.
`intf_info` is not a standard key name for interface state within a dictionary parsed from NETCONF data, making it an unlikely completion.
Given the Python format call `state=intf[?]`, if the dictionary `intf` (representing a single interface) contains a key named `intf_config` whose value is the operational state, then `intf['intf_config']` correctly completes the expression.
`intf_get` is not a standard key name for interface state within a dictionary parsed from NETCONF data; it more closely resembles a variable name for a retrieval operation.
`intf_config[0]` refers to the first element of a variable named `intf_config` and cannot be a key used to access a value within the `intf` dictionary itself.
Concept tested: Python dictionary access for NETCONF parsed data
Topics
Community Discussion
No community discussion yet for this question.