Which state management solution is based on the concept of stores and queries?

  • Akita
  • MobX
  • Redux
  • RxJS
Akita is based on the concept of stores and queries. In Akita, stores hold the application state, and queries are used to retrieve and manipulate data from these stores. This pattern makes state management in Akita efficient and intuitive.

The @Output() decorator is used to emit custom ________ from a component.

  • input events
  • methods
  • output events
  • properties
The @Output() decorator is used to emit custom output events from an Angular component. These events allow a component to communicate with its parent or containing components. By emitting custom events, a child component can notify its parent about specific actions or changes, enabling parent-child communication in Angular applications.

When using Lazy Loading, which property in the Angular routing configuration is used to point to the lazily loaded module?

  • importModule
  • lazyModule
  • loadChildren
  • loadModule
When implementing Lazy Loading in Angular, the loadChildren property in the routing configuration is used to specify the path to the lazily loaded module. This allows Angular to load the module on-demand when the associated route is visited, improving initial page load times.

How does the ChangeDetectionStrategy.OnPush improve performance in Angular components?

  • It enables two-way data binding
  • It forces constant change detection
  • It prevents data mutation
  • It reduces the frequency of change detection cycles
The ChangeDetectionStrategy.OnPush setting in Angular tells the framework to perform change detection only when the inputs to a component change, rather than after every event. This optimization reduces the frequency of change detection cycles, which can significantly improve performance, especially in complex applications.

When creating a custom attribute directive, which decorator is used to define its metadata?

  • @Component
  • @Directive
  • @Attribute
  • @Metadata
In Angular, to create a custom attribute directive, you use the @Directive decorator to define its metadata. This decorator allows you to specify the selector, inputs, outputs, and other properties that determine how the directive behaves when applied to elements in the DOM. The other options, such as @Component, @Attribute, and @Metadata, are not typically used for creating attribute directives.

When you want to cancel a subscription to an Observable, you call the ________ method on the subscription object.

  • cancel
  • complete
  • dispose
  • unsubscribe
To cancel a subscription to an Observable and release its resources, you call the unsubscribe method on the subscription object. It's important to unsubscribe from Observables to prevent memory leaks when you're done using them.

Which method of the ControlValueAccessor interface is called when the form control value changes programmatically?

  • controlValueChanged()
  • setValue()
  • updateValue()
  • writeValue()
The method of the ControlValueAccessor interface that is called when the form control value changes programmatically is writeValue(). This method allows you to update the form control's value from your custom form control component. It plays a crucial role in synchronizing the value between the custom control and the form group.

A client asks you to highlight the currently active page link in the navigation menu. How would you achieve this in Angular?

  • By using the routerLinkActive directive and applying it to the navigation menu items with a CSS class.
  • By using JavaScript to detect the active route and apply a CSS class to the corresponding navigation menu item.
  • By manually updating the active page link in the navigation component whenever a route changes.
  • By creating a custom Angular directive to handle active link highlighting.
To highlight the currently active page link in the navigation menu in Angular, you should use the routerLinkActive directive. This directive is applied to the navigation menu items and automatically adds a CSS class when the corresponding route is active. The other options are either incorrect or involve more manual and error-prone approaches.

In which scenario would you use the updateOn option with a value of 'blur' for a FormControl?

  • To update the control only on user focus.
  • To update the control only on user input.
  • To update the control immediately after any change.
  • To update the control on a custom event trigger.
You would use the updateOn option with a value of 'blur' for a FormControl when you want the control to update its value and trigger validation only when the user focuses on it (on blur). This can be helpful to provide a more user-friendly experience by not showing immediate validation errors as the user types. Options like 'user input' or 'immediately after any change' would lead to different behaviors not associated with 'blur.'

The ng build command, by default, creates the output in the dist/______ directory.

  • app
  • build
  • project
  • your-app-name
The ng build command, by default, creates the output in the dist/ directory of your Angular project. This directory contains the production-ready build of your application that you can deploy to a web server.

In Jasmine, what function is used to group together related test cases?

  • afterEach()
  • beforeAll()
  • describe()
  • it()
In Jasmine, the describe() function is used to group related test cases together. It provides a way to organize and structure your test suite by grouping individual test specs within a larger block. This helps in better test organization and readability.

When setting up routes in an Angular application, which property in the route configuration determines the component that should be displayed?

  • component
  • displayComponent
  • loadChildren
  • routeComponent
In Angular routing, the 'component' property in the route configuration is used to determine which component should be displayed when the route is activated. This is where you specify the component class that corresponds to the route. The 'component' property plays a fundamental role in defining the view associated with a route.