QuizzesGraphQL vs REST: Pros and Cons for Backend Development
intermediate
system-design

GraphQL vs REST: Pros and Cons for Backend Development

Evaluate the advantages and disadvantages of GraphQL and REST in backend development.

18 minutes 12 questions Pass at 70%
Time Limit
18 minutes - timer starts when you begin
Change Answers Freely
Revisit and change any answer before submitting
Full Review After Submit
Correct answers and explanations shown for every question
Auto-submit on timeout
Quiz submits automatically when time runs out

Questions in this quiz

12 questions on GraphQL vs REST: Pros and Cons for Backend Development. Work through them here, then start the quiz to answer them and see your score.

  1. 1.Which of the following is a key advantage of GraphQL over REST?

    • AGraphQL uses HTTP methods like GET and POST.
    • BGraphQL allows fetching multiple resources in a single request.
    • CGraphQL is inherently more secure than REST.
    • DGraphQL requires less client-side code.
  2. 2.What is a common drawback of using REST APIs?

    • AREST APIs are always slower than GraphQL.
    • BREST APIs cannot handle complex queries.
    • CREST APIs do not support caching.
    • DREST APIs require versioning when changes are made.
  3. 3.How does GraphQL handle over-fetching and under-fetching of data?

    • AGraphQL automatically optimizes queries to prevent these issues.
    • BGraphQL allows clients to specify exactly what data they need.
    • CGraphQL requires server-side configuration to handle these issues.
    • DGraphQL uses caching to prevent over-fetching.
  4. 4.Which of the following is a disadvantage of GraphQL?

    • AGraphQL cannot be used with existing REST APIs.
    • BGraphQL does not support real-time data updates.
    • CGraphQL queries can become complex and hard to manage.
    • DGraphQL is slower than REST for simple requests.
  5. 5.In what scenario might REST be preferred over GraphQL?

    • AWhen the API endpoints are stable and rarely change.
    • BWhen the API needs to handle complex queries.
    • CWhen the client requires real-time updates.
    • DWhen the client needs to specify exactly what data to retrieve.
  6. 6.How does REST typically handle different types of operations?

    • AREST uses a single endpoint for all operations.
    • BREST uses GraphQL-like queries for operations.
    • CREST uses HTTP methods like GET, POST, PUT, DELETE.
    • DREST requires a separate API for each operation type.
  7. 7.Why might GraphQL be considered more flexible than REST?

    • AGraphQL can only be used with JavaScript.
    • BGraphQL automatically scales better than REST.
    • CGraphQL requires no server-side schema.
    • DGraphQL allows clients to define the structure of the response.
  8. 8.What is a potential security concern with GraphQL?

    • AGraphQL does not support authentication.
    • BGraphQL does not support HTTPS.
    • CGraphQL queries can expose sensitive data if not properly secured.
    • DGraphQL requires open access to the database.
  9. 9.Which of the following is a benefit of REST's statelessness?

    • AREST scales easily as each request from client to server must contain all the information needed to understand and process the request.
    • BREST inherently supports real-time data updates.
    • CREST requires less bandwidth than GraphQL.
    • DREST can maintain user sessions easily.
  10. 10.How does GraphQL handle API versioning?

    • AGraphQL requires explicit versioning like REST.
    • BGraphQL does not require versioning as clients request specific fields.
    • CGraphQL uses HTTP headers for versioning.
    • DGraphQL uses URL parameters for versioning.
  11. 11.What is a common use case for choosing GraphQL over REST?

    • AWhen the API needs to support file uploads.
    • BWhen the API needs to be consumed by a single client.
    • CWhen the client needs to aggregate data from multiple sources in a single query.
    • DWhen the client requires a fixed response format.
  12. 12.Which of the following is a feature of REST that is not inherently part of GraphQL?

    • AREST requires a single endpoint for all operations.
    • BREST allows clients to specify response structure.
    • CREST supports HTTP status codes for error handling.
    • DREST supports real-time subscriptions.