Node.js | Technical Interview – QnA

I recommend you to also read our blog on JavaScript Technical Interview Questions before reading about Node.js Interview Questions. If you are confident with your JavaScript knowledge, go ahead !

Technical interview questions are unlike online MCQ based quizzes ! Because, Technical interviews are mainly for testing your conceptual knowledge. You do not need to memorise names of the packages, libraries or built-in functions and modules, etc. Internet is already there for such tasks, all a developer should know is How to utilise it better ?!

Node.js v/s JavaScript

JavaScript is a programming language. JavaScript can be only executed on browsers, because browsers provide a runtime environment for JavaScript. We cannot use the JavaScript directly on the server side.

Node.js is simply a runtime environment. It gives a platform to run JavaScript on servers (Just like browsers do on the client side), so you can use JavaScript on server side. It also includes I/O and networking based libraries to take more advantage of JavaScript.

Node.js : Synchronous OR Asynchronous

Node.js is Asynchronous, it does not wait for file read or network request for going to the next statement.

db.query(() => {
    console.log("log on db query callback");
console.log("log outside");

// --- output ---
// log outside
// log on db query callback

What is NPM ?

NPM = Node Package Manager

It is a set of reusable packages and modules. NPM have packages for almost all the basic tasks like library for date-time management (moment), for array-json operations (lodash) and so on ..

dependencies v/s dev-dependencies

If you are adding a package using “npm install” command and if that package needs to be there in the production, then you should append “–save” flag at end, so that it will be added in the dependencies section of the package.json file.

Ex. npm install moment –save

But, if you are adding a package that is not required on production (which will only be used for testing / development purposes ), you should append “–save-dev” flag with the command to add the entry in the devDependencies section.

Ex. npm install mocha –save-dev

   "name": "test",
   "version": "1.0.0",
   "description": "",
   "main": "index.js",
   "scripts": {
     "test": "echo \"Error: no test specified\" && exit 1"
   "author": "",
   "license": "ISC",
   "dependencies": {
     "moment": "^2.29.1"
   "devDependencies": {
     "mocha": "^8.3.0"

package.json v/s package-lock.json

package.json keeps the record of your dependencies along with the minimum required version of the dependency.

package-lock.json keeps also keeps the records of your dependencies but it mentions the exact version of the dependency that is currently being used in the project.

So, when you share a project it is more advisable to also share the package-lock.json to avoid dependency related issues.

If you want to understand the usage of package.json and package-lock.json in more depth, please read

Callback hell (Pyramid of Doom)

When you write a code where there is many nested callbacks, which makes code hard to read and hard to debug. For Example :

function_1 ((request, response) => {
    function_2 ((request, response) => {
        function_3 ((request, response) => {
            .... // and so on

Questions from more advanced level topics like event loops, I/O or networking can also be asked if you are applying for job as an experienced developer. Let us know, if you want us to write some more technical interview QnAs on Node.js. We can plan to add them in the next part !

Previous Post
Next Post

Leave a Reply

Your email address will not be published. Required fields are marked *

11 − 10 =