Skip to content
Tech Interview Prep
Technical interview guide

Working with APIs & Technical Specs

Reading and reviewing technical specs and API contracts well enough to catch problems before they ship.

Read
32 min
Practice MCQs
25
Interview Q&A
25
Edition
v3
Editorial status
Reviewed

Scope: OpenAPI 3.2.0, HTTP RFC 9110/9111, Problem Details RFC 9457, OAuth Security BCP RFC 9700, JSON Schema 2020-12, OWASP API Top 10:2023, gRPC, Protobuf proto3, and W3C Trace Context current 2026-08-31.

Curated: · Written: · Reviewed:

25 questions

MCQ-1A CI job runs `swagger-cli validate openapi.yaml` on every pull request and exits 0 on the current document. A downstream team generates a client from that document; their integration test fails because the server returns `{"amount": "19.99"}` for a field the document declares as `type: number`. The spec author says the validator passed, so the document is right. What did the passing validation actually establish?
MCQ-16A payments team describes `POST /refunds` in an OpenAPI 3.1 document. The request body schema is: ```yaml type: object properties: amount: {} currency: {} example: amount: 2500 currency: EUR ``` The API gateway validates every incoming body with ajv against the `schema` object. A client sends `{"amount": "2500", "currency": "EUR"}` and the gateway forwards it, so the refund service receives a string where it expects a number. Which single change to the document makes the validator reject that exact payload?
MCQ-25A payments API is spec-first: `POST /charges` declares `amount_cents` as an integer and sets `additionalProperties: false`. A partner's client has started sending `"amount_cents": "1250"` (a JSON string) plus an extra `idempotency_hint` field. The handler's deserializer coerces the string and drops the unknown field, so charges are created and the drift stays invisible until a downstream ledger job rejects the row. The partner cannot change its client. Which change surfaces the drift at the moment it happens?
MCQ-23A pricing service (the provider) is about to deploy a change that renames the `unitPrice` field to `price` in its `GET /quote` response. Three consumers (checkout, cart, and invoice) have each published a Pact contract to the team's broker. The provider's CI runs provider verification against the broker's latest contracts before deploy. What is the outcome of that verification step?
MCQ-6The accounts API gains one field, with nothing removed, renamed or retyped: GET /v2/accounts/{id} -> {"id":"acct_9","balance_cents":4200,"credit_limit_cents":0} The OpenAPI document marks credit_limit_cents required: false. Three clients read that body, all shipped as-is: - Android app 3.2: hand-written Java DTO with fields id and balanceCents, read by a plain new ObjectMapper() (Jackson 2.16, default feature flags, no @JsonIgnoreProperties anywhere). - Go service: json.NewDecoder(resp.Body).Decode(&acct) into a struct with Id and BalanceCents, with no DisallowUnknownFields(). - Python service: pydantic v2 BaseModel with id and balance_cents, no extra= in the model config. Which client fails on the first accounts call after the deploy, and why?
MCQ-22An internal payment orchestration cluster handles high-throughput East-West remote procedure calls where CPU consumption during message serialization and transport-level connection overhead dominate p99 latency. Which architectural property provides the technical basis for choosing gRPC over REST/JSON for this cluster?
MCQ-7A payments service ships `message Charge { int32 user_id = 3; }` in proto3 v1. For v2 the team deletes `user_id` and declares `bool is_admin = 3;` in the same message, then deploys the v2 server while v1 mobile clients are still sending charges. A v1 client sends a charge with `user_id = 1`. What does the v2 server decode for that message?
MCQ-17A payments API publishes a proto3 `PaymentState` enum with `PENDING = 0` and `SETTLED = 1`. The team adds `REFUNDED = 2` and ships it. A Go consumer you own, built with `protoc-gen-go`, handles the field with: ```go switch p.State { case pb.PaymentState_PENDING: ledger.MarkPending(p) case pb.PaymentState_SETTLED: ledger.MarkSettled(p) } ``` Refunded orders stop reaching the ledger and the service logs no errors. The API team ships a new enum value most months, and the ledger must account for every payment the API emits. Which change to the consumer fixes this and the next occurrence?
MCQ-13A team's deprecation policy allows a v1 endpoint to be sunset only when both conditions hold: at least 90 days have passed since the deprecation notice was published, and the endpoint has had 30 consecutive days with zero calls. The notice for `/v1/charges` was published on 2024-01-15, and the last v1 call was on 2024-03-25. What is the earliest date the endpoint may be sunset?
MCQ-18A gateway sends `traceparent: 00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01` to the checkout service. The checkout service handles the request and makes one outbound call to the payment service; its tracer assigns that outbound span the id `b7ad6b7169203331`. Which traceparent should the checkout service send to the payment service so both spans land in the same trace?
MCQ-14Over a 10-minute window a service handles 600,000 requests. 95% hit a cache and complete in 5 ms; the other 5% miss and complete in 400 ms. The team reports a mean latency of 25 ms. The SLO is 'p99 under 100 ms'. Which conclusion does the data support?
MCQ-5A service exposes invoices to multiple tenants. FastAPI 0.111 on Python 3.12: ```python from fastapi import FastAPI, Depends, Header app = FastAPI() INVOICES = { 101: {"id": 101, "tenant": "acme", "total": 4200}, 102: {"id": 102, "tenant": "globex", "total": 9100}, } def caller_tenant(authorization: str = Header(...)) -> str: claims = verify_jwt(authorization) # raises 401 on bad signature or expired exp return claims["tenant"] @app.get("/invoices/{invoice_id}") def read_invoice(invoice_id: int, tenant: str = Depends(caller_tenant)): return INVOICES[invoice_id] ``` A caller sends `GET /invoices/102` with a valid, unexpired token whose `tenant` claim is `acme`. What does the service return?
MCQ-21A multi-tenant API issues JWT access tokens carrying `sub`, `tenant`, `scope=reports:read`, `aud`, and `exp`. Reports are shared by every user within a tenant. The resource server authorizes `GET /reports/{id}` by checking only that the token's `scope` contains `reports:read`, then returns the report. A user reads a report belonging to a different tenant by editing the id. Which check closes the hole without breaking legitimate access?
MCQ-12A public API returns 500 responses as `{"error": {"message": "<raw exception text>"}}`. The shipped mobile app renders `error.message` to the user and the next release is six weeks out. Support debugs customer reports from screenshots of that message. A pentest, using a valid API key, sends `{"amount": "1e999"}` and gets back a message naming the internal table `ledger_entries` and the Postgres version. Which change removes the leak while keeping the shipped app and the support workflow working?
MCQ-2A client library retries a request once when the connection is reset before any response byte arrives. It calls PUT /v1/accounts/7/balance with body {"balance": 500}, the handler sets the balance to the body value, and POST /v1/accounts/7/transfers with body {"amount": 100}. The handler appends a transfer and adds 100 to transfers_total. Account 7 starts at balance 300 and transfers_total 0. Both first attempts are reset after the server has already committed them, and both retries succeed. What is the final state?
MCQ-10A batch-import service answers POST /imports with 202 Accepted, a Location: /imports/8f3c header, and a body of {"id":"8f3c"}. GET /imports/8f3c answers 200 from the moment the POST returns, with a JSON body whose state field is running until the import finishes and done afterwards; the import takes about 40 seconds. The client library treats every 2xx as terminal success, so the UI flips the import to Complete the moment the POST returns, and users who open the destination table immediately see no rows. What change makes the client report the import correctly?
MCQ-11A payments service runs 6 identical pods behind a load balancer that spreads requests randomly across them. Each pod keeps idempotency keys in a local in-memory map with a 24-hour TTL; there is no shared store. A client sends POST /charges with Idempotency-Key: 9c1f..., the request times out at the gateway's 30-second limit after the charge has been written, and the client immediately retries with the same key. What happens?
MCQ-4A payments API returns HTTP 500 with body `{"code": "card_declined", "retryable": false}` when the card issuer declines a charge. The client is a third-party SDK you cannot modify. Its documented behaviour: retry any 5xx up to 3 times with exponential backoff; retry 429 after the `Retry-After` delay; ignore the response body. Last Tuesday the issuer declined 5,000 charges, the SDK produced 20,000 authorization attempts, and the acquirer billed $0.02 per attempt. Which change to the error contract removes the $300 spent on attempts 2–4?
MCQ-24A gateway receives a request carrying a 2000 ms client deadline and calls service A, which calls service B. Each hop sets its own 2000 ms timeout independently: no deadline header is forwarded downstream, and no cancellation is sent when a caller gives up. During an incident B takes 2100 ms on every attempt, and A retries once on timeout. Which outcome follows?
MCQ-3A payments service sends 2,500 requests per second to a ledger. On a 503 the client retries the request, up to 3 attempts in total, with no cap on the total number of retries; any other response ends the request. During a ledger incident each attempt independently has a 40% chance of returning 503. What request rate does the ledger receive during the incident?
MCQ-9A CDN fronts an origin that serves `GET /v1/items/{id}` with `Cache-Control: public, max-age=3600`. There are 40,000 distinct ids, and requests arrive uniformly across all of them at a combined 8,000 requests/second. The CDN cache holds 10,000 objects and evicts LRU. How many requests per second reach the origin?
MCQ-8A posts table holds 100 rows, and a feed endpoint pages through it with `SELECT id, created_at FROM posts ORDER BY created_at DESC LIMIT 20 OFFSET :n`. A client fetches page 1 (n = 0), and before it requests page 2 (n = 20), 5 posts are inserted with created_at newer than every existing row. Nothing else changes. What does the page-2 response contain?
MCQ-15An API enforces 600 requests per minute per API key using a fixed window aligned to the wall clock, and the limiter's counter is shared across all gateway nodes. A client sends 590 requests in the last second of one minute and 590 in the first second of the next; the limiter rejects none of them, and the backend logs 1,180 requests across those two seconds. Which explanation accounts for the limiter allowing 1,180 requests in two seconds?
MCQ-20An `accounts` table has `id`, `balance`, and `version`. Row 1 starts at balance 500, version 5. Two sessions each read version 5 and then run: `UPDATE accounts SET balance = balance + <delta>, version = version + 1 WHERE id = 1 AND version = 5;` Session A computes delta = 100 and commits first. Session B computes delta = 50 and then runs its statement on PostgreSQL 16 under the default READ COMMITTED isolation. What does Session B's statement do?
MCQ-19A Go client opens a bidirectional streaming RPC and sends 5,000 requests of 200 bytes each in a single loop before it starts reading responses. The server handler reads one request, writes a 1 KiB response, then reads the next. Both sides use default gRPC settings. The call stalls partway through the client's send loop and eventually hits its deadline. What is the cause?