W3
Teacher
Explore
Browse by field
Artificial Intelligence
Accounting & Finance
Information Technology
Show all fields
Interview Q&A
All Interview Questions
Beginner
Intermediate
Advanced
Practice
MCQs
Quizzes
Mock Interviews
About
Light
Dark
Auto
Sign in
Get Started
Search interview questions
Search
7 questions for “Modules (CommonJS/ESM)”
Found in 1 field. Select a question to see its full answer.
Matching topics
Node.js
Core Node.js
Modules
2
Information Technology
7 questions in 1 technology
#
Question
Technology
Topic
Level
1
What is the difference between require() (CommonJS) and import (ES
Modules
) when loading Node.js's own core
modules
?
Node.js › Core Node.js Modules
Node.js
Core Node.js
Modules
Beginner
2
What is the node: prefix for core module imports, and why was it introduced?
Node.js › Core Node.js Modules
Node.js
Core Node.js
Modules
Beginner
3
What is the difference between __dirname/__filename in CommonJS and their equivalents in ES
Modules
?
Node.js › Global Objects & the process Object
Node.js
Global Objects & the process Object
Intermediate
4
What is a shebang line, and why does it need to be the first line of an executable Node.js CLI script?
Node.js › CLI Tools & Scripting with Node.js
Node.js
CLI Tools & Scripting with Node.js
Beginner
5
What is the Module pattern in Node.js, and how does it enable encapsulation?
Node.js › Architecture & Design Patterns
Node.js
Architecture & Design Patterns
Intermediate
6
What is the Singleton pattern, and what are the specific risks of using it in a Node.js application?
Node.js › Architecture & Design Patterns
Node.js
Architecture & Design Patterns
Intermediate
7
How would you parse command-line arguments and flags in a Node.js CLI tool using a library like commander or yargs?
Node.js › CLI Tools & Scripting with Node.js
Node.js
CLI Tools & Scripting with Node.js
Intermediate