P
prepair.app
Start interview →
EnglishУкраїнськаРусскийDeutsch
🟢

Junior Node.js BackendNode.js interview questions

Junior · no experience / under 1 year

Node.js interviews revolve around the event loop, asynchronous patterns, Express or NestJS, and the consequences of a single-threaded runtime. Below are the most common questions with model answers. Junior: core theory, definitions, and simple practical cases.

Try it — no account needed
Preparing your question…

Topics to prepare

Event loop and its phases
Promises and async/await
Streams and buffers
Express / NestJS
Middleware and error handling
JWT and authentication

7 Junior-level questions with answers

1

What is the event loop, and what does single-threaded actually mean here?

Answer

Node runs your JavaScript on one thread and hands I/O to the operating system, picking up the results as callbacks when they are ready. Single-threaded means your code never runs in two places at once — but the waiting happens elsewhere, which is why Node handles thousands of idle connections cheaply. The consequence to remember: a slow loop in your code blocks every request, not just the one it belongs to.

2

What is the difference between a callback, a promise and async/await?

Answer

They are the same mechanism at three levels of ergonomics. A callback is a function called on completion and nests badly. A promise is an object representing a future value that can be chained. async/await is syntax over promises that lets you write sequential-looking code. What does not change is the underlying model — await does not block the thread, it yields.

3

What happens if you forget to await a promise?

Answer

The function continues immediately with a pending promise instead of the value, so you get undefined behaviour downstream, and any error inside becomes an unhandled rejection that can take the process down. The most common shape is a database write that appears to succeed because nobody waited to find out it failed. Linters catch this and the rule is worth turning on.

4

How do you handle an error inside an async function?

Answer

With try/catch around the await, because a rejected promise inside an async function behaves like a thrown error. What does not work is try/catch around a callback-based call — the callback runs later, outside the block. In Express, errors from async handlers must be passed to next() or the request hangs until it times out.

5

What is the difference between dependencies and devDependencies?

Answer

Dependencies are needed to run the application, devDependencies only to build and test it. The distinction matters when the production image installs with --omit=dev: putting a build tool in the wrong place either bloats the image or breaks the build. The related question is package-lock — commit it, because it is what makes two installs produce the same tree.

6

What is middleware in Express?

Answer

A function that receives the request, the response and next, and either handles the request or passes it along. Order is everything: authentication placed after the route it protects does nothing, and an error handler must be registered last to catch what comes before it. Forgetting to call next() is the classic bug, and the symptom is a request that never answers.

7

What is the difference between process.env and a config file?

Answer

Environment variables come from outside the code, so the same build can run in staging and production with different values, and secrets never enter the repository. A config file is convenient and versioned, which is exactly why credentials must not live in one. The practical setup is a schema that validates the variables at startup, so a missing one fails immediately rather than at the first request.

🦎

Reading answers is not enough

In a real interview you speak under pressure. Cam asks these same questions, scores every answer, and shows exactly what to fix.

Practice a Junior Node.js Backend interview →
Free · 3 interviews per month

Other levels — Node.js Backend

Middle Node.js BackendSenior Node.js BackendAll Node.js Backend questions

Other specializations

🔍Junior Manual QA🤖Junior QA AutomationJunior Java Backend🐍Junior Python Backend🐘Junior PHP Backend🦫Junior Go Backend💎Junior Ruby on Rails🟣Junior .NET Backend Developer🔷Junior C++🟨Junior JavaScript