Angular JS MCQs with answers Page - 24

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 difference between Subject and BehaviorSubject in RxJS?

  • (A) Subject requires an initial value, BehaviorSubject does not
  • (B) BehaviorSubject stores the latest value and emits it immediately to new subscribers
  • (C) Subject stores the latest value, BehaviorSubject does not
  • (D) There is no difference

A

Admin • 833.24K Points
Coach

Q. How do you unsubscribe from an Observable in Angular?

  • (A) By calling unsubscribe() on the subscription
  • (B) By setting Observable to null
  • (C) Angular unsubscribes automatically for all Observables
  • (D) By using ngOnInit hook

A

Admin • 833.24K Points
Coach

Q. What is the purpose of the `providers` array in @NgModule?

  • (A) To declare components
  • (B) To import modules
  • (C) To register services for dependency injection
  • (D) To configure routes

A

Admin • 833.24K Points
Coach

Q. Which lifecycle hook is called once the component’s view has been fully initialized?

  • (A) ngAfterViewInit
  • (B) ngOnInit
  • (C) ngAfterContentInit
  • (D) ngOnChanges

A

Admin • 833.24K Points
Coach

Q. Which of the following is a structural directive?

  • (A) ngIf
  • (B) ngStyle
  • (C) ngClass
  • (D) ngModel

A

Admin • 833.24K Points
Coach

Q. Which Angular decorator marks a class as a component?

  • (A) @Component
  • (B) @Injectable
  • (C) @Directive
  • (D) @NgModule

A

Admin • 833.24K Points
Coach

Q. Which Angular CLI command generates a new service?

  • (A) ng generate service service-name
  • (B) ng create service service-name
  • (C) ng new service service-name
  • (D) ng add service service-name

A

Admin • 833.24K Points
Coach

Q. Which change detection strategy checks only when the component’s inputs change?

  • (A) Default
  • (B) OnPush
  • (C) Manual
  • (D) Detached

A

Admin • 833.24K Points
Coach

Q. Which Angular module is required for using reactive forms?

  • (A) FormsModule
  • (B) ReactiveFormsModule
  • (C) HttpClientModule
  • (D) RouterModule

A

Admin • 833.24K Points
Coach

Q. Which method is used to get the current value of a FormControl?

  • (A) value
  • (B) getValue()
  • (C) currentValue()
  • (D) get()