Challenge your knowledge on basic Node.js NPM functions and key concepts, designed for beginners seeking to strengthen their foundation in Node.js package management.
What does NPM stand for when discussing Node.js development?
Explanation: Node Package Manager is the correct full form of NPM in the Node.js ecosystem. The other options are not relevant; Nonstop Processing Module and Network Protocol Manager are not connected to Node.js, and Next Primary Manager is unrelated to package management.
Which command would you usually use to add a new package to your Node.js project?
Explanation: 'npm install' is used to add new packages. 'npm launch' and 'npm create' are not valid commands for adding packages, while 'npm remove' would suggest deleting a package instead of installing one.
Which file is commonly used to manage dependencies in a Node.js project?
Explanation: package.json tracks dependencies for Node.js projects. server.js is often used for server code, index.html is for web frontends, and readme.md typically stores project information, not dependencies.
What is the main purpose of NPM in Node.js development?
Explanation: NPM manages packages needed for Node.js projects, handling installs and updates. It does not design layouts (CSS/HTML), compile source code (which is handled by compilers), or run database queries (which requires a database engine).
Which command will show you which version of NPM you have installed?
Explanation: npm --version displays your installed NPM version. The other commands do not check versions: 'npm --update' is not a version check; 'npm run' is for scripts; and 'npm status' is not used for NPM version info.
How can you update an existing package using NPM?
Explanation: npm update upgrades installed packages. npm build is not for updating, npm delete is for removing, and npm push is not related to NPM package functions.
What command would you run to create a new package.json file interactively?
Explanation: npm init creates a package.json file. npm publish uploads a package, npm make is not correct, and npm start is used to run a script, not set up configuration.
Which NPM command removes a package from your project and updates package.json?
Explanation: npm uninstall removes a package and updates records. npm fetch is not valid here, npm open is for opening something else, and npm reboot doesn't relate to package removal.
What command lists all installed packages in your Node.js project directory?
Explanation: npm list shows installed packages. npm save is related to saving changes, npm read is not a listing command, and npm inject is irrelevant in this context.
What is the primary role of the node_modules folder in a Node.js project?
Explanation: node_modules stores all installed packages. It does not keep environment variables, HTML files, or handle routing, which are managed elsewhere within a project.