Angular JS MCQs with answers Page - 25

Here, you will find a collection of MCQ questions on Angular JS. Go through these questions to enhance your preparation for upcoming examinations and interviews.

To check the correct answer, simply click the View Answer button provided for each question.

Have your own questions to contribute? Click the button below to share your MCQs with others!

+ Add Question

A

Admin • 833.24K Points
Coach

Q. What is the purpose of the NgZone service?

  • (A) Optimize template rendering
  • (B) Manage async operations and trigger change detection
  • (C) Handle HTTP requests
  • (D) Manage routing

A

Admin • 833.24K Points
Coach

Q. What is the role of the `trackBy` function in *ngFor?

  • (A) Improve performance by tracking items by a unique identifier
  • (B) Sort items in the list
  • (C) Filter items dynamically
  • (D) Bind events to list items

A

Admin • 833.24K Points
Coach

Q. Which of the following is a pure pipe?

  • (A) uppercase
  • (B) async
  • (C) date
  • (D) all of the above

A

Admin • 833.24K Points
Coach

Q. How can you create a reactive form control in Angular?

  • (A) new FormControl()
  • (B) new Control()
  • (C) new ReactiveForm()
  • (D) new FormGroup()

A

Admin • 833.24K Points
Coach

Q. What is the difference between Template-driven and Reactive forms in Angular?

  • (A) Template-driven uses ngModel; Reactive uses explicit FormControl and FormGroup
  • (B) Reactive forms are simpler
  • (C) Template-driven forms don't support validation
  • (D) Reactive forms cannot be tested

A

Admin • 833.24K Points
Coach

Q. What is the default scope of a service provided via 'providedIn: root'?

  • (A) Module-level scope
  • (B) Singleton application-wide scope
  • (C) Component-level scope
  • (D) Lazy-loaded module scope

A

Admin • 833.24K Points
Coach

Q. Which Angular testing utility is used to create a component fixture?

  • (A) TestBed.createComponent()
  • (B) ComponentFixture()
  • (C) createFixture()
  • (D) TestComponent()

A

Admin • 833.24K Points
Coach

Q. What does the `fixture.detectChanges()` method do in Angular testing?

  • (A) Triggers Angular change detection to update the component view
  • (B) Initializes the component
  • (C) Creates a mock service
  • (D) Destroys the component

A

Admin • 833.24K Points
Coach

Q. What is the main advantage of using OnPush change detection strategy?

  • (A) Faster rendering by reducing change detection cycles
  • (B) More frequent change detection
  • (C) Works only with template-driven forms
  • (D) Works only with reactive forms

A

Admin • 833.24K Points
Coach

Q. Which decorator is used to define an input property in Angular?

  • (A) @Output
  • (B) @Input
  • (C) @ViewChild
  • (D) @Inject