wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Node.js Quiz

Total questions: 30

Worksheet time: 15mins

Name
Class
Date
1.

What is Node.js primarily used for?

a)

Creating static websites

b)

Running JavaScript on the server-side

c)

Styling web pages

d)

None of the above

2.

What feature does Node.js utilize to handle multiple requests?

a)

Synchronous programming

b)

Non-blocking I/O

c)

Multithreading

d)

Caching

3.

Which of the following is a core module in Node.js?

a)

express

b)

http

c)

mongoose

d)

jquery

4.

What is the default package manager for Node.js?

a)

Bower

b)

npm

c)

Yarn

d)

Composer

5.

Which of the following commands is used to initialize a new Node.js project?

a)

npm start

b)

npm create

c)

npm init

d)

npm install

6.

What does the 'Express' framework do?

a)

It helps in styling web pages.

b)

It is used for building web applications in Node.js.

c)

It is a database management system.

d)

It is a JavaScript library for animations.

7.

In the context of web applications, what does MVC stand for?

a)

Model-View-Controller

b)

Model-View-Creator

c)

Model-Variable-Controller

d)

Model-View-Creative

8.

Which of the following is NOT a part of the MERN stack?

a)

MongoDB

b)

Express

c)

React

d)

Angular

9.

What is the role of a web server in web development?

a)

To store static files only

b)

To process requests and serve content to clients

c)

To manage databases

d)

To manipulate client-side scripts

10.

In a typical web application architecture, what does the backend handle?

a)

User interface design

b)

Data management and business logic

c)

Client-side scripting

d)

Responsive design

11.

What does the command npm install express do?

a)

It installs the express package locally.

b)

It installs the express package globally.

c)

It updates the express package.

d)

It removes the express package.

12.

Which of the following best describes the role of MongoDB in a web application?

a)

It serves HTML files.

b)

It is a NoSQL database that stores data in JSON-like format.

c)

It is a CSS framework.

d)

It is a JavaScript library for DOM manipulation.

13.

How can you start a Node.js application?

a)

node app.js

b)

start app.js

c)

run app.js

d)

execute app.js

14.

What will console.log(typeof a); output if let a = 42;?

a)

number

b)

string

c)

object

d)

undefined

15.

Which of the following best describes the purpose of the require function in Node.js?

a)

To create a new module

b)

To import modules into a file

c)

To declare global variables

d)

To execute a function

16.

What happens if you call res.end() without first calling res.writeHead() in an HTTP server?

a)

The server will crash.

b)

The response will not send any headers.

c)

The server will hang indefinitely.

d)

The response will send a 404 status code.

17.

In the context of Node.js, what does an EventEmitter do?

a)

It manages HTTP requests.

b)

It allows handling of asynchronous events.

c)

It stores data in memory.

d)

It compiles JavaScript code.

18.

What is the purpose of the npm update command?

a)

To install new packages

b)

To update existing packages to their latest version

c)

To initialize a new project

d)

To uninstall packages

19.

Which of the following is a benefit of using asynchronous programming in Node.js?

a)

It simplifies code structure.

b)

It allows handling of multiple I/O operations simultaneously.

c)

It eliminates all bugs.

d)

It makes code run faster on the client-side.

20.

What type of application can you build using the Angular framework?

a)

Server-side applications

b)

Desktop applications

c)

Single-page applications

d)

Command-line applications

21.

In the context of the web, what does the term "stack" refer to?

a)

A collection of programming languages

b)

A set of technologies used together for web development

c)

A type of database

d)

A framework for building APIs

22.

What does the npm install -g command do?

a)

Installs a package in the local directory

b)

Installs a package globally on the system

c)

Updates a previously installed package

d)

Removes a package from the system

23.

What is the primary purpose of using middleware in Express?

a)

To handle errors

b)

To process requests before they reach the route handler

c)

To serve static files

d)

All of the above

24.

What does the http.createServer() method do in Node.js?

a)

It creates a new HTTP server

b)

It closes an existing HTTP server

c)

It sends data to the client

d)

It reads data from the client

25.

In which file would you typically define your project's dependencies when using npm?

a)

package.json

b)

app.js

c)

server.js

d)

index.html

26.

Which command would you use to check the current version of Node.js installed?

a)

node -version

b)

node --version

c)

node -v

d)

all of the above

27.

If you wanted to create a simple web server that responds with "Hello World!", which of the following code snippets is correct?

a)

http.createServer({ response: 'Hello World!' });

b)

http.createServer(() => { res.write('Hello World!'); });

c)

http.createServer((req, res) => { res.end('Hello World!'); }).listen(port);

d)

http.createServer(res => res.write('Hello World!'));

28.

In a Node.js application, what is the role of a callback function?

a)

It synchronizes the execution of code.

b)

It allows for asynchronous operations to complete before proceeding.

c)

It automatically handles errors.

d)

It is used to define global variables.

29.

What does the app.use() method in Express do?

a)

It defines static routes.

b)

It mounts middleware functions at a specific path.

c)

It creates an HTTP server.

d)

It initializes the application.

30.

Which of the following statements is true about React?

a)

It is mainly used for server-side programming.

b)

It is a framework for building user interfaces.

c)

It is a database management tool.

d)

It is a CSS preprocessor.