(Full Stack JavaScript) Working with APIs Knowledge Assessment Guide 2024, Exams of Javascript programming

(Full Stack JavaScript) Working with APIs Knowledge Assessment Guide 2024(Full Stack JavaScript) Working with APIs Knowledge Assessment Guide 2024(Full Stack JavaScript) Working with APIs Knowledge Assessment Guide 2024(Full Stack JavaScript) Working with APIs Knowledge Assessment Guide 2024

Typology: Exams

2023/2024

Available from 07/15/2024

geofchah
geofchah 🇺🇸

4.7

(7)

929 documents

1 / 20

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
FULL STACK JAVASCRIPT
Working with APIs
KNOWLEDGE ASSESSMENT GUIDE
2024
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14

Partial preview of the text

Download (Full Stack JavaScript) Working with APIs Knowledge Assessment Guide 2024 and more Exams Javascript programming in PDF only on Docsity!

FULL STACK JAVASCRIPT

Working with APIs

KNOWLEDGE ASSESSMENT GUIDE

  1. Which HTTP method is idempotent?
    • A) GET
    • B) POST
    • C) PUT
    • D) DELETE
    • Answer: C) PUT
    • Rationale: PUT requests are idempotent, meaning that multiple identical requests should have the same effect as a single request.
  2. What is the primary purpose of using OAuth in APIs?
    • A) Data encryption
    • B) User authentication
    • C) Rate limiting
    • D) Authorization
    • Answer: D) Authorization
    • Rationale: OAuth is used to grant third-party applications limited access to user resources without exposing user credentials.
  3. Which status code indicates that the request has been successfully processed and the resource has been created?
    • A) 200
    • B) 201

Fill-in-the-Blank Questions

  1. The process of converting a JavaScript object into a JSON string is called __________.
    • Answer: serialization
    • Rationale: Serialization is the process of converting an object into a format that can be easily transported or stored.
  2. In RESTful APIs, the __________ method is used to update a resource partially.
    • Answer: PATCH
    • Rationale: The PATCH method is used to apply partial modifications to a resource.
  3. The __________ header in an HTTP request specifies the media type of the resource.
    • Answer: Content-Type
    • Rationale: The Content-Type header indicates the media type of the resource being sent to the server.
  4. In API security, __________ is a technique used to prevent unauthorized access by verifying the identity of the user.
    • Answer: authentication
  • Rationale: Authentication is the process of verifying the identity of a user or application.
  1. The __________ status code indicates that the server cannot find the requested resource.
  • Answer: 404
  • Rationale: The 404 status code means that the server cannot find the requested resource.

True/False Questions

  1. REST APIs are stateless.
  • Answer: True
  • Rationale: REST APIs are designed to be stateless, meaning each request from a client to server must contain all the information needed to understand and process the request.
  1. CORS stands for Cross-Origin Resource Sharing.
  • Answer: True
  • Rationale: CORS is a mechanism that allows restricted resources on a web page to be requested from another domain outside the domain from which the resource originated.
  1. JSON is a binary format used for data interchange.
  • Answer: False
  • Rationale: RESTful APIs are designed to be stateless, meaning each request from a client to server must contain all the information needed to understand and process the request.
  1. What does the acronym CRUD stand for in the context of APIs?
  • A) Create, Read, Update, Delete
  • B) Connect, Retrieve, Update, Delete
  • C) Create, Retrieve, Upload, Delete
  • D) Connect, Read, Upload, Delete
  • Answer: A) Create, Read, Update, Delete
  • Rationale: CRUD stands for Create, Read, Update, Delete, which are the four basic operations of persistent storage.
  1. Which HTTP status code indicates a successful request but no content to return?
  • A) 200
  • B) 201
  • C) 204
  • D) 400
  • Answer: C) 204
  • Rationale: The 204 status code indicates that the request was successful but there is no content to return.
  1. In RESTful APIs, which method is typically used to delete a resource?

- A) GET

- B) POST

- C) PUT

- D) DELETE

  • Answer: D) DELETE
  • Rationale: The DELETE method is used to remove a resource from the server.
  1. Which of the following is a benefit of using API gateways?
  • A) Improved security
  • B) Reduced latency
  • C) Simplified client code
  • D) All of the above
  • Answer: D) All of the above
  • Rationale: API gateways provide several benefits including improved security, reduced latency, and simplified client code by acting as a single entry point for API requests. Multiple Choice Questions: Which HTTP method is commonly used to retrieve data from an API? A) POST B) GET C) PUT

Fill-in-the-Blank Questions: In API development, _ is a common format used for data exchange between the client and server.

Correct Answer: JSON (JavaScript Object Notation)

Rationale: JSON is widely used for its simplicity and readability in transmitting data. The process of restricting access to certain API endpoints based on user roles is known as _.

Correct Answer: Authorization

Rationale: Authorization controls what actions a user can perform on the API based on their role or permissions. API _ is the practice of designing APIs in a way that is easy to understand and use.

Correct Answer: Usability

Rationale: Usability plays a crucial role in the adoption and success of an API. True/False Questions: True or False: GraphQL is a query language for APIs that allows clients to request only the data they need.

Correct Answer: True

Rationale: GraphQL enables clients to specify the structure of the response data they require.

True or False: Rate limiting in API development is used to prevent abuse and ensure fair usage of resources.

Correct Answer: True

Rationale: Rate limiting helps protect API servers from being overwhelmed by excessive requests. True or False: Webhooks are synchronous communication mechanisms between APIs.

Correct Answer: False

Rationale: Webhooks are asynchronous notifications sent by APIs to inform external systems of events.

  1. Multiple Choice: When working with APIs, what does the term "REST" stand for? a) Remote Exchange Send Technology b) Representational State Transfer c) Real-time Event Synchronization d) Relational Entity System Transfer

Correct Answer: b) Representational State Transfer

Rationale: REST is an architectural style for designing networked applications, focusing on the transfer of representations of resources.

Rationale: JSON is a lightweight data interchange format derived from JavaScript object syntax.

  1. True/False: Cross-Origin Resource Sharing (CORS) is a security feature implemented by browsers to restrict API requests from different origins.

Correct Answer: True

Rationale: CORS helps prevent malicious websites from making unauthorized requests to APIs.

  1. Multiple Choice: Which authentication method involves sending a token in the Authorization header of API requests? a) Basic Authentication b) JWT Authentication c) OAuth2 Authentication d) Digest Authentication

Correct Answer: b) JWT Authentication

Rationale: JWT (JSON Web Token) is a popular method for securely transmitting information between parties as a JSON object.

  1. Fill-in-the-Blank: API documentation should include details such as endpoints, request ___________, response ___________, and example payloads.

Correct Answer: methods, formats

Rationale: Clear and comprehensive API documentation is essential for developers to understand and utilize an API effectively.

  1. True/False: GraphQL is an alternative to REST for building APIs that allows clients to request only the data they need.

Correct Answer: True

Rationale: GraphQL provides a more flexible and efficient approach to querying data compared to traditional RESTful APIs.

  1. Multiple Choice: Which JavaScript method is commonly used to make asynchronous API requests? a) fetch() b) load() c) send() d) request()

Correct Answer: a) fetch()

Rationale: The fetch() method is a modern API for making network requests in the browser, supporting asynchronous operations.

  1. Fill-in-the-Blank: API rate limiting is a mechanism used to prevent ___________ of API resources by limiting the number of requests a client can make within a given time period.

Correct Answer: abuse

Rationale: Rate limiting helps maintain API performance and prevent abuse or overload of server resources.

Correct Answer: True

Rationale: Caching can help reduce the number of redundant API requests and speed up client interactions with the API.

  1. Multiple Choice: Which HTTP method is idempotent, meaning multiple identical requests have the same effect as a single request? a) GET b) POST c) PUT d) DELETE

Correct Answer: c) PUT

Rationale: Idempotent methods like PUT ensure that the result of the request is the same regardless of how many times it is executed.

  1. Fill-in-the-Blank: API webhooks allow for real-time communication by sending ___________ from an API when specific events occur.

Correct Answer: callbacks

Rationale: Webhooks enable applications to receive notifications and updates from APIs without the need for continuous polling.

  1. True/False: OpenAPI (formerly known as Swagger) is a specification for describing and documenting RESTful APIs.

Correct Answer: True

Rationale: OpenAPI provides a standardized format for defining API endpoints, parameters, responses, and other details.

  1. Multiple Choice: Which authentication method involves exchanging a temporary, revocable token for access to API resources? a) Basic Authentication b) OAuth2 Authentication c) Digest Authentication d) API Key Authentication

Correct Answer: b) OAuth2 Authentication

Rationale: OAuth2 is a widely used authorization framework that allows secure access to resources with access tokens.

  1. Fill-in-the-Blank: API rate limiting can be implemented based on factors such as the ___________ of requests, the ___________ of requests, and the user or client making the requests.

Correct Answer: frequency, volume

Rationale: Rate limiting strategies can vary depending on the specific requirements and constraints of an API.

  1. True/False: API mocking is a technique used to simulate API responses during development and testing when the actual API is not available.

Correct Answer: True

Rationale: API mocking helps developers work on client-side implementations without relying on the availability of the real API.

  1. Multiple Choice: Which HTTP status code indicates that the requested resource has been permanently deleted and will not be available in the future? a) 200 OK b) 301 Moved Permanently c) 403 Forbidden d) 404 Not Found

Correct Answer: b) 301 Moved Permanently

Rationale: The 301 status code informs clients that the resource has been permanently relocated to a different URL.

  1. Fill-in-the-Blank: API pagination is used to limit the amount of data returned by an API request by dividing it into smaller, ___________-sized chunks.

Correct Answer: page

Rationale: Pagination helps manage large datasets by breaking them into more manageable segments for clients to process.

  1. True/False: API versioning through URL paths involves including the version number as a query parameter in API requests.

Correct Answer: False

Rationale: URL path versioning is a common practice where the API version is specified directly in the URL path, not as a query parameter.

  1. Multiple Choice: Which type of token is commonly used for granting temporary access to API resources without exposing user credentials?

a) Access Token b) Refresh Token c) Session Token d) Authentication Token

Correct Answer: a) Access Token

Rationale: Access tokens are typically short-lived tokens that provide access to protected API resources without requiring the user's credentials.

  1. Fill-in-the-Blank: API testing involves evaluating the functionality, performance, and ___________ of an API to ensure it meets the specified requirements and standards.

Correct Answer: security

Rationale: Testing is crucial for validating the reliability, scalability, and security of APIs before they are deployed in production environments.

  1. True/False: API gateway is a centralized service that acts as a single entry point for multiple APIs, providing features such as authentication, rate limiting, and logging.

Correct Answer: True

Rationale: API gateways help streamline API management tasks, enhance security, and enforce policies across various APIs within an organization.