curriculum/challenges/english/blocks/quiz-npm/69a98755ee5508d58e91dccc.md
To pass the quiz, you must correctly answer at least 18 of the 20 questions below.
What does npm provide for developers?
A curated platform that only hosts design assets like fonts and icons.
A hosting service that automatically deploys your project to the cloud.
A database solution that manages user records for your apps.
A registry of prebuilt software packages that solves common problems.
Which of the following is not one of the three parts npm refers to?
The website npmjs.com.
The package registry where libraries are stored.
The command-line tool for installing and managing packages.
The Node.js runtime.
What does the npm install command do?
It scaffolds a brand-new Node.js project from a template.
It runs your Node.js application on a local development server.
It removes packages that are no longer needed in your project.
It adds prebuilt packages to your project for common tasks.
Which file stores metadata like project name, version, author, and dependencies for a Node.js project?
README.md.
node_modules/package.json.
package-lock.json.
package.json.
How can you interactively create a package.json file?
Run npm install without specifying a package name.
Download a template from the npm registry homepage.
Copy the file from another project and rename it.
Run the npm init command.
How do you create a package.json file with default values without answering prompts?
Run npm init --interactive.
Create a blank file named package.json and leave it empty.
Use npm init and delete every prompt after opening the editor.
Run npm init -y (or npm init --yes) to accept all defaults automatically.
Where does npm list packages that are only needed while developing, such as linters or test runners?
Inside the "dependencies" section.
Inside the "scripts" section under custom commands.
Within the node_modules folder itself.
Inside the "devDependencies" section of package.json.
Which command installs nodemon as a development-only dependency?
npm uninstall nodemon.
npm save nodemon --dev.
npm install nodemon.
npm install nodemon -D.
Which folder and file are added to your project root after installing a dependency?
public folder and index.html.
dist folder and webpack.config.js.
src folder and README.md.
node_modules folder and package-lock.json file.
How does package-lock.json help keep builds consistent?
By deleting unused dependencies before every install.
By storing only the major version numbers of packages.
By automatically upgrading packages to their latest releases.
By freezing the exact versions of every dependency that were installed.
Why should you commit package-lock.json to your Git repository?
To make npm run faster on a developer’s machine.
To automatically update outdated dependencies.
To reduce the repository size.
So the whole team installs the same dependency versions and setup.
How do you install a specific version of a package, like [email protected]?
npm update [email protected].
npm get [email protected].
npm use [email protected].
npm install [email protected].
What does the caret (^) symbol allow when specifying dependency versions?
It locks the dependency to an exact patch version.
It allows updates to the major version only.
It excludes all versions below the specified one.
It permits newer minor and patch versions but blocks new major releases.
What does the tilde (~) symbol mean in a version range like ~1.2.3?
It allows updates to both major and minor versions.
It installs the newest major version regardless of the range.
It prevents npm from installing any updates at all.
It allows updates to the patch version only while keeping the minor version fixed.
What kind of changes trigger a major version bump in semantic versioning?
Minor stylistic tweaks to comments and formatting.
Small bug fixes that don’t change behavior.
Optional features that don’t break existing code.
Breaking changes that can cause existing code to stop working.
Which command lists dependencies that have newer published versions?
npm check.
npm list.
npm refresh.
npm outdated.
Yarn, PNPM, and Bun are mentioned as alternatives to npm. What kind of tools are they?
Registry websites where you publish or download npm packages.
Database services that store user data for npm packages.
Cloud hosting platforms that auto-deploy npm projects.
Alternative package managers.
Where are custom npm scripts declared in a project?
Inside the .npmrc file.
Within the "dependencies" section of package.json.
In a separate scripts.json file at the root.
Inside the "scripts" object of package.json.
How do you execute a custom npm script named build?
build npm.
node build.
run build.
npm run build.
What does the double hyphen (--) do when running npm run start -- 8000?
It silences the script output.
It forces npm to run the script in parallel.
It requests administrative privileges before executing the script.
It tells npm to forward everything after -- as arguments to the underlying command.