CS FundamentalsVery hardGATE CS · Product company CS fundamentals
A page at https://app.example.com uses fetch() to send a PUT request with a JSON body to https://api.example.com. What happens first?
- A. An OPTIONS preflight; the PUT follows only if CORS headers allow it
- B. The browser sends the PUT immediately and blocks only the response
- C. The server must reply with 301 before the PUT
- D. Nothing special happens because both are subdomains of example.com
Correct answer: A. An OPTIONS preflight; the PUT follows only if CORS headers allow it
Different subdomains are different origins. PUT with a JSON content type is not a 'simple' request, so the browser asks permission with OPTIONS (Access-Control-Request-Method) and proceeds only if Access-Control-Allow-Origin/Methods permit it.
More Computer Networks questions
- How does a WebSocket connection start?
- A REST API creates a resource in response to a POST. Which response is most appropriate?
- 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…