Q. Which lifecycle hook runs after every change detection cycle?

  • (A) ngOnInit
  • (B) ngAfterViewInit
  • (C) ngDoCheck
  • (D) ngOnDestroy
πŸ’¬ Discuss
βœ… Correct Answer: (C) ngDoCheck
Explanation: ngDoCheck runs during every change detection cycle.

Q. Which RxJS operator combines multiple observables and emits once all complete?

  • (A) combineLatest
  • (B) merge
  • (C) forkJoin
  • (D) zip
πŸ’¬ Discuss
βœ… Correct Answer: (C) forkJoin
Explanation: forkJoin emits once when all observables complete.

Q. What does ViewChild return by default?

  • (A) Component instance only
  • (B) ElementRef or component/directive instance
  • (C) HTML string
  • (D) Observable
πŸ’¬ Discuss
βœ… Correct Answer: (B) ElementRef or component/directive instance
Explanation: @ViewChild provides access to DOM element or component.

Q. Which Angular form type is immutable?

  • (A) Template-driven forms
  • (B) Reactive forms
  • (C) Hybrid forms
  • (D) Dynamic forms
πŸ’¬ Discuss
βœ… Correct Answer: (B) Reactive forms
Explanation: Reactive forms use immutable data structures.

Q. Which directive allows projecting external content?

  • (A) ngTemplateOutlet
  • (B) ngIf
  • (C) ngContent
  • (D) ngSwitch
πŸ’¬ Discuss
βœ… Correct Answer: (C) ngContent
Explanation: ngContent is used for content projection.

Q. Which Angular API enables manual change detection?

  • (A) ApplicationRef
  • (B) ChangeDetectorRef
  • (C) NgZone
  • (D) Injector
πŸ’¬ Discuss
βœ… Correct Answer: (B) ChangeDetectorRef
Explanation: ChangeDetectorRef provides methods to control change detection.

Q. Which guard is used to prevent navigation away from a route?

  • (A) CanActivate
  • (B) CanLoad
  • (C) CanDeactivate
  • (D) Resolve
πŸ’¬ Discuss
βœ… Correct Answer: (C) CanDeactivate
Explanation: CanDeactivate stops navigation if conditions fail.

Q. What is the purpose of NgZone.runOutsideAngular()?

  • (A) Improves performance by skipping change detection
  • (B) Disables routing
  • (C) Triggers change detection
  • (D) Stops HTTP calls
πŸ’¬ Discuss
βœ… Correct Answer: (A) Improves performance by skipping change detection
Explanation: runOutsideAngular avoids triggering change detection.

Q. Which operator shares a single subscription among multiple subscribers?

  • (A) map
  • (B) shareReplay
  • (C) filter
  • (D) delay
πŸ’¬ Discuss
βœ… Correct Answer: (B) shareReplay
Explanation: shareReplay shares and replays emitted values.

Q. Which Angular testing utility creates a test environment?

  • (A) TestBed
  • (B) Jasmine
  • (C) Karma
  • (D) Protractor
πŸ’¬ Discuss
βœ… Correct Answer: (A) TestBed
Explanation: TestBed configures the Angular testing module.