In Part 1, we covered TypeScript and Angular Core Concepts (Q1–Q50).
Now in Part 2 of Angular 20 Interview Questions and Answers (2025 Edition), we’ll explore:
- RxJS Operators & Advanced Usage (Q51–Q90)
* Angular Change Detection & Performance Optimization (Q91–Q100)
RxJS Questions (Q51–Q90)
Q51. Difference between switchMap
, mergeMap
, concatMap
, and exhaustMap
?
-
switchMap
→ cancels previous observable, subscribes to latest. -
mergeMap
→ runs all observables concurrently. -
concatMap
→ executes one after another in order. -
exhaustMap
→ ignores new until current completes.
Q52. What is the difference between forkJoin
and combineLatest
?
-
forkJoin
→ waits for all observables to complete, emits once. -
combineLatest
→ emits whenever any observable emits (after all have emitted at least once).
Q53. How do you create an observable in Angular?
- Using
new Observable()
, creation operators (of
,from
,interval
), or AngularHttpClient
.
Q54. What is takeUntil
in RxJS?
- Completes an observable when another observable emits (used for unsubscribing).
Q55. How to cancel HTTP requests in Angular using RxJS?
- Use
takeUntil
withSubject
. - Use
AbortSignal
(Angular 16+).
Q56. What is shareReplay
and why is it useful?
- Replays the last emitted values to new subscribers.
- Used for caching HTTP requests.
Q57. What is a Subject
in RxJS?
- Both observer and observable.
- Multicasts to multiple subscribers.
Q58. Difference between BehaviorSubject
, ReplaySubject
, and AsyncSubject
?
-
BehaviorSubject
→ stores last value. -
ReplaySubject
→ replays all/limited values. -
AsyncSubject
→ emits last value on completion.
Q59. What is the difference between hot and cold observables?
- Cold → new execution for each subscriber.
- Hot → shared execution across subscribers.
Q60. How do you debug RxJS streams in Angular?
- Use
tap()
, RxJS DevTools, or console logging.
Q61. What is the difference between map
and switchMap
?
-
map
→ transforms emitted values. -
switchMap
→ transforms and flattens inner observable.
Q62. What is debounceTime
and where is it useful?
- Ignores values until a set time passes without new emissions.
- Used in search/autocomplete inputs.
Q63. What is distinctUntilChanged
?
- Prevents emitting duplicate consecutive values.
Q64. What is filter
in RxJS?
- Emits values that pass a condition.
Q65. What is tap
operator used for?
- Performs side effects (logging, debugging) without altering values.
Q66. How is startWith
used in observables?
- Emits an initial value before other emissions.
Q67. What is catchError
in RxJS?
- Catches errors and returns a fallback observable.
Q68. What is retry
and retryWhen
?
-
retry(n)
→ retries n times on error. -
retryWhen
→ retries based on custom logic.
Q69. What is the difference between from
and of
?
-
of(1,2,3)
→ emits values as sequence. -
from([1,2,3])
→ emits each array element separately.
Q70. What is the difference between interval
and timer
?
-
interval(ms)
→ emits numbers repeatedly. -
timer(ms)
→ emits once or starts interval after delay.
Q71. What is merge
in RxJS?
- Combines multiple observables, emits as they come.
Q72. What is concat
in RxJS?
- Runs observables one after another.
Q73. What is zip
in RxJS?
- Combines values from observables into tuples, emits when all have emitted.
Q74. What is combineLatestWith
?
- Variant of
combineLatest
for cleaner chaining.
Q75. What is withLatestFrom
?
- Combines latest value from one observable with another emission.
Q76. How do you handle memory leaks in RxJS?
- Use
takeUntil
,async
pipe, orSubscription.unsubscribe()
.
Q77. What is the async
pipe in Angular?
- Subscribes and unsubscribes automatically.
Q78. What is multicast
in RxJS?
- Shares a single subscription among multiple observers.
Q79. What is the difference between publish
and share
?
-
publish
→ returns a ConnectableObservable. -
share
→ shorthand formulticast + refCount
.
Q80. What is a higher-order observable?
- Observable emitting other observables. Flattened using
switchMap
, etc.
Q81. What is windowTime
vs bufferTime
?
-
bufferTime
→ collects values, emits arrays. -
windowTime
→ collects into inner observables.
Q82. What is throttleTime
vs debounceTime
?
-
throttleTime
→ emits first value, ignores others for duration. -
debounceTime
→ waits until silence period ends.
Q83. What is auditTime
in RxJS?
- Ignores values until duration ends, then emits last value.
Q84. What is the purpose of finalize
operator?
- Executes logic when observable completes/errors/unsubscribes.
Q85. What is pairwise
operator?
- Emits previous and current values as pairs.
Q86. What is scan
vs reduce
in RxJS?
-
scan
→ accumulates values continuously. -
reduce
→ emits only final accumulated value.
Q87. What is pluck
in RxJS?
- Extracts a property from objects in a stream.
Q88. What is switchAll
operator?
- Flattens inner observables, similar to
switchMap
.
Q89. What is the difference between concatAll
, mergeAll
, and switchAll
?
-
concatAll
→ sequential. -
mergeAll
→ parallel. -
switchAll
→ latest only.
Q90. What is backpressure in RxJS and how do you handle it?
- Overwhelming emissions handled using
throttleTime
,debounceTime
, or buffering.
Change Detection & Performance (Q91–Q100)
Q91. What is Angular Change Detection?
- Updates DOM when component state changes.
Q92. What are Change Detection Strategies?
- Default → checks always.
- OnPush → checks only when inputs change or observables emit.
Q93. What is NgZone
in Angular?
- Patches async tasks, triggers change detection automatically.
Q94. What is runOutsideAngular
used for?
- Runs code outside Angular zone to avoid unnecessary checks.
Q95. How does ChangeDetectorRef.detectChanges()
work?
- Immediately runs change detection for that component subtree.
Q96. What is markForCheck()
in Angular?
- Marks component for check in next cycle.
*Q97. What is trackBy
in *ngFor and why use it?*
- Optimizes rendering by tracking items with a unique key.
Q98. How do you optimize Angular apps for performance?
- Use OnPush strategy, trackBy, lazy loading, async pipe, and avoid memory leaks.
Q99. What are Angular DevTools used for?
- Profiling change detection and performance bottlenecks.
Q100. What is the role of Singleton Services in performance?
- Avoids duplicate service instances, reduces memory usage.
Conclusion
This was Part 2 of Angular 20 Interview Questions and Answers (2025 Edition).
We covered:
RxJS Operators & Advanced Usage (Q51–Q90)
Change Detection & Performance Optimization (Q91–Q100)
Top comments (0)