wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Nodejs: Packages and Package.json

Total questions: 15

Worksheet time: 8mins

Name
Class
Date
1.

How do you run a JavaScript file in Nodejs

a)

run main.js

b)

js main.js

c)

node main.js

d)

go main.js

2.

Which command is used to initialise a NodeJs project

a)

node init

b)

js init

c)

npm init

d)

package init

3.

What file type is package.json

a)

json

b)

js

c)

ts

d)

pk

4.

What is the full meaning of JSON

a)

JavaScript Object Notion

b)

JavaScript Object Notation

c)

JavaScript Open Notation

d)

JavaScript Of Notation

5.

Which of the following is package.json NOT used for?

a)

dependency management

b)

project information

c)

define scripts

d)

none of the options

6.

Which of the following methods can be used to create a package.json file

a)

manually create a package.json

b)

using npm/yarn commands

c)

all of the above

d)

none of the above

7.

What is a package manager?

a)

tool that simplifies the process of installing, managing and sharing packages

b)

tool that simplifies the process of packaging software

c)

tool that simplifies the process of selling software/packages

d)

tool that simplifies the process of running packages/software

8.

In Nodejs ecosystem, what is the default package manager

a)

Yarn

b)

React

c)

NPM

d)

Node

9.

What is the correct command to install a package

a)

npm install <package name>

b)

npm init <package name>

c)

npm download <package name>

d)

npm use <package name>

10.

Choose the correct syntax for importing another js file in ES5

a)

const file = import('anotherfile')

b)

const file = require('anotherfile')

c)

const file = use('anotherfile')

d)

const file = export('anotherfile')

11.

Using ES6, one of the following is not a valid import statement

a)

import module from './module.js'

b)

import { a, b } from './module.js'

c)

import * as m from './module.js'

d)

import as m from './module.js'

12.

When packages are installed, what directory/folder are they stored in?

a)

node_packages

b)

node_modules

c)

node_entries

d)

node_installs

13.

The package-lock.json file is responsible for?

a)

locking the versions of dependencies used in the project

b)

locking the package.json

c)

locking the packages in the project

d)

locking the files in the project

14.

The default and primary storage for Nodejs packages is

a)

node registry

b)

npm registry

c)

yarn registry

d)

js registry

15.

To publish your package to the npm registry, which command would you use

a)

npm push

b)

npm publish

c)

npm package

d)

npm upload