Cisco CCNA Automation 200-901 Practice Test Questions and Exam Dumps Part20 Q381-Q400

View Full Cisco CCNA Automation 200-901 Exam Dumps and Practice Test Dumps.

 

Question 381

Which Python module provides functions for interacting with the operating system environment?

  1. math
  2. os
  3. json
  4. random

Correct Answer: 2

Explanation

The Python os module provides functions for interacting with the operating system. In automation scripts, it can be used to work with environment variables, directories, file paths, and other operating-system-level functionality. For example, an automation application can retrieve an API credential from an environment variable using os.environ or os.getenv(). The json module is used for JSON processing, math provides mathematical functions, and random generates pseudo-random values. Therefore, os is the appropriate module when an automation script needs operating-system interaction.

Question 382

Which Python function can retrieve an environment variable while returning a default value if it is not present?

  1. os.getenv()
  2. os.environment()
  3. env.getvalue()
  4. system.getenv()

Correct Answer: 1

Explanation

The os.getenv() function can retrieve the value of an environment variable. It can also accept a default value that is returned if the requested environment variable does not exist. This is useful in network automation because sensitive information such as API tokens or passwords can be supplied through environment variables rather than hard-coded directly into source code. For example, a script can retrieve an API token at runtime. This approach can reduce accidental exposure of credentials in source repositories. Therefore, os.getenv() is the correct choice.

Question 383

Which Python module is commonly used to match patterns using regular expressions?

  1. regexlib
  2. pattern
  3. re
  4. match

Correct Answer: 3

Explanation

Python’s re module provides support for regular expressions. Regular expressions can be useful in automation when scripts need to search, match, or extract structured information from text. For example, an automation script could use a regular expression to identify IP addresses, interface names, or specific patterns in command output. The module provides functions such as re.search(), re.match(), and re.findall(). The other listed names are not Python’s standard module for regular-expression processing. Therefore, re is the correct answer.

Question 384

Which Python regular-expression function searches for a match anywhere in a string?

  1. re.search()
  2. re.scan()
  3. re.locate()
  4. re.find()

Correct Answer: 1

Explanation

The re.search() function scans a string and returns a match object when the specified regular expression is found anywhere in the string. This makes it useful when the target pattern does not necessarily have to begin at the start of the input. For example, automation code can search command output for a particular interface state or error message. Other regular-expression functions have different purposes. re.findall() can return all matching occurrences, while re.match() checks for a match at the beginning of the string. Therefore, re.search() is correct.

Question 385

What is the primary purpose of URL query parameters in a REST API request?

  1. To specify the network interface speed
  2. To provide additional filtering or request options
  3. To replace the HTTP method
  4. To establish a TLS certificate

Correct Answer: 2

Explanation

Query parameters provide additional information or options to an API request and commonly appear after a question mark in a URL. They can be used for filtering, sorting, pagination, or selecting particular results. For example, an API might use parameters such as limit, offset, or status to control the returned data. Query parameters do not replace HTTP methods such as GET or POST, and they are unrelated to establishing TLS certificates. Their exact behavior depends on the API design and documentation. Therefore, providing additional filtering or request options is correct.

Question 386

In a REST API URL, what is a path parameter typically used to identify?

  1. A specific resource or resource identifier
  2. The TLS encryption algorithm
  3. The HTTP response status
  4. The API client’s operating system

Correct Answer: 1

Explanation

A path parameter is commonly used to identify a particular resource within an API URL. For example, an endpoint such as /devices/123 may use 123 as the identifier of a specific device. This differs from query parameters, which commonly provide filtering, sorting, pagination, or other optional request information. Path parameters are part of the resource path itself. They do not define TLS settings, HTTP response codes, or the client’s operating system. Understanding the difference between path and query parameters is important when building REST API automation scripts.

Question 387

What is the purpose of URL encoding in an HTTP request?

  1. To convert a URL into a valid representation for special characters
  2. To encrypt the entire HTTP request
  3. To authenticate the API client
  4. To convert JSON directly into XML

Correct Answer: 1

Explanation

URL encoding represents characters in a form that can safely be included in URLs. Certain characters have special meanings within URLs, so encoding prevents ambiguity when those characters are part of parameter values. For example, spaces and reserved characters may need to be percent-encoded. URL encoding is not encryption and does not provide authentication. HTTPS and TLS provide transport encryption, while authentication mechanisms such as tokens or OAuth can identify or authorize clients. URL encoding is therefore primarily concerned with correctly representing data within a URL.

Question 388

Which HTTP header indicates the format of the data being sent in the request body?

  1. Accept
  2. Authorization
  3. Content-Type
  4. User-Agent

Correct Answer: 3

Explanation

The Content-Type HTTP header indicates the media type of the data contained in the request body. For example, an API client sending JSON commonly uses Content-Type: application/json. This allows the server to understand how the request payload should be interpreted. The Accept header instead indicates which response media types the client prefers. Authorization carries authentication or authorization credentials, while User-Agent identifies the client software. Therefore, Content-Type is the correct header for identifying the request-body format.

Question 389

Which HTTP header tells a server which response media types the client can process?

  1. Content-Type
  2. Accept
  3. Authorization
  4. Host

Correct Answer: 2

Explanation

The HTTP Accept header tells a server which response media types the client is prepared to receive. For example, an API client may send Accept: application/json when it expects a JSON response. This is different from Content-Type, which describes the format of data being sent in the request body. Authorization carries credentials or authorization information, while Host identifies the target host. Understanding Accept and Content-Type is important when working with REST APIs because they describe different directions of data exchange.

Question 390

Which HTTP status code indicates that a request has been accepted for processing but may not have completed yet?

  1. 200
  2. 201
  3. 202
  4. 204

Correct Answer: 3

Explanation

HTTP status code 202 Accepted indicates that the request has been accepted for processing, but processing may not have completed when the response is returned. This is useful for asynchronous operations where an API accepts a task and performs the work separately. A client may need to query a task or status endpoint later to determine the final result. HTTP 200 generally indicates successful completion, 201 indicates that a resource was created, and 204 indicates successful completion with no response body. Therefore, 202 is correct.

Question 391

Which mechanism is commonly used to avoid repeatedly sending API requests too quickly after receiving a temporary failure?

  1. Retry with backoff
  2. Disable authentication
  3. Delete the API endpoint
  4. Change JSON to XML

Correct Answer: 1

Explanation

Retry with backoff allows an automation application to retry a failed API request after waiting for an increasing or controlled period of time. This is particularly useful for temporary conditions such as rate limiting, transient network problems, or temporary service unavailability. Exponential backoff is one common strategy where the delay increases after successive failures. Proper retry logic should also limit the number of attempts and distinguish retryable errors from permanent errors. Disabling authentication or changing the payload format does not solve temporary request-rate problems. Therefore, retry with backoff is correct.

Question 392

Why is API pagination commonly used when retrieving large collections of resources?

  1. It encrypts the response
  2. It limits the amount of data returned in each response
  3. It disables HTTP status codes
  4. It converts REST into NETCONF

Correct Answer: 2

Explanation

Pagination divides a large collection of API results into smaller pages. Instead of returning thousands of resources in one response, an API can return a manageable number of records and provide information needed to retrieve subsequent pages. This can reduce memory usage, response size, and processing overhead for both the client and server. Common pagination mechanisms include page numbers, offsets, cursors, or continuation links, depending on the API design. Pagination does not encrypt responses or change REST into NETCONF. Therefore, limiting the amount of data returned in each response is correct.

Question 393

Which specification format is commonly used to describe REST API endpoints, parameters, request bodies, and responses?

  1. OpenAPI
  2. SMTP
  3. SSH
  4. SNMP

Correct Answer: 1

Explanation

OpenAPI is a specification format used to describe APIs in a structured way. An OpenAPI document can define endpoints, HTTP methods, parameters, request bodies, response structures, authentication schemes, and other API information. Tools can use these definitions to generate documentation, validate requests, or assist with client generation. OpenAPI documents are commonly represented using YAML or JSON. SMTP is an email protocol, SSH provides secure remote access, and SNMP is a network management protocol. Therefore, OpenAPI is the correct specification for describing REST APIs.

Question 394

Which data format can commonly be used to represent an OpenAPI document?

  1. Binary only
  2. JSON or YAML
  3. CSV only
  4. Plain text without structure

Correct Answer: 2

Explanation

OpenAPI documents can commonly be represented using either JSON or YAML. Both formats allow the API definition to describe paths, operations, parameters, schemas, authentication methods, and responses in a structured manner. YAML is often convenient for human-readable configuration and API specifications, while JSON provides a structured machine-readable representation. CSV is primarily tabular data and does not naturally represent the hierarchical structure required by an API specification. Therefore, JSON or YAML is the correct answer.

Question 395

What is the primary purpose of validating a TLS certificate when connecting to an HTTPS API?

  1. To verify the server’s identity and trust relationship
  2. To increase API response size
  3. To convert HTTP methods
  4. To create a JSON payload

Correct Answer: 1

Explanation

TLS certificate validation helps an HTTPS client verify that it is communicating with the intended server and that the certificate is trusted according to the client’s trust configuration. This reduces the risk of connecting to an impersonating or otherwise untrusted endpoint. Certificate validation typically involves checking the certificate chain, validity period, hostname, and trusted certificate authorities. Disabling certificate verification can make testing easier in some controlled environments but reduces security and should not be treated as a general production solution. Therefore, verifying server identity and trust is correct.

Question 396

Which authentication framework is commonly used to allow applications to obtain delegated access tokens without directly sharing a user’s password with the application?

  1. FTP
  2. OAuth 2.0
  3. ARP
  4. ICMP

Correct Answer: 2

Explanation

OAuth 2.0 is an authorization framework that allows applications to obtain access tokens representing granted permissions without requiring the application to directly handle the user’s password. The exact flow depends on the application type and authorization scenario. Access tokens can then be presented to protected APIs. OAuth 2.0 is therefore relevant when designing API integrations that require delegated authorization. FTP is a file-transfer protocol, ARP resolves IP addresses to MAC addresses, and ICMP is used for network control and diagnostic messaging. Therefore, OAuth 2.0 is the correct answer.

Question 397

In NETCONF, what is the purpose of the <lock> operation?

  1. To reserve a datastore so conflicting configuration changes are prevented
  2. To restart the NETCONF server
  3. To encrypt XML messages
  4. To retrieve interface statistics

Correct Answer: 1

Explanation

The NETCONF <lock> operation is used to lock a configuration datastore so that conflicting configuration changes can be prevented while an authorized client performs configuration work. This helps coordinate changes in environments where multiple clients or automation systems might attempt to modify the same device configuration. NETCONF operates with structured XML messages and supports operations on datastores such as running and candidate, depending on device capabilities. The <lock> operation does not restart the server, encrypt messages, or retrieve interface statistics. Therefore, reserving the datastore against conflicting changes is correct.

Question 398

Which YANG statement is commonly used to define a condition that must be satisfied by configuration or state data?

  1. must
  2. require
  3. condition
  4. validate-only

Correct Answer: 1

Explanation

The YANG must statement defines a constraint that must evaluate successfully for the associated data. It can be used to express relationships or validation requirements that cannot be represented simply through basic data types. Network devices and management systems can use such model constraints to validate configuration consistency. The exact XPath expression contained in a must statement determines the condition being checked. require, condition, and validate-only are not the standard YANG statements used for this purpose. Therefore, must is correct.

Question 399

What is a key characteristic of model-driven telemetry compared with traditional periodic polling?

  1. Data can be streamed from the device based on a defined subscription
  2. It requires manual CLI commands for every update
  3. It only supports configuration changes
  4. It cannot send operational data

Correct Answer: 1

Explanation

Model-driven telemetry can stream structured operational data from network devices based on subscriptions or defined telemetry policies. Instead of repeatedly polling individual values, a collector can receive updates from the device as specified by the telemetry configuration. This can provide more timely visibility into network state and can reduce the need for constant polling requests. Model-driven telemetry can carry operational information such as interface statistics and other modeled data. It is therefore useful for monitoring and automation workflows. The defining characteristic in this context is subscription-based streaming of structured data.

Question 400

Which Cisco platform is designed to provide centralized management and automation capabilities for Cisco SD-WAN environments?

  1. Cisco DNA Center
  2. Cisco vManage
  3. Cisco NSO
  4. Cisco ISE

Correct Answer: 2

Explanation

Cisco vManage is the management component of the Cisco SD-WAN architecture and provides centralized management, configuration, monitoring, and policy capabilities for SD-WAN environments. It allows administrators and automation systems to interact with the SD-WAN infrastructure through centralized interfaces and APIs. Cisco DNA Center focuses primarily on enterprise campus and branch network management, Cisco NSO provides network orchestration and service-management capabilities, and Cisco ISE focuses on identity and access control. Therefore, Cisco vManage is the platform specifically associated with centralized Cisco SD-WAN management.