Skip to content

Latest commit

Β 

History

History
134 lines (70 loc) Β· 3.5 KB

File metadata and controls

134 lines (70 loc) Β· 3.5 KB

πŸ“Œ Basic Node.js Questions

1. What is Node.js?

3. Core Modules

4. Common Uses

6. Popular Frameworks

βœ”οΈ What actually uses the thread pool?

⚠️ Why heavy JS computation cannot be moved to the thread pool?

  1. What is the difference between Node.js and JavaScript in the browser?

  2. What is npm (Node Package Manager)?

  3. What is the difference between CommonJS (require) and ES Modules (import)?

  4. What are callbacks, and why are they used in Node.js?

5.A) Callback Hell?

5.B βœ… Modern Fix: Use Promises or async/await

5.C await for task and Parallel execution with promise C

  1. What is the event loop in Node.js?

    • Explain phases (timers, I/O callbacks, idle, poll, check, close).
  2. What are Streams in Node.js?

    • Types: Readable, Writable, Duplex, Transform.
  3. What are Buffers in Node.js?

    • How Node.js handles binary data.

πŸ“Œ Intermediate Node.js Questions

  1. How does Node.js handle concurrency if it’s single-threaded?

  2. What is the difference between process.nextTick() and setImmediate()?

  3. What is middleware in Node.js (Express)?

  • Explain request-response lifecycle.
  1. What are some common built-in modules in Node.js?
  • fs, path, http, os, events, util.
  1. What are the differences between synchronous and asynchronous functions in Node.js?

  2. Explain how error handling works in Node.js.

  • Try/catch, error events, async/await error handling.
  1. What is clustering in Node.js?
  • How to utilize multiple CPU cores.
  1. How does Node.js differ from multithreaded servers like Java or .NET?

  2. What is the difference between fork(), spawn(), and exec() in child processes?

  3. Explain JWT authentication in Node.js.

  4. What is CORS, and how do you handle it in Node.js?

  5. What is the difference between REST and GraphQL in Node.js?


πŸ“Œ Advanced Node.js Questions

  1. How does the V8 engine work in Node.js?
  • JIT compilation, memory management, garbage collection.
  1. How does Node.js manage memory?
  • Heap, stack, garbage collection.
  1. What is libuv, and what role does it play in Node.js?

  2. Explain load balancing in Node.js applications.

  • Cluster mode, PM2, reverse proxies like Nginx.
  1. What are worker threads in Node.js, and when should you use them?

  2. How do you handle scalability in a Node.js application?

  • Horizontal vs vertical scaling.
  1. How do you secure a Node.js application?
  • Helmet, rate limiting, sanitization, avoiding eval, managing tokens.
  1. How do you optimize performance in Node.js applications?
  • Caching, streams, clustering, avoiding synchronous code.
  1. What is async_hooks in Node.js?
  • Tracking asynchronous resources.
  1. How do you debug Node.js applications?
  • Node Inspector, Chrome DevTools, logging libraries.

πŸ“Œ Code-Based/Scenario Questions

  • Write an HTTP server without Express.
  • Show how to read/write a file using fs.
  • Convert callback-based code into async/await.
  • Demonstrate error handling in async/await.
  • How to stream a large file without loading it fully into memory.
  • Implement a simple middleware in Express.
  • Handle race conditions with Promises.
  • Write a code snippet for clustering.

πŸ‘‰ Do you want me to prepare a mock interview Q&A style (questions with short, crisp answers you can practice), or do you prefer just the list of questions for now?