Programming MCQs Feed

📊 Angular
Q. Which Angular feature allows signals-based reactivity?
  • (A) RxJS Subjects
  • (B) Zone.js
  • (C) Angular Signals
  • (D) ChangeDetectorRef
💬 Discuss
✅ Correct Answer: (C) Angular Signals

Explanation: Angular Signals provide fine-grained reactivity without relying on RxJS.

📊 Angular
Q. What does ChangeDetectorRef.detach() do?
  • (A) Destroys the component
  • (B) Stops change detection for the component
  • (C) Refreshes the view
  • (D) Triggers routing
💬 Discuss
✅ Correct Answer: (B) Stops change detection for the component

Explanation: detach() removes the component from change detection tree.

📊 Angular
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.

📊 Angular
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.

📊 Angular
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.

📊 Angular
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.

📊 Angular
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.

📊 Angular
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.

📊 Angular
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.

📊 Angular
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.