Bird
0
0

If a client sends:

medium📝 Predict Output Q5 of 15
Rest API - Request and Response Format
If a client sends:
Accept: application/xml;q=0.7, application/json;q=0.9
and the server supports both formats, which will it choose?
Aapplication/xml
Bapplication/json
Ctext/html
Dapplication/octet-stream
Step-by-Step Solution
Solution:
  1. Step 1: Compare quality factors in Accept header

    application/json has q=0.9, application/xml has q=0.7.
  2. Step 2: Server picks highest quality supported format

    Server chooses application/json because 0.9 > 0.7.
  3. Final Answer:

    application/json -> Option B
  4. Quick Check:

    Higher q value = application/json [OK]
Quick Trick: Server picks format with highest q value in Accept header [OK]
Common Mistakes:
MISTAKES
  • Choosing lower q value format
  • Ignoring q values and picking first listed
  • Assuming server picks text/html by default

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes