View Full Cisco CCNA Automation 200-901 Exam Dumps and Practice Test Dumps.
Question 141
Which Python module is commonly used to work with JSON data?
- csv
- json
- os
- math
Correct Answer: 2
Explanation
The Python json module provides functions for encoding and decoding JSON data. Network automation applications frequently use JSON when communicating with REST APIs because API requests and responses commonly contain structured JSON objects. Python can convert JSON data into native dictionaries and lists, allowing automation scripts to access individual fields and process the information programmatically. The csv module handles comma-separated data, os provides operating-system interfaces, and math provides mathematical functions. Therefore, the json module is the appropriate Python module for working with JSON data.
Question 142
Which Python collection stores key-value pairs and is commonly used to represent JSON objects after parsing?
- Tuple
- Set
- Dictionary
- String
Correct Answer: 3
Explanation
A Python dictionary stores data as key-value pairs and is commonly used to represent JSON objects after JSON data has been parsed. For example, device information can be represented with keys such as hostname, ip_address, and platform, each associated with a corresponding value. Dictionaries are particularly useful in network automation because they provide efficient access to structured information by key. Tuples store ordered values, sets store unique elements, and strings store text. Therefore, a dictionary is the correct Python collection for representing key-value data.
Question 143
Which Python collection is ordered and can contain duplicate values?
- List
- Set
- Dictionary key
- Boolean
Correct Answer: 1
Explanation
A Python list is an ordered collection that can contain duplicate values. Lists are commonly used in automation scripts to store multiple devices, IP addresses, interfaces, commands, or other items that need to be processed sequentially. For example, a script could maintain a list containing the management addresses of multiple routers and then loop through the list. Sets store unique values without relying on duplicates, while Boolean represents logical values. Therefore, a list is the appropriate Python collection when ordered data and duplicate values are allowed.
Question 144
Which Python collection automatically eliminates duplicate elements?
- List
- Tuple
- Set
- String
Correct Answer: 3
Explanation
A Python set is a collection designed to contain unique elements. If duplicate values are added to a set, only one instance of each value remains. This can be useful in network automation when a script needs to remove duplicate IP addresses, interface names, or other identifiers from a data set. Lists and tuples can contain duplicate values, while strings represent sequences of characters. Sets are also useful for membership testing and mathematical set operations. Therefore, the set data type is the correct choice when unique elements are required.
Question 145
Which Python loop is commonly used to iterate over each item in a collection?
- switch
- for
- case
- select
Correct Answer: 2
Explanation
The Python for loop is commonly used to iterate over items in a collection such as a list, tuple, dictionary, or set. In network automation, a for loop can process a list of device IP addresses, iterate through interfaces, or examine API results one item at a time. Python does not use traditional switch, case, or select statements as the standard mechanism for collection iteration. A loop can also be combined with conditions to perform different operations based on the current item. Therefore, for is the correct loop construct.
Question 146
Which Python keyword is used to execute a block of code only when a condition is true?
- if
- loop
- check
- when
Correct Answer: 1
Explanation
The Python if statement is used to execute a block of code when a specified condition evaluates to true. Automation scripts frequently use if statements to make decisions based on device status, API responses, configuration values, or other conditions. For example, an automation program might check whether an interface is administratively down before deciding whether to change its configuration. Python also provides elif and else for handling additional conditions. Therefore, if is the correct keyword for conditional execution.
Question 147
Which Python keyword provides an alternative block when the original if condition is false?
- case
- otherwise
- else
- alternate
Correct Answer: 3
Explanation
The Python else statement defines a block of code that executes when the associated if condition is false. It provides a simple way to handle an alternative path in automation logic. For example, a script can check whether a device responds to an API request and execute one block when the request succeeds and another when it fails. The elif statement can be used when additional conditions need to be evaluated. case, otherwise, and alternate are not Python keywords for this purpose. Therefore, else is the correct answer.
Question 148
Which Python construct is used to handle an exception that occurs while executing a block of code?
- try/except
- if/else
- for/while
- import/from
Correct Answer: 1
Explanation
Python uses try and except blocks to handle exceptions that may occur during program execution. This is particularly useful in network automation because operations such as API requests, SSH connections, file access, and data parsing can fail for various reasons. A script can catch an expected exception and respond appropriately instead of terminating unexpectedly. if/else handles logical conditions, for/while controls loops, and import/from handles module imports. Therefore, try/except is the correct construct for handling runtime exceptions.
Question 149
Which Python keyword is used to explicitly raise an exception?
- error
- raise
- throwerror
- exception
Correct Answer: 2
Explanation
The Python raise keyword is used to explicitly generate an exception. Automation developers can use it when a program detects an invalid condition that should stop normal processing or be handled by another part of the application. For example, a script might raise an exception when a required device variable is missing or when an API response does not contain expected information. This allows developers to make error handling more deliberate and predictable. Therefore, raise is the correct Python keyword for explicitly generating an exception.
Question 150
Which Python keyword is used to import a module?
- include
- require
- import
- module
Correct Answer: 3
Explanation
The Python import keyword is used to make modules and their functionality available to a program. Network automation scripts frequently import modules such as json, requests, os, or vendor-specific libraries. Importing modules allows developers to reuse existing functionality instead of implementing everything from scratch. Python also supports forms such as from module import name for importing specific objects. include and require are not the standard Python keyword for importing modules. Therefore, import is the correct answer.
Question 151
Which HTTP method is primarily used to retrieve data from a REST API?
- POST
- PATCH
- GET
- DELETE
Correct Answer: 3
Explanation
The HTTP GET method is primarily used to retrieve information from a REST API. For example, an automation script can send a GET request to obtain device inventory, interface information, configuration data, or operational statistics. POST is commonly used to submit data or create resources, PATCH is commonly used for partial updates, and DELETE is used to remove resources. Although exact API behavior depends on the API design, GET is conventionally associated with retrieving resources. Therefore, GET is the correct HTTP method for obtaining data from a REST API.
Question 152
Which HTTP method is commonly used to partially modify an existing REST API resource?
- PATCH
- GET
- OPTIONS
- HEAD
Correct Answer: 1
Explanation
The HTTP PATCH method is commonly used to partially modify an existing resource. This is useful when an automation application needs to change only selected fields without sending a complete replacement representation. For example, an API client might use PATCH to modify a device description while leaving other attributes unchanged. GET retrieves information, OPTIONS provides communication options, and HEAD retrieves response headers without the normal response body. API behavior can vary by implementation, but PATCH is conventionally associated with partial updates. Therefore, PATCH is the appropriate answer.
Question 153
Which HTTP method is commonly used to delete a resource from a REST API?
- PUT
- DELETE
- GET
- POST
Correct Answer: 2
Explanation
The HTTP DELETE method is commonly used to request removal of a specified resource from a REST API. In network automation, an API client might use DELETE to remove an object such as a configured resource, policy entry, or inventory object when the API supports that operation. GET retrieves resources, POST commonly creates or submits information, and PUT is generally associated with replacing or creating a resource representation. The exact behavior depends on the API implementation, but DELETE is conventionally used for resource removal. Therefore, DELETE is the correct answer.
Question 154
Which REST API characteristic means that each request contains the information needed for the server to process it?
- Statelessness
- Broadcasting
- Fragmentation
- Multicasting
Correct Answer: 1
Explanation
Statelessness means that each REST request contains the information necessary for the server to process that request, rather than depending on stored client session state between requests. This design makes REST APIs easier to scale because the server does not necessarily need to maintain application-specific session information for every client. Authentication information, parameters, and requested resources can be included as required by the API. Broadcasting, fragmentation, and multicasting are networking concepts and do not describe this REST architectural characteristic. Therefore, statelessness is the correct answer.
Question 155
Which HTTP response code commonly indicates that a new resource was successfully created?
- 301
- 201
- 404
- 503
Correct Answer: 2
Explanation
HTTP status code 201 means “Created” and is commonly returned when a request successfully creates a new resource. In REST API automation, a POST request that creates a device object, policy, or other supported resource may return a 201 response along with information about the newly created resource. Status 301 represents a redirect, 404 means that a requested resource was not found, and 503 indicates that the service is unavailable. Therefore, 201 is the appropriate response code for successful resource creation.
Question 156
Which HTTP status code commonly indicates that authentication is required or the supplied authentication credentials are invalid?
- 401
- 201
- 204
- 302
Correct Answer: 1
Explanation
HTTP status code 401, “Unauthorized,” commonly indicates that authentication is required or that the credentials supplied with a request are not accepted. In API automation, this can occur when an access token is missing, expired, incorrectly formatted, or otherwise invalid. Automation applications should detect authentication failures and handle them appropriately rather than repeatedly sending unsuccessful requests. Status 201 indicates successful resource creation, 204 indicates successful processing without response content, and 302 indicates a redirect. Therefore, 401 is the correct response code for the described authentication condition.
Question 157
Which HTTP status code commonly indicates that the client is authenticated but does not have permission to access the requested resource?
- 200
- 403
- 201
- 304
Correct Answer: 2
Explanation
HTTP status code 403, “Forbidden,” indicates that the server understood the request but refuses to authorize access to the requested resource. In an automation environment, a user or API token may be correctly authenticated but lack the required permissions to perform a particular operation. This differs from 401, which generally indicates an authentication issue. A 200 response indicates successful processing, 201 commonly represents successful resource creation, and 304 indicates that a cached representation has not changed. Therefore, 403 is the appropriate status code for an authorization failure.
Question 158
Which security practice limits an automation application’s API permissions to only the resources and actions it actually requires?
- Least privilege
- Open access
- Shared credentials
- Anonymous access
Correct Answer: 1
Explanation
The principle of least privilege means granting an application or user only the permissions necessary to perform its required tasks. In network automation, an API account should not automatically receive unrestricted administrative access if it only needs to retrieve inventory or update a specific type of resource. Limiting permissions reduces the potential impact of compromised credentials, programming errors, or unintended operations. Open access, shared credentials, and anonymous access generally increase security exposure. Therefore, least privilege is the appropriate security practice for controlling automation API permissions.
Question 159
Which authentication technology is commonly used to provide a temporary token for accessing an API instead of repeatedly sending a username and password?
- Token-based authentication
- MAC learning
- ARP inspection
- DHCP snooping
Correct Answer: 1
Explanation
Token-based authentication allows an application to obtain and use a token when accessing an API. Depending on the authentication system, the token may have a limited lifetime, defined permissions, and other security properties. This approach can reduce the need to repeatedly transmit a username and password with every API request. Automation systems commonly use API tokens or bearer tokens when interacting with management platforms and services. MAC learning, ARP inspection, and DHCP snooping are network security or switching mechanisms unrelated to API authentication. Therefore, token-based authentication is the correct answer.
Question 160
Which practice helps protect automation projects from accidentally exposing passwords or API tokens in a public Git repository?
- Store secrets directly in source code
- Commit passwords to every branch
- Use secret management and exclude sensitive files
- Publish credentials in README files
Correct Answer: 3
Explanation
Using secret-management mechanisms and excluding sensitive files from version control helps prevent credentials from being accidentally committed to a Git repository. Automation projects may use tools such as Ansible Vault, environment variables, CI/CD secret stores, or dedicated secrets-management platforms depending on the environment. Sensitive files can also be excluded using appropriate Git configuration such as .gitignore, although .gitignore alone should not be considered a complete secrets-management solution. Hard-coding passwords or publishing them in documentation creates significant exposure. Therefore, secure secret management combined with appropriate repository practices is the correct approach.