Question 1: Why does Angular use Zone.js?
- For routing
- For HTTP interception
- To trigger change detection on async tasks
- To manage dependency injection
Explanation: Zone.js tracks async operations to trigger change detection.
This advanced Angular quiz is designed for senior frontend developers and engineers preparing for high-level interviews. It focuses on Angular internals, change detection mechanics, performance optimization, RxJS patterns, architecture decisions, and real-world production scenarios.
Explanation: Zone.js tracks async operations to trigger change detection.
Explanation: Default strategy checks all components frequently.
Explanation: OnPush runs on reference changes or explicit triggers.
Explanation: Mutating objects does not change references.
Explanation: It schedules the component for checking.
Explanation: Detached components are skipped in change detection.
Explanation: switchMap cancels previous inner subscriptions.
Explanation: concatMap waits for previous completion.
Explanation: exhaustMap ignores new values until completion.
Explanation: Unsubscribed observables prevent memory leaks.
Explanation: Async pipe manages subscriptions automatically.
Explanation: takeUntil completes streams on destroy.
Explanation: DI ensures controlled service instances.
Explanation: It enables tree-shaking for unused services.
Explanation: Component-level providers create new instances.
Explanation: Nested subscriptions are hard to manage.
Explanation: Services + Observables manage shared state.
Explanation: NgRx provides Redux-style state management.
Explanation: NgRx introduces significant boilerplate.
Explanation: Selectors compute derived state.
Explanation: Effects manage async side effects.
Explanation: Lazy loading reduces initial bundle size.
Explanation: Preloading loads lazy modules after bootstrap.
Explanation: PreloadAllModules loads all lazy modules.
Explanation: AOT compiles templates at build time.
Explanation: AOT improves performance and security.
Explanation: Templates are not compiled at runtime.
Explanation: DomSanitizer prevents unsafe HTML execution.
Explanation: It disables Angular security checks.
Explanation: View is fully initialized at this stage.
Explanation: ng-content enables flexible component layouts.
Explanation: Renderer2 abstracts DOM access safely.
Explanation: It may expose the app to XSS.
Explanation: Tree shaking removes unused code.
Explanation: It serves modern or legacy bundles based on browser.
Explanation: Angular Universal enables SSR.
Explanation: SSR improves SEO and perceived performance.
Explanation: window/document are unavailable on server.
Explanation: Immutable data ensures reference changes.
Explanation: trackBy minimizes DOM updates.
Explanation: Feature modules improve separation of concerns.
Explanation: They retain memory unnecessarily.
Explanation: Reactive patterns scale well.
Explanation: Angular enforces scalable structure.
Explanation: Default change detection can be expensive.
Explanation: Angular is designed for large-scale apps.
This advanced Angular quiz is designed for senior frontend developers and engineers preparing for high-level interviews. It focuses on Angular internals, change detection mechanics, performance optimization, RxJS patterns, architecture decisions, and real-world production scenarios.