Untitled

Download as pdf or txt
Download as pdf or txt
You are on page 1of 114

1.

Diff between post and put && put and patch:


With the help of post method we can create the new data
And with help of put we can update the data whenever we need to update.

The PATCH method applies partial modifications to a resource.

Hoisting:hoisting is a basically javaScripts phenomena by which we can access variable and


function even before the initialized that value and function or put some value in it we can access
without any error

closure:In JavaScript, a closure is a function that references variables in the outer


scope from its inner scope. The closure preserves the outer scope inside its inner
scope.

Diff between let var and const


var declarations are globally scoped or function scoped
while let and const are block scoped.

● var variables can be updated and re-declared within its

scope; let variables can be updated but not re-declared;

const variables can neither be updated nor re-declared.

● They are all hoisted to the top of their scope. But while

var variables are initialized with undefined, let and const

variables are not initialized.

● While var and let can be declared without being

initialized, const must be initialized during declaration


Is javascript dynamic or static: javaScript is dynamic

What is operator:An operator is capable of manipulating a certain value or


operand. Operators are used to perform specific mathematical and logical
computations on operands. In other words, we can say that an operator operates
the operands. In JavaScript operators are used for compare values, perform
arithmetic operations etc.

middleware:Middleware is a software that acts as an intermediary


between two applications or services to facilitate their
communication

callback:a callback is a function that you pass into another function as an argument
for. const message = function() {

console.log("This message is shown after 3 seconds");

setTimeout(message, 3000)
Node js:node js is an open source cross platform runtime environment which is created
on chrome’s v* engine and it is used for creating server side web applications and also
at the same time it is used for right pick the data for real time application.and by nature
it is an asynchronous non blocking event driven model.

eventloop:A programming structure that continually tests for external events and
calls the appropriate routines to handle them. An event loop is often the main
loop in a program that typically waits for the user to trigger something

What is .env file Javascript?

Its environment variables file. In simple terms, it is a variable text file. In this file
we set a variable with value and that you wouldn't want to share with anyone, but
the file is kept as secret and secure because in . env file we store our database
password, username, API key etc.

What is websocket?
The WebSocket API is an advanced technology that makes it possible to open a two-
way interactive communication session between the user's browser and a server.

What is redis?Why is it fast?why not mongoDB


Redis is a no-sql remote dictionary server.it can store data in key value pairs.basically
it's a temporary data storage which is located to the server its very fast and provides
quick response to the server.
It's fast because we only store a particular data as per requirements for the client.its
a light weight we know that every light weight things are very fast just like that redis
also works fast.it reduces the user latency.
Basically we don’t use mongoDb because its contain lot of the or billions of data
when we try to fetch the data it will take more time which is not good for the business
purpose which is not also good for the user interaction.thats why we try to avoid the
mongodb.

What is docker and container?

Docker is a containerization platform that packages your application and all its
dependencies together in the form of a docker container to ensure that your
application works seamlessly in any environment

Container is a standardized unit which can be created on the fly to deploy a


particular application or environment. It could be an Ubuntu container, CentOs
container, etc. to full-fill the requirement from an operating system point of view.
Also, it could be an application oriented container like CakePHP container or a
Tomcat-Ubuntu container etc

What is Rest Api


REpresentational State Transfer (REST) is an architectural style that
defines a set of constraints to be used for creating web services. REST API
is a way of accessing web services in a simple and flexible way without
having any processing. Ex:u can take example as restaurant and a waiter.
What is noSql?what are the benefits
No sql is basically stand for “not only sql” its is not a traditional database or a
relational database system,with the help of no-sql we can handel and sort the all
types of unsttructured messy and complicated data.in word we say its just a new
way to think about the database.

In today’s world all are means all the things aare depended on the data.wit the
help of data we can access any thing what ever we we want its make our life
easy but the day by day data is becoming more bigger and complex we need to
main the complex data in this scenario no sql provides a efficient and scalable
way that we can easily maintain the complex data.

What is the different between sql and nosql?


In no-sql we create a document or model and we are able to modify that
model anytime and any date.
In SQL it becomes very difficult to change Schema later.

In no sql when ever a document is created it automatically provide the Unique Id


by the db.
In sql you have to maintain id get by yourself
No sql database are non relational and sql database are relational.

What is the ref and populate?


Ref basically specifies the collection of the referenced document.
Populate is the process of replacing the specified path in the document of
one collection with the actual document from the other collection.
What is lodash and lookup?
Lodash is a JavaScript library. Lodash helps in working with arrays, strings,
objects, numbers etc. Lodash Array methods are used to perform operations on
arrays using inbuilt methods
. The lookup operator is an aggregation operator or an aggregation stage,
which is used to join a document from one collection to a document of another
collection of the same database based on some queries.

What is pagination in mongoDB?


The pagination is nothing but the retrieval of the next page by using the
previous page. To faster access data, we can create the index on the
collections field in MongoDB.

What is aggregation?
Aggregation is grouping our documents and doing some mathematical
operations. With this operation he gives us output whatever we want like
maximum minimum or employees total salary etc.

What is BSON and JSON?


JavaScript Object Notation, more commonly known as JSON.JavaScript objects
are simple associative containers, wherein a string key is mapped to a value
(which can be a number, string, function, or even another object). This simple
language trait allowed JavaScript objects to be represented remarkably simply in
text

BSON simply stands for “Binary JSON,” BSON’s binary structure encodes type
and length information, which allows it to be parsed much more quickly.
Since its initial formulation, BSON has been extended to add some optional non-
JSON-native data types, like dates and binary data, without which MongoDB
would have been missing some valuable support.

Languages that support any kind of complex mathematics typically have different
sized integers (ints vs longs) or various levels of decimal precision (float, double,
decimal128, etc.).

Not only is it helpful to be able to represent those distinctions in data stored in


MongoDB, it also allows for comparisons and calculations to happen directly on
data in ways that simplify consuming application code.

What is indexing in mongoDB?

In MongoDB, indexes help in efficiently resolving queries. What an Index does is that it
stores a small part of the data set in a form that is easy to traverse. The index stores
the value of the specific field or set of fields, ordered by the value of the field as
specified in the index.

MongoDB’s indexes work almost identically to typical relational database indexes.

Indexes look at an ordered list with references to the content. These in turn allow
MongoDB to query orders of magnitude faster. To create an index, use the
createIndex collection method.

For example:

> db.users.find({"username":
"user101"}).explain("executionStats")
Difference between “ == “ and “ === “ operators.
Both are comparison operators. The difference between both the operators is
that,“==” is used to compare values whereas, “ === “ is used to compare both value
and types.

Example:

var x = 2;

var y = "2";

(x == y) // Returns true since the value of both x and y is the same

(x === y) // Returns false since the typeof x is "number" and typeof y is "string"

What is stack where we use it?

=>A Stack is a widely used linear data structure in modern computers in which
insertions and deletions of an element can occur only at one end, i.e., top of the Stack. It
is used in all those applications in which data must be stored and retrieved in the last.

Application of stack

● Evaluation of Arithmetic Expressions

● Backtracking
● Delimiter Checking

● Reverse a Data

● Processing Function Calls

3.stackoverflow meaning in tech?

Ans)A stack overflow is an undesirable condition in which a particular


computer program tries to use more memory space than the call stack has
available. In programming, the call stack is a buffer that stores requests that
need to be handled.

The size of a call stack depends on various factors. It is usually defined at the
start of a program. Its size can depend on the architecture of the computer on
which the program runs, the language in which the program is written, and the
total amount of available memory in the system. When a stack overflow
occurs as a result of a program's excessive demand for memory space, that
program (and sometimes the entire computer) may crash.

4.what is difference between git and GitHub?

Ans)While Git is a tool that's used to manage multiple versions of source code edits that
are then transferred to files in a Git repository, GitHub serves as a location for uploading
copies of a Git repositor

5.sort an Array so that all zero moved to words right [3,2,0,4, 0,5,6,0]?

6. linked list find point where list is becoming circular. making a P?


7.Reverse Array without using extra array?

Ans) let arr = [1, 2, 3, 4, 5, 6, 7];

let n = arr.length-1;

for(let i=0; i<=n/2; i++)

{ let temp = arr[i]; arr[i] = arr[n-i]; arr[n-i] = temp; }

console.log(arr);

2.What is Authentication and Authorisation and in Which Api we are doing


Authentication and Authorisation?

.What is call back function?

A callback function is a function passed into another function as an argument,


which is then invoked inside the outer function to complete some kind of routine
or action.

.What is the diff btw asyn and Asynchoronus Function?

=>In synchronous operations tasks are performed one at a time and only when one is
completed, the following is unblocked. In other words, you need to wait for a task to
finish to move to the next one. In asynchronous operations, on the other hand, you
can move to another task before the previous one finishes.

.What is Async and Await?

=>“async” keyword needs to be updated in front of functions that contain ”await”


keyword to notify that the result might be available after a certain delay since we
are explicitly making the main thread wait until the promise has been resolved.
Await and Async has introduced synchronous behavior to the Execution.

What is Jwt Token?

=>JSON Web Token (JWT) is an open standard (RFC 7519) that defines a compact
and self-contained way for securely transmitting information between parties as a
JSON object. This information can be verified and trusted because it is digitally signed.

Information Exchange: JWTs are a good way of securely transmitting information


between parties because they can be signed, which means you can be sure that the
senders are who they say they are. Additionally, the structure of a JWT allows you to
verify that the content hasn't been tampered with.

=>diffrence between tree and stack?

In stack, the track of the last element present in the list is tracked with a pointer
called top. Below is the diagrammatic representation of the same: Tree: A Tree tree is
a finite set of one or more nodes such that: There is a specially designated node called
root.

=>eventloop?

An event loop is something that pulls stuff out of the queue and places it onto the
function execution stack whenever the function stack becomes empty.

=>diffrenece between i++ and ++i ?

The only difference is the order of operations between the increment of the variable and
the value the operator returns. So basically ++i returns the value after it is
incremented, while i++ return the value before it is incremented. At the end, in both
cases the i will have its value incremented.

=>what is redis?

Redis (REmote DIctionary Server) is an advanced NoSQL key-value data store


used as a database, cache, and message broker. Redis is known for its fast read and
write operations, rich data types, and advanced memory structure. It is ideal for
developing high-performance, scalable web applications.

Redis is one of the most popular key-value databases, ranking at #4 in user


satisfaction for NoSQL databases. The popularity of Redis continues to rise, and
many companies are seeking Redis developers for roles like database administrator
and beyond.

=>what is mongodb?

As a definition, MongoDB is an open-source database that uses a document-oriented

data model and a non-structured query language. It is one of the most powerful NoSQL

systems and databases around, today.

MongoDB Atlas is a cloud database solution for contemporary applications that is

available globally. This best-in-class automation and established practices offer to

deploy fully managed MongoDB across AWS, Google Cloud, and Azure.

It also ensures availability, scalability, and compliance with the most stringent data

security and privacy requirements. MongoDB Cloud is a unified data platform that

includes a global cloud database, search, data lake, mobile, and application services.
Is JavaScript single thread or multi-threaded? Explain how.

=>JavaScript is a single-threaded language because while running code on a single


thread, it can be really easy to implement as we don't have to deal with the complicated
scenarios that arise in the multi-threaded environment like deadlock. Since, JavaScript
is a single-threaded language, it is synchronous in nature.

Explain asynchronous functions. How call stack is managed in async functioning?

=>An asynchronous function is any function that delivers its result asynchronously
– for example, a callback-based function or a Promise-based function. An async
function is defined via special syntax, involving the keywords async and await . It is also
called async/await due to these two keywords

When an external api is hit. Is that async or sync?

=>synchronous

What are the drawbacks of callback function?

=>The biggest problem with callbacks is that they do not scale well for even
moderately complex asynchronous code. The resulting code often becomes hard to
read, easy to break, and hard to debug

Explain async using set timeout.

=>

Explain caching.?

=>Caching is the process of storing copies of files in a cache, or temporary storage


location, so that they can be accessed more quickly. Technically, a cache is any
temporary storage location for copies of files or data, but the term is often used in
reference to Internet technologies. Web browsers cache HTML files, JavaScript, and
images in order to load websites more quickly, while DNS servers cache DNS records
for faster lookups and CDN servers cache content to reduce latency.
How Redis is different from MongoDb?

=>MongoDB is a document-oriented, disk-based database optimized for operational


simplicity, schema-free design and very large data volumes. Redis is an in-memory,
persistent data structure store that enables developers to perform common
operations with minimal complexity and maximum performance

=>What makes caching memory faster than permamnet memory when both has equal
amt of data?

Cache memory allows for faster access to data for two reasons: cache uses Static
RAM whereas Main Memory (RAM) uses dynamic RAM. cache memory stores
instructions the processor may require next, which can then be retrieved faster than if
they were held in RAM.

Expalin cache miss. How can we reduce cache miss?

=>A cache miss is an event in which a system or application makes a request to


retrieve data from a cache, but that specific data is not currently in cache memory.
Contrast this to a cache hit, in which the requested data is successfully retrieved from
the cache. A cache miss requires the system or application to make a second attempt
to locate the data, this time against the slower main database. If the data is found in the
main database, the data is then typically copied into the cache in anticipation of another
near-future request for that same data.

A cache miss occurs either because the data was never placed in the cache, or because
the data was removed (“evicted”) from the cache by either the caching system itself or
an external application that specifically made that eviction request. Eviction by the
caching system itself occurs when space needs to be freed up to add new data to the
cache, or if the time-to-live policy on the data expired.

Explain execution policy and cache policy?

=>An execution policy is part of the PowerShell security strategy. Execution policies
determine whether you can load configuration files, such as your PowerShell profile, or
run scripts. And, whether scripts must be digitally signed before they are run.
Explain authenticaton & authorisation?

=>repeated

Explain jwt. What library do we use in JWT.

=>JSON Web Token (JWT) is an open standard (RFC 7519) that defines a compact
and self-contained way for securely transmitting information between parties as a JSON
object. This information can be verified and trusted because it is digitally signed. JWTs
can be signed using a secret (with the HMAC algorithm) or a public/private key pair
using RSA or ECDSA.

the jsonwebtoken library to help us create and verify JWT tokens

Explain usage of middleware in express?

=>An Express application can use the following types of middleware: Application-level
middleware. Router-level middleware. Error-handling middleware.

how to create a branch

git branch -b branchname

how to push.

1) git add.

2) git commit -m “commit here”

3) git push repolink

where we store long url.


how we redirect long url to Short url

quants test having 20 questions

https://docs.google.com/spreadsheets/d/1qqgRWdi5FWsw8L80tUQBWFeuPnkv6OHemRnNJ
9AABDI/edit#gid=887086757

Q1. Are you ready to learn new tech stack related to data science?

Q1. Asked to explain URL shortner project

Q1. Check wehter the given string is a palindrome.

Q2. Explain Event loop in JS.

The event loop got its name because of how it's usually implemented.JavaScript has a
runtime model based on an event loop, which is responsible for executing the code,
collecting and processing events, and executing queued sub-tasks.

Q3. Explain hoisting in JS

In JavaScript, Hoisting is the default behavior of moving all the declarations at the
top of the scope before code execution. Basically, it gives us an advantage that no
matter where functions and variables are declared, they are moved to the top of their
scope regardless of whether their scope is global or local.

Q4. Explain closure in JS

A closure is the combination of a function bundled together (enclosed) with references


to its surrounding state (the lexical environment). In other words, a closure gives you
access to an outer function's scope from an inner function. In JavaScript, closures are
created every time a function is created, at function creation time.

aptitude test , verbal. maths. Questions


https://docs.google.com/document/d/1ftWlydBPgy6Tse_EZwBU5hOlp7pZ8G6S/edit?usp=shari
ng&ouid=102481008947598942660&rtpof=true&sd=true

write a program to print hello world

what is restfull api and diff between post and get

A REST API is an API implementation that adheres to the REST architectural


constraints. It acts as an interface. The communication between the client and
the server happens over HTTP. A REST API takes advantage of the HTTP
methodologies to establish communication between the client and the server.
REST also enables servers to cache the response that improves the
application’s performance.

Both GET and POST method is used to transfer data from client to server in
HTTP protocol but Main difference between POST and GET method is that GET
carries request parameter appended in URL string while POST carries request
parameter in message body which makes it more secure way of transferring data
from client to server.

what is arrow function

Arrow function is one of the features introduced in the ES6 version of

JavaScript. It allows you to create functions in a cleaner way compared to

regular functions. For example,

This function

// function expressionlet x = function(x, y) {

return x * y;

can be written as
// using arrow functionslet x = (x, y) => x * y;

diff between var let const

Differences between var, let, and const

var let const

The scope of a var The scope of a let The scope of a const


variable is variable is block variable is block
functional scope. scope. scope.

It can be updated It can be updated It cannot be updated or


and re-declared into but cannot be re- re-declared into the
the scope. declared into the scope.
scope.

It can be declared It can be declared It cannot be declared


without without without initialization.
initialization. initialization.

It can be accessed It cannot be It cannot be accessed


without accessed without without initialization,
initialization as initialization, as as it cannot be
its default value is it returns an declared without
“undefined”. error. initialization.
event emitter,

https://www.tutorialspoint.com/nodejs/nodejs_event_emitter.htm

authentication and authorisation

In simple terms, authentication is the process of verifying who a user is, while
authorization is the process of verifying what they have access to

asked me to write login api

what is jwt,

JSON Web Token (JWT) is an open standard ( RFC 7519) that defines a compact and
self-contained way for securely transmitting information between parties as a JSON
object.

payload,

The second part of the token is the payload, which contains the claims. Claims are
statements about an entity (typically, the user) and additional data. There are three
types of claims: registered, public, and private claims.

aws,

AWS for beginners offers database storage options, computing power, content
delivery, and networking among other functionalities to help organizations scale
up. It allows you to select your desired solutions while you pay for exactly the services
you consume only.

asked about oops concept,class objects and inheritance

Classes– Classes are blueprint of an Object. A class can have many Object,
because class is a template while Object are instances of the class or the concrete
implementation.
Inheritance – It is a concept in which some property and methods of an Object is
being used by another Object. Unlike most of the OOP languages where classes
inherit classes, JavaScript Object inherits Object i.e. certain features (property and
methods)of one object can be reused by other Objects.

Object– An Object is a unique entity that contains property and methods. For
example “car” is a real life Object, which has some characteristics like color, type,
model, horsepower and performs certain action like drive. The characteristics of an
Object are called as Property, in Object-Oriented Programming and the actions are
called methods. An Object is an instance of a class. Objects are everywhere in
JavaScript almost every element is an Object whether it is a function, array, and
string.

write function add 2 no.

change add function with take multiple inputs return sum

write prime number check function

write function even odd check

difference between asynchronous and synchronous

Synchronous code runs in sequence. This means that each operation must wait
for the previous one to complete before executing. Asynchronous code runs in
parallel. This means that an operation can occur while another one is still being
processed.

given array of object . how to access these objects key

WAP input=[1,[2,[3,[4]]]] output=[1,2,3,4] using recurssion.

what is difference btn js and nodejs.

Javascript is a programming language that is used for writing scripts on the


website. NodeJS is a Javascript runtime environment.

what is aggrigation in mongodb


In MongoDB, aggregation operations process the data records/documents and
return computed results. It collects values from various documents and groups them
together and then performs different types of operations on that grouped data like sum,
average, minimum, maximum, etc to return a computed result.

what is chashing?types of cashing?

It is used to store in the local memory.Cashing is a common technique for making our
application faster.It let’s avoid slow operation’s.

Types of cashing

1. Hit : Found the data in cache it return data to the client.

2. Miss : Didn’t find the data in cache than we can call to the db to search the data &
return the data to the client.

why mongodb is advantagious?

MongoDB offers many advantages over traditional relational databases:

● Full cloud-based application data platform


● Flexible document schemas
● Widely supported and code-native data access
● Change-friendly design
● Powerful querying and analytics
● Easy horizontal scale-out with sharding
● Simple installation
● Cost-effective
● Full technical support and documentation

what is differnce between vertical and horizontal scaling.

While horizontal scaling refers to adding additional nodes, vertical scaling


describes adding more power to your current machines. For instance, if your server
requires more processing power, vertical scaling would mean upgrading the CPUs. You
can also vertically scale the memory, storage, or network speed.

Tell me about yourself

Open your projects in local system and run that , show me your postman

do you work on frontend part also of these projects

https://app.tactiq.io/api/2/u/m/r/SqLYOFNer9g3r1famMCl?o=sl

Detailed explanation about our projects

Why we use nodejs,

Node. js is primarily used for non-blocking, event-driven servers, due to its single-threaded
nature. It's used for traditional web sites and back-end API services, but was designed with real-
time, push-based architectures in mind.

Express

use is a method to configure the middleware used by the routes of the Express
HTTP server object. The method is defined as part of Connect that Express is based
upon.

and mongo db

MongoDB is an open-source document database and leading NoSQL database.

What is promisify

The util.promisify() method defines in utilities module of Node.js standard library. It


is basically used to convert a method that returns responses using a callback
function to return responses in a promise object.

What is redis and how to use redis in your project

Redis is a super fast and efficient in-memory, key–value cache and store. It's also
known as a data structure server, as the keys can contain strings, lists, sets, hashes
and other data structures. Redis is best suited to situations that require data to be
retrieved and delivered to the client as quickly as possible.
What is time complexity

Time complexity is the amount of time taken by an algorithm to run, as a function


of the length of the input

What is middle ware why you use middle ware in your project

Middleware is software which lies between an operating system and the applications
running on it.

What is event loop

The event loop allows Node.js to perform non-blocking I/O operations despite the
fact that JavaScript is single-threaded. It is done by assigning operations to the
operating system whenever and wherever possible

· Event loop is an endless loop, which waits for tasks, executes them and then
sleeps until it receives more tasks.

· The event loop executes tasks from the event queue only when the call stack
is empty i.e. there is no ongoing task.

· The event loop allows us to use callbacks and promises.

· The event loop executes the tasks starting from the oldest first.

How to deployed your projects

How to build http requests

Express advantages

Given some kind of conditions and asked regarding approach how to solve this. Like
authorization possess regarding and accessibility to change profile etc.

Some other question regarding approach discussion like array and stack and queue etc
where do you see yourself after 5 years

tell about your favourite project

are you willing to relocate

what are your salary expectations

scenario of stockmarket how u will build api to shocase live data.

differnce between sequel and nosequel

SQL pronounced as “S-Q-L” or as “See-Quel” is primarily called RDBMS or


Relational Databases whereas NoSQL is a Non-relational or Distributed Database.
Comparing SQL vs NoSQL database, SQL databases are table based databases
whereas NoSQL databases can be document based, key-value pairs, graph databases.

what is ur faviourate data structure,gave some scenarios and asked real world

ex.(queue).railway tikit booking system

why functionup?

why career in tech?

1. find the sum of pairs

2. find index of given number from array

3. what is scope and scope chain

Scope - The place in which a variable can be accessed. Scope Chain - A stack of
currently accessible scopes, from the most immediate context to the global
context. Global Scope - A globally scoped variable can be accessed anywhere in the
program.

what is promises and difference promises and async and await

Promise is an object representing intermediate state of operation which is guaranteed to


complete its execution at some point in future.

In using async and await, async is prepended when returning a promise, await is
prepended when calling a promise. try and catch are also used to get the rejection
value of an async function.

1. Tell me about your favourite project & the challenges you faced in that project.

2. Where did you use Redis and AWS ?

3. Do you know reactJs ?

4. Write a function to calculate the max sum of three cosecutive elements in an array.

5. Write a function to merge these two arrays & result should be like this -

let array1 = [

{ name: "a", value: 123 },

{ name: "b", value: 666 },

];

let array2 = [

{ name: "c", value: 444 },

{ name: "d", value: 999 },

{ name: "b", value: 111 },

];

// result: [

// { name: "a", value: 123 },


// { name: "b", value: 111 },

// { name: "c", value: 444 },

// { name: "d", value: 999 },

// ];

what are the data variables in c++

In C++, there are different types of variables (defined with different keywords), for
example: int - stores integers (whole numbers), without decimals, such as 123 or -123.
double - stores floating point numbers, with decimals, such as 19.99 or -19.99. char -
stores single characters, such as 'a' or 'B'.

what is repl and where you used

Mongodb is not installed on replit so you need to find an external place for a mongodb database.
You can achieve this with mongodb atlas which has a free tier.

How mongoDB provide consistency ?

MongoDB is consistent by default: reads and writes are issued to the primary
member of a replica set. Applications can optionally read from secondary replicas,
where data is eventually consistent by default.

Which method is used to Isolate the cursors from intervening with the write

Snapshot() method
Ans. Snapshot() method is used to isolate cursors from intervening the write operation. By using
this method it negotiates the index and makes sure that each query comes to an article only once.

what is oops and sop

Object-Oriented Programming Structural Programming. Object-Oriented


Programming is a type of programming which is based on objects rather than just
functions and procedures Provides logical structure to a program where programs are
divided functions.

Top down approach and bottom down approach

Top-Down Approach Bottom-Up Approach

May contains redundancy as we break up the This approach contains less redundancy if
problem into smaller fragments, then build that the data encapsulation and data hiding are
section separately. being used.

What are the main features of the oops

There are three major features in object-oriented programming that makes them
different than non-OOP languages: encapsulation, inheritance and polymorphism.

What is Mongoose?

Mongoose is a Node. js-based Object Data Modeling (ODM) library for MongoDB. It
is akin to an Object Relational Mapper (ORM) such as SQLAlchemy for traditional SQL
databases. The problem that Mongoose aims to solve is allowing developers to enforce
a specific schema at the application layer.

Are you used flutter?

Flutter is Google's portable UI toolkit for crafting beautiful, natively compiled


applications for mobile, web, and desktop from a single codebase. Flutter works
with existing code, is used by developers and organizations around the world, and is
free and open source.
211 ) Sort the array?

Ans.

1- Array.sort(a,b=>{return a-b});

2- USING FOR LOOP

for(i=0;i<array.length;i++)

for(j=i+1;j<array.length;j++)

If(array[i]>array[j]) [array[i], array[j]]= [array[j], array[i]];

214) What is API/Restfull API?

Ans. Application Programming Interface. It is basically a collection of function & procedure


which allows us to communicate 2 applications or library.

RestfullAPI:-As REST is an acronym for REpresentational State Transfer, statelessness is key.


An API can be REST if it follows the below constraints .

1- Uniform Interface.

2-Stateless.

3-Cacheable.

4-Client-Server.

5-Layered System.
6- Code on Demand.

215) What is middleware?

Ans. Middleware is software which lies between an operating system and the applications
running on it. Essentially functioning as hidden translation layer, middleware enables
communication and data management for distributed applications.

216) How Node.JS works?

Ans. Node.js is a popular framework for building backend systems (network applications) which
can scale very well. Node.js is a JavaScript runtime based on Chrome V8 engine. It is use to
perform non-blocking activities.

217) What is JWT?

Ans. A JSON Web Token (JWT) is an access token standardized according to RFC 7519, which
makes it possible for two parties to securely exchange data. It contains all important
information about an entity, meaning that no database queries are necessary and the session
doesn’t need to be saved on the server. JWT is especially popular in authentication
processes.Its short messages can be encrypted and securely convey who the sender is and
whether they have the necessary access rights.

Header

The header usually contains two parts and provides important information about the token. It
contains the type of the token and the signing/encryption algorithm being used.

Pay-Load

The header usually contains two parts and provides important information about the token. It
contains the type of the token and the signing/encryption algorithm being used.

Signature

The signature of a JSON Web Token is created using the Base64 coding of the header and
payload and the indicated signing algorithm. The structure is determined by the JSON Web
Signature (JWS).

220) Create API to get data from another API and send into JSON format?

222) What is Event Loop?


Ans. An event loop is something that pulls stuff out of the queue and places it onto the function
execution stack whenever the function stack becomes empty. The event loop is the secret by
which JavaScript gives us an illusion of being multithreaded even though it is single-threaded.

224) what are promises?

Ans. Promises in Node JS makes it simple for the developers to write asynchronous code in a
manner that it is almost like the synchronous coding. It allows the async call to return a value
just like the synchronous function. Itdon’t need to run extra checks or try/catch for the error
handling.

226) What is async and Await?

Ans. An async function is a function that is declared with the async keyword and allows the
await keyword inside it. The async and await keywords allow asynchronous, promise-based
behaviour to be written more easily and avoid configured promise chains. The async keyword
may be used with any of the methods for creating a function.

JavaScript Await function is used to wait for the promise. It could only be used inside the async
block. It instructs the code to wait until the promise returns a response. It only delays the async
block. Await is a simple command that instructs JavaScript to wait for an asynchronous action to
complete before continuing with the feature. It's similar to a "pause until done" keyword.

227) BST

https://www.educba.com/binary-tree-javascript/

233) What is the difference between findOne(), find() and findOneAndUpdate()?

Ans. Find returns an array, while remaining two returns an object. Find returns the list of the matching
data, while findOne returns only the 1st matching data, and findOneAndUpdate returns the singl data after
updating it.

234) NodeJS is a single threaded or multi threaded?

Ans. Single threaded.

237) Advantages of NoSQL over SQL?

Ans. Advantages of NoSQL

● NoSQL is Non-relational
● NoSQL is Low Cost

● Scalability is Easier

Disadvantages of NoSQL

· Less Community Support

· Standardization

· Interfaces and Interoperability

Advantages of SQL

● Speed

● Well- Defined Standards

● No Coding

● Data Integration Scripts

● Retrieving Information

● Analytical Queries

Disadvantages of SQL

● Interfaces

● Complex Interface

● Implementation

● Only Partial Control

● Expense
238) What are maps(), filter() and closure?

Ans. Map and filter are higher order functions, which can take functions are an input, are returns

in the form of array. Map function is use to iterate all the elements of the input array and do

some operations and returns a new array, while filter function is use to iterate all the elements

and with a condition filter out the things, condition returns the Boolean, if it is true then the filter

function will push that element in to the new array else not.

When the inner nested functions read the variables which are declared outside the function or

inside the outer functions (lexical/ inheritance) this concept is called as closure.

241) Hoisting?

Ans. When we declare the functions or a variable then JS first reserve some memory for them

which predefined value as “undefined”. this is called Hoisting.

242) What is execution phase?

Ans. In the Code Execution Phase, JavaScript being a single thread language again runs
through the code line by line and updates the values of function and variables which are stored
in the Memory Allocation Phase in the Memory Component. So, in the code execution phase,
whenever a new function is called, a new Execution Context is created.

243) What is cors policy?

Ans. CORS stands for “Cross-Origin Resource Sharing” and is a way for a website to use

resources not hosted by its domain as their own. This became an W3C recommendation in

2014 and has been adopted by all major browsers. The purpose is to prevent scripts from

making requests to non-authorized domains.


259) Space complexity& strict in JS?

Ans. The amount of space occupied by a code while executing is called it space complexity.

While Strict mode was introduced by ECMAScript 5 to JavaScript. Using strict mode JavaScript

silent errors can be easily detected as they would throw an error. This makes JavaScript

debugging much easy and helps developers to avoid unnecessary mistakes.

Scope in JS: - 2 types- Global, Local

Question Difference between Node.JS and Express?

Pros of Express JS

· Is easy to use and offers a robust set of features.

· Has powerful routing APIs.

· Has an extendable and customizable architecture.

· Provides various HTTP utility methods and middleware.

· Can be easily integrated with databases like MongoDB, Redis, etc.

Cons of Express JS

· Uses middleware functions extensively which can sometimes lead to a messy


codebase.

· Does not have an inbuilt ORM system or any other way to interact with
databases.

Pros of NodeJS
Node.js advantages are numerous and beneficial to all kinds of apps whether you are building a
payment system or a video streaming app. Some benefits are identified below. NodeJS:

· Has unmatchable speed due to its non-blocking architecture and event loop
feature.

· It is highly scalable despite its single-threadedness.

· It makes debugging easy as it uses Google Chrome’s V8 JavaScript engine to


execute code.

· It has a large library of various JavaScript modules that simplifies the


development of web applications using NodeJS to a great extent.

Cons of NodeJS

· Uses asynchronous programming model, which can be confusing for beginner


developers. However, once mastered, this model helps to improve app performance
and responsiveness.

· Lacks support for some databases, like relational ones. In any case, developers
can solve this challenge using frameworks such as Express.js.

262) How NodeJS works?

Ans. Node.js is a popular framework for building backend systems (network applications) which
can scale very well. Node.js is a JavaScript runtime i.e. it runs the JavaScript codes. JavaScript
has long been used in webpages and run by the browsers. But now the JavaScript can also run
without a browser. This was made possible via Node.js which uses Chrome's V8 JavaScript
engine.

263) Authentication and Authorisation?

Ans.

Authentication Authorization
Authentication is the process of identifyingAuthorization
a is the process of giving permission
user to provide access to a system. to access the resources.

In this, the user or client and server are


In this, it is verified that if the user is allowed
verified. through the defined policies and rules.

It is usually performed before the


It is usually done once the user is successfully
authorization. authenticated.

It requires the login details of the user, such


It requires the user's privilege or security level.
as user name & password, etc.

Data is provided through the Token Ids. Data is provided through the access tokens.

Example: Entering Login details is necessary


Example: After employees successfully
for the employees to authenticate themselves
authenticate themselves, they can access and
to access the organizational emails work or on certain functions only as per their roles
software. and profiles.

Authentication credentials can be partially


Authorization permissions cannot be changed
changed by the user as per the requirement.
by the user. The permissions are given to a user
by the owner/manager of the system, and he
can only change it.

270) What is a call-back function?

Ans. A call-back function always has a specific action which is bound to a specific circumstance.
Therefore, a call-back function is only called once a clearly defined operation has been
performed. Event handlers are a good example of a type of call-back function. These are used
in HTML elements such as buttons.

271) What is call-back hell?


Ans. This is a big issue caused by coding with complex nested call-back. Here, each and every
call-back takes an argument that is a result of the previous call-back. In this manner, the code
structure looks like a pyramid, making it difficult to read and maintain. Also, if there is an error in
one function, then all other functions get affected.

272) What is Middleware?

Ans. Software that acts as a bridge between an operating system or database and applications,
especially on a network.

283. What is callback function?

Ans Callback is a function that is passed as an argument to another function and its execution is
delayed until that function in which

it is passed is executed. Meaning, if I pass a function, let's say function1 to another function, i.e.,
function2 ,then function1 will

not be executed until function2 is executed

Example:

// function

function greet(name, callback) {

console.log('Hi' + ' ' + name);

callback();

// callback function
function callMe() {

console.log('I am callback function');

// passing function as an argument

greet('Peter', callMe);

Output:

Hi Peter

I am callback function

Benefit of Callback Function

The benefit of using a callback function is that you can wait for the result of a previous function
call and then execute another function call.

Example: Program with setTimeout()

// program that shows the delay in execution

function greet() {

console.log('Hello world');

}
function sayName(name) {

console.log('Hello' + ' ' + name);

// calling the function

setTimeout(greet, 2000);

sayName('John');

Output

Hello John

Hello world

284. What is callback hell?

Ans: Callback hell, also known as the pyramid of doom, is the result of intensively nested,
unreadable, and unmanageable callbacks,

which in turn makes the code harder to read and debug.

improper implementation of the asynchronous logic causes callback hell


285. what is middleware?

Ans: Middleware functions are functions that have access to the request object (req), the response
object (res), and the next middleware function

in the application’s request-response cycle. The next middleware function is commonly denoted
by a variable named next.

1. As name suggests it comes in middle of something and that is request and response cycle

2. Middleware has access to request and response object

3. Middleware has access to next function of request-response life cycle

Middleware functions can perform the following tasks:

-> Execute any code.

-> Make changes to the request and the response objects.

-> End the request-response cycle.

-> Call the next middleware in the stack.

288. why node is single threaded?

Ans: Node.js, all request are handled in a single thread with shared resources. Then how does
Node.js handle concurrent traffic or requests?
It follows “Single Threaded Event Loop Model” architecture that runs on top of single V8 engine
instance.

It is important to not say Node.js is single-threaded because the JavaScript programming


language is single-threaded. This is incorrect.

JavaScript can run in different programming environments, and Node.js being among the most
popular environments using JavaScript. Therefore,

it is a common misconception to think JavaScript is single-threaded. When speaking about


single-threaded or multi-threaded, we should look at

how the programming environment operates rather than how the language in itself.

289. if node is single threaded then how it perform multi threading

Ans: Each thread will use the same Node.js architecture which is single-threaded based.

You can achieve multithreading by generating multiple nodes or Node.js V8 engines which in
isolation are single-threaded.

It is still correct to say Node.js is not multi-threaded.

290. What is Event Loop?

Ans: The event loop is a constantly running process that monitors both the callback queue and the
call stack.

If the call stack is not empty, the event loop waits until it is empty and places the next function
from the callback queue to the call stack.
291. What is Assert and its syntex?

Ans: The assert() method tests if a given expression is true or not.

If the expression evaluates to 0, or false, an assertion failure is being caused, and the program is
terminated.

The assert() method is an alias of the assert.

Synatx:

assert(expression, message);

expression Required. Specifies an expression to be evaluated

message Optional. Specifies the error message to be assigned to the AssertionError. If omitted, a
default message is assigned

295. how AWS S3 works

Ans: The S3 object storage cloud service gives a subscriber access to the same systems that
Amazon uses to run its own websites.

S3 enables customers to upload, store and download practically any file or object that is up to 5
terabytes (TB) in size -- with

the largest single upload capped at 5 gigabytes (GB).

298. find and findOne Difference Based On Application.


Ans: The findOne() returns first document if query matches otherwise returns null. The find() return
all document if query mathes

otherwise returns a empty array.

300. Which Sorting Is Best And Why

Ans: Quicksort. Quicksort is one of the most efficient sorting algorithms, and this makes of it one of
the most used as well.

The first thing to do is to select a pivot number, this number will separate the data, on its left are
the numbers smaller

than it and the greater numbers on the right

301. What is Promise And Syntex Of promise

Ans: A promise is an object which can be returned synchronously from an asynchronous function. It
will be in one of 3 possible states:

Fulfilled: onFulfilled() will be called (e.g., resolve() was called)

Rejected: onRejected() will be called (e.g., reject() was called)

Pending: not yet fulfilled or rejected

when a Promise object is "pending" (working), the result is undefined.

When a Promise object is "fulfilled", the result is a value.

When a Promise object is "rejected", the result is an error object.


Syntax:

let myPromise = new Promise(function(myResolve, myReject) {

myResolve(); // when successful

myReject(); // when error

});

myPromise.then(

function(value) { /* code if successful */ },

function(error) { /* code if some error */ }

);

305 a). Explain SQL Database?

Ans: SQL (Structured Query Language) is a powerful and standard query language for relational
database systems.

Data is stored in the form of a table

We use SQL to perform CRUD (Create, Read, Update, Delete) operations on databases along
with other various operations.
SQL is used to

create databases

create tables in a database

read data from a table

insert data in a table

update data in a table

delete data from a table

delete database tables

delete databases

grant and revoke permissions

backup and restore databases

and many more database operations

b) Mongodb Query

Ans: MongoDB Query is a way to get the data from the MongoDB database. MongoDB queries
provide the simplicity in process of fetching data

from the database, it’s similar to SQL queries in SQL Database language.

Equal filter query


The equality operator($eq) is used to match the documents where the value of the field is equal
to the specified value.

In other words, the $eq operator is used to specify the equality condition.

Syntax:

db.collectionName.find({< key > : {$eq : < value >}})

Example:

db.article.find({author:{$eq:"devil"}})

Here, we are going to display the documents that matches the filter query(i.e., {author : {$eq :
“devil”}}) from the article collection.

Greater than filter query

To get the specific numeric data using conditions like greater than equal or less than equal use
the $gte or $lte operator in the find() method.

Syntax:

db.collectionName.find({< key > : {$gte : < value >}})

or

db.collection_name.find({< key > : {$lte : < value >}})

Example:

db.article.find({length:{$gte:510}})

Here, we are querying to get documented data which has the length attribute value greater than
510. So, we pass a filter query that is

{length : {$gte : 510}} in the find() method.


c) Explain in detail how nodejs work in backend

Ans: Node.js accepts the request from the clients and sends the response, while working with the
request node.js handles them with a single thread.

To operate I/O operations or requests node.js use the concept of threads. Thread is a sequence
of instructions that the server needs to perform.

It runs parallel on the server to provide the information to multiple clients. Node.js is an event
loop single-threaded language.

It can handle concurrent requests with a single thread without blocking it for one request.

Node.js basically works on two concept

Non-blocking I/o:

Non-blocking i/o means working with multiple requests without blocking the thread for a single
request. I/O basically interacts with external

systems such as files, databases. Node.js is not used for CPU-intensive work means for
calculations, video processing because a single thread

cannot handle the CPU works.

Asynchronous:

Asynchronous is executing a callback function. The moment we get the response from the other
server or database it will execute a callback

function. Callback functions are called as soon as some work is finished and this is because the
node.js uses an event-driven architecture.
The single thread doesn’t work with the request instead it sends the request to another system
which resolves the request and it is accessible

for another request.

d) Single and Multi-Thread

Ans: Single Thread refers to executing an entire process from begining to end without interruption
by a thread.

A Single thread executes a process in single threading.

Multi Thread refers to allowing multiple threads within a process such that they execute
independently but share their resources.

Multiple thread executes a process in multithreading.

f) Shallow Copy and Deep Copy

Ans: Shallow copy

Shallow copy is a bit-wise copy of an object. A new object is created that has an exact copy of the
values in the original object.

If any of the fields of the object are references to other objects, just the reference addresses are
copied i.e., only the memory address

is copied.
Example.

Shallow Copy: It makes a copy of the reference to X into Y. Think about it as a copy of X’s
Address. So, the addresses of X and Y will be

the same i.e. they will be pointing to the same memory location.

Deep copy

A deep copy copies all fields, and makes copies of dynamically allocated memory pointed to by
the fields. A deep copy occurs when an object

is copied along with the objects to which it refers.

Example.

Deep copy: It makes a copy of all the members of X, allocates different memory location for Y and
then assigns the copied members to Y to

achieve deep copy. In this way, if X vanishes Y is still valid in the memory.

h) Explain Higher Order Function.

Ans. A higher order function is a function that takes a function as an argument, or returns a function.
Higher order function is in contrast to

first order functions, which don’t take a function as an argument or return a function as output.

.map() and .filter(). Both of them take a function as an argument. They're both higher order
functions.

Example:

The .map() Method


The .map() method executes a callback function on each element in an array. It returns a new
array made up of the return values from the

callback function.

////////////////////////////////////////////////////////////////////////////

const finalParticipants = ['Taylor', 'Donald', 'Don', 'Natasha', 'Bobby'];

const announcements = finalParticipants.map(member => {

return member + ' joined the contest.';

})

console.log(announcements)

The .filter() Method

The .filter() method executes a callback function on each element in an array. The callback
function for each of the elements must return

either true or false. The returned array is a new array with any elements for which the callback
function returns true.

///////////////////////////////////////////

const randomNumbers = [4, 11, 42, 14, 39];

const filteredArray = randomNumbers.filter(n => {

return n > 5;

});
i) Most Effective Sorting Algorith?

Ans: Quicksort is one of the most efficient sorting algorithms, and this makes of it one of the most
used as well. The first thing to do is to

select a pivot number, this number will separate the data, on its left are the numbers smaller than
it and the greater numbers on the right

j) Implementation of Quick Sort?

Ans: Quick sort is one of the most important sorting methods in javascript. It takes a pivot value(a
random value) from an array. All the other

elements in the array are split to two categories.They may be less than the pivot value and greater
than the pivot value.

After that each of the categories(less than the pivot and greater than the pivot) are subjected to
the same procedure that is a pivot is chosen

then each category is divided in to sub-categories(less than the pivot and greater than the pivot).

The sub-categories are divided in such a way that they may contain an element or no element if
there are no more elements to compare.

The rest of the values will be denoted as a pivots at some previous points and did not trickle
down to this lowest sub category

306 a). What is Prototype?


Ans: Prototype is basically a property of a JavaScript function. At each time we create a function in
JavaScript, JavaScript engine adds an extra

property called prototype to the created function. This prototype property is an object (called as
prototype object) has a constructor

property by default. This constructor property points back to the function object on which the
prototype object is a property

Example

// constructor function

function Person () {

this.name = 'John',

this.age = 23

// creating objects

const person1 = new Person();

const person2 = new Person();

// adding property to constructor function

Person.prototype.gender = 'male';

// prototype value of Person

console.log(Person.prototype);
// inheriting the property from prototype

console.log(person1.gender);

console.log(person2.gender);

b) Do you know angular?

Ans No.

c) What are keys and ref in react

Ans: Key:

A “key” is a special string attribute you need to include when creating lists of elements in React.
Keys are used to React to identify which

items in the list are changed, updated, or deleted. In other words, we can say that keys are used to
give an identity to the elements in the

lists

ref:

Refs provide a way to access DOM nodes or React elements created in the render method. In the
typical React dataflow, props are the only way

that parent components interact with their children. To modify a child, you re-render it with new
props

or
ref gives access to the DOM element. Whereas key identifies which item has been changed,
added or removed.

d) what is express?

Ans: Express is a node js web application framework that provides broad features for building web
and mobile applications.

It is used to build a single page, multipage, and hybrid web application.

It's a layer built on the top of the Node js that helps manage servers and routes.

f) Difference between PUT and PATCH

Ans PUT handles updates by replacing the entire entity, while PATCH only updates the fields that you
give it.

PATCH does not change any of the other values. If you use the PUT method, then everything will
get updated.

313 b) What is async and await?

Ans: An async function is a function declared with the async keyword, and await keyword is
permitted within it.

The async and await keywords enable asynchronous, promise-based behavior to be written in a
cleaner style, avoiding the need to
explicitly configure promise chains.

e) Difference between non-blocking ve synchronous.

Ans: Non-blocking means that if an answer can't be returned rapidly, the API returns immediately
with an error and does nothing else.

synchronous mean you call the API, it hangs up the thread until it has some kind of answer and
returns it to you.

501. what is node.js and how have you implemented node.js in your
projects.

Node. js is a platform built on Chrome's JavaScript runtime for easily building


fast and scalable network applications. Node. js uses an event-driven, non-
blocking I/O model that makes it lightweight and efficient, perfect for data-
intensive real-time applications that run across distributed devices.

Step 1: Go to the NodeJS website and download NodeJS.

Step 2: Make sure Node and NPM are installed and their PATHs defined.

Step 3: Create a New Project Folder.

Step 4: Start running NPM in your project folder.

Step 5: Install Any NPM Packages:

Step 6: Create an HTML file.

Step 7: Create a Node/JavaScript file in the project folder


502. What is redis and why do we use redis? why do we perticularly use
redis only and not any other database.

Redis is a commonly used as a cache to store frequently accessed data in


memory so that applications can be responsive to users.

Redis is a super fast and efficient in-memory, key–value cache and store.
It's also known as a data structure server, as the keys can contain strings, lists, sets,
hashes and other data structures. Redis is best suited to situations that require data to
be retrieved and delivered to the client as quickly as possible.

Redis is different than other database solutions in many ways: it uses


memory as main storage support and disk only for persistence, the data model is pretty
unique, it is single threaded and so forth.

503. what is aws and why do we perticularly use aws only and not any
other server.

Amazon Simple Storage Service is a scalable,high-speed,web-based cloud


storage service.This service is designed for online backup and archiving of data
and applications on Amazon Web Service .It allow you to store and retrieve any
amount of data stored in bucket from any where using any devices.

AWS has significantly more services, and more features


within those services, than any other cloud provider–from infrastructure
technologies like compute, storage, and databases–to emerging technologies,
such as machine learning and artificial intelligence, data lakes and analytics, and
Internet of Things

504. some linux commands

1. pwd 2. ls — Use the "ls" command to know what files are in the directory
you are in. You 3. cd — Use the "cd" command to go to a directory.4. mkdir &
rmdir — Use the mkdir command when you need to create a folder or a directory. 5. rm -
Use the rm command to delete files and directories6. touch — The touch command is
used to create a file.7. man & --help — It shows the manual pages of the command. For
example, “man cd” shows the manual pages of the cd command. Typing in the
command name and the argument helps it show which ways the command can be used
(e.g., cd –help).8. cp — Use the cp command to copy files through the command line. It
takes two arguments: The first is the location of the file to be copied, the second is
where to copy.9. mv — Use the mv command to move files through the command line.
We can also use the mv command to rename a file.

505. define event loop.

Event loop is an endless loop, which waits for tasks, executes them and then
sleeps until it receives more tasks. The event loop executes tasks from the event
queue only when the call stack is empty i.e. there is no ongoing task. The event
loop allows us to use callbacks and promise

506.what is async and await and write the syntax of async await
Async await makes it easier to write promises.The keyword ‘Async’ before a
function makes the function return a promise always,It makes sure that your
code passed through a promise. Await is used inside async functions,which
makes the programme wait untill the promises resolves.Basically It maintain a
request parallaly by non blocking.

507.what is promises why do we use it

It is a JS Object that represent wheather an asynchronous operations is completed or


not.Asynchronous operations like db calls or axios call.

Promise is in one of these states:

● pending: initial state, neither fulfilled nor rejected.

● fulfilled: meaning that the operation was completed successfully.

● rejected: meaning that the operation failed.

Promise lets asynchronous methods return values like synchronous methods: instead
of immediately returning the final value, the asynchronous method returns a promise to
supply the value at some point in the future.

508.what is caching
Caching is the concept of saving commonly / frequently used data in memory and use
them on behalf of the actual data source when the same types of operations or data are
requested. Benefits: 1.Reduce data cost,reduce the load on the backend.

509.MongoDb

Mongodb is open source NoSQL database which is used to build highly


scalable and available appliaction. It supports the dynamic schema design.

510.what is asynchronous function

An asynchronous function is any function that delivers its result asynchronously – for
example, a callback-based function or a Promise-based function. An async function is
defined via special syntax, involving the keywords async and await . It is also called
async/await due to these two keywords.

511.what is non-blocking

It refers to the program that does not block the execution of further operations. Non-
Blocking methods are executed asynchronously. Asynchronously means that the
program may not necessarily execute line by line.

512.what is let,var and const?


let allows you to declare variables that are limited to the scope of a block statement, or
expression on which it is used.

The var statement declares a function-scoped or globally-scoped variable, optionally


initializing it to a value.

Constants are block-scoped, much like variables declared using the let keyword. The
value of a constant can't be changed through reassignment , and it can't be redeclared .

513.hoisting?

In JavaScript, Hoisting is the default behavior of moving all the declarations at the top
of the scope before code execution. Basically, it gives us an advantage that no matter
where functions and variables are declared, they are moved to the top of their scope
regardless of whether their scope is global or local

514.what is map function?

map() creates a new array from calling a function for every array element. map() calls a
function once for each element in an array. map() does not execute the function for
empty elements. map() does not change the original array.

515.Closure

In JavaScript, a closure is a function that references variables in the outer scope from
its inner scope. The closure preserves the outer scope inside its inner scope. To
understand the closures, you need to know how the lexical scoping works first.
516.Callstack
The call stack is used by JavaScript to keep track of multiple function calls. It is
like a real stack in data structures where data can be pushed and popped and
follows the Last In First Out (LIFO) principle. We use call stack for memorizing
which function is running right now.

517.Architechture of web api

Step 1:

Create Layered Architecture

Generally, Web API has 3 layers, which are given below.

Web API Layer

Business Layer (Business Logic Layer)

Repository Layer (Data Access Layer

Step 2

Add POCO (Plain Old CLR Object).

Step 3
Add repository layer project to implement Repository layer interfaces and
Business layer project to implement Business layer interfaces.

552. Architecture of node js


Node. js uses the “Single Threaded Event Loop” architecture to
handle multiple concurrent clients. Node. js Processing Model is
based on the JavaScript event-based model along with the
JavaScript callback mechanism

553.how node js works


It is a used as backend service where javascript works on the
server-side of the application. This way javascript is used on
both frontend and backend. Node. jsruns on chrome v8 engine
which converts javascript code into machine code, it is highly
scalable, lightweight, fast, and data-intensive.

554. REPL
The Node. js Read-Eval-Print-Loop (REPL) is an interactive shell
that processes Node.js expressions. The shell reads JavaScript
code the user enters, evaluates the result of interpreting the line
of code, prints the result to the user, and loops until the user
signals to quit.
555. WRITE SERVER CODE

557.Promise.all()

The Promise.all() method takes an iterable of promises as an input,


and returns a single Promisethat resolves to an array of the
results of the input promises.

558.CALL BACK FUNCTIONS


A callback function is a function passed into another function
as an argument

562.call back hell,callback,how to resolve callback hell


What is callback hell and how can it be avoided?

Callback hell in Node. js is the situation in which we have complex


nested callbacks. In this, each callback takes arguments that have
been obtained as a result of previous callbacks. This kind of
callback structure leads to lesser code readability and
maintainability.

563. Event loop


Event loop is an endless loop, which waits for tasks, executes
them and then sleeps until it receives more tasks. The event
loop executes tasks from the event queue only when the call
stack is empty i.e. there is no ongoing task. The event loop
allows us to use callbacks and promises.

567. AWS(amazon web service)

Amazon s3 is a program that’s built to store, protect and


retrieve data from buckets at any time from anywhere on any
device

568. Indexing in MongoDb

In MongoDB, indexes help in efficiently resolving queries. What an Index

does is that it stores a small part of the data set in a form that is easy to

traverse. The index stores the value of the specific field or set of fields,

ordered by the value of the field as specified in the index.

MongoDB’s indexes work almost identically to typical relational database

indexes.

Indexes look at an ordered list with references to the content. These in

turn allow MongoDB to query orders of magnitude faster. To create an

index, use the createIndex collection method.

For example:>db.users.find({"username":

"user101"}).explain("executionStats")
Here, executionStats mode helps us understand the effect of using an index

to satisfy queries.

569. What is name space

MongoDB stores BSON (Binary Interchange and Structure Object

Notation) objects in the collection. The concatenation of the

collection name and database name is called a namespace.

570. What are promises

It is a js object that represent whether an asynchronous operation

completed or not (like db or axios call)

There are 3 types of promises

1. Pending: not awaited and hence has not completed

yet(when you don’t wait an axios or db call)

2. Rejected: when promise failed(wrong url/server down)

3. Fulfilled: promise completed successfully(db call has

completed and return a result successfully)


582. What isNosql

NoSQL database technology stores information in JSON documents

instead of columns and rows used by relational databases. To be clear,

NoSQL stands for “not only SQL” rather than “no SQL” at all. This

means a NoSQL JSON database can store and retrieve data using

literally “no SQL.” Or you can combine the flexibility of JSON with the

power of SQL for the best of both worlds.

583. What is schema ?

A schema is a JSON object that defines the structure and contents of

your data.

584. what is expressJs


express JS is a backend framework used to create REST API’s and do

server side programming. It’s flexible and makes our development

process easy, efficient and robust.

585. What is module ?


In Node JS we treat all the files inside our project as modules. The

purpose being, we can use methods of any particular file(module) across

our node app. Commonly used modules are:os, fs, __dirname etc.

588. How many types of APIs are there in node JS?

You can find two types of API functions in Node. js, namely

Synchronous, blocking functions, and Asynchronous, non-blocking

functions.

593. What is sorting


Sorting is the processing of arranging the data in ascending and

descending order.

598. Why use MongoDB instead of Oracle?

Organizations of all sizes are adopting MongoDB because it

enables them to build applications faster, handle highly diverse

data types, and manage applications more efficiently at scale


What is MVC? Why we use MVC and Why we not write all code in single
file?

The Model-View-Controller (MVC) is an architectural pattern that separates an


application into three main logical components: the model, the view, and the
controller. This is done to separate internal representations of information from the
ways information is presented to and accepted from the user.

• Model: stores & manages data.


Often a database, in our quick example we’ll use local web storage on a
browser to illustrate the concept.
• View: Graphical User Interface
The view is a visual representation of the data- like a chart, diagram, table,
form.
The view contains all functionality that directly interacts with the user - like
clicking a button, or an enter event.
• Controller: Brains of the application.
The controller connects the model and view. The controller converts inputs
from the view to demands to retrieve/update data in the model.

Why we use: bcoz it improve the user usability and some other benefits are:

• Organizes large-size web applications –


• Easily Modifiable –
• Faster Development Process

What is data structure??

Data structure is a storage that is used to store and organize data. It is a way of
arranging data on a computer so that it can be accessed and updated efficiently.

What is algorithms??
A programming algorithm is a procedure or formula used for solving a
problem. It is based on conducting a sequence of specified actions in
which these actions describe how to do something, and your computer
will do it exactly that way every time. An algorithm works by following a
procedure, made up of inputs.

What is redis??

‘Redis’, which stands for Remote Dictionary Server. According to Redis official,
Redis is an open-source (BSD licensed), in-memory data structure store, used as a
database, cache, and message broker. On the other hand, AWS says that

Redis is a fast, open-source, in-memory key-value data store for use as a database,
cache, message broker, and queue’.

What is output??

Programs require data to be input. This data is used (processed) by the program,
and data (or information ) is output as a result.

What is non-blocking??

Non-Blocking: It refers to the program that does not block the execution of further
operations. Non-Blocking methods are executed asynchronously. Asynchronously
means that the program may not necessarily execute line by line.
What are the bitwise operators??

Bitwise operators are characters that represent actions to be performed on single


bits. A bitwise operation operates on two-bit patterns of equal lengths by
positionally matching their individual bits: A logical AND (&) of each bit pair results
in a 1 if the first bit is 1 AND the second bit is 1.

Difference between sql and nosql db??

SQL databases are used to store structured data while NoSQL databases like
MongoDB are used to save unstructured data. MongoDB is used to save
unstructured data in JSON format. MongoDB does not support advanced analytics
and joins like SQL databases support

SQL NoSQl

Tables with fixed rows and columns Document: JSON documents,

Key-value: key-value pairs, Wide-column:

Fix schema or predefined schema dynamic schema


best suited for complex queries not so good for complex queries

Vertically Scalable Horizontally Scalable

Different between settimeout and setinterval??

The only difference is , setTimeout() triggers the expression only once while
setInterval() keeps triggering expression regularly after the given interval of time.
(unless you tell it to stop). To stop further calls, we should call
clearInterval(timerId)
Why nodejs is asynchronous??

Node. js favors asynchronous APIs because it is single-threaded. This allows it to


efficiently manage its own resources, but requires that long-running operations be
non-blocking, and asynchronous APIs are a way to allow for control of flow with lots
of non-blocking operations

Where do you store jwt??.

What is Scope?

Scope is the area of code where a variable (or function) exists and is accessible.

There are a few different types of scopes in JavaScript: Global Scope, Function Scope

and Block Scope.

Global Scope

Variables declared outside of functions or blocks (curly braces { }) are considered to

have global scope meaning that they can be accessed anywhere in the JavaScript

program

Function Scope
A variable declared within a function is considered to be part of the function’s scope.

This scope is referred to as function scope. You will sometimes see function scope

also referred to as local scope.

Variables declared inside a function scope can be accessed from within the function

but not outside of it.

Block Scope
Block scope was introduced in ES2016 along with the let and const variable

declaration keywords. Block scope only applies to variables created with either the

let or const keywords.

Block scope is the scope defined within a set of curly brackets { }. The curly brackets

define a “block” of code, hence the name, “block scope”.

A block scoped variable cannot be accessed outside of the block that it was defined

in.

Lexical Scope

JavaScript is a lexically scoped language (as opposed to a dynamically scoped

language). You will also see Lexical Scoping defined as Static Scoping. So what does

lexical scoping mean?

Lexical scoping means that the scope is defined at the location where the variable

and function is defined (as opposed to where they are run).


Difference between map and filter??

map creates a new array by transforming every element in an array individually. filter

creates a new array by removing elements that don't belong

filter()
The filter method is called on an array and returns a new array and selects the

elements that satisfy a certain condition.

Function useFilter(arr){

Return arr.filter((element)=>{

Return element % 2 ===0

})

useFilter([1,2,3,4,5])

Return [2,4]

In the example above the condition is element % 2 === 0. Therefore only even

numbers satisfy this condition which are 2 and 4 in the example above.

map()
The map method is used when we want to change each element inside of an array and

then return a new array containing the new elements.

function doubler(arr) {
return arr.map((element) => {

return element * 2

})

doubler([1, 2, 3]) // returns [2, 4, 6]

The simple function above returns a new array in which all the elements are
doubled.

Why do you need schema if mongodb is schemaless??

As a NoSQL database, MongoDB is considered schemaless because it does not


require a rigid, pre-defined schema like a relational database. There are no
constraints for the data stored, so every document in the collection can have
different attributes and format. This is why it's called schema-less.

About sort and search??

The processes of looking up a particular data record in the database is called


searching. The process of ordering the records in a database is called Sorting.

What do you mean by scalable??


Scalability is the measure of a system's ability to increase or decrease in performance
and cost in response to changes in application and system processing demands.

What is linked list??

In computer science, a linked list is a linear collection of data elements whose order is
not given by their physical placement in memory. Instead, each element points to the
next. It is a data structure consisting of a collection of nodes which together represent
a sequence.

or

A linked list is a linear data structure consisting of a group of nodes where each node
points to the next node through a pointer. Each node is composed of data and a
reference (in other words, a link) to the next node in the sequence.

Doubly linked list??

In computer science, a doubly linked list is a linked data structure that consists of a set
of sequentially linked records called nodes. Each node contains three fields: two link
fields (references to the previous and to the next node in the sequence of nodes) and
one data field.

or

A Doubly linked list is a linear data structure in which each node consists of three
fields viz., the data field, previous, and the next field. The previous and the next are the
address fields that store the address of the previous element and the next element
respectively.
Difference between circular and doubly linked list??

you can go through..

https://www.geeksforgeeks.org/difference-between-singly-linked-list-and-doubly-
linked-list/

What is git??

Git is a version-control system for tracking changes in computer files and coordinating
work on those files among multiple people. Git is a Distributed Version Control
System.

Git is a version control system used for tracking changes in computer files, making it a
top-rated utility for programmers world-wide. Git can handle projects of any size.

Git is used to coordinate the workflow among project team members and track their
progress over time. It also benefits both programmers and non-technical users by
keeping track of their project files. Git allows multiple users to work together without
disrupting each other’s work.

Importance:It is free, open-source software that lowers the cost because developers
can use Git without paying money. It provides support for non-linear development. Git
enables multiple developers or teams to work separately without having an impact on
the work of others.

Github??

GitHub is a Git repository hosting service that provides a web-based graphical


interface. It is the world’s largest coding community. Putting a code or a project into
GitHub brings it increased, widespread exposure. Programmers can find source codes
in many different languages and use the command-line interface, Git, to make and
keep track of any changes.

GitHub helps every team member work together on a project from any location while
facilitating collaboration.

Git commands:-

1. git clone

This command is used for downloading the latest version of a remote project and
copying it to the selected location on the local machine.

git fetch

2.This Git command will get all the updates from the remote repository, including new
branches.

git init

3.This is the command you need to use if you want to start a new empty repository or
to reinitialize an existing one in the project root.

git pull

4.Using git pull will fetch all the changes from the remote repository and merge any
remote changes in the current local branch.

Quicksort
Quicksort is a popular sorting algorithm that is often faster in practice compared to
other sorting algorithms. It utilizes a divide-and-conquer strategy to quickly sort data
items by dividing a large array into two smaller arrays.

Mergesort

Merge sort is a sorting algorithm based on the Divide and conquer strategy. It works
by recursively dividing the array into two equal halves, then sort them and combine
them. It takes a time of (n logn) in the worst case

Why aws is important??

AWS enables you to select the operating system, programming language, web
application platform, database, and other services you need. With AWS, you receive a
virtual environment that lets you load the software and services your application
requires.

benefits:

AWS allows organizations to use the already familiar programming models,


operating systems, databases, and architectures.

It is a cost-effective service that allows you to pay only for what you use,
without any up-front or long-term commitments.

You will not require to spend money on running and maintaining data
centers.
Offers fast deployments

You can easily add or remove capacity.

You are allowed cloud access quickly with limitless capacity.

Offers Centralized Billing and management

Git stash

Git stash saves the uncommitted changes locally, allowing you to make
changes, switch branches, and perform other Git operations. You can then
reapply the stashed changes when you need them. A stash is locally scoped
and is not pushed to the remote by git push

655. Difference between sql and no-sql?

Ans:- SQ

● SQL databases are table based databases.

● Have predefined schema.

● Are vertically scalable.

● Use SQL (Structured Query Language) for defining and manipulating the data.
● A good fit for the complex query intensive environment

● Emphasize ACID properties (Atomicity, Consistency, Isolation and Durability)

● Examples include: MySql, Oracle, Sqlite, Postgres and MS-SQL.

NoSQL

● NoSQL databases are document based, key-value pairs, graph databases.

● Have dynamic schema.

● Are horizontally scalable.

● Focused on the collection of documents.

● Not ideal for complex queries.

● Follow the Brewers CAP theorem (Consistency, Availability and Partition tolerance

● Examples include: MongoDB, BigTable, Redis, RavenDb, Cassandra, Hbase, Neo4j and

CouchDb.

What is ES6 and tell some features about ES6?

Ans:- ECMAScript 2015 (or ES6) is the sixth and major edition of the ECMAScript language
specification standard. It defines the standard for the JavaScript implementation.
ES6 comes with significant changes to the JavaScript language. It brought several new features like,
let and const keyword, rest and spread operators, template literals, classes, modules and many
other enhancements to make JavaScript programming easier and more fun

What is NodeJs?

Ans:-

● Node.js is an open source server environment

● Node.js is free

● Node.js runs on various platforms (Windows, Linux, Unix, Mac OS X, etc.)

● Node.js uses JavaScript on the server

How to find user Details from DB?

Difference between var and let?

Ans:-

let var
let is block-scoped. var is function scoped.

let does not allow to redeclare variables. var allows to redeclare variables.

Hoisting does not occur in let. Hoisting occurs in var.

What is Web pack?

Ans:- Webpack is a free and open-source module bundler for JavaScript. It is made primarily for
JavaScript, but it can transform front-end assets such as HTML, CSS, and images if the
corresponding loaders are included. Webpack takes modules with dependencies and generates
static assets representing those modules.

660.oops concept like class object, principles, interface?

Ans:- object - An object in OOPS is nothing but a self-contained component which

consists of methods and properties to make a particular type of data useful.


Principles- The basic principles of OOP involves Abstraction, Encapsulation,
Inheritance, and Polymorphism.

Interface- In Object Oriented Programming, an Interface is a description of all functions


that an object must have in order to be an "X".

661.what is DOM?

Ans:- The Document Object Model (DOM) is a programming interface for web documents. It
represents the page so that programs can change the document structure, style, and content. The
DOM represents the document as nodes and objects; that way, programming languages can interact
with the page.

662.what is callback function?

Ans:- A callback function is a function passed into another function as an argument, which is then
invoked inside the outer function to complete some kind of routine or action.

663.what is hoisting?

Ans:- JavaScript Hoisting refers to the process whereby the interpreter appears to
move the declaration of functions, variables or classes to the top of their scope, prior
to execution of the code. Hoisting allows functions to be safely used in code before
they are declared.

669.Tell me about yourself?

What do you mean by dsa?

Ans:- Data Structures are the programmatic way of storing data so that data can be
used efficiently. Almost every enterprise application uses various types of data
structures in one or the other way. This tutorial will give you a great understanding on
Data Structures needed to understand the complexity of enterprise level applications
and need of algorithms, and data structures.

Define tree and if we want to reverse the array how we do ?

Ans:- A tree is a hierarchical data structure defined as a collection of nodes. Nodes


represent value and nodes are connected by edges. A tree has the following properties:
The tree has one node called root. The tree originates from this, and hence it does not
have any parent.

What do you mean by promise?


Ans:- A Promise is a JavaScript object that links producing code and consuming
code

A JavaScript Promise object can be:

● Pending

● Fulfilled

● Rejected

The Promise object supports two properties: state and result.

While a Promise object is "pending" (working), the result is undefined.

When a Promise object is "fulfilled", the result is a value.

When a Promise object is "rejected", the result is an error object.

What do you understand by callback hell?

Ans:- This is a big issue caused by coding with complex nested callbacks. Here,
each and every callback takes an argument that is a result of the previous
callbacks. In this manner, The code structure looks like a pyramid, making it
difficult to read and maintain.

What is git and command of git hub?


Ans:- Git is a distributed version-control system for tracking changes in any set of
files, originally designed for coordinating work among programmers cooperating on
source code during software development.

git config
Usage: git config –global user.name “[name]”

Usage: git config –global user.email “[email address]”

This command sets the author name and email address respectively to be used
with your commits.

git init
Usage: git init [repository name]

This command is used to start a new repository.

git clone
Usage: git clone [url]

This command is used to obtain a repository from an existing URL.

git add
Usage: git add [file]
This command adds a file to the staging area.

Usage: git add *

This command adds one or more to the staging area.

git commit
Usage: git commit -m “[ Type in the commit message]”

This command records or snapshots the file permanently in the version history.

Usage: git commit -a

This command commits any files you’ve added with the git add command and
also commits any files you’ve changed since then.

git diff
Usage: git diff

This command shows the file differences which are not yet staged.

Usage: git diff –staged

This command shows the differences between the files in the staging area and
the latest version present.

Usage: git diff [first branch] [second branch]

This command shows the differences between the two branches mentioned.

git reset
Usage: git reset [file]
This command unstages the file, but it preserves the file contents.

Usage: git reset [commit]

This command undoes all the commits after the specified commit and preserves
the changes locally.

Usage: git reset –hard [commit] This command discards all history and
goes back to the specified commit.

git status
Usage: git status

This command lists all the files that have to be committed.

git rm
Usage: git rm [file]

This command deletes the file from your working directory and stages the
deletion.

git log
Usage: git log

This command is used to list the version history for the current branch.

Usage: git log –follow[file]

This command lists version history for a file, including the renaming of files
also.
git show
Usage: git show [commit]

This command shows the metadata and content changes of the specified
commit.

git tag
Usage: git tag [commitID]

This command is used to give tags to the specified commit.

git branch
Usage: git branch

This command lists all the local branches in the current repository.

Usage: git branch [branch name]

This command creates a new branch.

Usage: git branch -d [branch name]

This command deletes the feature branch.

git checkout
Usage: git checkout [branch name]

This command is used to switch from one branch to another.

Usage: git checkout -b [branch name]


This command creates a new branch and also switches to it.

git merge
Usage: git merge [branch name]

This command merges the specified branch’s history into the current branch.

git remote
Usage: git remote add [variable name] [Remote Server Link]

This command is used to connect your local repository to the remote server.

git push
Usage: git push [variable name] master

This command sends the committed changes of master branch to your remote
repository.

Usage: git push [variable name] [branch]

This command sends the branch commits to your remote repository.

Usage: git push –all [variable name]

This command pushes all branches to your remote repository.

Usage: git push [variable name] :[branch name]

This command deletes a branch on your remote repository.

git pull
Usage: git pull [Repository Link]

This command fetches and merges changes on the remote server to your
working directory.

git stash
Usage: git stash save

This command temporarily stores all the modified tracked files.

Usage: git stash pop

This command restores the most recently stashed files.

Usage: git stash list

This command lists all stashed changesets.

Usage: git stash drop

This command discards the most recently stashed changeset.

What is / command in git hub?

Ans:- Slash Command Dispatch is a GitHub action that facilitates “ChatOps” by


creating repository dispatch events for slash commands. The action runs in
issue_comment event workflows and checks comments for slash commands.
671.Introduce yourself?

What is promise in your words.?

What is functional scope and block scope.?

Ans:- Function Scope: When a variable is declared inside a function, it is only accessible
within that function and cannot be used outside that function.

Block Scope: A variable when declared inside the if or switch conditions or inside for or
while loops, are accessible within that particular condition or loop.

674.what is closure and example?

Ans:- A closure is the combination of a function bundled together (enclosed) with


references to its surrounding state (the lexical environment). In other words, a closure
gives you access to an outer function's scope from an inner function. In JavaScript,
closures are created every time a function is created, at function creation time.

Ex:- function makeFunc() {

var name = 'Mozilla';


function displayName() {

alert(name);

return displayName;

var myFunc = makeFunc();

myFunc();

677.event loop?

Ans:- JavaScript has a runtime model based on an event loop, which is responsible for
executing the code, collecting and processing events, and executing queued sub-tasks.
This model is quite different from models in other languages like C and Java.

679. js is multithreading or single threading diff between them?

Ans:-

685.setTimeout function?
Ans:- The setTimeout() method executes a block of code after the specified time. The
method executes the code only once. The commonly used syntax of JavaScript
setTimeout is: setTimeout(function, milliseconds);

687.Lexical scope?

Ans:- A lexical scope in JavaScript means that a variable defined outside a function
can be accessible inside another function defined after the variable declaration. But
the opposite is not true; the variables defined inside a function will not be accessible
outside that function.

688.How nodejs work?

Ans:- Node.js accepts the request from the clients and sends the response, while
working with the request node.js handles them with a single thread. To operate
I/O operations or requests node.js use the concept of threads. Thread is a
sequence of instructions that the server needs to perform. It runs parallel on the
server to provide the information to multiple clients. Node.js is an event loop
single-threaded language. It can handle concurrent requests with a single thread
without blocking it for one request.

Node.js basically works on two concept


● Asynchronous

● Non-blocking I/O

It is a used as backend service where javascript works on the server-side of the


application. This way javascript is used on both frontend and backend. Node.js
runs on chrome v8 engine which converts javascript code into machine code, it is
highly scalable, lightweight, fast, and data-intensive.

694. Difference between == and ===?

Ans:- The comparison is made by == and === operators in javascript. The main
difference between the == and === operator in javascript is that the == operator does
the type conversion of the operands before comparison, whereas the === operator
compares the values as well as the data types of the operands.

697.what is redis?

Ans:- Redis is an in-memory data structure store, used as a distributed, in-memory


key–value database, cache and message broker, with optional durability. Redis
supports different kinds of abstract data structures, such as strings, lists, maps, sets,
sorted sets, HyperLogLogs, bitmaps, streams, and spatial indices.
698.what is caching?

Ans:- Caching is a mechanism to improve the performance of any type of application.


Technically, caching is the process of storing and accessing data from a cache.

699.what is controller?

Ans:- In addition to the views and routes the diagram shows "controllers" — functions
that separate out the code to route requests from the code that actually processes
requests.

6. what is promises

=> A promise is an object that may produce a single value some time in the future : either a
resolved value, or a reason that it's not resolved (e.g., a network error occurred). Promises are used
to handle asynchronous operations in JavaScript. They are easy to manage when dealing with
multiple asynchronous operations where callbacks can create callback hell leading to unmanageable
code.

7. what is event loop /what is async and await

=> event loop is a loop that take some task and perform the operation and wait for another task.
Event loop which makes javascript single threaded. The event loop allows us to use callbacks and
promises.

The async and await keywords enable asynchronous, promise-based behavior. await only
blocks the code execution within the async function. It only makes sure that the next line is
executed when the promise resolves. So, if an asynchronous activity has already started, await will
not have any effect on it.
Async/Await makes it easier to write promises. The keyword 'async' before a function makes the
function return a promise, always. And the keyword await is used inside async functions, which
makes the program wait until the Promise resolves

8. what is callback hell

=> We can avoid the callback hell with the help of Promises. Promises in javascript are a way to
handle asynchronous operations in Node. js. It allows us to return a value from an asynchronous
function like synchronous functions.

There are four easy ways to manage callback hell:


1. Write comments.
2. Split functions into smaller functions.
3. Using Promises.
4. Using Async/await.

9. diffrence between non-blocking vs synchronous

10. sort array which contain only 0s and 1s

11 Print 1, 2 , 3 ….. 10 after 1 second using setInterval

for(var i = 0; i <= 10; i++){

print(i);}

function print(i){

setTimeout(function(){

console.log(i)

},2000);

12 what is http protocol ? any other way to transferring data than http?

● =>HTTP stands for HyperText Transfer Protocol.

● It is a protocol used to access the data on the World Wide Web (www).
● The HTTP protocol can be used to transfer the data in the form of plain text,
hypertext, audio, video, and so on.
● This protocol is known as HyperText Transfer Protocol because of its efficiency
that allows us to use in a hypertext environment where there are rapid jumps
from one document to another document.
● HTTP is similar to the FTP as it also transfers the files from one host to another
host. But, HTTP is simpler than FTP as HTTP uses only one connection, i.e., no
control connection to transfer the files

13 what is diff bewtn git hosting and goDaddy hosting

14 what is hosting

15 what is JWT. What is secret key in JWT

JWT is jsonwebtoken and it is a way to transmitting secure information between third parties with
JSON object.

JWT can typically used to pass identity of authenticated users between an identity provider and
a service provider, or any other type of claims as required by business processes. JWT is
created with a secret key and that secret key is private to you which means you will never
reveal that to the public or inject inside the JWT token. When you receive a JWT from the
client, you can verify that JWT with this that secret key stored on the server.

16 what is AWS

=> Amazon web service is an online platform that provides scalable and cost-effective cloud
computing solutions. AWS is a broadly adopted cloud platform that offers several on-demand
operations like compute power, database storage, content delivery, etc., to help corporates scale
and grow.

AWS provides servers, storage, networking, remote computing, email, mobile development,
and security.
17 can we upload images in database without using AWS

=>No in database like mongodb we can’t upload images. That why we use AWS

18 benefits of AWS

ð AWS offers flexibility and affordability

ð Provides security

ð Unlimited sever capacity

ð Easy to use

18 Program for second larget number in array

function findSecondLargestElem(arr){

let first = -1 , second = -1;

for(let i = 0; i <= arr.length-1; i++){

if(arr[i] > first){

second = first; first = arr[i];

} else if( arr[i] > second && arr[i] != first)

{ second = arr[i];

} console.log(second);

let arr = [12, 35, 1, 10, 34, 1]

findSecondLargestElem(arr);
19 middleware => A middleware is a function, that basically takes request
response and next objects as the parameters

It is the pipeline between the request and the response, if the


conditions written inside the middle ware does not satisfies then the user
would not be able to see the response.

If the middle ware gets successfully executed the next function is called
and the next operation starts getting executed that is scheduled to run.

why do you need them- Middleware is very helpful in code reusability and
to provide checks to the codes and authentication,authorisation.

20 what is controller?

● In addition to the views and routes the diagram shows "controllers" — functions that
separate out the code to route requests from the code that actually processes
requests. Controller functions to get the requested data from the models, create an HTML
page displaying the data, and return it to the user to view in the browser.

21 what is route ?

A route is a section of Express code that associates an HTTP verb (GET, POST, PUT,
DELETE, etc.), a URL path/pattern, and a function that is called to handle that pattern.

"Routes" to forward the supported requests (and any information encoded in request
URLs) to the appropriate controller functions.

22 what is index.js file (write the code )

23 request response cycle code

24 what is call back function

=> A callback is a function which is called when a task is completed, thus helps
in preventing any kind of blocking and a callback function allows other code to run in
the meantime. Callback is called when task get completed and is asynchronous
equivalent for a function

Ex: var callback = function () {

console. log("10 seconds later..."); };


A callback function is a function passed into another function as an argument, which
is then invoked inside the outer function to complete some kind of routine or
action .

25 What are dependencies and devDependencies?

"dependencies" : Packages required by your application in production.

dependencies are the package references that are used by your library without which it cannot
work and to be installed along with your library installation automatically.

We can install dependencies using npm I <package_name> command

"devDependencies" : Packages that are only needed for local development and testing.

DevDependencies are the packages a developer needs during development. A peer


dependency specifies that our package is compatible with a particular version of an npm package. If
a package doesn't already exist in the node_modules directory, then it is automatically added. i t
consists of all the packages that are used in the project in its development phase and not in
the production or testing environment with its version number

We can find both in package.json file

26 write index file and api to print hello world

=>

27 : program to print 3rd smallest number in array

function getThirdSmallest( a) {

let temp;

//sort the array

for (let i = 0; i < a.length; i++) {

for (let j = i + 1; j < a.length; j++) {


if (a[i] > a[j]) {

temp = a[i];

a[i] = a[j];

a[j] = temp;

//return third smallest element

return a[2];

} console.log(getThirdSmallest([11,10,4, 15, 16, 13, 2]));

27 diff between p tag and span tag

p tag is paragraph tag and span tag is in-line and usually used for a small chunk of
HTML inside a line

p tag is block level and span is inline container.

Span tag It can be used for style purposes and p tag used for writing paragraph

28 diff between inline and block element

=>Block elements are a kind of blocks where there are many elements in a line itself.
While inline elements take up the space of an entire line and there will be only one line
within the space width.Inline elements do not respect the top and bottom margins but
only the left and right and also consider the padding. While block elements respect left,
right, top, bottom margins and padding. The width and height sets are not included in
inline elements. There are width and height elements in block elements

● Ex: inline element : <main> <address> <a>, <span>,<input>

● Ex: block element : <p>,<h1>to<h6>,<ul>,<ol>

28 diff between justify content space between and space evenly

space-evenly : items are distributed so that the spacing between any two adjacent
alignment subjects, before the first alignment subject, and after the last alignment
subject is the same. Items will have equal space around them

space-between : items are evenly distributed in the line; first item is on the start line, last
item on the end line. Items will have space between them

29 What is float left?

The float CSS property places an element on the left or right side of its container, allowing text and
inline elements to wrap around it. The element is removed from the normal flow of the page, though
still remaining a part of the flow (in contrast to absolute positioning)

Ex: if we want a picture to left side and infront of it we want pargraph so we can use float :left
property to picture.

Syntax:

Img {

float:left

What is justify content flex-start: Default value. Items are positioned at the beginning of the
container

30 what is call, bind, apply ?

1. Call invokes the function and allows you to pass in arguments one by one.
2. Apply invokes the function and allows you to pass in arguments as an array. The apply() method
takes arguments as an array.
3. Bind returns a new function, allowing you to pass in a this array and any number of arguments. It
is called with a particular this value.

31 What is difference between array and object?

Objects represent a special data type that is mutable and can be used to store a collection of data
(rather than just a single value).

Objects are used to store multiple values in single variable

Objects are like key-pair values

Properties of objects are accessed using dot notation.

Arrays are a special type of variable that is also mutable and can also be used to store a list of
values.

Arrays are set of similar data types in a list.

Elements of array can be accessed by index 0,1,2,3….

32 what is difference between arrow function and regular function

Syntax: arrow function

Const square =a=> a*a

this inside arrow functions is that they cannot be used as constructors. Using new
with an arrow function results in a TypeError.
They don’t have their own arguments

Regular function

Function square (a){

Return a*a }

Regular functions can be used as constructors, using the new keyword

They have their own arguments.

33 . What is Express,NodeJs.

Express is open-source framework

Express is node js framework which provides set for web and mobile application developing.

express provides mechanisms to: Write handlers for requests with different HTTP verbs at
different URL paths (routes).

Node.js is open source programming language not a framework.

It is an runtime environment which runs on v8 engine

It used for executing javascript code outside the browser.

Nodejs is used on client as well as server side language and it is single threaded

34 what is redis cache?


Redis is a caching system that works by temporarily storing information in a key-value data
structure.

Redis actually stands for Remote Dictionary Server. It is basically a data-structure store that
stores the data in the primary memory of a computer system. It uses key-value pairs to store
the data,

All the cache data will be stored in the memory of the server provided to the config of running
redis server. The clients do not hold any data, they only access the data stored by the redis server.

A cache's primary purpose is to increase data retrieval performance by reducing the need to
access

35. What are middlewares and why do you need them?

=> A middle ware is a function, that basically takes request response and
next objects as the parameters

It is the pipeline between the request and the response, if the


conditions written inside the middle ware does not satisfies,

then the user would not be able to see the response.

If the middle ware gets successfully executed the next function is called
and the next operation starts getting executed that is scheduled to run.

why do you need them- Middleware is very helpful in code reusability and
to provide checks to the codes and authentication,authorisation.

36. What are route and application level middleware?

=> Route level api are route based which code is written in the controller
file and it connect with route file. const router = express. Router() Load router-level
middleware by using the router.

Application middleware – This middleware mostly a global middleware that


used in index.js file. It consists of app.use() or
or app.METHOD functions where method is the HTTP method of the request.

37 What is meant by authentication. Try to give a real life example of the same? Show in your code
where authentication is being implemented.

=> it is process of verifying users identification through the credentials and using those credentials
to confirm the user identity. ex: when user login into fb with her credentials then this data saved
into cookies so user dose not need to enter credentials again and again . if credentials are valid then
user verified as valid user. then user logged into her fb account. In out project we implement the
authentication in middleware file.

38 What is meant by authorization. Give a real life example for authorization too. Again, show in your
code where authorization is being implemented.

=>The HTTP Authorization request header can be used to provide credentials that authenticate a
user agent with a server, allowing access to a protected resource. ex: when valid user logged into fb
then only that user allowed to change, edit, delete something in her account.

In our project we implement the authorization in middleware file.

39 Why do we write the auth code in a middleware?

=> we are using middleware for particular user so when we are going to hit the API and we write the
auth code in middleware so we don't need to write code again and again and our code will be short n
nice. and it will not be time consuming .

- Where should the auth middleware be called? At application level or route level

=>route level

40 what is hoisting

What is hoisting explain with example?

Hoisting in JavaScript is a behavior in which a function or a variable can be used before


declaration.
. Hoisting allows functions to be safely used in code before they are declared.

Ex: // using test before declaring

console.log(test); // undefined

var test;

41 what is clouser

a closure gives you access to an outer function's scope from an inner function. In JavaScript,
closures are created every time a function is created, at function creation time. A closure is a
function having access to the parent scope, even after the parent function has closed.

It makes it possible for a function to have "private" variables

upload file using fastify framework,create an endpoint and add


array in it,show output on server.

Fastify is a NodeJS framework for building fast NodeJS servers. With this
wonderful tool, you can create a server with NodeJS, create routes
(endpoints), handle requests to each endpoint, and lots more. Fastify is an
alternative to Express (L express) which you must have heard of if you are
familiar with NodeJS before.

explain event loop


Node.js is a single-threaded event-driven platform capable of running non-
blocking, asynchronous programming. These functionalities of Node.js
make it memory efficient. The event loop allows Node.js to perform non-
blocking I/O operations even though JavaScript is single-threaded

which sort is quick and more efficient? why?

Quicksort is one of the efficient and most commonly used algorithms. Most
of the languages used quicksort in their inbuild “sort” method
implementations.

reverse string

how u will traverse large object and access key value pair and
print it?

'use strict';

// ECMAScript 2017

const object = {'a': 1, 'b': 2, 'c' : 3};

for (const [key, value] of Object.entries(object)) {

console.log(key, value);

}
aptitude and coding test

1. find anagrams

2. check the count for 360-degree rotation

3. array to check the sum of elements equal to k integer

There are two strings m and n. These are non-empty strings.


Return an array of all the start indices of n's anagrams in m.

Count for 360-degree rotation List of directions to spin around.

Find all pairs of numbers from the list that sum to a given no.

Find all the possible elements in one or two pairs from the given
array which is equal to the kth sum value.

find the substring present in the first string how many times
without repeating any element.
how many the number of rotations of left and right to complete
360 degrees.

aptitude question topics-probability, percentage,

7 problems were given and we have to solve 3

https://drive.google.com/file/d/1SzQ45Mu4KUXmbJZkcT0fs98jehbbzatu/
view?usp=sharing

how to find something from MongoDB(find)

In MongoDB, we use the find and findOne methods to find data in a


collection.

how to make folder using express.js(model,controller,index,route)

queue management

A queue management system (QMS) is a set of tools developed to manage


and analyze the flow of visitors.

promises and alternatives of promise

A JavaScript Promise object contains both the producing code and calls to
the consuming code: When the executing code obtains the result, it should
call one of the two callbacks: The Promise object supports two properties:
state and result. While a Promise object is "pending" (working), the result is
undefined.

Alternative-Async-await

difference between client-siderender page and server-


siderender page

Server-side rendering Client-side rendering

· Dynamic content loading is · Dynamic content loading takes more


quicker as SSR has more powerful time as the computing power is restricted
computing and network speed

· SSR is more suitable for the · CSR is more appropriate for web
website development as a cache of applications as this type of rendering
the newly opened tab takes care of ensures in fast speed of loading which is
load speed crucial for web apps

· SSR takes less time for the first · CSR has a slower initial load but it
load of the page has a privilege for the next loadings
compared to SSR

let &var&const

var let const

· The scope of a var · The scope of a let


variable is functional variable is block · The scope of a const
scope. scope. variable is block scope.
· It can be updated
· It can be updated but cannot be re-
and re-declared into declared into the · It cannot be updated or
the scope. scope. re-declared into the scope.

· It can be declared · It can be declared · It cannot be declared


without initialization. without initialization. without initialization.

· It can be accessed · It cannot be · It cannot be accessed


without initialization as accessed without without initialization, as it
its default value is initialization, as it cannot be declared without
“undefined”. returns an error. initialization.

webpack

The webpack is a type of application that is used for compiling JavaScript modules.
Using this user can bundle up the different modules into one single module.

spread operator

The spread operator ( …) with objects is used to create copies of existing


objects with new or updated values or to make a copy of an object with more
properties.

JavaScript objects including arrays are deeply nested, the spread operator
only copies the first level with a new reference, but the deeper values are still
linked together.

You might also like