Loading

Quipoin Menu

Learn • Practice • Grow

react / Routes and Links
mcq
Direction: Choose the correct option

Q1.

How do you create a basic route that renders the Home component at '/'?
A. <Route path='/'><Home /></Route>
B. <Route path='/' element={<Home />} />
C. <Route path='/' render={Home} />
D. <Route path='/' component={Home} />
Direction: Choose the correct option

Q2.

What is the purpose of the component?
A. It prevents navigation
B. It only works for external links
C. It navigates with a full page reload
D. It's the same as <Link> but adds styling attributes when active
Direction: Choose the correct option

Q3.

Which hook is used to navigate programmatically?
A. useNavigate
B. usePush
C. useHistory
D. useRedirect
Direction: Choose the correct option

Q4.

What does the 'exact' prop do in React Router v5? (v6 uses exact by default)
A. It makes the route case-sensitive
B. It's used for redirects
C. It matches the route only once
D. It ensures the route matches exactly, not partially
Direction: Choose the correct option

Q5.

How do you define a wildcard route to handle 404 pages?
A. <Route path='/*' element={<NotFound />} />
B. <Route path='404' element={<NotFound />} />
C. <Route component={NotFound} />
D. <Route path='*' element={<NotFound />} />