0% found this document useful (0 votes)
107 views10 pages

API and Design Interview Question

Uploaded by

c211069
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
107 views10 pages

API and Design Interview Question

Uploaded by

c211069
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

API Questions

1. What does API stand for?

Answer: API stands for Application Programming Interface.

2. What is an API?

Answer: An API is a set of rules and protocols for building and interacting with
software applications.

3. What is RESTful API?

Answer: RESTful API follows the principles of Representational State Transfer


(REST) and uses HTTP methods to perform CRUD operations.

4. What is SOAP?

Answer: SOAP (Simple Object Access Protocol) is a protocol for exchanging


structured information in web services using XML.

5. What is GraphQL?

Answer: GraphQL is a query language for APIs that allows clients to request specific
data and provides a more flexible alternative to REST.

6. What is the purpose of an API endpoint?

Answer: An API endpoint is a specific URL or URI where an API request is sent and
processed.

7. What is an API key?

Answer: An API key is a unique identifier used to authenticate and authorize access
to an API.

8. What is JSON?

Answer: JSON (JavaScript Object Notation) is a lightweight data interchange format


that is easy for humans to read and write and easy for machines to parse and
generate.

9. What is XML?

Answer: XML (Extensible Markup Language) is a markup language used to encode


documents in a format that is both human-readable and machine-readable.
10. What is CORS?

Answer: CORS (Cross-Origin Resource Sharing) is a security feature that allows or


restricts resources on a web page to be requested from another domain.

11. What is OAuth?

Answer: OAuth (Open Authorization) is a protocol for token-based authorization that


allows applications to access resources on behalf of a user.

12. What is the difference between PUT and POST in RESTful APIs?

Answer: PUT is used to update or create a resource at a specified URI, while POST
is used to create a new resource, often with a server-generated URI.

13. What is rate limiting in APIs?

Answer: Rate limiting controls the number of API requests a user or application can
make within a specified time period.

14. What is an API payload?

Answer: An API payload is the data sent in the body of an API request or response.

15. What is API throttling?

Answer: API throttling is a technique used to control the rate at which requests are
processed to prevent abuse and ensure fair usage.

16. What are HTTP status codes?

Answer: HTTP status codes are numerical codes returned by the server to indicate
the outcome of an API request (e.g., 200 OK, 404 Not Found).

17. What is the purpose of API versioning?

Answer: API versioning manages changes to an API over time by specifying different
versions to ensure backward compatibility.

18. What is a RESTful API resource?

Answer: A RESTful API resource is an object or data that can be accessed or


manipulated through HTTP methods.

19. What is a webhook?

Answer: A webhook is a user-defined HTTP callback that triggers an action in


response to events or changes in real-time.
20. What is the difference between synchronous and asynchronous API calls?

Answer: Synchronous API calls block the client until the server responds, while
asynchronous API calls allow the client to continue processing while waiting for the
response.

21. What is HATEOAS?

Answer: HATEOAS (Hypermedia as the Engine of Application State) is a RESTful


principle where responses include hyperlinks to related resources.

22. What is API documentation?

Answer: API documentation provides detailed information about how to use an API,
including endpoints, request parameters, and response formats.

23. What is an API client?

Answer: An API client is an application or tool that makes requests to an API and
processes the responses.

24. What is the purpose of API authentication?

Answer: API authentication verifies the identity of the user or application making the
API request to ensure secure access.

25. What is API authorization?

Answer: API authorization determines the permissions and level of access granted to
authenticated users or applications.

26. What is a RESTful API verb?

Answer: RESTful API verbs refer to HTTP methods used to perform actions on
resources, such as GET, POST, PUT, and DELETE.

27. What is the difference between REST and SOAP?

Answer: REST is an architectural style using standard HTTP methods and is typically
more flexible, while SOAP is a protocol that uses XML and has strict standards for
messaging.

28. What is the purpose of API middleware?

Answer: API middleware is software that processes requests and responses in


transit, often used for tasks such as logging, authentication, and error handling.

29. What is API caching?

Answer: API caching stores responses temporarily to reduce latency and improve
performance for repeated requests.
30. What is API security?

Answer: API security involves measures and practices to protect APIs from
unauthorized access, misuse, and attacks.

31. What is a RESTful API resource identifier?

Answer: A RESTful API resource identifier is a unique URI used to identify a specific
resource in a RESTful API.

32. What is a JSON Web Token (JWT)?

Answer: JWT is an open standard for securely transmitting information between


parties as a JSON object, often used for authentication.

33. What is a response header in an API?

Answer: A response header provides metadata about the response, such as content
type, length, and caching directives.

34. What is an API response code?

Answer: An API response code is a status code returned by the server to indicate the
result of the API request.

35. What is the difference between an API request and an API response?

Answer: An API request is made by the client to the server to perform an action,
while an API response is returned by the server with the result of the request.

36. What is an API gateway?

Answer: An API gateway manages and routes API requests, provides security, and
handles load balancing.

37. What is a rate limit in an API?

Answer: A rate limit is a restriction on the number of requests that can be made to an
API within a certain time frame.

38. What is an API endpoint path?

Answer: An API endpoint path is the specific URL or URI used to access a particular
resource or service.

39. What is the purpose of API logging?

Answer: API logging records information about API requests and responses for
monitoring, debugging, and auditing purposes.
40. What is a RESTful API request method?

Answer: A RESTful API request method refers to HTTP verbs such as GET, POST,
PUT, and DELETE used to perform operations on resources.

41. What is the role of an API proxy?

Answer: An API proxy acts as an intermediary between clients and servers, often
used for security, transformation, and monitoring.

42. What is a resource in a RESTful API?

Answer: A resource is an object or data representation in a RESTful API that can be


accessed and manipulated using HTTP methods.

43. What is a status code 200 in an API response?

Answer: Status code 200 indicates that the request was successful, and the server
has returned the requested data.

44. What is a status code 404 in an API response?

Answer: Status code 404 indicates that the requested resource was not found on the
server.

45. What is a status code 500 in an API response?

Answer: Status code 500 indicates that there was an internal server error while
processing the request.

46. What is an API endpoint URI?

Answer: An API endpoint URI is a unique identifier for a specific resource or service
in an API.

47. What is API endpoint mapping?

Answer: API endpoint mapping is the process of linking specific URIs to functions or
operations in an API.

48. What is a RESTful API parameter?

Answer: A RESTful API parameter is additional information included in a request


URL or body to modify the response or operation.

49. What is API serialization?

Answer: API serialization converts data into a format suitable for transmission, such
as JSON or XML.
50. What is an API deserialization?

Answer: API deserialization converts data from a format received in an API response
back into an object or data structure.

Design Pattern Questions

1. What is a design pattern?

Answer: A reusable solution to a common problem in software design.

2. What is the Singleton pattern?

Answer: A pattern that ensures a class has only one instance and provides a global
point of access to it.

3. What is the Factory Method pattern?

Answer: A pattern that defines an interface for creating objects but allows subclasses
to alter the type of objects created.

4. What is the Abstract Factory pattern?

Answer: A pattern that provides an interface for creating families of related or


dependent objects without specifying their concrete classes.

5. What is the Builder pattern?

Answer: A pattern that separates the construction of a complex object from its
representation, allowing the same construction process to create different
representations.

6. What is the Prototype pattern?

Answer: A pattern that creates new objects by copying an existing object, known as
the prototype.

7. What is the Adapter pattern?

Answer: A pattern that allows incompatible interfaces to work together by converting


the interface of a class into another interface expected by the client.

8. What is the Decorator pattern?

Answer: A pattern that allows adding new functionality to an object dynamically


without altering its structure.

9. What is the Facade pattern?

Answer: A pattern that provides a simplified interface to a complex subsystem.


10. What is the Proxy pattern?

Answer: A pattern that provides a surrogate or placeholder for another object to


control access to it.

11. What is the Observer pattern?

Answer: A pattern that defines a one-to-many dependency between objects so that


when one object changes state, all its dependents are notified and updated
automatically.

12. What is the Strategy pattern?

Answer: A pattern that defines a family of algorithms, encapsulates each one, and
makes them interchangeable.

13. What is the Command pattern?

Answer: A pattern that encapsulates a request as an object, allowing for


parameterization of clients with queues, requests, and operations.

14. What is the Chain of Responsibility pattern?

Answer: A pattern that passes a request along a chain of handlers, allowing multiple
objects to handle the request without the sender knowing which handler will process
it.

15. What is the State pattern?

Answer: A pattern that allows an object to alter its behavior when its internal state
changes, appearing as if the object changed its class.

16. What is the Template Method pattern?

Answer: A pattern that defines the skeleton of an algorithm in a base class, allowing
subclasses to implement specific steps of the algorithm.

17. What is the Mediator pattern?

Answer: A pattern that defines an object that encapsulates how a set of objects
interact, promoting loose coupling.

18. What is the Memento pattern?

Answer: A pattern that captures and externalizes an object's internal state without
violating encapsulation, allowing the object to be restored to that state later.

19. What is the Visitor pattern?

Answer: A pattern that defines a new operation without changing the classes of the
elements on which it operates.
20. What is Dependency Injection?

Answer: A design pattern that allows an object to receive dependencies from an


external source rather than creating them internally.

21. What is the difference between the Factory Method and the Abstract Factory
patterns?

Answer: Factory Method deals with creating a single object, while Abstract Factory
deals with creating families of related objects.

22. What is the purpose of the Singleton pattern?

Answer: To ensure that a class has only one instance and provide a global point of
access to that instance.

23. What is the purpose of the Builder pattern?

Answer: To construct a complex object step-by-step, allowing different


representations.

24. What is the purpose of the Adapter pattern?

Answer: To convert one interface into another interface expected by the client.

25. What is the purpose of the Decorator pattern?

Answer: To add new functionality to an object dynamically without altering its


structure.

26. What is the purpose of the Facade pattern?

Answer: To provide a simplified interface to a complex subsystem.

27. What is the purpose of the Proxy pattern?

Answer: To control access to another object, often for purposes like security or
performance.

28. What is the purpose of the Observer pattern?

Answer: To allow one object to notify other objects about changes in its state.

29. What is the purpose of the Strategy pattern?

Answer: To define a family of algorithms, encapsulate each one, and make them
interchangeable.
30. What is the purpose of the Command pattern?

Answer: To encapsulate a request as an object, allowing for parameterization and


queuing of requests.

31. What is the purpose of the Chain of Responsibility pattern?

Answer: To allow multiple objects to handle a request without the sender knowing
which object will process it.

32. What is the purpose of the State pattern?

Answer: To allow an object to change its behavior when its internal state changes.

33. What is the purpose of the Template Method pattern?

Answer: To define the skeleton of an algorithm in a base class and let subclasses
implement specific steps.

34. What is the purpose of the Mediator pattern?

Answer: To manage communication between objects, promoting loose coupling.

35. What is the purpose of the Memento pattern?

Answer: To capture and restore an object's state without violating encapsulation.

36. What is the purpose of the Visitor pattern?

Answer: To add new operations to objects without changing their classes.

37. What is the difference between the Prototype and the Singleton patterns?

Answer: Prototype clones existing objects, while Singleton ensures only one instance
of a class.

38. What is an example use case for the Builder pattern?

Answer: Constructing complex objects like a computer with various components.

39. What is an example use case for the Strategy pattern?

Answer: Implementing different sorting algorithms in a collection.

40. What is an example use case for the Observer pattern?

Answer: Implementing an event system where multiple subscribers are notified of


changes.

41. What is an example use case for the Command pattern?

Answer: Implementing undo/redo functionality in an application.


42. What is an example use case for the Decorator pattern?

Answer: Adding scrollbars or borders to a graphical user interface component.

43. What is an example use case for the Proxy pattern?

Answer: Controlling access to a network resource or expensive object.

44. What is an example use case for the Facade pattern?

Answer: Simplifying access to a complex library or subsystem.

45. What is an example use case for the Template Method pattern?

Answer: Defining the steps for processing data while allowing customization of
specific steps.

46. What is an example use case for the Chain of Responsibility pattern?

Answer: Implementing a series of validation checks where each handler processes


part of the request.

47. What is an example use case for the State pattern?

Answer: Managing the behavior of an object based on its state, such as a media
player.

48. What is an example use case for the Mediator pattern?

Answer: Managing interactions between components in a chat application.

49. What is an example use case for the Memento pattern?

Answer: Saving and restoring the state of a game or text editor.

50. What is the key benefit of using design patterns?

Answer: To provide a proven solution to common design problems, making code


more reusable and maintainable

You might also like