Advertisement
satishfrontenddev5

Untitled

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