To enable lazy loading in Angular, you need to use the _____ property in your routing configuration.

  • enableLazyLoad
  • lazyLoad
  • loadChildren
  • routeLazy
To enable lazy loading in Angular, you need to use the loadChildren property in your routing configuration to specify the module to load lazily.

What technique can be used to ensure that an observable is automatically unsubscribed from, even if it was not manually unsubscribed?

  • Angular automatically unsubscribes all observables by default.
  • Employing the finalize operator to ensure automatic unsubscription.
  • Implementing a custom unsubscription handler function.
  • Using the unsubscribe method in a subscription.
To ensure that an observable is automatically unsubscribed, you can use the finalize operator, which allows for automatic cleanup when the observable completes, errors, or is unsubscribed. It is a good practice to prevent memory leaks.

The _____ decorator is used to mark a class as available to be provided and injected as a dependency.

  • @Component
  • @Dependency
  • @Injectable
  • @Service
The @Injectable decorator is used to mark a class as available to be provided and injected as a dependency in Angular.

You have an Angular form where users can input an email address. You want to check in real-time whether the email address is already registered in your system. Which type of validation would be suitable for this?

  • Async Validators that perform server-side checks.
  • Built-in Validators like required and email.
  • Custom Synchronous Validators with JavaScript functions.
  • Pattern Validators with regular expressions.
To check in real-time whether an email address is already registered, you should use Async Validators that perform server-side checks, allowing you to query the server for existing email addresses.

To test a component as a whole, including its interaction with child components, you should use _____ testing.

  • e2e
  • integration
  • mock
  • unit
To test a component as a whole, including its interaction with child components, you should use integration testing. This allows testing the component's behavior in a broader context.

When components need to be loaded dynamically at runtime, you make use of Angular's _____.

  • ComponentFactoryResolver
  • DI (Dependency Injection)
  • NgModule
  • Route Guards
When components need to be loaded dynamically at runtime, you make use of Angular's ComponentFactoryResolver. This allows dynamic component creation in Angular applications.

When defining routes, the _____ property specifies which component should be displayed when a particular path is navigated to.

  • component
  • componentSelector
  • componentToShow
  • viewComponent
When defining routes, the component property specifies which component should be displayed when a particular path is navigated to.

What is the main advantage of using Angular Universal for server-side rendering?

  • Enhanced development experience
  • Improved SEO and faster initial page loads
  • Native mobile app support
  • Simplified component creation
The main advantage of using Angular Universal for server-side rendering is improved SEO and faster initial page loads. It allows search engines to index your content better and speeds up the first page load.

What is the primary purpose of two-way data binding in Angular?

  • Handle user input
  • Send data from template to class
  • Synchronize data between class & template
  • Trigger events automatically
The primary purpose of two-way data binding in Angular is to synchronize data between the component's class and its template, allowing changes in one to reflect in the other, making it useful for forms and interactive UI elements.

To ensure proper cleanup and prevent memory leaks, it's important to unsubscribe from observables when they are no longer needed.

  • close
  • complete
  • disconnect
  • unsubscribe
To ensure proper cleanup and prevent memory leaks, it's important to unsubscribe from observables when they are no longer needed.