14.7.2 Module Quiz – Network Automation Answers
1. What is JSON?
- It is a data format for storing and transporting data.
- It is a scripting language.
- It is a database.
- It is a compiled programming language.
Explanation: JavaScript Object Notation (JSON) is a data format used by applications to store and transport data.
2. What is an architectural constraint to which a true RESTful API web service must adhere?
- It must support the XML data format.
- It operates as a cloud service.
- It runs as client/server model.
- It uses HTTPS to transport data.
Explanation: Conforming to the constraints of the REST architecture is generally referred to as being “RESTful”. An API can be considered “RESTful” if it has the following features:
-
- Client/server – The client handles the front end and the server handles the back end.
- Stateless – No client data is stored on the server between requests. The session state is stored on the client.
- Cacheable – Clients can cache responses locally to improve performance.
3. In the RESTful API request example, http://www.mapquestapi.com/directions/v2/route?outFormat=json&key=KEY&from=San+Jose,Ca&to=Monterey,Ca
, which term describes the component directions/v2/route
?
- parameters
- resources
- API server
- query
Explanation: In this sample API request, the different components are as follows:
– API Server – the MapQuest API server, http://www.mapquestapi.com
– Resources – the MapQuest directions API, directions/v2/route
– Query – the data format and information the client is requesting from the API service, include these:
- Format – format JSON is requested
- Key – authentication key, here it is KEY
- Parameters – information pertaining to the request, in this example, \”from=San+Jose,Ca\” and \”to=Monterey,Ca\”
4. Which statement describes an API?
- It is a set of functions and procedures that allows a client application to access the data of the service application.
- It is a programming language for creating a web-based application.
- It is a set of functions and subroutines to be used in a comprehensive application.
- It is a set of rules that filter network traffic for web-based applications.
Explanation: An application programming interface (API) is a set of functions and procedures to allow communication among applications. Typically, a service application provides the API to allow client applications to access the data of the service application.
5. Which term describes the process of managing configuration changes of network devices in an orderly fashion?
- orchestration
- version control
- provisioning
- automation
Explanation: Configuration management tools typically include automation and orchestration. Automation is automatically performing a task on a system. Arranging the automated tasks into a coordinated process or workflow is called orchestration.
6. Which web service API can use multiple data formats including JSON, XML, and YAML?
- JSON-RPC
- REST
- SOAP
- XML-RPC
Explanation: REST API can use multiple data formats including JSON, XML, YAML, and others. Both SOAP and XML-RPC use XML format. JSON-RPC uses JSON format.
7. What are two reasons that most RESTful APIs require a key in the request? (Choose two.)
- to authenticate the requesting source
- to gather information on the people using the API
- to encrypt the query message in the API request
- to make sure that the query matches the service offered by the web application
- to specify the data format expected from the response
Explanation: Many RESTful APIs, including public APIs, require a key. The reasons an API provider may require a key include the following:
- to authenticate the source to make sure it is authorized to use the API
- to limit the number of people using the API
- to better capture and track the data being requested by users
- to gather information on the people using the API
8. What is a difference between the XML and HTML data formats?
- XML uses a self-descriptive data structure but HTML uses a standard document structure.
- XML formats data in hexadecimal whereas HTML formats data in binary.
- XML requires indentation for each key/value pair whereas HTML does not require indentation.
- XML encloses data within a pair of tags whereas HTML uses a pair of quotation marks to enclose data.
Explanation: XML is a human readable data structure used to store, transfer, and read data by applications. Like HTML, XML uses a related set of tags to enclose data. However, unlike HTML, XML does not use predefined tags or a standard document structure, but rather it uses self-descriptive tags and structure.
9. A programmer is using Ansible as the configuration management tool. Which term is used to describe a set of instructions for execution?
- Pillar
- Manifest
- Cookbook
- Playbook
Explanation: Ansible uses the name Playbook to describe the set of instructions to be executed.
10. Which term is used to describe a set of instructions for execution by the configuration management tool Chef?
- Playbook
- Pillar
- Cookbook
- Manifest
Explanation: The configuration management tool Chef uses the name Cookbook to describe the set of instructions to be executed.
11. Which two configuration management tools are developed using Python? (Choose two.)
- Chef
- Ansible
- SaltStack
- Puppet
- NETCONF
Explanation: Ansible and SaltStack are configuration management tools developed using Python. Chef and Puppet are configuration management tools developed using Ruby. Ruby is typically considered a more difficult language to learn than Python. NETCONF is a network management protocol.
12. Which function of the Cisco intent-based networking system (IBNS) enables network operators to express the expected networking behavior that will best support the business intent?
- translation
- ACL analysis
- activation
- assurance
Explanation: The translation feature of Cisco IBNS enables network operators to express the expected network behavior that will best support the business intent.
13. Which types of APIs are suitable for the data communication between a travel website and a hotel chain inquiring about room availability data?
- public APIs
- partner APIs
- open APIs
- internal APIs
Explanation: Application APIs are categorized as follows:
- Open APIs or Public APIs – publicly available and can be used with no restrictions
- Internal or Private APIs – used by an organization or company to access data and services for internal use only
- Partner APIs – used between a company and its business partners or contractors to facilitate business between them
14. Which characters are used to enclose a JSON key?
- commas
- square brackets
- colons
- quotation marks
Explanation: JSON keys are on the left side of the colon. They need to be wrapped in double quotation marks, as in “key”, and can be any valid string.
15. Which character is used to separate JSON key/value pairs?
- (semi colon) ;
- (dash) –
- (comma) ,
- (forward slash) /
Explanation: Each key/value pair in a series of key/value pairs is separated by a comma, so the middle of a JSON looks like this “key”: “value”, “key”: “value”.
16. In the following example, which data format is used?
message: success
timestamp: 1560789260
iss_position:
latitude: '25.9990'
longitude: '-132.6992'
Explanation: YAML Ain’t Markup Language (YAML) separates the key/value pairs using a colon without quotation marks. YAML also uses indentation to define the structure, without using brackets or commas. JavaScript Object Notation (JSON) encloses key/value pairs in braces, { }. Keys must be strings within double quotation marks, “ ”. A key is separated from a value by a colon. Extensible Markup Language (XML) data is enclosed within a related set of tags: <tag>data</tag>.
17. In the following example, which data format is used?
{
"message": "success",
"timestamp": 1560789260,
"iss_position": {
"latitude": "25.9990",
"longitude": "-132.6992"
}
}
Explanation: JavaScript Object Notation (JSON) encloses key/value pairs in braces, { }. Keys must be strings within double quotation marks, “ ”. A key is separated from a value by a colon. YAML Ain’t Markup Language (YAML) separates the key/value pairs using a colon without quotation marks. YAML also uses indentation to define the structure, without using brackets or commas. Extensible Markup Language (XML) data is enclosed within a related set of tags: <tag>data</tag>.
18. A RESTful API (for example, a public API) mat require a key. What is the function of the key?
- It is the top-level object of the API query.
- It is used in the encryption of the message by an API request.
- It is used to authenticate the requesting source.
- It represents the main query components in the API request.
Explanation: A RESTful API, including a public API, may require a key. The key is used to identify the source of the request through authentication.
19. Which configuration management tool combines a set of instructions in a manifest?
- Ansible
- Chef
- Puppet
- RESTCONF
- SaltStack
Explanation: Puppet is an agent-based configuration management tool built on Ruby that allows you to create a set of instructions called a manifest. Ansible is an agentless configuration management tool built on Python that allows you to create a set of instructions called a playbook. Chef is an agent-based configuration management tool built on Ruby that allows you to create a set of instructions called a cookbook. SaltStack is an agentless configuration management tool built on Python that allows you to create a set of instructions called a pillar.
20. Which RESTful operation corresponds to the HTTP POST method?
- create
- delete
- read
- update
Explanation: The HTTP operation POST corresponds to the RESTful operation create, GET to read, PUT/PATCH to update, and DELETE to delete.
21. How does the YAML data format structure differ from JSON?
- YAML uses brackets and commas.
- YAML uses end tags.
- YAML uses hierarchical levels of nesting.
- YAML uses indentations.
Explanation: YAML Ain’t Markup Language (YAML) separates the key/value pairs using a colon without quotation marks. YAML also uses indentation to define its structure, without using brackets or commas. Extensible Markup Language (XML) data is enclosed within a related set of tags: <tag>data</tag>. JavaScript Object Notation (JSON) encloses key/value pairs in braces, { }. Keys must be strings within double quotation marks, “ ”. A key is separated from a value by a colon.
22. Which configuration management tool combines a set of instructions in a playbook?
- Ansible
- Chef
- Puppet
- RESTCONF
- SaltStack
Explanation: Ansible is an agentless configuration management tool built on Python that allows you to create a set of instructions called a playbook. Chef is an agent-based configuration management tool built on Ruby that allows you to create a set of instructions called a cookbook. Puppet is an agent-based configuration management tool built on Ruby that allows you to create a set of instructions called a manifest. SaltStack is an agentless configuration management tool built on Python that allows you to create a set of instructions called a pillar.
23. In the following example, which data format is used?
<root>
<message>success</message>
<timestamp>1560789260</timestamp>
<iss_position>
<latitude>25.9990</latitude>
<longitude>-132.6992</longitude>
</iss_position>
</root>
Explanation: Extensible Markup Language (XML) data is enclosed within a related set of tags: <tag>data</tag>. JavaScript Object Notation (JSON) encloses key/value pairs in braces, { }. Keys must be strings within double quotation marks, “ ”. A key is from a value by a colon. YAML Ain’t Markup Language (YAML) separates the key/value pairs using a colon without quotation marks. YAML also uses indentation to define its structure without using brackets or commas.
24. What is a difference between the HTML and XML data formats?
- HTML formats data in plaintext, whereas XML formats data in binary.
- HTML uses predefined tags, and XML does not.
- HTML requires indentation for each key/value pair, but XML does not.
- HTML uses a pair of quotation marks to enclose data, whereas XML encloses data within a pair of tags.
Explanation: Like XML, HTML uses a related set of tags to enclose data. However, HTML uses predefined tags, whereas XML does not. XML is a human-readable data structure that applications use to store, transfer, and read data.
25. What is REST?
- It is a human-readable data structure that applications use for storing, transforming, and reading data.
- It is a protocol that allows administrators to manage nodes on an IP network.
- It is a way to store and interchange data in a structured format.
- It is an architecture style for designing web service applications.
Explanation: REST is not a protocol or service but rather a style of software architecture for designing web service applications. A REST API is an API that works on top of HTTP. It defines a set of functions developers can use to perform requests and receive responses via HTTP, such as GET and POST.
26. Which RESTful operation corresponds to the HTTP PUT method?
- create
- delete
- read
- update
Explanation: The HTTP operation PUT corresponds to the RESTful operation update, POST to create, GET to read, and DELETE to delete.
27. What is JSON?
- It is a compiled programming language.
- It is a data format that is simpler than XML.
- It is a scripting language.
- It is a superset of YAML.
Explanation: JSON is a lightweight data format for storing and transporting data. It is simpler and more readable than XML and is supported by web browsers. Like JSON, YAML Ain’t Markup Language (YAML) is a data format that applications use to store and transport data. YAML is considered a superset of JSON.
28. Which scenario describes the use of a public API?
- It can be used with no restrictions.
- It is used only within an organization.
- It requires a license.
- It is used between a company and its business partners.
Explanation: Public, or open, APIs have no restrictions and are available to the public. Some API providers do require a user to obtain a free key or token prior to using the API in order to control the volume of API requests received and processed.