INTERVIEW QUESTIONS

Angular Interview Questions

Practice Angular prompts by theme and build clearer interview answers.

Practice by topicAngular topic lensesClear answer prompts

Showing 4 RxJS in Angular practice prompts

A

ANGULAR

Explain the difference between `switchMap`, `mergeMap`, `concatMap`, and `exhaustMap` in RxJS.

`switchMap` cancels previous inner observables when a new outer value arrives (best for search auto-complete). `mergeMap` runs all inner observables concurrently without cancellation (parallel requests). `concatMap` queues inner observables, executing them sequentially one after another (order-dependent saves). `exhaustMap` ignores new outer values until the active inner observable completes (login/submit buttons preventing duplicate submissions).
◦ rxjs
A

ANGULAR

How does the `AsyncPipe` prevent memory leaks in Angular?

The `async` pipe subscribes to an Observable or Promise in the template and automatically yields the latest emitted value. When the host component is destroyed, `AsyncPipe` automatically un-subscribes from the observable, eliminating manual `Subscription` tracking, `takeUntilDestroyed()`, or `ngOnDestroy` boilerplate.
◦ rxjs
A

ANGULAR

What is the difference between `Subject`, `BehaviorSubject`, and `ReplaySubject` in RxJS?

`Subject` has no initial value and only emits values received after subscription. `BehaviorSubject` requires an initial seed value and immediately replays the single current/latest value to new subscribers (`getValue()`). `ReplaySubject(n)` replays a specified buffer of `n` historical values to new subscribers upon subscription.
◦ rxjs
A

ANGULAR

What is `takeUntilDestroyed()` and how does it prevent memory leaks using `DestroyRef`?

`takeUntilDestroyed(destroyRef?)` is an RxJS operator that automatically completes an Observable stream when the enclosing injection context or component is destroyed. If used within an injection context (constructor or field initializer), it automatically resolves the current `DestroyRef`. Outside injection contexts, passing `inject(DestroyRef)` manually binds lifecycle destruction without needing manual `ngOnDestroy` boilerplates.
◦ rxjs

Your next interview is closer than you think.

Practice smarter and land better opportunities.

✓ Start with the free plan✓ No credit card✓ Cancel anytime
Start preparing free