• +91 9723535972
  • info@interviewmaterial.com

RxJS Interview Questions and Answers

RxJS Interview Questions and Answers

Question - 51 : - Are there any similarities between Redux and RxJS?

Answer - 51 : -

These libraries are very different for very different purposes, but there are some vague similarities.

  • Redux is a tool for managing state throughout the application. It is usually used as an architecture for UIs. Think of it as an alternative to (half of) Angular.

  • RxJS is a reactive programming library. It is usually used as a tool to accomplish asynchronous tasks in JavaScript. Think of it as an alternative to Promises.

Redux uses the Reactive paradigm little bit because the Store is reactive. The Store observes actions from a distance, and changes itself. RxJS also uses the Reactive paradigm, but instead of being an architecture, it gives you basic building blocks, Observables, to accomplish this "observing from a distance" pattern.

Question - 52 : - Explain the Term Non-Blocking

Answer - 52 : -

In concurrent programming an algorithm is considered non-blocking if threads competing for a resource do not have their execution indefinitely postponed by mutual exclusion protecting that resource. In practice this usually manifests as an API that allows access to the resource if it is available otherwise it immediately returns informing the caller that the resource is not currently available or that the operation has been initiated and not yet completed. A non-blocking API to a resource allows the caller the option to do other work rather than be blocked waiting on the resource to become available. This may be complemented by allowing the client of the resource to register for getting notified when the resource is available or the operation has completed.

Question - 53 : - What is Actor Model?

Answer - 53 : -

All Actor model says that your concurrency primitives are actors, which can:

  • receive a message and decide what to do next depending on the content of the message, including:
  • send messages to any actors they know about
  • create new actors
and provides certain guarantees, e.g.:

  • any actor will only handle a single message at a time
  • messages sent by actor X to actor Y will arrive in the order thay were sent

Question - 54 : - What is Elasticity (in contrast to Scalability)?

Answer - 54 : -

Elasticity means that the throughput of a system scales up or down automatically to meet varying demand as resource is proportionally added or removed. The system needs to be scalable to allow it to benefit from the dynamic addition, or removal, of resources at runtime. Elasticity therefore builds upon scalability and expands on it by adding the notion of automatic resource management.

Question - 55 : -
What is the difference between BehaviorSubject and Observable in RxJS?

Answer - 55 : -

  • Observable is a consumer/listener while a BehaviourSubject is a synchronous data source that emits data to observers.
  • Observables are stateless while BehaviourSubject is stateful.
  • Observables create a copy of the data while BehaviourSubject emits data to observers.
  • Observables are unidirectional in nature while BehaviorSubject is bi-directional in nature.

Question - 56 : -
What is the difference between Reactive Programming and Imperative Programming?

Answer - 56 : -

  • Reactive programming is a programming paradime where data is being Pushed to subscribed observers in an application. Where as:
  • Imperative programming is a programming paradime where data is being Pulled on request from an application.

Question - 57 : -
Is there any similarity between Redux and RxJS?

Answer - 57 : -

  • Redux uses reactive paradigm to mutate state of the store.
  • RxJs uses reactive paradigm to accomplish asynchronous data processing.

Question - 58 : -
What are the core principles of Redux?

Answer - 58 : -

–Single source of Truth: All application data is stored in a single object tree.

  • State is read only: The state is immutable.
  • State can only be change with Pure Functions: These pure functions are called Reduces and they specify how the object tree is should be updated.

Question - 59 : -
What is Redux?

Answer - 59 : -

Open-Source JavaScript library for managing application state. Used in frontend framework such as React, Angular & Rxjs

Question - 60 : -
When we use zip and combineLatest and withLatestFrom?

Answer - 60 : -

zip and combineLatest are functions and withLatestFrom is operator that allows to combine a few observable sequences in a different ways, that are really helpful in real world application.

Composing functions and operators usually accept observables as their params and also they return observable that emits array with values produced by argument observables. This result observable emission logic is different depending on which operator or function we use.


NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners