To create a form control that can hold an array of values, Angular provides the _______ class.

  • ArrayControl
  • FormArray
  • FormControlArray
  • FormGroupArray
To create a form control that can hold an array of values, Angular provides the FormArray class. A FormArray is a part of Angular's reactive forms, and it can hold an array of FormControls or other FormArrays.

To apply a function to each item emitted by an Observable, you use the _____ operator in RxJS.

  • combineLatest
  • pluck
  • take
  • tap
To apply a function to each item emitted by an Observable, you use the tap operator in RxJS. The tap operator is typically used for side effects without modifying the values emitted.

How do you inject a service into an Angular component?

  • In the component's constructor
  • Using HTML attributes
  • Via @NgModule metadata
  • With an external JavaScript file
You inject a service into an Angular component by including it as a parameter in the component's constructor. This allows the component to use the service's methods and properties.

How can you retrieve query parameters and fragments in addition to route parameters using Angular's router?

  • ActivatedRoute
  • Route guards
  • Router events
  • Snapshot routing
To retrieve query parameters and fragments in addition to route parameters, you can use ActivatedRoute. ActivatedRoute provides access to route parameters, query parameters, and fragments.

When handling errors in an Observable stream, which operator allows you to provide a fallback Observable?

  • catchError
  • concatMap
  • mergeMap
  • switchMap
The catchError operator allows you to handle errors in an Observable stream and provide a fallback Observable.

What is the purpose of the --prod flag when building an Angular application using the Angular CLI?

  • Create a new production app
  • Enable Angular Pro mode
  • Generate production code
  • Optimize for production
The --prod flag in the Angular CLI build command is used to optimize the application for production, resulting in smaller and faster code.

What is the purpose of a Route Guard in Angular?

  • Controlling access to routes
  • Defining route configuration
  • Handling route parameters
  • Rendering component views
The purpose of a Route Guard in Angular is to control access to routes, allowing you to restrict or permit navigation based on specific conditions.

In a scenario where you need to combine responses from multiple API calls but only want to proceed when all calls have completed successfully, which RxJS operator would be most suitable?

  • concatMap
  • forkJoin
  • mergeAll
  • switchMap
In a scenario where you need to combine responses from multiple API calls and proceed only when all calls have completed successfully, the most suitable RxJS operator is forkJoin.

You've been given a task to add PWA (Progressive Web App) capabilities to your existing Angular application. Which Angular CLI command would you use to achieve this?

  • ng add @angular/pwa
  • ng pwa --enable
  • ng create pwa
  • ng generate service-worker
To add PWA capabilities to an existing Angular application, you would use the "ng add @angular/pwa" command (option a). This command sets up the necessary service workers and configuration for a Progressive Web App.

The _____ function is used to compose multiple validators into a single function that combines their effects.

  • asyncValidator
  • combineLatest
  • composeValidators
  • validateControl
In Angular, the composeValidators function is used to compose multiple validators into a single function that combines their effects.

What is the purpose of using AbstractControl in reactive forms?

  • Handle HTTP requests
  • Handle routing in Angular
  • Manage form validation and user input state
  • Render component views
AbstractControl is used to manage form validation and user input state in reactive forms. It represents a form control, such as an input field, and provides validation and interaction capabilities.

You have a logging service that logs errors to the console in the development environment and sends them to the server in the production environment. How can you switch between different implementations of the logging service depending on the environment?

  • Using 'app.module.ts' file
  • Using 'config.json' file
  • Using 'environment.ts' configuration
  • Using a separate service for each environment
To switch between different implementations of the logging service based on the environment, you can use the 'environment.ts' configuration, which allows you to specify different configurations for each environment.