Q1.What is idempotency, which HTTP methods are idempotent, and why does a tester care?
Separates candidates who memorised a methods table from those who understand retry safety.
An operation is idempotent when performing it N times leaves the server in the same state as performing it once. GET, HEAD, PUT and DELETE are defined as idempotent; POST and PATCH are not (PATCH can be, but is not required to be).
It matters because clients, proxies and load balancers retry. If a payment endpoint is POST and the client retries after a timeout, the customer can be charged twice. The testable requirement is usually an idempotency key: send the same key twice and assert the second call returns the original result rather than creating a second resource.
- Confusing idempotent with safe — DELETE is idempotent but definitely not safe.
- Assuming idempotent means 'returns the same status code'; the second DELETE legitimately returns 404.