yoklainterview sim

Backend Nodejs Stdlib Http Interview Questions

75 verified Backend Nodejs Stdlib Http interview questions — solve with answers, learn from explanations, test yourself in a real simulation.

Try the real simulation →

Sample questions

Nodejs Stdlib HttpDifficulty 1
On POSIX systems (Linux/macOS), what is the value of Node's path.sep?
  • a\\
  • b/
  • c:
  • d.
Explanation:path.sep is the platform-specific path segment separator: / on POSIX, \ on Windows. Code that hardcodes separators instead of using path.sep/path.join breaks across platforms.
Nodejs Stdlib HttpDifficulty 1
const buf = Buffer.from('hello');
console.log(Buffer.isBuffer(buf));
console.log(Buffer.isBuffer('hello'));

What is logged?
  • atrue then false
  • bfalse then true
  • ctrue then true
  • dfalse then false
Explanation:Buffer.isBuffer() only returns true for actual Buffer instances. A plain string is not a Buffer, so the second call returns false.
Nodejs Stdlib HttpDifficulty 1
When you run node app.js foo, what does process.argv[0] represent?
  • aThe first CLI argument (foo)
  • bThe path to the script being executed (app.js)
  • cAn array containing only the arguments, without node
  • dThe path to the Node.js executable itself
Explanation:process.argv[0] is the executable path (node), argv[1] is the script path, and argv[2] onward are the actual CLI arguments passed by the user.
Nodejs Stdlib HttpDifficulty 1
const fs = require('fs');
console.log(fs.existsSync('/definitely/not/here/xyz'));

What is logged?
  • atrue
  • bIt throws an Error
  • cfalse
  • dundefined
Explanation:fs.existsSync() never throws for a missing path — it simply returns false. It only throws for genuinely invalid arguments (e.g. wrong type).
Nodejs Stdlib HttpDifficulty 1
path.parse('/home/user/file.txt') returns an object with which keys?
  • aroot, dir, base, ext, name
  • broot, dir, file, extension
  • cdirname, basename, extname
  • dOnly path, ext, name
Explanation:path.parse() returns { root, dir, base, ext, name }. base is the full filename (file.txt), name is the filename without extension (file).
Nodejs Stdlib HttpDifficulty 1
const http = require('http');
const server = http.createServer((req, res) => {
  console.log(req.method);
  res.end('ok');
});

A client sends a GET request. What does req.method log?
  • aThe full request URL
  • b'GET'
  • cundefined until res.end is called
  • d'get' (lowercase)
Explanation:req is an http.IncomingMessage; its method property holds the HTTP verb exactly as it appeared on the wire, e.g. 'GET', 'POST' — Node doesn't uppercase or otherwise normalize it. Here the client sent GET, so req.method === 'GET'.

Test yourself against the 3300-question Backend bank.

Start interview