Birlasoft
Gemini Engi Fab Interview Questions and Answers
Event Emitter is a class in Node.js that allows objects to emit and listen for events.
Event Emitter is a core module in Node.js that provides an implementation of the observer pattern.
It allows multiple functions to be attached to a single event, which can be triggered synchronously or asynchronously.
Example: const EventEmitter = require('events');
Example: const myEmitter = new EventEmitter();
Example: myEmitter.on('event', () => { console.log('an event occurred!'); });
Example...read more
Node.js is a runtime environment that allows JavaScript code to run on the server side.
Node.js uses an event-driven, non-blocking I/O model, making it lightweight and efficient.
It uses the V8 JavaScript engine from Google Chrome to execute code.
Node.js allows developers to use JavaScript for both client-side and server-side development.
It has a large ecosystem of libraries and frameworks, such as Express.js for building web applications.
Node.js can be used to build scalable n...read more
Middlewares are functions that have access to the request and response objects in Node.js, allowing for additional functionality to be added to the server.
Middlewares can be used to perform tasks like authentication, logging, error handling, etc.
They are executed in the order they are defined in the code.
Examples of middlewares include body-parser for parsing incoming request bodies, morgan for logging HTTP requests, and express-validator for validating request data.
Q4. What is Hoisting ?
Hoisting is a JavaScript mechanism where variables and function declarations are moved to the top of their scope.
Hoisting applies to variable declarations and function declarations
Variable declarations are hoisted but not their values
Function declarations are fully hoisted
Function expressions are not hoisted
Hoisting can lead to unexpected behavior and bugs
Q5. Explain Node Js architecture.
Node Js architecture is based on event-driven, non-blocking I/O model.
Event loop handles all I/O operations asynchronously
Single-threaded event loop allows for high scalability
Modules and packages can be easily added through NPM
Uses V8 engine for efficient JavaScript execution
Q6. Middle-ware in node js
Middleware is a software layer that sits between the application and the server, allowing for additional functionality to be added.
Middleware functions are executed sequentially, and can modify the request and response objects.
Common middleware includes body-parser, cookie-parser, and express-session.
Custom middleware can be created to add specific functionality to an application.
Middleware can be used for authentication, logging, error handling, and more.
Top Node Js Backend Developer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month