Search Tutorials


Top RxJS (2021) frequently asked interview questions | JavaInUse

Top RxJS frequently asked interview questions.

In this post we will look at RxJS Interview questions. Examples are provided with explanations.


What is RxJS
A:
RxJS implements reactive extension for TypeScript and JavaScript. It is a combination of observer patter, iterator pattern and functional programming. It is a javascript library that brings the concept of "reactive programming" to the web. RxJS is a library for reactive programming using Observables, to make it easier to compose asynchronous or callback-based code. It is a standalone Javascript library that gives access to programmers to the Observable.

Q: What are the disadvantages of using RxJS?
A:
The disadvantages are as follows -
  • Debugging the code with observables is little difficult.
  • As you start to use Observables, you can end up your full code wrapped under the observables.
Q: What is difference between BehaviorSubject and Observable ?
A:
The difference between BehaviourSubject and Observable -
Observable BehaviourSubject
Observable is stateless BehaviourSubject is stateful
Observable creates copy of data BehaviourSubject shares data
Observable is unidirectional BehaviourSubject is bidirectional
Q: What is difference between Observables and Promises ?
A:
The difference between Observables and Promises -
Promises Observables
Promises runs asynchronously and we get the return value only once. Observables runs asynchronously and we get the return value multiple times
Promises are not lazy Observables are lazy
Promises cannot be cancelled Observables can be cancelled
Promises provide a single future value. Observables provide multiple future values.


Q: What are the operators in RxJS ?
A:
The operators in RxJS are as follows-
  • tap()
  • catchError()
  • switchAll()
  • finalize()
  • throwError()
Q: What is difference between Hot and Cold Observables?
A:
The difference between Observables and Promises -
Cold Hot
COLD is when your observable creates the producer HOT is when your observable closes over the producer
Emits at controller rate when Observer is ready Emits immediately whether Observer is ready or not
Created with OnSubscribe Created with Timer Events

See Also

Spring Boot Interview Questions Apache Camel Interview Questions Drools Interview Questions Java 8 Interview Questions Enterprise Service Bus- ESB Interview Questions. JBoss Fuse Interview Questions Angular 2 Interview Questions