WorksheetsNodejs: Packages and Package.json
Total questions: 15
Worksheet time: 8mins
How do you run a JavaScript file in Nodejs
run main.js
js main.js
node main.js
go main.js
Which command is used to initialise a NodeJs project
node init
js init
npm init
package init
What file type is package.json
json
js
ts
pk
What is the full meaning of JSON
JavaScript Object Notion
JavaScript Object Notation
JavaScript Open Notation
JavaScript Of Notation
Which of the following is package.json NOT used for?
dependency management
project information
define scripts
none of the options
Which of the following methods can be used to create a package.json file
manually create a package.json
using npm/yarn commands
all of the above
none of the above
What is a package manager?
tool that simplifies the process of installing, managing and sharing packages
tool that simplifies the process of packaging software
tool that simplifies the process of selling software/packages
tool that simplifies the process of running packages/software
In Nodejs ecosystem, what is the default package manager
Yarn
React
NPM
Node
What is the correct command to install a package
npm install <package name>
npm init <package name>
npm download <package name>
npm use <package name>
Choose the correct syntax for importing another js file in ES5
const file = import('anotherfile')
const file = require('anotherfile')
const file = use('anotherfile')
const file = export('anotherfile')
Using ES6, one of the following is not a valid import statement
import module from './module.js'
import { a, b } from './module.js'
import * as m from './module.js'
import as m from './module.js'
When packages are installed, what directory/folder are they stored in?
node_packages
node_modules
node_entries
node_installs
The package-lock.json file is responsible for?
locking the versions of dependencies used in the project
locking the package.json
locking the packages in the project
locking the files in the project
The default and primary storage for Nodejs packages is
node registry
npm registry
yarn registry
js registry
To publish your package to the npm registry, which command would you use
npm push
npm publish
npm package
npm upload
