Idempotency — Concept Check
Questions on Idempotency. An operation is idempotent if performing it multiple times produces the same result as performing it once. Idempotency is essential in distributed systems where retries and duplicate messages are inevitable.
Questions in this quiz
8 questions on Idempotency — Concept Check. Work through them here, then start the quiz to answer them and see your score.
1.A payment service receives duplicate POST requests due to a network glitch. How can it prevent double charges?
- AImplement retries without any additional checks
- BUse idempotency keys to ensure each request is processed once
- CRely on the client to avoid sending duplicate requests
- DUse GET requests instead of POST for payment processing
2.A developer claims that all HTTP methods are idempotent. Which method contradicts this claim?
- APUT
- BPOST
- CGET
- DDELETE
3.In a distributed system, a message queue consumer processes the same message twice. What mechanism can prevent this?
- AIncrease the queue size to handle duplicates
- BUse a faster network to reduce message duplication
- CImplement a retry mechanism without tracking
- DTrack processed message IDs to avoid reprocessing
4.A client retries a POST request with an idempotency key. What should the server do if the request was already processed?
- AProcess the request again to ensure consistency
- BReturn an error indicating a duplicate request
- CReturn the cached response without reprocessing
- DIgnore the request to prevent duplicate processing
5.A developer uses a PATCH request to update a resource. Is this operation always idempotent?
- AYes, if used with idempotency keys
- BNo, it depends on the implementation
- CNo, PATCH is never idempotent
- DYes, PATCH is always idempotent
6.A payment API uses idempotency keys. What happens if a client sends a request with a previously used key?
- AThe server processes the request again
- BThe server charges the client again
- CThe server returns the cached response
- DThe server rejects the request as invalid
7.A developer believes DELETE requests are not idempotent because they modify resources. What's the flaw in this reasoning?
- ADELETE is idempotent because deleting the same resource multiple times has no additional effect
- BDELETE is only idempotent if the resource exists
- CDELETE requires idempotency keys to be idempotent
- DDELETE is not idempotent because it changes resource state
8.A service processes payments and uses Redis for idempotency key storage. Why is a TTL important in this setup?
- AIt prevents the storage from growing indefinitely
- BIt allows keys to be reused immediately
- CIt avoids the need for idempotency keys
- DIt ensures keys are always available