5 exercises on reactive programming RxJS vocabulary.
0 / 5 completed
1 / 5
In RxJS, what is an Observable?
Observable: represents a push-based stream of values delivered over time. It is lazy - nothing happens until you subscribe - and can emit many values, then complete or error.
2 / 5
What is the difference between a hot and a cold observable?
Hot vs cold: a cold observable creates a fresh producer for each subscriber (e.g., an HTTP request per subscription). A hot observable multicasts a single shared source (e.g., DOM events) to all subscribers.
3 / 5
Why must you usually unsubscribe from a long-lived observable?
Unsubscribe: an active subscription keeps the producer and callbacks alive. Forgetting to unsubscribe (or use takeUntil) leaks memory, especially when components are destroyed but subscriptions persist.
4 / 5
What does the switchMap operator do that mergeMap does not?
switchMap: maps each value to an inner observable but unsubscribes from the previous inner one when a new outer value arrives. This is ideal for type-ahead search where only the latest request matters.
5 / 5
What does the term backpressure describe?
Backpressure: the mismatch when a fast producer overwhelms a slow consumer. Strategies like buffering, throttling, sampling, or dropping values manage the flow to prevent overload.