Swagger is a suite of tools for API developers from SmartBear Software and a former specification upon which the OpenAPI Specification is based.
Swagger MCQs: This section contains multiple-choice questions on Swagger. All MCQs have the correct answers and explanations. These MCQs will help students and professionals to test their skills and to enhance their knowledge of Swagger.
List of Swagger MCQs
1. What is the full form of API?
- Administration programming interface
- Application programming intersection
- Application programmatical interface
- Application programming interface
Answer: D) Application programming interface
Explanation:
API stands for an application programming interface.
2. Swagger specifically deals with the ____ API.
- GraphQL API
- Web API
- Amazon API
Answer: B) Web API
Explanation:
Swagger specifically deals with the Web API.
3. An ____ is a file that lists all the operations that may be performed on a file.
- API Definition File
- API Operation File
- API Definition
Answer: A) API Definition File
Explanation:
An API Definition File is a file that lists all the operations that may be performed on a file.
4. Which of the following things does an API definition file includes?
- It contains how authorization is handled in terms of security
- It contains Every resource that is accessible through that API
- All the different data that you can send in a request.
- All of the above
Answer: D) All of the above
Explanation:
The API Definition File includes the following information: how authorization is handled in terms of security, Every resource that is accessible through that API, and every type of requestable data.
5. We mainly specify the request body in ____ format for some methods such as PUT, POST, etc
- Plain Text
- CSV
- XLs
- JSON
Answer: D) JSON
Explanation:
We mainly specify the request body in JSON format for some methods such as PUT, POST, etc.
6. The response body in REST can be anything, although it is often expressed in which format?
- Plain Text
- CSV
- XLs
- JSON
Answer: D) JSON
Explanation:
The response body in REST can be anything, although it is often expressed in JSON format.
7. ____ is the process of confirming a user’s identity using their login and password.
- Authentication
- Authorization
Answer: A) Authentication
Explanation:
Authentication is the process of confirming a user’s identity using their login and password.
8. YAML stands for ____.
- Any markup language
- API markup language
- Ain’t markup language
- A markup language
Answer: C) Ain’t markup language
Explanation:
YAML stands for Ain’t Markup Language.
9. YAML is used for the content, not for the data.
- True
- False
Answer: B) False
Explanation:
YAML is used for the data, not for the content.
10. Authorization means allowing the user to access the data?
- True
- False
Answer: A) True
Explanation:
Authorization means allowing the user to access the data.
11. The data in YAML is represented in which form?
- Graph
- Plain text
- List
- key/value pairs
Answer: D) key/value pairs
Explanation:
The data in YAML is represented in the form of key/value pairs.
12. Levels in YAML are indicated by ____.
- white space indenting,
- Curly brackets
- Parenthesis
- None
Answer: A) white space indenting,
Explanation:
Levels are indicated by white space indenting.
13. In YAML do we need Quotes around the strings?
- Yes
- No
Answer: B) No
Explanation:
With YAML, we don’t require quotes around the strings since levels are represented by white space indenting. One exception is that quotations are necessary if anything is understood to be a number or a Boolean value.
14. In YAML, we need to use a ____ to indicate a list item.
- Bullets
- ~
- Dash
- Square brackets
Answer: C) Dash
Explanation:
In YAML, we need to use a ____ to indicate a list item.
15. What do you mean by OAS?
- Open API System
- Open API Serialization
- Open API Specification
- Open API Specialization
Answer: C) Open API Specification
Explanation:
OAS stands for Open API Specification.
16. Which of the following is a tool that enables real-time documentation preview and editing of Open API specifications in YAML within the browser?
- Swagger Editor
- Swagger Core
- Swagger Codegen
- Swagger Inspector
Answer: A) Swagger Editor
Explanation:
A Swagger Editor is a tool that enables real-time documentation preview and editing of Open API specifications in YAML within the browser.
17. Which of the following is a tool that enables us to create attractive documentation dynamically? It is a collection of HTML, JavaScript, and CSS elements.
- Swagger Codegen
- Swagger Core
- Swagger UI
- Swagger Inspector
Answer: C) Swagger UI
Explanation:
Swagger UI is a tool that enables us to create attractive documentation dynamically. It is a collection of HTML, JavaScript, and CSS elements.
18. The object is identified as a reference to another structure in the YAML file by the special OAS key known as ____.
- –unique
- $ reference
- $ref
- $ key
Answer: C) $ref
Explanation:
The object is identified as a reference to another structure in the YAML file by the special OAS key known as $ref.
19. Which of the following is the advantage of API testing?
- Language Independent
- GUI Independent
- Improved Test Coverage –
- Faster Release
- All of the above
Answer: E) All of the above
Explanation:
The following are some advantages of API testing:Language Independent, Increased Test Coverage, GUI Independent, Quicker Release.
20. ____ is a testing tool for APIs that enables you to check your APIs and create OpenAPI specifications from an already-existing API.
- Swagger Inspector
- Swagger Tester
- Swagger Inspect
Answer: A) Swagger Inspector
Explanation:
Swagger Inspector is a testing tool for APIs that enables you to check your APIs and create OpenAPI specifications from an already-existing API.
21. Which of the following Protocols is used by API Testing?
- HTTP
- JMS
- UDDI
- All of the above
Answer: D) All of the above
Explanation:
Protocols used by API Testing are as follows:
- HTTP
- REST
- SOAP
- JMS
- UDDI
22. Which of the following tool enables us to automatically produce the documentation, server stubs, and client libraries for the API?
- Swagger Codegen
- Swagger Core
- Swagger UI
- Swagger Inspector
Answer: A) Swagger Codegen
Explanation:
Swagger Codegen enables us to automatically produce the documentation, server stubs, and client libraries for the API.
23. Which of the following statement is TRUE?
- POSTMAN is a specification for APIs, whereas SWAGGER is an API client.
- SWAGGER is a specification for APIs, whereas POSTMAN is an API client.
Answer: B) SWAGGER is a specification for APIs, whereas POSTMAN is an API client.
Explanation:
Statement B is correct, SWAGGER is a specification for APIs, whereas POSTMAN is an API client.
24. The ____ is used to create, consume, and interact with API specifications, is a collection of java-related libraries.
- Swagger core
- Swagger Java
- Swagger Script
Answer: A) Swagger core
Explanation:
The Swagger core, which is used to create, consume, and interact with API specifications, is a collection of Java-related libraries.
25. Swagger is good for testing an API based on specifications?
- True
- False
Answer: B) False
Explanation:
Postman is good for testing an API based on specifications, whereas Swagger tools are excellent for API-first development.
26. Among SOAP and REST which of them is faster?
- SOAP
- REST
Answer: B) REST
Explanation:
SOAP is slower, and REST is faster.
27. The client state is not kept on the server due to the REST architecture’s design. ____ is the term used to describe this.
- Statelessness
- State fullness
Answer: A) Statelessness
Explanation:
The client state is not kept on the server due to the REST architecture’s design. Statelessness is the term used to describe this.
28. In REST, any HTTP Request has how many main components?
- 2
- 3
- 4
- 5
Answer: D) 5
Explanation:
In REST, any HTTP Request has 5 main components, they are:
- Method/Verb
- URI −
- HTTP Version
- Request Header
- Request Body
29. HTTP Response has how many components?
- 2
- 3
- 4
- 5
Answer: C) 4
Explanation:
HTTP Response has 4 components:
- Response Status Code
- HTTP Version
- Response Header
- Response Body
30. Which of the following annotation is used for mapping requests to specific handler classes or methods?
- @RequestPath
- @RequestMethod
- @RequestDict
- @RequestMapping
Answer: D) @RequestMapping
Explanation:
@RequestMapping annotation is used for mapping requests to specific handler classes or methods.