0% found this document useful (0 votes)
14 views3 pages

1.the Material

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views3 pages

1.the Material

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

1.

what is react
It uses a component-based approach to create reusable user interface components.
It's used to create complex and interactive web and mobile user interfaces.
Instead of using the real DOM, it employs the virtual DOM.
Server-side rendering is used.
It improves the performance of the application.
It can be used on both the client and server sides with ease.

2.

Real DOM Virtual DOM

Slow Updates Fast Updates


Can update HTML directly Cannot update HTML directly
New DOM is created when
an element updates JSX is updated when an element is updated
Expensive DOM manipulation Easy DOM manipulation
There is memory wastage
No memory wastage

3.what is the purpose of render()?


Render() is required for every React component. It returns a single React
element that is the native DOM component's representation.

4.what is props?
props is stand for property in react.
They are read only component and must be kept immutable.
They passed down from parent to the child components.
5.what is state
States serve as a data source.
states are the objects that determine how components are rendered and behave.
They are mutable and create dynamic and interactive elements.

6.How can you update the state of a component?


Functional components use the ''use State'' hook to manage state.

7.What is redux
Redux is one of the most popular front-end development libraries.
It is a state container for JavaScript applications that is used to manage the
entire state of the application.

## NodeJS all interview question


what is event driven programming?
Event-driven programming in Node.js is a programming paradigm where the flow of
the application is controlled by events.
Event Loop: Node.js continuously listens for events and processes them
asynchronously, allowing non-blocking I/O operations.
Event Emitter: Node.js uses the Event Emitter class to create, listen for, and
handle events.

What is the event loop in Node.js?

The event loop is a mechanism that handles asynchronous operations


in Node.js. It allows Node.js to perform non-blocking I/O operations by
offloading operations to the system kernel whenever possible.

A callback function is a function passed as an argument to another function and is


executed after the completion of that function.
In Node.js, callbacks are commonly used for handling asynchronous operations.
Here's how it works:
A function is called and an operation (like I/O) starts.
Instead of waiting for the operation to finish, the function continues
executing.

In Node.js, the single-threaded architecture works by using an event-driven, non-


blocking model to handle multiple tasks concurrently on a single thread.
single Thread, Event Loop ,Non-blocking I/O.

what is child process?


A child process is a separate instance of a process that is created from the
main Node.js process.
It allows Node.js to execute tasks outside the main event loop, enabling
parallel execution of code.

Middleware chaining in Node.js refers to the sequential execution of multiple


middleware functions during request processing in frameworks like Express.js.
Each middleware can handle the request, modify it, or pass it to the next function
using next().
what is load balancing
Load balancing is the process of distributing incoming network traffic across
multiple servers to ensure no single server becomes overwhelmed.
This improves application availability, reliability, and performance by optimizing
resource use.

What is Mongoose and why is it used

Mongoose is an Object Data Modeling (ODM) library for MongoDB


and Node.js. It provides a schema-based solution to model application data.

Feature WebSocket
HTTPS
Purpose Full-duplex communication (bidirectional) Half-
duplex communication (request-response cycle)
Communication Real-time, persistent connection Connection
is closed after each request-response transaction
Connection Type One connection for continuous data exchange A new
connection is created for each request
Use Case Real-time applications Standard web
browsing, API requests
Protocol Works over TCP (usually ws:// or wss://) Works over
HTTP/HTTPS (http:// or https://)
Latency Lower latency, as the connection is kept alive
Slightly higher latency due to repeated connection setup
Overhead Lower overhead, as it avoids repeated HTTP handshakes Higher
overhead, since each request requires a full handshake
Security Can use WSS (WebSocket Secure) for encrypted communicationHTTPS
ensures encrypted communication using SSL/TLS
memory leaks in Js occur when a program or application allocates memory but fails
to release or deallocate it properly .over time these memory leaks can lead to
increased memory usage, slower performance and potential crash.
memwatch-next , heap dump these tools use for this.

What is the event loop in Node.js?


The event loop is a mechanism that handles asynchronous operations in Node.js. It
allows Node.js to perform non-blocking I/O operations by
offloading operations to the system kernel whenever possible.

what is cluster in NodeJS


a cluster allows you to create multiple worker processes that share the same server
port, enabling the application to utilize multiple CPU cores.
Each worker runs a separate instance of the Node.js application, distributing the
load across different processes.

Why it's used:


Improved performance: By leveraging multiple cores, clusters can handle more
requests simultaneously.
Fault tolerance: If one worker crashes, the others continue running, and the
master can restart the crashed worker.
This makes Node.js applications more scalable and resilient.

how to implement multithread in NodeJS


multithreading is implemented using the Worker Threads module(is use for high
computation task),This allows you to run JavaScript code in parallel threads,
separate from the main event loop, enabling CPU-bound tasks to execute concurrently
without blocking the main thread.

You might also like