RXJS(Reactive Extensions for JavaScript) interview questions for freshers/RXJS(Reactive Extensions for JavaScript) Interview Questions and Answers for Freshers & Experienced

Where did you use RxJs in Angular?

Most of the times rxJs is used in http calls with angular. As http streams asynchronous data we can subscribe , apply filters to the http streams.

Below is a simple sample code of how RxJs can be used with HTTP calls.

var stream1 = httpc.get("https://www.myapi.com/somedata");
var stream2 = stream1.pipe(filter(x=>x>3));
stream2.subscribe(res=>this.Success(res),res=>this.Error(res));

How to unsubscribe from the stream?

We need to get reference of the "subscription" object. This subscription object is returned when we call the "subscribe" function. To unsubscribe we can call "unsubscribe" on the "sunscription" object.

var subscription = observ.subscribe(res=>Listener(res));
subscription.unsubscribe();

What is ViewEncapsulation and how many ways are there do to do it in Angular?

To put simply, ViewEncapsulation determines whether the styles defined in a particular component will affect the entire application or not. Angular supports 3 types of ViewEncapsulation:
Emulated : Styles used in other HTML spread to the component
Native : Styles used in other HTML doesn’t spread to the component
None : Styles defined in a component are visible to all components of the application

What's new in Angular 6?

Below major new aspects introduced in Angular 6:

RxJS 6

- Angular 6 makes use of RxJS 6 internally, RxJS released a library called rxjs-compat, that allows you to still using one of the “old” syntaxes.
Elements:

lets you wrap your Angular components as Web Components and embed them in a non-Angular application
i18n (internationalization):
Without having to build the application once per locale, any Angular application can have “runtime i18n”
Tree-shakeable providers:
recommended, way to register a provider, directly inside the @Injectable() decorator, using the new providedIn attribute
New Rendering Engine:
Ivy - increases in speed and decreases in application size.

What is difference between Angular and AngularJS?

Here are few differences between Angular and AngularJS are stated as follows

>> AngularJS supports the MVC design model. Angular relies on components and directives instead.
>> Angular supports a hierarchical Dependency Injection with unidirectional tree-based change detection. AngularJS doesn’t support DI
>> In AngularJS, a specific ng directive is required for the image or property and an event. >> Angular, on the other hand, use () and [] for blinding an event and accomplishing property binding, respectively
>> AngularJS doesn’t have mobile support while Angular does have
While JavaScript is the recommended language for AngularJS, TypeScript is the recommended language for Angular

What is latest version of Angular?

The lastest version of Angular framework is Angular 9 which is in pipeline to release in this month.

How to implement authentication in web application?

We can use Spring Boot JWT with Angular for token authentication in web application.

How to build full stack web application?

Angular is extremely famous for modern web application development, Spring Boot and Angular are a strong and developer-friendly combination if you want to create the full stack web application.

When we use zip and combineLatest and withLatestFrom?

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

What is NgRx?

NgRx stands for Angular Reactive Extensions, NgRx Store provides reactive state management for Angular apps inspired by Redux. NgRx has libraries for managing both global and local state. Isolation of side effects in order to achieve a more streamlined component architecture. Developer tooling that makes it easier for developers to construct a variety of applications.

What is RxJS concatMap?

concatMap : Projects each source value to an Observable which is merged in the output Observable, in a serialized fashion waiting for each one to complete before merging the next - Official RxJS Docs

What is Reactive programming and how does it relate to Angular?

The principle of responsive programming is that you can just build the different streams and operations that take place on those flows by specifying the whole program.

Angular uses RxJS for some aspects of its internal service, such as Http, Router, etc.
RxJS is a very powerful library that facilitates the design of applications.

What are different between of Subject, BehaviorSubject and ReplaySubject?

Subject :

In case of Subject, Observers who are subscribed at a later date will not obtain the data values emitted prior to their subscription.

ReplaySubject :

In ReplaySubject, Observers who are subscribed at a later point will receive data values issued prior to their subscription. As it operates by using a buffer that holds the values emitted and re-emits them once new Observers are subscribed.

BehaviorSubject :

BehaviorSubject functions similar to ReplaySubject but only re-issues the last emitted value. So you're interested in the last / current value of the observer, if BehaviorSubject is useful.

What do you understand by to be Resilient for a Reactive System?

To be Resilient for a Reactive System means the system will stay responsive if it gets any chance of failure. Any system that is not resilient will be unresponsive after a failure. Resilience is achieved by replication, containment, isolation and delegation. Failures are contained within each component, isolating components from each other, thereby ensuring that parts of the system can fail and recover without compromising the entire system.

What is the difference between Imperative, Functional and Reactive Programming?

Let's compare them to see the difference:

Imperative Programming: Imperative programming is a programming paradigm where each line of code is sequentially executed to produce the desired result. This programming paradigm forces programmers to write "how" a program will solve a certain task.

Functional Programming: Functional programming is a programming paradigm where we can set everything as a result of a function that avoids changing states and mutating data.

Reactive Programming: Reactive programming is a programming paradigm with asynchronous data streams or event streams. An event stream can be anything like keyboard inputs, button taps, gestures, GPS location updates, accelerometer, iBeacon etc. Here, we can listen to a stream and react to it according to the situation.

What do you understand by Elasticity in contrast to Scalability?

In the IT infrastructure, the term "Elasticity" can be defined as the ability to quickly expand or cut back capacity and services without obstructing the infrastructure's stability, performance, security, governance or compliance protocols.

It means that the throughput of a system scales up or down automatically to meet varying demand as a 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.

What is RxJS Map, and what do you understand by Higher-Order Observable Mapping?

RxJS map operator facilitates us to project the payload of the Observable into something else. We can see the powerful features of Observables when we start using Rx operators to transform, combine, manipulate, and work with sequences of items emitted by Observables.

RxJS Higher-Order Observable Mapping
We map source observable emitted value into other Observable in higher-order mapping instead of mapping a flat value like 1 to another value like 10.! The result is an Observable higher order.

What are the differences between Subject, BehaviorSubject and ReplaySubject in RxJS?

Subject
In the RxJS Subject, Observers who are subscribed later do not obtain the data values emitted before their subscription.

ReplaySubject
In RxJS ReplaySubject, Observers who are subscribed at a later point receives data values issued before their subscription. It operates by using a buffer that holds the values emitted and re-emits them once new Observers are subscribed.

BehaviorSubject
BehaviorSubject functions similar to ReplaySubject but only re-issues the last emitted values. So, it should be used when you are interested in the observer's last/current value.

What do you understand by the Actor Model in RxJS?

An actor model can do the following things:

<> An Actor model specifies that your concurrency primitives are actors.

<> It can send messages to any actors they know about.

<> It can receive a message and decide what to do next depending on the content of the message.

<> It can create new actors and provides certain guarantees, such as any actor will only handle a single message at a time and messages sent by actor X to actor Y will arrive in the order they were sent.

What is the difference between Cold and Hot Observables in RxJS?

In simple words, the concept of cold and hot Observable can be defined as the following:

When the data is produced by the Observable itself, t is called the cold Observable. When the data is produced outside the Observable, it is called hot Observable.

What does Asynchronous means in the context of RxJS or Reactive programming?

According to the Oxford Dictionary, the term asynchronous can be defined as "not existing or occurring at the same time." In the context of Reactive programming, it means that the processing of a request occurs at an arbitrary point in time, sometime after it has been transmitted from client to service. The client cannot directly observe, or synchronize with, the execution that occurs within the service. Asynchronous is the antonym of synchronous processing, which implies that the client only resumes its execution once the service has processed the request.

What do you understand by the term Non-Blocking in RxJS?

In RxJS or Reactive programming, an algorithm is called non-blocking if threads competing for a resource do not have their execution indefinitely postponed by mutual exclusion protecting that resource.

This concept is used in an API that allows access to the resource if available; otherwise, it immediately returns informing the caller that the resource is not currently available or the operation has been initiated and not yet completed. A non-blocking API to a resource allows the caller to do other work rather than be blocked waiting on the resource to become available. This may be complemented by allowing the client to register for getting notified when the resource is available or the operation has been completed.

What is the difference between Reactive Programming and Imperative Programming?

In Reactive Programming, observables emit data, and send it to the subscribers. This process can be called as data being PUSHed in reactive programming. On the other hand, data is being PULLed in imperative programming, where we explicitly request data (iterating over collection, requesting data from the DB, etc).

What do you understand by the Reactive Manifesto document?

A document was introduced to define the core principles of reactive programming. That document is known as the Reactive Manifesto. The Reactive Manifesto document was first released in 2013 by a group of developers led by a man called Jonas Boner. The Reactive Manifesto underpins the principles of reactive programming.

What is AOT Compilation?

Angular AOT contains mainly of components and their HTML templates.The components and templates are provided by the angular requires a compilation process before it can run in browser.AOT helps in converting Angular HTML and TypeScript code in to efficient JavaScript code while building phase before the browser downloads and runs the code.
Here are some reasons you might want to use AOT:
Faster rendering
Fewer asynchronous requests
Smaller Angular framework download size
Detect template errors earlier
Better security

What are the key features of Angular?

The key features of the Angular are as follows:
Templates
Model View Controller
Dependency Injection
Directive
Code splitting
Validation
Testing
Data Binding
Localization

What do you understand by to be Resilient for a Reactive System?

To be Resilient for a Reactive System means the system will stay responsive if it gets any chance of failure. Any system that is not resilient will be unresponsive after a failure. Resilience is achieved by replication, containment, isolation and delegation. Failures are contained within each component, isolating components from each other, thereby ensuring that parts of the system can fail and recover without compromising the entire system.

What is the use of mergeMap?

mergeMap os also known as flatmap, which is used for flattening an inner observable and also in controlling the number of inner subscription.It also helps in maintaining multiple active inner subscription at once.
It starts emitting the values from replacing the original values and it does not cancle any of the inner observables.
Here is an example of mergeMap:
mergeMap(project: (value: T, index: number) => O): OperatorFunction<T, ObservedValueOf<O>>

What are different types of Subject ?

Behaviour Subject

Behaviour subject will give you the latest value when called.

Replay Subject

A replaysubject is similar to behaviour subject, wherein, it can buffer the values and replay the same to the new subscribers.

Name some rxJs Operators?

* Map - Transforms data in a observable in to a different format.
* Filter - Allows data which meets conditions.
* Merge - This operator will combine multiple Observables into one. So if one of the observables emit a value the combined one will emit as well.
* Concat - only when observable completes, it will start with the next observable.
* From - This operator will turn array, promise or iterable into an observable.
* Debouncetime - discard emitted values if a certain time didn't pass between the last input.
* Distinctuntilchanged - only emits a value if it is different than the last one.
* Pluck - select a property to emit.
* Delay - emits a value with a delay.

Explain the Term Non-Blocking?

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.

What is Subject ?

Subject can act as both Observable as well as Observer. A Subject is a sort of bridge or proxy that is available in some implementations of ReactiveX that acts both as an observer and as an Observable.

What is the Reactive Manifesto?

The Reactive Manifesto is a document that defines the core principles of reactive programming. It was first released in 2013 by a group of developers led by a man called Jonas Boner. The Reactive Manifesto underpins the principles of reactive programming.

What are the core principles of Redux?

Redux follows the following three fundamental principles:

<> Single source of truth: It stores the state of your whole application in an object tree within a single store. The single state tree makes it easier to keep track of changes over time and debug or inspect the application.

<> State is ready only: It emits an action that is the only way to change the state. It ensures and
specifies that neither the views nor the network callbacks will ever write directly to the state.

<> Changes are made with pure functions: We have to write pure reducers to specify how the st
ate tree is transformed by actions. Reducers are simple pure functions that take the previous state and an action, and return the next state.

What are observables and observers?

RxJs library helps to handle async data stream easily. But in order to access the async stream it has to be exposed as a rxJs Observable object. The listener who is interested in accessing the Observable stream is exposed as an observer.
In simple word observable represents async stream of data and observer subscribes to the observable to receive the stream.

What is Redux?

Redux is an open-source JavaScript library which is used to manage the application state. It is most commonly used with libraries such as React, Angular, or RxJS for building user interfaces. Redux is inspired by Facebook's Flux architecture and also very similar to it. It was created by Dan Abramov and Andrew Clark.

What are switchMap, mergeMap and concatMap?

These are the operators used to flatten the observables, they are applicable in different scenerios.Switvh and Merge maps are the most powerful and they are frequently used as the operators.
Mergemap used in creating an observable immediately for any other source item and it keeps the observables alive.
Concatmap are used for crating a new observable.
Switchmap helps in completing the previous observable and creates the next observable.

What is RxJS concatMap?

ConcatMap is a combination of 2 operators(concat and map), it lets us mapping a value from a source observable to an observale stream.When the inner observable lets it valoue and pass it down to an observable.It helps in collecting all the emitted values from all of the inner observables and emits it into the subscribers.
Concat is used for taking each form value and in transforming into an observer HTTP,known as inner observer.It also helps in subscribing to the inner observable and also sends the output to the observable result.

What does a subject do in RxJS?

Subject helps in aloowing the values to be multicast for many observers.They are multicast instead of plain observables, it is the equivalent of an event emitter and also the only way of multicasting a value or event or multiple observers.
Subjects implements observable and observer interfaces.There are 3 types of subjects: ReplaySubject, BehaviorSubject and AsyncSubject

What is Subscriptions ?

* Subscriptions are objects returned when an Observable is subscribed.
* Listening to the stream is called subscribing.

What are the advantages of Observable over Promise ?

* An Observable is like a Stream. It enables to pass zero or more events where the callback is called for each event.
* Observable is preferred over Promise because it provides the features of Promise and more.
* With Observable we can handle a single or multiple events.
* Observable also has the advantage over Promise to be cancelable.
* Observable allows lazy initialization.
* Observable allows to format data
* Observable provides operators like map, forEach, reduce etc

What are the biggest advantages of Reactive Programming?

<> Reactive programming provides a lot of operators that can simplify our work.
<> Reactive programming is very simple to compose streams of data.
<> It can be used to avoid "callback problems".
<> In Reactive programming, it is very simple to do async and threaded task.
<> It makes complex threading very easy.
<> By using Reactive programming, we can get a more cleaner and readable code base.
<> In Reactive programming, it is easy to implement back-pressure.

What are some Advantages of Reactive Programming?

<> RxJS can be used with other Javascript libraries and frameworks. It is supported by javascript and also with typescript. Few examples are Angular, ReactJS, Vuejs, nodejs etc.

<> RxJS is an awesome library when it comes to the handling of async tasks. RxJS uses observables to work with reactive programming that deals with asynchronous data calls, callbacks and event-based programs.

<> RxJS offers a huge collection of operators in mathematical, transformation, filtering, utility, conditional, error handling, join categories that makes life easy when used with reactive programming.

What are RxJS Operators ?

An operator is a method that acts on an Observable and changes the stream in some way.
The purpose of operator is to modify or filter the originally emitted values in a way that we normally need for the project tasks.

What is the difference between React and RxJS ?

* React is an open-source JavaScript library providing a view for data rendered as hyper text markup language.

* RxJS stands for Reactive Extensions for JavaScript. It is a library for composing asynchronous programming in web development and event-based programs using observable sequences and LINQ-style query operators.

What is the difference between Cold and Hot Observables ?

Cold Observables:

<> Cold observables start to run upon subscription, so observable sequence only starts pushing values to observers when subscribe is called.

Hot Observables:

<> Hot observables produce values even before subscriptions is made.
<> Hot observables such as mousemove events, stock pickers or WebSocket connections, are already produced in values even before subscription is active

What is Observable?

<> Observable represents the idea of an invokable collection of future values or events.

<> In RxJS, we model asynchronous data streams using observable sequences or just called observables, too.

What should we know before going to learn RxJS?

Before learning RxJS, we must have a basic knowledge of JavaScript, JavaScript frameworks, and Angular. You can easily understand this technology if you have a basic understanding of JS.

What is Reactive Programming?

Reactive programming is a declarative programming paradigm which deals with asynchronous data streams. Glenn Wadden first developed reactive programming in 1986 as a programming language in the Supervisory Control and Data Acquisition (SCADA) industry. Event buses or typical click events are called asynchronous event streams, used in reactive programming to observe and do some side effects. Reactive programming facilitates us to create data streams of anything, not just from click and hover events.

What is RxJS? / What do you understand by RxJS?

RxJS
is an acronym that full form is Reactive Extension for Javascript. It is a JavaScript library that uses observables to work with reactive programming and deals with asynchronous data calls, callbacks and event-based programs. RxJS has introduced the concept of "reactive programming" to the web. It implements a reactive extension for TypeScript
and JavaScript
.

RxJS works as a combination of the observer pattern, iterator pattern and functional programming.

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.

Search
R4R Team
R4R provides RXJS(Reactive Extensions for JavaScript) Freshers questions and answers (RXJS(Reactive Extensions for JavaScript) Interview Questions and Answers) .The questions on R4R.in website is done by expert team! Mock Tests and Practice Papers for prepare yourself.. Mock Tests, Practice Papers,RXJS(Reactive Extensions for JavaScript) interview questions for freshers,RXJS(Reactive Extensions for JavaScript) Freshers & Experienced Interview Questions and Answers,RXJS(Reactive Extensions for JavaScript) Objetive choice questions and answers,RXJS(Reactive Extensions for JavaScript) Multiple choice questions and answers,RXJS(Reactive Extensions for JavaScript) objective, RXJS(Reactive Extensions for JavaScript) questions , RXJS(Reactive Extensions for JavaScript) answers,RXJS(Reactive Extensions for JavaScript) MCQs questions and answers Java, C ,C++, ASP, ASP.net C# ,Struts ,Questions & Answer, Struts2, Ajax, Hibernate, Swing ,JSP , Servlet, J2EE ,Core Java ,Stping, VC++, HTML, DHTML, JAVASCRIPT, VB ,CSS, interview ,questions, and answers, for,experienced, and fresher R4r provides Python,General knowledge(GK),Computer,PHP,SQL,Java,JSP,Android,CSS,Hibernate,Servlets,Spring etc Interview tips for Freshers and Experienced for RXJS(Reactive Extensions for JavaScript) fresher interview questions ,RXJS(Reactive Extensions for JavaScript) Experienced interview questions,RXJS(Reactive Extensions for JavaScript) fresher interview questions and answers ,RXJS(Reactive Extensions for JavaScript) Experienced interview questions and answers,tricky RXJS(Reactive Extensions for JavaScript) queries for interview pdf,complex RXJS(Reactive Extensions for JavaScript) for practice with answers,RXJS(Reactive Extensions for JavaScript) for practice with answers You can search job and get offer latters by studing r4r.in .learn in easy ways .