QuizzesCORS — What Is Actually Happening — Concept Check
intermediate
full-stack

CORS — What Is Actually Happening — Concept Check

Questions on CORS — What Is Actually Happening. The browser blocks your response because you asked another origin for it. CORS is the server's way of saying that is allowed — which is why no amount of frontend code can fix it.

8 minutes 8 questions Pass at 70%
Time Limit
8 minutes - timer starts when you begin
Change Answers Freely
Revisit and change any answer before submitting
Full Review After Submit
Correct answers and explanations shown for every question
Auto-submit on timeout
Quiz submits automatically when time runs out

Questions in this quiz

8 questions on CORS — What Is Actually Happening — Concept Check. Work through them here, then start the quiz to answer them and see your score.

  1. 1.A developer notices that their web application works perfectly with curl but fails with a CORS error in the browser. What is the likely reason?

    • AThe server is not reachable from the browser.
    • BThe server is down.
    • CThe server is not configured to allow the browser's origin.
    • DThe browser has a bug.
  2. 2.A frontend engineer sends a POST request with 'Content-Type: application/json' and it fails due to a CORS error. What should they check first?

    • AAdd 'application/json' to the request headers.
    • BUse a different HTTP method.
    • CChange the request to a simple GET request.
    • DEnsure the server handles OPTIONS requests for preflight.
  3. 3.Why might a CORS error occur even if the server sends the correct 'Access-Control-Allow-Origin' header?

    • AThe server is not sending 'Access-Control-Allow-Credentials'.
    • BThe server is not responding to preflight requests.
    • CThe server is not sending 'Access-Control-Allow-Headers'.
    • DThe client is using an unsupported HTTP method.
  4. 4.A developer configures CORS to allow 'http://localhost:3000', but the browser reports a CORS error. What might be the issue?

    • AThe browser does not support CORS.
    • BThe server is not reachable from the browser.
    • CThe server is using an outdated CORS library.
    • DThe server is configured for a different origin.
  5. 5.Which of the following requests would trigger a CORS preflight?

    • AA POST request with 'Content-Type: text/plain'.
    • BA HEAD request with no custom headers.
    • CA GET request with no custom headers.
    • DA POST request with 'Content-Type: application/json'.
  6. 6.A developer sees 'No 'Access-Control-Allow-Origin' header is present' in the browser console. What is the most likely cause?

    • AThe server did not send the required CORS headers.
    • BThe client is sending requests with incorrect headers.
    • CThe server is blocking all incoming requests.
    • DThe browser is not making the request.
  7. 7.A team is debugging a CORS issue and sees 'Request header field x-request-id is not allowed'. What should they do?

    • ARemove 'x-request-id' from the request headers.
    • BUse a different HTTP method.
    • CAdd 'x-request-id' to 'Access-Control-Allow-Headers'.
    • DDisable CORS on the server.
  8. 8.Why is it incorrect to assume that a CORS error can be fixed with frontend code?

    • AThe browser doesn't support frontend fixes for CORS.
    • BCORS errors are caused by incorrect JavaScript syntax.
    • CCORS errors are due to network issues.
    • DCORS is enforced by the server, not the client.