Bird
0
0

How would you combine concatMap and exhaustMap to process a queue of tasks but skip new tasks if one is running?

hard📝 component behavior Q9 of 15
Angular - RxJS Operators
How would you combine concatMap and exhaustMap to process a queue of tasks but skip new tasks if one is running?
AUse exhaustMap inside concatMap to queue and skip tasks
BUse concatMap inside exhaustMap to queue tasks and ignore new while active
CUse mergeMap inside exhaustMap to run all tasks concurrently
DUse switchMap inside concatMap to cancel queued tasks
Step-by-Step Solution
Solution:
  1. Step 1: Understand desired behavior

    Queue tasks but skip new tasks if one is running.
  2. Step 2: Analyze operator nesting

    Using concatMap inside exhaustMap means exhaustMap controls ignoring new tasks while active, concatMap queues tasks inside.
  3. Final Answer:

    Use concatMap inside exhaustMap to queue tasks and ignore new while active -> Option B
  4. Quick Check:

    exhaustMap outer ignores new, concatMap inner queues [OK]
Quick Trick: Nest concatMap inside exhaustMap for queue with skip [OK]
Common Mistakes:
MISTAKES
  • Reversing nesting order
  • Using mergeMap causing concurrency
  • Using switchMap cancelling tasks unexpectedly

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes