In a reactive form, which method is used to access a form control's value?

  • access() method
  • getValue() method
  • retrieve() method
  • value() method
In a reactive form, you can access a form control's value using the value() method provided by the FormControl class. This method returns the current value of the form control.

What could be a potential issue if two services have a circular dependency on each other in Angular?

  • Compilation error
  • No issue, Angular handles it automatically
  • Reduced performance
  • Stack overflow error
If two services have a circular dependency on each other in Angular, it can lead to a stack overflow error as they keep calling each other recursively.

When using Angular Elements, the _____ function is used to convert an Angular component into a custom element.

  • createCustom()
  • createCustomElement()
  • createModule()
  • ngModule()
When using Angular Elements, the createCustomElement() function is used to convert an Angular component into a custom element.

In Angular, you can group together multiple form controls into a single logical unit using _____ .

  • ControlUnit
  • FormControlGroup
  • FormDirective
  • FormGroup
In Angular, you can group together multiple form controls into a single logical unit using a FormGroup.

In template-driven forms, how can you customize the update trigger for form controls?

  • By using the ControlValueAccessor interface
  • By using the FormsModule module
  • By using the HTTPInterceptor interface
  • By using the ReactiveForms module
In template-driven forms, you can customize the update trigger for form controls by implementing the ControlValueAccessor interface, which allows you to define custom behavior for control updates.

To inject a service into another service, the service being injected should have the _____ decorator.

  • @Component()
  • @Inject()
  • @Injectable()
  • @Service()
To inject a service into another service in Angular, the service being injected should have the @Injectable() decorator.

Which Route Guard method should be implemented to decide whether navigation to a route should be allowed?

  • canActivate
  • canActivateChild
  • canDeactivate
  • canLoad
In Angular, the canActivate method of a Route Guard should be implemented to decide whether navigation to a route should be allowed.

Why might you want to use async/await syntax in your Protractor tests?

  • To improve test performance
  • To make tests slower
  • To reduce code complexity
  • To synchronize operations
Using async/await syntax in Protractor tests helps synchronize operations and handle asynchronous tasks, ensuring more reliable and stable tests.

You are building a registration form and want to ensure that the password and confirm password fields match. Which approach would you use to validate this?

  • Use a simple JavaScript function to compare the fields.
  • Use the Reactive Forms approach with custom validators.
  • Use the Template-Driven Forms approach with ngModel binding.
  • Use the Validator Functions provided by Angular.
To ensure that the password and confirm password fields match in an Angular registration form, you should use the Reactive Forms approach with custom validators. This allows for more complex validation logic and better user feedback.

How can you identify and select a specific element on a webpage in a Protractor test?

  • browser.selectElement()
  • element(by.css())
  • element(by.model())
  • findElement(By.id())
To identify and select an element on a webpage in Protractor, you can use the element(by.css()) method, specifying a CSS selector.