CS FundamentalsHardProduct-company placement
A team wants its HTTP API to allow safe retries of PUT /users/42 with the full user body. Which property of PUT makes this safe, and what must the server ensure?
- A. PUT is safe (read-only), so the server may ignore it
- B. PUT is cacheable, so the second request is served from a cache
- C. PUT is neither safe nor idempotent, so retries are never allowed
- D. PUT is idempotent: the server must apply it as a full replacement so that sending the same request twice leaves the same state as sending it once
Correct answer: D. PUT is idempotent: the server must apply it as a full replacement so that sending the same request twice leaves the same state as sending it once
Idempotence means repeated identical requests have the same effect as one. Implementing PUT as 'increment a counter' or 'append' would break that contract; it changes state, so it is not safe.
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
- Putnam's software equation implies that, for a fixed size and process productivity, effort varies as 1/t^4, where t is the development…
- A project has BAC = ₹500 lakh, PV = ₹240 lakh, EV = ₹200 lakh and AC = ₹250 lakh. If both cost and schedule performance are expected to…
- Last sprint, 6 developers working 10 days completed 30 story points. Next sprint 5 developers are available for 9 days each. Using the…
- A single-server queue (M/M/1) serves 10 requests per second. At 8 requests/s the mean response time W = 1/(μ - λ) is 0.5 s. What happens…
- 90% of a CI pipeline's run time is parallelisable tests and 10% is serial setup. Moving to 8 parallel runners, what overall speed-up does…
- A suite of 1,200 tests averaging 3 seconds each is split evenly across 6 parallel shards, and each shard needs 2 minutes of setup before…