CS FundamentalsHardProduct-company API design interview
A mobile home screen needs a user's name, the titles of their last 3 orders and their unread-notification count. The REST API needs 3 calls returning large objects. Which statement about GraphQL is correct?
- A. The client can ask for exactly those fields in one query, avoiding over-fetching and multiple round trips, though server-side caching and query cost control become harder
- B. GraphQL always makes the server faster
- C. GraphQL removes the need for authorisation
- D. GraphQL requires one endpoint per field
Correct answer: A. The client can ask for exactly those fields in one query, avoiding over-fetching and multiple round trips, though server-side caching and query cost control become harder
GraphQL lets clients shape responses, solving under- and over-fetching. The trade-offs: plain HTTP caching works less naturally with a single POST endpoint, and expensive nested queries need limits.
Practise more Software Engineering, Git and Cloud Basics questionsSoftware Engineering, Git and Cloud Basics: notes and key points
More Software Engineering, Git and Cloud Basics questions
- An API accepts a video for transcoding, which takes several minutes. What is the most appropriate immediate response?
- What is the difference between the HTTP headers Cache-Control: no-cache and Cache-Control: no-store?
- A web app at https://app.example.com sends a PUT request with a JSON body to https://api.example.com. Before the PUT, the browser sends…
- An API uses self-contained JWT access tokens that are valid for 24 hours and are verified only by signature. A user's laptop is stolen and…
- A token-bucket rate limiter holds up to 10 tokens and refills 2 tokens per second; it starts full. A client fires requests as fast as…
- main has A-B-C. feature1 branched from C with commits D-E, and feature2 branched from E with commits F-G. feature1 is abandoned, but…