Loading

Quipoin Menu

Learn • Practice • Grow

angular / Setting Up Routes
mcq
Direction: Choose the correct option

Q1.

How do you define a simple route for `/home`?
A. { path: 'home', component: HomeComponent }
B. { path: '/home', component: HomeComponent }
C. { route: 'home', component: HomeComponent }
D. { url: '/home', comp: HomeComponent }
Direction: Choose the correct option

Q2.

What is a wildcard route (e.g., path: '**') used for?
A. To load lazy modules
B. To match any route
C. To handle 404 - pages not found
D. To redirect to home
Direction: Choose the correct option

Q3.

How do you redirect from one path to another?
A. { path: '', forward: '/home' }
B. { path: '', redirectTo: '/home', pathMatch: 'full' }
C. { path: '', to: '/home' }
D. { path: '', redirect: '/home' }
Direction: Choose the correct option

Q4.

What does `pathMatch: 'full'` mean?
A. Partial match
B. Case-sensitive match
C. Only the prefix matches
D. The entire path must match
Direction: Choose the correct option

Q5.

Where are routes typically defined in an Angular application?
A. In app.component.ts
B. In a separate routing module or app-routing.module.ts
C. In angular.json
D. In main.ts
Direction: Choose the correct option

Q6.

What is the purpose of `loadChildren` in routes?
A. To load child routes
B. To load services
C. To define lazy-loaded modules
D. To load components
Direction: Choose the correct option

Q7.

What is an empty path route?
A. A route with path: '' which matches the base URL
B. An invalid route
C. A route with no path
D. A default route
Direction: Choose the correct option

Q8.

How do you define routes with parameters?
A. `{ path: 'user', component: UserComponent, param: 'id' }`
B. `{ path: 'user', component: UserComponent, params: true }`
C. `{ path: 'user/:id', component: UserComponent }`
D. `{ path: 'user/{id}', component: UserComponent }`
Direction: Choose the correct option

Q9.

What is the `data` property in routes used for?
A. To create data services
B. To load data dynamically
C. To attach static data to a route
D. To define data types
Direction: Choose the correct option

Q10.

How do you define multiple routes with same path but different methods?
A. Cannot have same path; need different paths
B. Using `verb` property
C. Using `method` property
D. Using `action` property