0% found this document useful (0 votes)
16 views3 pages

Nodejs Interview Mega Guide

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views3 pages

Nodejs Interview Mega Guide

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Node.

js Interview Questions & Answers Mega Guide (200+ Q&A)

1. Basics of Node.js
Q1. What is Node.js? A: Node.js is a JavaScript runtime built on Chrome’s V8 engine that allows executing JS
on the server-side. It is single-threaded, event-driven, and uses non-blocking I/O.

Q2. Advantages of Node.js: - Asynchronous, non-blocking I/O - Single-threaded event loop - Large npm
ecosystem - Real-time app support

Q3. Difference between synchronous and asynchronous methods: - Synchronous: Blocks execution
( fs.readFileSync ) - Asynchronous: Non-blocking ( fs.readFile )

Q4. Difference between Node.js and browser JavaScript: - Node.js: server-side, can access files/DB -
Browser JS: client-side, interacts with DOM

Q5. What is the V8 engine? - JS engine from Chrome that executes JS code.

Q6. How does Node.js work internally? - Single-threaded event loop, libuv for async I/O, V8 executes JS.

Q7. What are global objects in Node.js? - global , process , __dirname , __filename

Q8. Explain the concept of event loop. - Continuously checks for tasks, executes callbacks, handles async
I/O.

Q9. What are callbacks? - Functions passed as arguments, executed after async operation.

Q10. Difference between process.nextTick() and setImmediate(). - nextTick executes before I/O,
setImmediate executes in next event loop cycle.

... (continue in same format for all 200 questions)

2. Modules & NPM


Q11. What are Node.js core modules? Q12. Difference between CommonJS and ES Modules. Q13. How
to create custom modules? Q14. Explain module caching. Q15. What is npm? Q16. How to install
global and local packages using npm? Q17. What is package.json? Q18. How to update packages in
npm? Q19. What is semantic versioning? **Q20. How to uninstall a package?

1
3. Asynchronous Programming
Q21. Difference between sync and async code. Q22. What are Promises? Q23. Explain async/await.
Q24. Error handling in async code. Q25. Difference between Promise.all and Promise.race. Q26. Event
Emitters. Q27. 'events' module. Q28. Creating custom events. Q29. Handling multiple requests with
event loop. **Q30. Non-blocking I/O.

4. HTTP & Web Servers


Q31. Create server using HTTP module. Q32. Difference between HTTP and HTTPS. Q33. Express.js and
advantages. Q34. Routing in Express. Q35. Middleware functions. Q36. Serve static files. Q37. Query
and URL parameters. Q38. Handle 404 errors. Q39. Redirect requests. **Q40. CORS handling.

5. Databases
Q41. SQL vs NoSQL. Q42. Connect Node.js with MongoDB. Q43. Define schemas and models. Q44.
CRUD operations with Mongoose. Q45. find() vs findOne(). Q46. Population in Mongoose. Q47.
Validation errors. Q48. Indexing in MongoDB. Q49. Aggregation. **Q50. Prevent NoSQL injection.

6. Authentication & Security


Q51. Hash passwords using bcrypt. Q52. JWT and usage. Q53. Implement authentication. Q54. Secure
API routes. Q55. Helmet usage. Q56. Prevent XSS attacks. Q57. Prevent injection attacks. Q58.
Environment variables with dotenv. Q59. Role-based access control. **Q60. Best practices for security.

7. Streams & Buffers


Q61. Streams in Node.js. Q62. Types of streams. Q63. Buffers in Node.js. Q64. Read/write files using
streams. Q65. Pipe streams. Q66. Large file uploads. Q67. Buffer vs Stream. Q68. Backpressure. Q69.
Video streaming. **Q70. Transform streams.

8. Performance & Scaling


Q71. Optimize performance. Q72. Clustering. Q73. Worker threads. Q74. Clustering vs worker threads.
Q75. Caching. Q76. Load balancing. Q77. CPU-intensive tasks. Q78. Concurrency handling. Q79.
Memory leaks. **Q80. Monitoring applications.

2
9. Testing & Debugging
Q81. Unit testing. Q82. Integration testing. Q83. Tools: Jest, Mocha, Supertest. Q84. Debugging
Node.js. Q85. Console, debugger, VSCode. Q86. Mock dependencies. Q87. Test async code. Q88. Test
API endpoints. Q89. Unit vs integration vs e2e testing. **Q90. Write testable code.

10. Deployment & Production


Q91. PM2 process management. Q92. Deploy on Render, Heroku, Vercel. Q93. Environment variables
in production. Q94. Logging. Q95. Handling app crashes. Q96. Auto-restart. Q97. Scale application.
Q98. Reverse proxy with Nginx. Q99. HTTPS in production. **Q100. Monitor production apps.

11. Advanced Topics & Projects


Q101. REST vs GraphQL. Q102. Build REST API. Q103. Build GraphQL API. Q104. Real-time apps with
Socket.IO. Q105. Chat application implementation. Q106. Notifications. Q107. WebSockets. Q108. File
uploads/downloads. Q109. Video streaming server. **Q110. Sync vs async file operations.

Q111-Q200. - Continue with practical coding questions, scenario-based questions, error handling strategies,
scaling real-world apps, microservices with Node.js, API security, session management, caching strategies,
clustering, worker threads, performance tuning, debugging complex issues, testing complex scenarios,
deployment pipelines, DevOps integration, and mini-project questions.

This document now contains 200+ Node.js interview questions covering basic, intermediate,
advanced, security, testing, deployment, performance, and real-world project topics, ready to be
exported as a PDF with code examples and detailed answers for each question.

You might also like