Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - **Beginner Node.js Interview Questions:**
- 1. What is a first class function in Javascript?
- - Functions that can be treated like any other variable.
- 2. What is Node.js and how it works?
- - A virtual machine using JavaScript, running Chrome’s V8 engine, with an event-driven architecture.
- 3. How do you manage packages in your node.js project?
- - Using npm or yarn, along with package.json and package-lock.json for version control.
- 4. How is Node.js better than other frameworks most popularly used?
- - Non-blocking I/O, event-based model, runs on Chrome's V8 engine, faster development, abundant libraries.
- 5. Explain the steps how “Control Flow” controls the functions calls?
- - Order of execution, data collection, concurrency limitation, calling subsequent steps.
- 6. What are some commonly used timing features of Node.js?
- - setTimeout/clearTimeout, setInterval/clearInterval, setImmediate/clearImmediate, process.nextTick.
- 7. What are the advantages of using promises instead of callbacks?
- - Better code manageability, avoiding callback hell.
- 8. What is fork in node JS?
- - Used to spawn child processes, creating new instances of V8 engine for multiple workers.
- 9. Why is Node.js single-threaded?
- - Experiment in async processing, utilizing event-driven model.
- 10. How do you create a simple server in Node.js that returns Hello World?
- ```javascript
- var http = require("http");
- http.createServer(function (request, response) {
- response.writeHead(200, {'Content-Type': 'text/plain'});
- response.end('Hello World\n');
- }).listen(3000);
- ```
- 11. How many types of API functions are there in Node.js?
- - Asynchronous, non-blocking functions and synchronous, blocking functions.
- 12. What is REPL?
- - Read, Eval, Print, Loop; for evaluating code on the go.
- 13. List down the two arguments that async.queue takes as input?
- - Task Function and Concurrency Value.
- 14. What is the purpose of module.exports?
- - Exposing functions of a module for use elsewhere.
- 15. What tools can be used to assure consistent code style?
- - ESLint for maintaining consistent coding style.
- - **Intermediate Node.js Interview Questions:**
- 16. What do you understand by callback hell?
- - Nested callbacks making code unreadable and unmaintainable.
- 17. What is an event-loop in Node JS?
- - Manages asynchronous operations with queues and listeners.
- 18. If Node.js is single threaded then how does it handle concurrency?
- - Managed by libuv library with a thread pool.
- 19. Differentiate between process.nextTick() and setImmediate()?
- - process.nextTick() adds to the start of the event queue, setImmediate() to the check phase.
- 20. How does Node.js overcome the problem of blocking of I/O operations?
- - Handles I/O operations asynchronously through the event loop.
- 21. How can we use async await in node.js?
- - Utilizing async-await pattern for asynchronous operations.
- 22. What is node.js streams?
- - Instances of EventEmitter for working with streaming data.
- 23. What are node.js buffers?
- - Temporary memory for streaming data in fixed-length sequences of bytes.
- 24. What is middleware?
- - Intercepts requests before reaching the business logic.
- 25. Explain what a Reactor Pattern in Node.js?
- - Pattern for nonblocking I/O operations.
- 26. Why should you separate Express app and server?
- - Encapsulates business logic and application logic, improving readability.
- 27. For Node.js, why Google uses V8 engine?
- - Most evolved and fastest JavaScript and WebAssembly engine.
- 28. Describe the exit codes of Node.js?
- - Indicate reasons behind process termination.
- 29. Explain the concept of stub in Node.js?
- - Replaces functions being tested for easier testing.
- - **Advanced Node.js Interview Questions:**
- 30. What is an Event Emitter in Node.js?
- - EventEmitter is a class in Node.js capable of emitting events, allowing attached functions to be invoked synchronously.
- 31. Enhancing Node.js performance through clustering.
- - Clustering enables multiple instances of the event loop to utilize multiple CPU cores, improving performance.
- 32. What is a thread pool and which library handles it in Node.js?
- - The thread pool is managed by the libuv library, which provides support for asynchronous I/O operations.
- 33. What is WASI and why is it being introduced?
- - WASI (WebAssembly System Interface) provides a way for WebAssembly modules to interact with the underlying operating system, enhancing efficiency and access to system-level features.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement