Topic 19 Practice Test 1 covers Python, JSON, YANG, Catalyst Center/SD-WAN APIs, and REST Results for Cisco 350-401 ENCOR. For broader exam preparation, review the Cisco 350-401 ENCOR Exam Dumps. Every option includes focused technical reasoning explaining both the Cisco enterprise networking concept and its fit to the scenario.
Question 1
A Cisco network automation engineer has been asked to turn an API response string already stored in memory into a Python dictionary or list. The rest of the architecture is already approved. Which approach addresses the stated constraint? Choose ONE.
- response.json()
- json.loads()
- Correct authorization or role after HTTP 403
- HTTP DELETE
Correct Answer(s)
B
Rationale
- response.json() belongs where the goal is to avoid separately passing response text to a JSON parser. It decodes JSON directly from an HTTP response. The stem instead requires the team to turn an API response string already stored in memory into a Python dictionary or list; so it does not meet this constraint.
- json.loads() is the best fit because it parses a JSON string into Python objects. The case requires the team to turn an API response string already stored in memory into a Python dictionary or list. The design gets the required behavior with this option.
- Correct authorization or role after HTTP 403 can be appropriate to fix a call where the token is valid but the account lacks permission for the operation. It addresses authenticated-but-forbidden access. Here the need is to turn an API response string already stored in memory into a Python dictionary or list; and therefore is not the best fit.
- HTTP DELETE solves scenarios that need to express removal through the standard REST method rather than an update workaround. It removes the addressed REST resource. For this question the team must turn an API response string already stored in memory into a Python dictionary or list; leaving the stated need unsatisfied.
Question 2
A Cisco network automation engineer needs a solution that can convert a Python dictionary into JSON text for logging or a request body. The decision must follow the platform’s intended semantics. Which option is the best fit? Choose ONE.
- json.dumps()
- response.raise_for_status()
- Correct the URI or identifier after HTTP 404
- Content-Type header
Correct Answer(s)
A
Rationale
- json.dumps() is the best fit because it serializes Python objects into a JSON string. The case requires the team to convert a Python dictionary into JSON text for logging or a request body. That makes it the narrowest correct answer.
- response.raise_for_status() is intended to route HTTP failures into exception handling without manually testing every status code. It raises exceptions for unsuccessful HTTP responses. This case instead needs convert a Python dictionary into JSON text for logging or a request body; and therefore is not the best fit.
- Correct the URI or identifier after HTTP 404 normally helps teams fix a request that targets a nonexistent object ID. It addresses a missing API resource. But this case needs the team to convert a Python dictionary into JSON text for logging or a request body; leaving the stated need unsatisfied.
- Content-Type header is useful when teams need to fix a request rejected because the server cannot interpret the submitted body format. It describes the media type of the request body. The stated constraint is to convert a Python dictionary into JSON text for logging or a request body; so the required behavior is still absent.
Question 3
A Cisco network automation engineer must choose a mechanism to read a Catalyst Center response body as Python data after a successful request. No broader redesign is requested. Which choice most directly meets the requirement? Choose ONE.
- Explicit HTTP timeout
- Conflict-aware handling for HTTP 409
- response.json()
- Accept header
Correct Answer(s)
C
Rationale
- Explicit HTTP timeout is useful when teams need to make request latency failure deterministic for an orchestration pipeline. It bounds how long an automation request waits. The stated constraint is to read a Catalyst Center response body as Python data after a successful request; and therefore is not the best fit.
- Conflict-aware handling for HTTP 409 addresses cases that need to reconcile current state before retrying an operation rejected for conflict. It addresses a resource state conflict. The design decision here is to read a Catalyst Center response body as Python data after a successful request; leaving the stated need unsatisfied.
- response.json() is the best fit because it decodes JSON directly from an HTTP response. The case requires the team to read a Catalyst Center response body as Python data after a successful request. That property directly matches the constraint.
- Accept header serves designs that must state which media type the client can consume in the response. It requests a preferred response representation. The actual requirement is to read a Catalyst Center response body as Python data after a successful request; so it misses the requirement here.
Question 4
A Cisco network automation engineer has this requirement: fail fast when a Python requests call returns a 4xx or 5xx status. Unrelated availability and identity settings must not change. What should be selected for this design? Choose ONE.
- response.raise_for_status()
- Exponential backoff retry
- HTTP GET
- Catalyst Center X-Auth-Token header
Correct Answer(s)
A
Rationale
- response.raise_for_status() is the best fit because it raises exceptions for unsuccessful HTTP responses. The case requires the team to fail fast when a Python requests call returns a 4xx or 5xx status. That property directly matches the constraint.
- Exponential backoff retry can be appropriate to make large automation jobs resilient to short-lived API saturation. It spaces retries after transient throttling or server errors. Here the need is to fail fast when a Python requests call returns a 4xx or 5xx status; so the required behavior is still absent.
- HTTP GET solves scenarios that need to query device inventory from an API. It retrieves a resource without requesting a state change. For this question the team must fail fast when a Python requests call returns a 4xx or 5xx status; so it misses the requirement here.
- Catalyst Center X-Auth-Token header is intended to fix a 401 caused by omitting the controller token header. It carries the Catalyst Center access token on API calls. This case instead needs fail fast when a Python requests call returns a 4xx or 5xx status; which leaves this requirement unresolved.
Question 5
A Cisco network automation engineer is reviewing how to prevent a Python network automation job from hanging indefinitely on an unresponsive controller. The change should be limited to the relevant layer. Which mechanism should the architect select? Choose ONE.
- Refresh the API token after HTTP 401
- HTTP POST
- Explicit HTTP timeout
- Poll an asynchronous task identifier
Correct Answer(s)
C
Rationale
- Refresh the API token after HTTP 401 is intended to distinguish an authentication failure from a missing-resource response. It handles expired or invalid authentication. This case instead needs prevent a Python network automation job from hanging indefinitely on an unresponsive controller; so the required behavior is still absent.
- HTTP POST normally helps teams invoke an action-style API whose documentation requires a POST body. It submits data to create or invoke an operation. But this case needs the team to prevent a Python network automation job from hanging indefinitely on an unresponsive controller; so it misses the requirement here.
- Explicit HTTP timeout is the best fit because it bounds how long an automation request waits. The case requires the team to prevent a Python network automation job from hanging indefinitely on an unresponsive controller. That makes it the narrowest correct answer.
- Poll an asynchronous task identifier addresses cases that need to avoid assuming configuration is complete merely because the API accepted the request. It waits for controller-side job completion. The design decision here is to prevent a Python network automation job from hanging indefinitely on an unresponsive controller; rather than the decision posed here.
Question 6
A Cisco network automation engineer is planning a change to recover from HTTP 429 without hammering the controller repeatedly. Only this stated constraint is driving the decision. What is the most appropriate implementation? Choose ONE.
- Exponential backoff retry
- Correct authorization or role after HTTP 403
- HTTP PUT
- YANG list key and modeled path
Correct Answer(s)
A
Rationale
- Exponential backoff retry is the best fit because it spaces retries after transient throttling or server errors. The case requires the team to recover from HTTP 429 without hammering the controller repeatedly. That makes it the narrowest correct answer.
- Correct authorization or role after HTTP 403 belongs where the goal is to grant the required controller role rather than repeatedly reauthenticating a forbidden user. It addresses authenticated-but-forbidden access. The stem instead requires the team to recover from HTTP 429 without hammering the controller repeatedly; which leaves this requirement unresolved.
- HTTP PUT serves designs that must send the complete desired representation to a REST resource that defines PUT semantics. It replaces a resource representation idempotently. The actual requirement is to recover from HTTP 429 without hammering the controller repeatedly; rather than the decision posed here.
- YANG list key and modeled path can be appropriate to build a RESTCONF path that selects a specific modeled list instance. It identifies a unique list entry in structured network data. Here the need is to recover from HTTP 429 without hammering the controller repeatedly; so it does not meet this constraint.
Question 7
A Cisco network automation engineer is evaluating a design that must recover when Catalyst Center reports unauthorized because its token has expired. The team wants the most specific native mechanism. Which option solves the requirement at the correct layer? Choose ONE.
- Correct the URI or identifier after HTTP 404
- HTTP PATCH
- json.loads()
- Refresh the API token after HTTP 401
Correct Answer(s)
D
Rationale
- Correct the URI or identifier after HTTP 404 can be appropriate to troubleshoot a valid token calling the wrong resource path. It addresses a missing API resource. Here the need is to recover when Catalyst Center reports unauthorized because its token has expired; which leaves this requirement unresolved.
- HTTP PATCH solves scenarios that need to preserve unspecified resource fields while applying a targeted update. It applies a partial resource update. For this question the team must recover when Catalyst Center reports unauthorized because its token has expired; rather than the decision posed here.
- json.loads() is intended to turn an API response string already stored in memory into a Python dictionary or list. It parses a JSON string into Python objects. This case instead needs recover when Catalyst Center reports unauthorized because its token has expired; so it does not meet this constraint.
- Refresh the API token after HTTP 401 is the best fit because it handles expired or invalid authentication. The case requires the team to recover when Catalyst Center reports unauthorized because its token has expired. The choice therefore fits without broadening scope.
Question 8
A Cisco network automation engineer is correcting an implementation so it can fix a call where the token is valid but the account lacks permission for the operation. The implementation should not expand scope beyond this need. What should the team use? Choose ONE.
- Conflict-aware handling for HTTP 409
- HTTP DELETE
- Correct authorization or role after HTTP 403
- json.dumps()
Correct Answer(s)
C
Rationale
- Conflict-aware handling for HTTP 409 normally helps teams avoid treating a duplicate-resource conflict as a transport outage. It addresses a resource state conflict. But this case needs the team to fix a call where the token is valid but the account lacks permission for the operation; rather than the decision posed here.
- HTTP DELETE is useful when teams need to remove YANG-modeled data through a RESTCONF endpoint that supports DELETE. It removes the addressed REST resource. The stated constraint is to fix a call where the token is valid but the account lacks permission for the operation; so it does not meet this constraint.
- Correct authorization or role after HTTP 403 is the best fit because it addresses authenticated-but-forbidden access. The case requires the team to fix a call where the token is valid but the account lacks permission for the operation. This addresses the requirement at the intended layer.
- json.dumps() belongs where the goal is to emit valid JSON from in-memory Python data. It serializes Python objects into a JSON string. The stem instead requires the team to fix a call where the token is valid but the account lacks permission for the operation; and therefore is not the best fit.
Question 9
A Cisco network automation engineer has been asked to fix a request that targets a nonexistent object ID. The selected control should solve this condition directly. Which approach addresses the stated constraint? Choose ONE.
- HTTP GET
- Content-Type header
- response.json()
- Correct the URI or identifier after HTTP 404
Correct Answer(s)
D
Rationale
- HTTP GET belongs where the goal is to read controller state before deciding whether a change is required. It retrieves a resource without requesting a state change. The stem instead requires the team to fix a request that targets a nonexistent object ID; so it does not meet this constraint.
- Content-Type header serves designs that must differentiate request-body encoding from the response format the client would prefer. It describes the media type of the request body. The actual requirement is to fix a request that targets a nonexistent object ID; which is a different design problem.
- response.json() can be appropriate to read a Catalyst Center response body as Python data after a successful request. It decodes JSON directly from an HTTP response. Here the need is to fix a request that targets a nonexistent object ID; and therefore is not the best fit.
- Correct the URI or identifier after HTTP 404 is the best fit because it addresses a missing API resource. The case requires the team to fix a request that targets a nonexistent object ID. It satisfies the case while preserving unrelated controls.
Question 10
A Cisco network automation engineer needs a solution that can resolve a create or update that conflicts with existing controller state. Other controls are already satisfactory. Which option is the best fit? Choose ONE.
- HTTP POST
- Accept header
- Conflict-aware handling for HTTP 409
- response.raise_for_status()
Correct Answer(s)
C
Rationale
- HTTP POST solves scenarios that need to request a token from an authentication endpoint that specifies POST. It submits data to create or invoke an operation. For this question the team must resolve a create or update that conflicts with existing controller state; which is a different design problem.
- Accept header is intended to separate response-content negotiation from the encoding of the request body. It requests a preferred response representation. This case instead needs resolve a create or update that conflicts with existing controller state; and therefore is not the best fit.
- Conflict-aware handling for HTTP 409 is the best fit because it addresses a resource state conflict. The case requires the team to resolve a create or update that conflicts with existing controller state. The scenario depends on exactly that capability.
- response.raise_for_status() is useful when teams need to keep error responses from being processed as though they were successful data. It raises exceptions for unsuccessful HTTP responses. The stated constraint is to resolve a create or update that conflicts with existing controller state; so the required behavior is still absent.
Question 11
A Cisco network automation engineer must choose a mechanism to query device inventory from an API. The team wants to avoid custom compensating code. Which choice most directly meets the requirement? Choose ONE.
- HTTP PUT
- Catalyst Center X-Auth-Token header
- Explicit HTTP timeout
- HTTP GET
Correct Answer(s)
D
Rationale
- HTTP PUT is useful when teams need to repeat the same full-resource update without creating additional objects. It replaces a resource representation idempotently. The stated constraint is to query device inventory from an API; and therefore is not the best fit.
- Catalyst Center X-Auth-Token header addresses cases that need to use the controller’s documented token header rather than placing the token in a query string. It carries the Catalyst Center access token on API calls. The design decision here is to query device inventory from an API; leaving the stated need unsatisfied.
- Explicit HTTP timeout belongs where the goal is to prevent a Python network automation job from hanging indefinitely on an unresponsive controller. It bounds how long an automation request waits. The stem instead requires the team to query device inventory from an API; so the required behavior is still absent.
- HTTP GET is the best fit because it retrieves a resource without requesting a state change. The case requires the team to query device inventory from an API. The choice therefore fits without broadening scope.
Question 12
A Cisco network automation engineer has this requirement: create a new controller object through a REST endpoint. Existing unrelated behavior must remain intact. What should be selected for this design? Choose ONE.
- HTTP POST
- HTTP PATCH
- Poll an asynchronous task identifier
- Exponential backoff retry
Correct Answer(s)
A
Rationale
- HTTP POST is the best fit because it submits data to create or invoke an operation. The case requires the team to create a new controller object through a REST endpoint. That property directly matches the constraint.
- HTTP PATCH can be appropriate to preserve unspecified resource fields while applying a targeted update. It applies a partial resource update. Here the need is to create a new controller object through a REST endpoint; so the required behavior is still absent.
- Poll an asynchronous task identifier solves scenarios that need to track a long-running controller operation after the initial request returns a task reference. It waits for controller-side job completion. For this question the team must create a new controller object through a REST endpoint; so it misses the requirement here.
- Exponential backoff retry is intended to retry temporary 5xx failures with increasing delays. It spaces retries after transient throttling or server errors. This case instead needs create a new controller object through a REST endpoint; which leaves this requirement unresolved.
Question 13
A Cisco network automation engineer is reviewing how to send the complete desired representation to a REST resource that defines PUT semantics. The rest of the architecture is already approved. Which mechanism should the architect select? Choose ONE.
- HTTP PUT
- HTTP DELETE
- YANG list key and modeled path
- Refresh the API token after HTTP 401
Correct Answer(s)
A
Rationale
- HTTP PUT is the best fit because it replaces a resource representation idempotently. The case requires the team to send the complete desired representation to a REST resource that defines PUT semantics. This addresses the requirement at the intended layer.
- HTTP DELETE normally helps teams remove YANG-modeled data through a RESTCONF endpoint that supports DELETE. It removes the addressed REST resource. But this case needs the team to send the complete desired representation to a REST resource that defines PUT semantics; so it misses the requirement here.
- YANG list key and modeled path is useful when teams need to address one interface entry in a YANG list using its key. It identifies a unique list entry in structured network data. The stated constraint is to send the complete desired representation to a REST resource that defines PUT semantics; which leaves this requirement unresolved.
- Refresh the API token after HTTP 401 addresses cases that need to distinguish an authentication failure from a missing-resource response. It handles expired or invalid authentication. The design decision here is to send the complete desired representation to a REST resource that defines PUT semantics; rather than the decision posed here.
Question 14
A Cisco network automation engineer is planning a change to change only selected fields without resending the entire object. The decision must follow the platform’s intended semantics. What is the most appropriate implementation? Choose ONE.
- Content-Type header
- HTTP PATCH
- json.loads()
- Correct authorization or role after HTTP 403
Correct Answer(s)
B
Rationale
- Content-Type header addresses cases that need to fix a request rejected because the server cannot interpret the submitted body format. It describes the media type of the request body. The design decision here is to change only selected fields without resending the entire object; so it misses the requirement here.
- HTTP PATCH is the best fit because it applies a partial resource update. The case requires the team to change only selected fields without resending the entire object. It satisfies the case while preserving unrelated controls.
- json.loads() serves designs that must turn an API response string already stored in memory into a Python dictionary or list. It parses a JSON string into Python objects. The actual requirement is to change only selected fields without resending the entire object; rather than the decision posed here.
- Correct authorization or role after HTTP 403 can be appropriate to separate authorization policy failure from token-expiration handling. It addresses authenticated-but-forbidden access. Here the need is to change only selected fields without resending the entire object; so it does not meet this constraint.
Question 15
A Cisco network automation engineer is evaluating a design that must delete an API-managed object by its resource URI. No broader redesign is requested. Which option solves the requirement at the correct layer? Choose ONE.
- Accept header
- HTTP DELETE
- json.dumps()
- Correct the URI or identifier after HTTP 404
Correct Answer(s)
B
Rationale
- Accept header can be appropriate to state which media type the client can consume in the response. It requests a preferred response representation. Here the need is to delete an API-managed object by its resource URI; which leaves this requirement unresolved.
- HTTP DELETE is the best fit because it removes the addressed REST resource. The case requires the team to delete an API-managed object by its resource URI. That is the requested behavior here.
- json.dumps() is intended to convert a Python dictionary into JSON text for logging or a request body. It serializes Python objects into a JSON string. This case instead needs delete an API-managed object by its resource URI; so it does not meet this constraint.
- Correct the URI or identifier after HTTP 404 normally helps teams troubleshoot a valid token calling the wrong resource path. It addresses a missing API resource. But this case needs the team to delete an API-managed object by its resource URI; which is a different design problem.
Question 16
A Cisco network automation engineer is correcting an implementation so it can tell a REST API that the payload being sent is JSON. Unrelated availability and identity settings must not change. What should the team use? Choose ONE.
- Catalyst Center X-Auth-Token header
- response.json()
- Content-Type header
- Conflict-aware handling for HTTP 409
Correct Answer(s)
C
Rationale
- Catalyst Center X-Auth-Token header normally helps teams fix a 401 caused by omitting the controller token header. It carries the Catalyst Center access token on API calls. But this case needs the team to tell a REST API that the payload being sent is JSON; rather than the decision posed here.
- response.json() is useful when teams need to extract keys from a REST response whose media type is JSON. It decodes JSON directly from an HTTP response. The stated constraint is to tell a REST API that the payload being sent is JSON; so it does not meet this constraint.
- Content-Type header is the best fit because it describes the media type of the request body. The case requires the team to tell a REST API that the payload being sent is JSON. This addresses the requirement at the intended layer.
- Conflict-aware handling for HTTP 409 belongs where the goal is to avoid treating a duplicate-resource conflict as a transport outage. It addresses a resource state conflict. The stem instead requires the team to tell a REST API that the payload being sent is JSON; and therefore is not the best fit.
Question 17
A Cisco network automation engineer has been asked to ask a RESTCONF service to return JSON rather than XML where supported. The change should be limited to the relevant layer. Which approach addresses the stated constraint? Choose ONE.
- Poll an asynchronous task identifier
- Accept header
- response.raise_for_status()
- HTTP GET
Correct Answer(s)
B
Rationale
- Poll an asynchronous task identifier belongs where the goal is to avoid assuming configuration is complete merely because the API accepted the request. It waits for controller-side job completion. The stem instead requires the team to ask a RESTCONF service to return JSON rather than XML where supported; so it does not meet this constraint.
- Accept header is the best fit because it requests a preferred response representation. The case requires the team to ask a RESTCONF service to return JSON rather than XML where supported. The design gets the required behavior with this option.
- response.raise_for_status() can be appropriate to fail fast when a Python requests call returns a 4xx or 5xx status. It raises exceptions for unsuccessful HTTP responses. Here the need is to ask a RESTCONF service to return JSON rather than XML where supported; and therefore is not the best fit.
- HTTP GET solves scenarios that need to read controller state before deciding whether a change is required. It retrieves a resource without requesting a state change. For this question the team must ask a RESTCONF service to return JSON rather than XML where supported; leaving the stated need unsatisfied.
Question 18
A Cisco network automation engineer needs a solution that can authenticate subsequent Catalyst Center requests after obtaining the token. Only this stated constraint is driving the decision. Which option is the best fit? Choose ONE.
- YANG list key and modeled path
- Explicit HTTP timeout
- HTTP POST
- Catalyst Center X-Auth-Token header
Correct Answer(s)
D
Rationale
- YANG list key and modeled path solves scenarios that need to build a RESTCONF path that selects a specific modeled list instance. It identifies a unique list entry in structured network data. For this question the team must authenticate subsequent Catalyst Center requests after obtaining the token; which is a different design problem.
- Explicit HTTP timeout is intended to return control to retry logic when the API stops responding. It bounds how long an automation request waits. This case instead needs authenticate subsequent Catalyst Center requests after obtaining the token; and therefore is not the best fit.
- HTTP POST normally helps teams create a new controller object through a REST endpoint. It submits data to create or invoke an operation. But this case needs the team to authenticate subsequent Catalyst Center requests after obtaining the token; leaving the stated need unsatisfied.
- Catalyst Center X-Auth-Token header is the best fit because it carries the Catalyst Center access token on API calls. The case requires the team to authenticate subsequent Catalyst Center requests after obtaining the token. That is the requested behavior here.
Question 19
A Cisco network automation engineer must choose a mechanism to track a long-running controller operation after the initial request returns a task reference. The team wants the most specific native mechanism. Which choice most directly meets the requirement? Choose ONE.
- json.loads()
- Poll an asynchronous task identifier
- Exponential backoff retry
- HTTP PUT
Correct Answer(s)
B
Rationale
- json.loads() is useful when teams need to decode JSON text from a file buffer before accessing nested keys. It parses a JSON string into Python objects. The stated constraint is to track a long-running controller operation after the initial request returns a task reference; and therefore is not the best fit.
- Poll an asynchronous task identifier is the best fit because it waits for controller-side job completion. The case requires the team to track a long-running controller operation after the initial request returns a task reference. That is the requested behavior here.
- Exponential backoff retry belongs where the goal is to recover from HTTP 429 without hammering the controller repeatedly. It spaces retries after transient throttling or server errors. The stem instead requires the team to track a long-running controller operation after the initial request returns a task reference; so the required behavior is still absent.
- HTTP PUT serves designs that must repeat the same full-resource update without creating additional objects. It replaces a resource representation idempotently. The actual requirement is to track a long-running controller operation after the initial request returns a task reference; so it misses the requirement here.
Question 20
A Cisco network automation engineer has this requirement: address one interface entry in a YANG list using its key. The implementation should not expand scope beyond this need. What should be selected for this design? Choose ONE.
- json.dumps()
- Refresh the API token after HTTP 401
- HTTP PATCH
- YANG list key and modeled path
Correct Answer(s)
D
Rationale
- json.dumps() serves designs that must emit valid JSON from in-memory Python data. It serializes Python objects into a JSON string. The actual requirement is to address one interface entry in a YANG list using its key; leaving the stated need unsatisfied.
- Refresh the API token after HTTP 401 can be appropriate to request a fresh token before repeating a call rejected as unauthenticated. It handles expired or invalid authentication. Here the need is to address one interface entry in a YANG list using its key; so the required behavior is still absent.
- HTTP PATCH solves scenarios that need to change only selected fields without resending the entire object. It applies a partial resource update. For this question the team must address one interface entry in a YANG list using its key; so it misses the requirement here.
- YANG list key and modeled path is the best fit because it identifies a unique list entry in structured network data. The case requires the team to address one interface entry in a YANG list using its key. The design gets the required behavior with this option.