Loading

Quipoin Menu

Learn • Practice • Grow

angular / Router Outlet and Navigation
mcq
Direction: Choose the correct option

Q1.

What is ``?
A. A router for outlets
B. A CSS class
C. A directive that marks where the routed component should be displayed
D. An outlet for HTTP
Direction: Choose the correct option

Q2.

How do you navigate programmatically?
A. Use `window.location`
B. Inject Router and call `router.navigate(['/path'])`
C. Use `href`
D. Use `ngNavigate` directive
Direction: Choose the correct option

Q3.

What is the `routerLink` directive used for?
A. To link to services
B. To link to modules
C. To create links in templates for navigation
D. To link to CSS
Direction: Choose the correct option

Q4.

What does `routerLinkActive` do?
A. Adds a CSS class when the link is active
B. Enables routing
C. Links to active routes
D. Activates the router
Direction: Choose the correct option

Q5.

How do you get the current route URL in a component?
A. Use `window.location`
B. Inject Router and use `router.url`
C. Inject ActivatedRoute
D. Use `location` service
Direction: Choose the correct option

Q6.

What is the difference between `router.navigate()` and `router.navigateByUrl()`?
A. `navigateByUrl()` is for relative paths
B. They are the same
C. `navigate()` is for absolute paths
D. `navigateByUrl()` uses a string URL; `navigate()` uses an array
Direction: Choose the correct option

Q7.

How do you pass query parameters with `routerLink`?
A. `queryParams` attribute
B. `[queryParams]='{page: 1}'`
C. `[params]`
D. `[query]`
Direction: Choose the correct option

Q8.

How do you preserve query parameters during navigation?
A. `saveQuery: true`
B. `keepQuery: true`
C. `queryParamsHandling: 'preserve'` or `'merge'`
D. `preserveQueryParams: true`
Direction: Choose the correct option

Q9.

What is a relative navigation in Angular?
A. Navigation with relative URLs
B. Navigation to parent
C. Navigation to relative paths
D. Navigation relative to the current route
Direction: Choose the correct option

Q10.

What does `routerLinkActiveOptions` do?
A. Configures router options
B. Configures link options
C. Configures exact matching for `routerLinkActive`
D. Configures active options