DEV Community

Cover image for NODE.JS: Interview Questions
Mitchell Mutandah
Mitchell Mutandah

Posted on

NODE.JS: Interview Questions

Have you ever found that technical interviews are a bit tricky? Well, the first reason why many people find coding interviews hard is that they lack the fundamental knowledge of the topic in question.

I have come up with some basic typical interview questions for Node.js, so let's get started!!
get started

What is Node JS?

  • Node.js is an open source server environment.
  • Node.js is a platform built on Chrome's JavaScript runtime for easily building fast and scalable network applications.
  • It is a single threaded, non-blocking and event driven.

When to use Node JS?

  • Considering the main features of Node.js and its strengths, we can say data-driven, I/O-driven, event-driven, and non blocking applications benefit the best from a Node.js implementation.
  • It can be used to create:

=> Web servers.
=> Real Time applications (chat applications, streaming, online games).
=> Command line applications.
=> Creating APIs.

As you just said Nodejs is a single threaded then how Nodejs is fast?

  • Node js uses an event loop that handles the asynchronous tasks.
  • The event loop makes our program non-blocking.
  • We can handle multiple request at a time in parallel - that's the reason why node js fast.

Is it possible to access DOM in Node Js?

  • No.

What is Express Js?

  • Express is a node js web application framework that provides broad features for building web and mobile applications.
  • It's a layer built on the top of the Node js that helps manage servers and routes.

What is Package.json file?

  • The package.json file is the heart of any Node project.
  • In package.json file we keep all the details of the projects that hold various metadata relevant to the project like version, description, dependencies, run scripts, license and all pm packages.
  • Without this package, your project will not work.

What is Event Loop?

  • The event loop makes the code async.
  • Behind the scene when our code run asynchronously then there are containers that are:

=> call-stack,
=> call-back queue,
=> web API and
=> micro task queue.

  • The purpose of event loop is to execute the async task as per priority.

That's it for now. Let me know what you think in the comments.
cheers

Top comments (0)