When testing Angular services, you can replace a real service with a _____ to simulate service behavior.

  • component
  • mock
  • pipe
  • spy
When testing Angular services, you can replace a real service with a mock to simulate service behavior and control the service's responses for testing purposes.

Which operator can be used to automatically unsubscribe from an observable when a component is destroyed?

  • "map" operator
  • "subscribe" operator
  • "takeUntil" operator
  • "tap" operator
The "takeUntil" operator is commonly used to automatically unsubscribe from an observable when a component is destroyed. It takes an observable that emits when the component is destroyed, ensuring that the original observable is unsubscribed.

A directive that changes the appearance or behavior of a DOM element is known as a(n) _____ directive.

  • attribute
  • component
  • decorator
  • structural
A directive that changes the appearance or behavior of a DOM element is known as an attribute directive in Angular.

In a directive, the ________ decorator is used to get a reference to the host element.

  • @Directive
  • @HostBinding
  • @HostListener
  • @Injectable
In a directive, the @HostBinding decorator is used to get a reference to the host element, allowing you to access and modify its properties.

Reactive forms in Angular are also known as _____ forms.

  • Data-driven forms
  • Dynamic forms
  • Model-driven forms
  • Template forms
Reactive forms in Angular are also known as Model-driven forms, as they focus on creating the model and then binding it to the UI elements.

Which method is used to submit a form in Angular?

  • formSubmit()
  • ngSubmit()
  • postForm()
  • submitForm()
In Angular, the method used to submit a form is typically ngSubmit(). It's a commonly used event handler that is triggered when a form is submitted.

In Angular, the _____ pipe is used to automatically update the view with the latest value emitted by an Observable.

  • async
  • refresh
  • subscribe
  • update
In Angular, the async pipe is used to automatically update the view with the latest value emitted by an Observable. It simplifies data binding.

For testing dynamic behavior in directives, such as responding to user input or changes in data, you can use _______.

  • Jasmine
  • Mocks
  • Spies
  • TestBed
To test dynamic behavior in directives, you can use Jasmine for its testing capabilities, including spies for tracking function calls.

A cold observable starts emitting values only when it has at least one subscriber.

  • delayed
  • hot
  • multicasting
  • synchronous
A cold observable starts emitting values only when it has at least one subscriber.

Which type of Angular directive is responsible for manipulating the structure of the DOM?

  • Attribute Directives
  • Component Directives
  • Pipe Directives
  • Structural Directives
Structural directives are responsible for manipulating the structure of the DOM. They change the layout of the view by adding or removing elements from the DOM based on certain conditions or logic.