Questions: Idempotent Operations in Distributed Systems

5 questions to test your understanding

Score: 0 / 5
Question 1 Multiple Choice

A payment service receives two HTTP requests with identical idempotency keys — the second is a retry after a network timeout. What should the server do?

AProcess both requests to ensure the payment completes — network timeouts mean the first may not have succeeded
BReject the second request with an error, forcing the client to generate a new idempotency key before retrying
CRecognize the duplicate key, skip the second operation, and return the result of the first successful execution
DBlock all subsequent requests for that account until the first request's outcome is manually confirmed
Question 2 Multiple Choice

An API has two balance endpoints: POST /accounts/{id}/credit with body {amount: 100} and PUT /accounts/{id}/balance with body {balance: 600}. A network fault causes each request to be delivered twice. Which outcome is correct?

ABoth endpoints charge twice — all POST and PUT requests must be treated as non-idempotent by default
BThe POST endpoint adds $200 total (non-idempotent: each delivery executes the increment), while the PUT endpoint sets the balance to $600 exactly once (idempotent: repeated sets produce the same result)
CThe PUT endpoint is non-idempotent because PUT creates a new resource on each call
DBoth endpoints are safe to retry because modern databases handle duplicate detection automatically
Question 3 True / False

If an operation fails and returns an error response, the client can safely retry it because a failed operation cannot have partially changed server state.

TTrue
FFalse
Question 4 True / False

HTTP DELETE is designed to be idempotent: sending the same DELETE request multiple times should produce the same server state as sending it once.

TTrue
FFalse
Question 5 Short Answer

A developer argues that idempotency is only important for payment systems and financial APIs. Why is this reasoning too narrow?

Think about your answer, then reveal below.