What does the ChangeDetectionStrategy.OnPush strategy signify in an Angular component?

  • Automatic change detection
  • Manual change detection
  • No change detection
  • Two-way data binding
The ChangeDetectionStrategy.OnPush signifies that change detection is manual, and Angular checks for changes only when data-bound properties change or events occur.

In Angular, the data fetched by the Route Resolver can be accessed in the component through the route's _____ property.

  • data
  • params
  • queryParams
  • routeData
The blank should be filled with data. The data fetched by the Route Resolver can be accessed in the component through the route's data property.

You want to implement a feature that prompts the user if they try to navigate away from a form without saving changes. Which Route Guard would you use to achieve this?

  • CanActivate Route Guard
  • CanDeactivate Route Guard
  • CanLoad Route Guard
  • Resolve Route Guard
To prompt the user when navigating away from a form, you should use the CanDeactivate Route Guard. It checks if the form can be deactivated without saving changes.

What is the purpose of a lazy-loaded module in Angular?

  • To decrease initial bundle size
  • To ensure a module is always loaded
  • To improve application performance
  • To simplify routing configuration
The purpose of a lazy-loaded module in Angular is to decrease the initial bundle size by loading the module on-demand, typically when a user navigates to a specific route. This helps improve application performance.

How can you access the data resolved by a Route Resolver within a component?

  • Using a decorator
  • Using a function
  • Using a service
  • Using an observable
You can access data resolved by a Route Resolver within a component using an observable returned by the ActivatedRoute service.

In what scenario would you use the fragment property of the NavigationExtras object?

  • For routing configuration
  • For smooth scrolling
  • To handle query parameters
  • To manage lazy loading
The fragment property of the NavigationExtras object is used for smooth scrolling to a specific location on a page after navigation.

When creating a dynamic form, how can you ensure that the form adjusts based on data fetched from an API?

  • Use ngFor directive to iterate through form controls
  • Use ngIf directive to conditionally render form elements
  • Use reactive forms with a fixed structure
  • Use static HTML templates
To ensure that a dynamic form adjusts based on data fetched from an API in Angular, you should use the ngFor directive to iterate through form controls. This allows you to generate form elements dynamically based on the API data.

To display a validation error message only when a form control is touched and invalid, you can use the expressions formControlName._____ and formControlName._____.

  • dirty, pristine
  • touched, pristine
  • valid, dirty
  • valid, invalid
To display a validation error message only when a form control is touched and invalid, you can use the expressions formControlName.touched and formControlName.pristine.

In a real-time data streaming application built with Angular, you want to ensure that multiple components receive the same data from an observable without creating multiple subscriptions. What kind of observable would you use?

  • AsyncSubject
  • BehaviorSubject
  • ReplaySubject
  • Subject
To ensure multiple components receive the same data from an observable without multiple subscriptions, you would use a ReplaySubject. It replays the latest emitted value to all new subscribers.

How can you access a specific form control within a form group in Angular?

  • Using form.get()
  • Using formArray
  • Using formControl
  • Using formGroup.get()
You can access a specific form control within a form group in Angular by using the **formGroup.get()** method. It allows you to retrieve a form control by its name.

Which RxJS operator is commonly used to filter items emitted by an Observable based on a condition?

  • catchError
  • filter
  • switchMap
  • takeUntil
The RxJS operator commonly used to filter items emitted by an Observable based on a condition is filter. It allows you to specify a predicate function to determine which items should be included in the output.

To execute the Observable and start emitting values, you need to call the _____ method.

  • emit()
  • execute()
  • start()
  • subscribe()
To execute the Observable and start emitting values, you need to call the subscribe() method. This method subscribes to the Observable and listens for emitted values.