Loading

Quipoin Menu

Learn • Practice • Grow

Direction: Choose the correct option

Q1.

What are route guards in Angular?
A. Route parameters
B. Route resolvers
C. Security guards
D. Interfaces that control access to routes
Direction: Choose the correct option

Q2.

Which guard is used to check if a user can enter a route?
A. CanDeactivate
B. Resolve
C. CanActivate
D. CanLoad
Direction: Choose the correct option

Q3.

What does `CanDeactivate` guard do?
A. Resolves data
B. Checks if the user can enter
C. Checks if the user can leave the current route
D. Checks if the module can be loaded
Direction: Choose the correct option

Q4.

How do you implement a guard?
A. Create a service implementing the guard interface (e.g., CanActivate)
B. Create a pipe
C. Create a directive
D. Create a component
Direction: Choose the correct option

Q5.

What does a guard typically return?
A. number
B. string
C. void
D. boolean, UrlTree, or Observable/Promise of them
Direction: Choose the correct option

Q6.

What is the `CanLoad` guard used for?
A. To check loading
B. To load modules
C. To prevent lazy loading of modules
D. To load guards
Direction: Choose the correct option

Q7.

What is the `Resolve` guard used for?
A. To resolve parameters
B. To resolve URLs
C. To resolve conflicts
D. To pre-fetch data before activating a route
Direction: Choose the correct option

Q8.

How do you apply multiple guards to a route?
A. Using `&`
B. Using `and` operator
C. In an array: `canActivate: [AuthGuard, RoleGuard]`
D. Separate by commas
Direction: Choose the correct option

Q9.

What is the order of execution of guards?
A. CanLoad -> CanActivate
B. CanDeactivate -> CanLoad -> CanActivateChild -> CanActivate
C. CanActivateChild -> CanActivate
D. CanActivate -> CanDeactivate
Direction: Choose the correct option

Q10.

Can guards be applied at component level?
A. Yes, using @Component
B. Yes, using @Directive
C. Yes, using @Injectable
D. No, they are applied in route configuration