To restrict access to child routes based on user roles, you can implement a custom _____ Guard.

  • authentication
  • canActivate
  • canDeactivate
  • role
To restrict access based on user roles, you can implement a custom canActivate Guard. A Guard like this checks whether the user has the required role to access the route.

Which directive is used to create a form control in template-driven forms?

  • FormControl
  • FormGroup
  • ngForm
  • ngModel
In template-driven forms, the ngModel directive is used to create a form control. It binds form elements like input fields and selects to properties in the component class, allowing two-way data binding.

To wait for Angular to finish rendering before executing the next command in a Protractor test, you can use _____.

  • browser.pause()
  • browser.sleep()
  • browser.waitForAngular()
  • browser.waitForRender()
To wait for Angular rendering in a Protractor test, you can use browser.waitForAngular(), which ensures synchronization with Angular.

How can you create a custom operator in RxJS?

  • Create a new Observable class
  • Extend the Observable class
  • Implement a Promise-based approach
  • Use the pipe method
To create a custom operator in RxJS, you should use the pipe method to compose existing operators and functions to form your custom operator.

For a directive to be used across multiple modules, it needs to be declared in a shared module and exported using the ________ array.

  • declarations
  • exports
  • imports
  • providers
To use a directive across multiple modules, it should be declared in a shared module and exported using the exports array.

The Ivy Renderer’s instruction set allows Angular to be more efficient in updating the DOM by avoiding the need for a _____.

  • Browser Update Cycle
  • Change Detection
  • Template Engine
  • Virtual DOM
The Ivy Renderer’s instruction set allows Angular to be more efficient in updating the DOM by avoiding the need for Change Detection, reducing the overhead of checking for changes in the application's data and view.

How can you simulate user interactions with an element when testing a directive?

  • Use ComponentFixture.nativeElement
  • Use TestBed.configureTestingModule()
  • Use TestBed.get()
  • Use TestBed.inject()
To simulate user interactions when testing a directive, you can use the ComponentFixture.nativeElement to interact with the element.

Which property of the NavigationExtras object allows you to preserve query parameters across multiple navigation operations?

  • preserveQueryParams
  • queryParamsHandling
  • queryParamsPersistence
  • saveQueryParameters
The queryParamsHandling property of the NavigationExtras object is used to preserve query parameters across multiple navigation operations.

You are developing a real-time dashboard that needs to display data from multiple API endpoints. Which RxJS operators can help you effectively combine and manage the data from these endpoints?

  • filter and combineLatest
  • map and catchError
  • mergeMap and forkJoin
  • reduce and debounceTime
In this scenario, you can use mergeMap to merge and flatten multiple observables, and forkJoin to wait for all observables to complete and return their results. This combination is effective for handling data from multiple API endpoints in a real-time dashboard.

Which Angular lifecycle hook is invoked when the value of an input property changes?

  • ngAfterViewInit
  • ngDoCheck
  • ngOnChanges
  • ngOnInit
The Angular lifecycle hook ngOnChanges is invoked when the value of an input property changes. Developers can use this hook to respond to input property changes.