You are on page 1of 6

qustions

Node js handle concurrency by using its event-driven non-blocking io models it uses a


single threaded event loop that efficently mange the concurrent requests
Both promist .all and promise .race offer differnet methods to handle multiple promises
promise .all waits for all promises to fullfill the resolved array while promise .race only
waits for the first promise to settle the resolved array
res.send:-send a specified data as the response body
res.json :- send data in JSON response
res.render:-render a veiw template using a differnt template engines such as ejs hbs etc
res.write:we can send chunk data as a part of our resoponse body
res.end :- it is used to finalize the response
The cluster and worker model allows you to scale our node js application horizontally
by using multible cpu cores each worker proceses run on a separate core allow the
application to handle multiple requestts in parrell and improve overall perfomance and
output
By using limit and skip methods we can do pagination in node js and mongo db
A transaction is a set of operation that are executed in a single atomic unit some key
point about transaction are
Atmoicity :-If any operation gets failed the entire operation gets failed and the database
remain unchanged
Isolation :-Intermediate state of transaction are not visible to another state untill the
transaction is commited
Consistency :- transaction maintan the consistency of data by enforcing a set of defined
rules and constrains
Durability:- once a transaction is commited the changes that made by that transaction
are durable and premenantly stored in database
In mongodb embedded document is document that is nested with in another document
Indexing are the technique used to improve the efficency and perfomance of database
queries by creating index on a specific field
single field indexing

qustions 1
compund index
multiky index
text index
hashed index
horizontal scaling adds more machines to distribute the load,
vertical scaling increases the resources of a single machine to handle increased load or
data volume
capped collection have a fixed size and limit that automatically overwrites older
documents with new documents when the maximum sotrage limit is reached
Gris fs is a storage mechanism in mongo db which is user to store and retrive
comparitively large size of data
fragment is a component that allows you to group multiple elements together without
adding any wrapping element in the HTML output
it is a tool used to analyze and optimize the perfomance of a react application
loading of a certain components untill they are needed improveing he size like
reduccing the initial bundle size and loading the necessary things
Pure component
Thunk is a middleware library that allow you to write action creators that return fuction
instead of plain objects thunks will handle the asynchronus operation in Redux Saga is
also a middle ware to handle asynchronus operation which use generator fucnction to
handle asynchronus opraions

Render props is a pattern in React where a component receives a function as a prop,


which it can then invoke to render content. This pattern allows for dynamic content
composition and reusability.

A generator function is a special type of function in JavaScript that can be paused and
resumed during execution. It allows for the generation of a sequence of values over
time, rather than returning a single value like a regular function.

A Binary tree is a Perfect Binary Tree in which all the internal nodes have two children
and all leaf nodes are at the same level.
A Binary Tree is a Complete Binary Tree if all the levels are completely filled except
possibly the last level and the last level has all keys as left as possible.

qustions 2
A Binary Tree is a full binary tree if every node has 0 or 2 children.
By using min heap and max heap we can apply heap in prioriy queue

Graph indexing refers to creating an index to efficently retirve and query data in a graph
the differnce method using for a graph indexing are Adjececy List adjecency matrix etc..

A spanning tree is a subset of Graph G, which has all the vertices covered with
minimum possible number of edges. Hence, a spanning tree does not have cycles and
it cannot be disconnected.

a minimum spanning tree is a spanning tree that has minimum weight than all other
spanning trees of the same graph.
Cycle detection algorithms, such as Floyd's cycle detection algorithm or depth-
first search, are used to determine whether a Graph contains any cycles.

new
In the context of web development, both "params" and "query" refer to different ways of
passing data in a URL. Here's the difference between the two:

Params (Path Parameters):


Params are used to encode variable values in the path or URL segment of a request.
They are typically used to specify dynamic parts of a URL, such as IDs, usernames, or
category names.
Params are defined directly within the URL path and are separated by slashes (/).
Example: https://example.com/users/:userId, where :userId is a path parameter
representing a specific user's ID.
Query Parameters:

Query parameters are used to pass additional data in the URL for specific requests.
They are appended to the URL after a question mark (?) and separated by ampersands
(&).
Query parameters consist of a key-value pair and are used to modify or filter the
requested resource.
Example: https://example.com/search?q=keyword&category=books, where q and
category are query parameters with respective values.
The main differences between params and query parameters are as follows:

qustions 3
Usage: Params are typically used for specifying identifiers or dynamic segments in the
URL path, while query parameters are used for providing additional information or
modifying a request.
Location: Params are part of the URL path itself, while query parameters are appended
to the URL as key-value pairs.
Syntax: Params are defined within the URL path, typically denoted by a colon (:) or
other placeholders. Query parameters are appended to the URL after a question mark
(?) and separated by ampersands (&).
Encoding: Params are usually URL-encoded to handle special characters and spaces in
the values. Query parameters are also URL-encoded, with special characters encoded
as well.
To summarize, params are used to represent dynamic parts of a URL's path, while
query parameters provide additional data in the URL for filtering, modifying, or
enhancing the request.
Keywords: Reserved words that have a specific meaning in the language and cannot be
used as identifiers
Identifiers: User-defined names used to represent variables, functions, or labels in the
code. Identifiers can consist of letters, digits, underscores, and dollar signs but cannot
start with a digit.
Literals: Fixed values that are directly used in the code.

Escape sequences begin with a backslash \ followed by one or more characters that
have a specific meaning
The Temporal Dead Zone (TDZ) is a period in JavaScript where variables declared with
let and const exist but cannot be accessed until they are formally declared in the code.
Attempting to access them during this period results in a runtime error.

The optional chaining operator is represented by ?. and can be used with object
properties and methods. If the property or method before ?. is null or undefined, the
expression returns undefined, and the evaluation stops there, avoiding any potential
errors.

Nullish Coalescing Operator ?? is a feature in JavaScript that provides a concise and


safe way to handle default values for cases where a variable is null or undefined. It
specifically checks for null or undefined values, rather than falsy values like 0, false, or
an empty string ('').

qustions 4
A pure function is a function in programming that always produces the same output for
the same given input and has no side effects on the program's state or external
environment.

JSON.parse: Converts a JSON-formatted string into a JavaScript object.


JSON.stringify: Converts a JavaScript object into a JSON-formatted string.

Cookies:
Cookies are small pieces of data stored on the user's browser.
They are used to persistently store information across visits or page requests from the
same user.
Cookies are limited in size (usually around 4KB) and can be accessed by both client-
side (JavaScript) and server-side (web server) code.
Sessions:
Sessions are stored on the server-side.
They manage user-specific data during their visit to a website, typically identified by a
session ID stored in a cookie on the user's browser.
Unlike cookies, session data is not stored on the user's browser; instead, it is stored on
the server, usually in memory or a database.
Sessions can store larger amounts of data compared to cookies since they are not
limited by the size constraints of browser cookies.

An SMTP server is a specialized software application running on a computer or network


device that facilitates the transfer of outgoing email messages from email clients (such
as Outlook, Thunderbird, or mobile devices) to the recipients' email servers. When you
send an email, your email client communicates with the SMTP server, providing the
recipient's email address, subject, body, and attachments. The SMTP server then
processes this information and forwards the email to the appropriate destination server
based on the recipient's domain.
JWT stands for JSON Web Token. It is a compact, self-contained, and secure way of
transmitting information between two parties as a JSON object. JWT is commonly used
for authentication and authorization in web applications.The JWT consists of three
parts: header, payload, and signature. The header contains the algorithm and token
type, the payload includes the data, and the signature is created using the encoded
header, payload, and a secret key to ensure its authenticity.

REST API is a set of rules and conventions that define how client applications can
request and interact with resources (data or functionalities) hosted on a web server.

qustions 5
These resources are typically represented as URLs (Uniform Resource Locators), and
the communication between clients and servers is done using standard HTTP methods
like GET, POST, PUT, DELETE, etc.

Streams allow data to be processed in smaller chunks as it is being read or written,


rather than loading the entire data into memory at once.
Readable Streams: These streams are used to read data from a source, such as a file
or an HTTP request. They provide methods for consuming data in a chunk-by-chunk
manner, making it efficient for processing large files.

Writable Streams: These streams are used to write data to a destination, such as a file
or an HTTP response. They accept data in chunks, enabling efficient writing of large
datasets.

Duplex Streams: These streams can both read and write data. They combine the
functionalities of Readable and Writable streams and are often used for tasks that
require bidirectional data flow.

Transform Streams: These streams are a special type of duplex stream that allows data
to be modified while being read or written. They are useful for data processing tasks,
such as compression, encryption, or parsing.

qustions 6

You might also like