Top Reactive Programming Interview Questions for 2020

Top Reactive Programming Interview Questions for 2020

The article assembles the top Reactive programming questions asked during interviews at one place.

1. What is Reactive Manifesto?

Ans. The Reactive Manifesto, first released in 2013, is a document defining the central principles of reactive programming. It was made by a group of developers led by a man called Jonas Boner. The Reactive Manifesto underpins the principles of reactive programming.

2. What is Reactive Programming?

Ans. Reactive programming refers to programming with asynchronous data streams. Your typical click events or event buses are an asynchronous event stream, on which you can observe and do some side effects. Reactive is that idea on steroids. You can create data streams for anything, without just sticking to hover and click events. Streams are cheap and predominant; anything could be a stream- data structures, variables, properties, user inputs, caches, etc. For instance, you can consider your Twitter feed. Your Twitter-feed is a data stream in a similar way in which click events are. You can choose to listen to that stream and react to it accordingly.

3. What is Stream?

Ans. A stream refers to a succession of perpetual events ordered in time. It can produce three things: a value, an error, or a completed signal.

4. What Are Some Advantages of Reactive Programming?

Ans. The following are the advantages of Reactive Programming:

a. You can avoid "callback hell."

b. It simplifies async/threaded work.

c. It has several operators that simplify work.

d. It allows an elementary composition of data streams.

e. It also simplifies complicated threading

f. It will enable you to conclude with a cleaner, readable codebase.

g. It allows for easy implementation of back-pressure.

5. What does Asynchrony mean in the context of Reactive Systems?

Ans. In the context of Reactive Systems, Asynchrony means that the processing activities of a request happens at an erratic point of time. Sometimes, it happens a while after the system has transmitted it from the client to service. The system does not allow the client to directly observe, or synchronize with, the execution that occurs within the service. It is the antonym of synchronous processing, which implies that the client only resumes its execution once the service has processed the request.

6. What is Back Pressure?

Ans. When one component is grappling to keep up, the system as a whole needs to respond sensibly. It is unacceptable for the element under stress to fail catastrophically or to drop messages in an uncontrolled fashion. Since it cannot cope or abandon, it must be communicating the fact that it is under stress to upstream components. Hence, it can make them reduce the load. This back-pressure is a vital feedback mechanism that allows systems to respond to load rather than collapse under it gracefully. The back-pressure may cascade up to the user, at which point responsiveness may degrade. Still, this mechanism will ensure that the system is resilient under load, and will provide information that may allow the policy itself to apply other resources to help distribute the weight.

7. What is Elasticity in contrast to Scalability?

Ans. Elasticity refers to the throughput of a system when it scales up or scales down automatically. It is to meet various demands as it removes or adds resources proportionally. The system has to be scalable to make way for it to benefit from the active addition or subtraction of resources at runtime. Hence, Elasticity builds upon Scalability and intensifies on it by adding the notion of automatic resource management.

8. Define Non-Blocking.

Ans. With concurrent programming, an algorithm is non-blocking, if mutual exclusion protecting that resource does not delay the execution of the competing threads. Usually, in practice, it manifests as an API that allows access to the support if available. Else, it returns immediately and informs the caller that the resource is not available at present or that it has begun the operation, but has not yet completed it. A non-blocking API to a remedy gives the caller the option to perform other tasks rather than blocking it while waiting for the resource to be available. You may complement it by enabling the client of the resource to register to receive notifications when the resource is available, or the function is complete.

9. Define the Actor Model?

Ans. The All Actor model says that your concurrency primitives are actors, which can

a. receive a message and make a decision on what to do next depending on the content of the word, including the following:

b. Sending messages to any actors, they know about

c. Creating new actors

c. Providing certain guarantees, e.g. any actor will only handle a single note at a time messages sent by actor X to actor Y will arrive in the order they were sent.

10. Differentiate between Reactive Programming vs. Imperative Programming.

Ans. In reactive programming, Observables emit data and send it to the subscribers. You can see it as data being PUSHed in reactive programming, as opposed to data being PULLed in imperative programming, where you explicitly request data (iterating over a collection, requesting data from the DB, etc.).

11. Mention a few similarities between Redux and RxJS.

Ans. Both libraries are different for very different reasons. Yet, they do have a few vague similarities.

Redux is a tool for managing state throughout the application. Web Developers for hire usually use it as an architecture for UIs. Think of it as an alternative to half of Angular.

RxJS is a reactive programming library. Web Developers generally use it as a tool to accomplish asynchronous tasks in JavaScript. Think of it as an alternative to Promises.

Redux uses the Reactive paradigm a little bit because the Store is sensitive. The Store perceives actions distantly and changes itself. RxJS also uses the Reactive standard, but instead of being an architect, it gives you basic building blocks to achieve this observing-from-a-distance pattern.

So these were a few questions asked during the interviews for reactive programming. Hope you find them useful.