CS FundamentalsModerateGATE CS · Product company CS fundamentals
A REST API creates a resource in response to a POST. Which response is most appropriate?
- A. 200 OK with no body
- B. 201 Created with a Location header pointing to the new resource
- C. 204 No Content with the new ID in the body
- D. 302 Found to the collection URL
Correct answer: B. 201 Created with a Location header pointing to the new resource
201 tells the client that a new resource exists and Location gives its URL. 204 means success with no body at all, and redirects (3xx) are for moving the client elsewhere, not for reporting creation.
More Computer Networks questions
- Which application protocols use UDP by default? SNMP, NTP, SSH, DHCP
- Uncompressed 1080p video (1920 × 1080 pixels, 24 bits per pixel, 30 frames/s) is sent over a network. What bit rate does it need?
- A 1 Gbps switch forwards a 1500-byte frame. A store-and-forward switch waits for the whole frame; a cut-through switch starts forwarding…
- A signal goes from a ground station up to a geostationary satellite (altitude about 35,786 km) and down to another ground station…
- On a 1 Gbps path with RTT 10 ms, what throughput can one TCP connection reach with a 65,535-byte window, and with the same window scaled…
- The IPv4 fragment-offset field is 13 bits and counts 8-byte units. What is the largest offset (in bytes) a fragment can have, and why must…