QuizzesHistory & URLs — Client-Side Routing Underneath — Concept Check
intermediate
javascript

History & URLs — Client-Side Routing Underneath — Concept Check

Questions on History & URLs — Client-Side Routing Underneath. The History API changes the URL without a page load, and URLSearchParams parses query strings. Together they are what every client-side router is built on.

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 History & URLs — Client-Side Routing Underneath — Concept Check. Work through them here, then start the quiz to answer them and see your score.

  1. 1.A single-page application changes views without reloading the page. What does the History API use to change the URL without a server request?

    • Apopstate
    • BreplaceState
    • CURLSearchParams
    • DpushState
  2. 2.What happens when you call history.pushState() in a web application?

    • AThe URL does not change but popstate event fires
    • BThe URL changes but popstate event does not fire
    • CThe URL and popstate event both do not change
    • DThe URL changes and popstate event fires
  3. 3.In a React application, why might refreshing a page like '/problems/two-sum' result in a 404 error?

    • AReact Router is incorrectly configured
    • BThe URL is not properly encoded
    • CThe URLSearchParams are missing
    • DThe server must return index.html for unknown paths
  4. 4.How can you ensure that the state of a filter in a web application is shareable and survives a page refresh?

    • AStore the filter state in the URL
    • BStore the filter state in a component
    • CUse session storage for the filter state
    • DUse local storage for the filter state
  5. 5.A developer uses URLSearchParams to parse a query string. What is a benefit of using this API over manual parsing?

    • AIt automatically handles encoding and repeats
    • BIt only works with specific URL structures
    • CIt does not support repeated parameters
    • DIt requires manual handling of encoding
  6. 6.When using pushState, why is it recommended to render the view immediately after calling it?

    • ApushState triggers an automatic view update
    • BpushState does not trigger popstate, so manual rendering is needed
    • CpushState automatically renders the view
    • Dpopstate event fires immediately after pushState
  7. 7.A developer mistakenly believes that URLSearchParams can only read query strings. What can URLSearchParams actually do?

    • ARead, modify, and serialize query strings
    • BOnly read query strings
    • COnly serialize query strings
    • DOnly modify query strings
  8. 8.Why might a developer prefer to use URLSearchParams over manually parsing query strings?

    • AIt requires less code than any other method
    • BIt is faster than manual parsing
    • CIt is the only way to parse query strings
    • DIt simplifies handling of encoding and repeated parameters