wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

React and Express Quiz

Total questions: 30

Worksheet time: 15mins

Name
Class
Date
1.

What does MERN stand for?

a)

MongoDB, Express.js, React, Node.js

b)

MySQL, Express.js, React, Node.js

c)

MongoDB, Express.js, Ruby, Node.js

d)

MySQL, Express.js, Ruby, Node.js

2.

Which command is used to create a new React application using Create React App?

a)

create-react-app new-app

b)

npx create-react-app new-app

c)

npm create-react-app new-app

d)

npx new-react-app new-app

3.

What is the primary purpose of React components?

a)

To manage state

b)

To encapsulate UI elements

c)

To handle API requests

d)

To style the application

4.

In React, what is state?

a)

A method for managing asynchronous calls

b)

An object that holds data that may change over time

c)

A library for styling components

d)

A tool for routing in applications

5.

Which method is used to update the state in a class component?

a)

updateState()

b)

setState()

c)

changeState()

d)

modifyState()

6.

What does the Express framework primarily facilitate?

a)

Data visualization

b)

Building web applications and APIs

c)

State management

d)

Component styling

7.

How do you define a route in Express to handle GET requests?

a)

app.route('GET', '/path', callback)

b)

app.get('/path', callback)

c)

app.on('GET', '/path', callback)

d)

app.request('GET', '/path', callback)

8.

What is the purpose of Webpack in a React application?

a)

To optimize database queries

b)

To bundle JavaScript files and manage assets

c)

To provide styling for components

d)

To handle routing in applications

9.

Which of the following is a way to handle routing in a React application?

a)

React Router

b)

Redux

c)

Axios

d)

Webpack

10.

What is a key benefit of server-side rendering (SSR) in React?

a)

Improved client-side performance

b)

Better SEO and faster initial load times

c)

Simplified component management

d)

Enhanced user state tracking

11.

In which file do you typically configure Webpack in a React project?

a)

webpack.config.js

b)

package.json

c)

.babelrc

d)

server.js

12.

What is the primary function of the useState hook in functional components?

a)

To manage side effects

b)

To render components

c)

To manage state

d)

To handle props

13.

In React Router, which component is used to define a link to a route?

a)

RouteLink

b)

NavLink

c)

Link

d)

Route

14.

When creating a RESTful API, which HTTP method is typically used to delete a resource?

a)

GET

b)

POST

c)

PUT

d)

DELETE

15.

What is the purpose of middleware in Express?

a)

To serve static files

b)

To handle requests and responses

c)

To connect to databases

d)

To style components

16.

Which statement correctly describes a functional component in React?

a)

It can hold state and lifecycle methods.

b)

It is an ES6 class.

c)

It is a plain JavaScript function that returns JSX.

d)

It cannot accept props.

17.

Which of the following is NOT a lifecycle method in React?

a)

componentDidMount

b)

componentWillUnmount

c)

componentShouldUpdate

d)

componentDidUpdate

18.

How can you pass data from a parent component to a child component in React?

a)

By using props

b)

By using state

c)

By using context

d)

By using hooks

19.

Which command do you use to install React Router in your project?

a)

npm install react-router

b)

npm install react-router-dom

c)

npm install react-router-native

d)

npm install react-router-core

20.

What does the ReactDOMServer.renderToString() method do?

a)

Renders a React component to a string for server-side rendering

b)

Renders a component to the DOM

c)

Converts JSX to JavaScript

d)

Compiles React components into HTML

21.

Which of the following describes how React manages updates to the UI?

a)

It updates the entire DOM

b)

It directly manipulates the DOM

c)

It uses a virtual DOM to optimize updates

d)

It requires manual updates by the developer

22.

In a REST API, what does CRUD stand for?

a)

Create, Read, Update, Delete

b)

Create, Render, Update, Delete

c)

Create, Read, Upload, Delete

d)

Create, Read, Update, Deploy

23.

What is the primary role of the package.json file in a Node.js project?

a)

To define project dependencies and scripts

b)

To configure Webpack settings

c)

To define routes for the Express server

d)

To write CSS styles for the application

24.

Which React lifecycle method is called immediately after a component is added to the DOM?

a)

componentDidUpdate

b)

componentDidMount

c)

componentWillUnmount

d)

componentDidReceiveProps

25.

Which of the following can be used to optimize the performance of a React application?

a)

Using functional components with hooks

b)

Avoiding the use of props

c)

Using class components exclusively

d)

Limiting state management

26.

What is the purpose of the npm start command in a React application?

a)

To build the application for production

b)

To start the development server

c)

To install dependencies

d)

To run tests

27.

In Express, how can you handle errors in your application?

a)

By using the next() function

b)

By throwing exceptions

c)

By defining an error-handling middleware

d)

By using try-catch blocks

28.

What is the primary advantage of using modularization in a React application?

a)

Simplifying the API

b)

Making code easier to maintain and reuse

c)

Reducing the number of components

d)

Speeding up server requests

29.

What characterizes a stateless functional component in React?

a)

It manages its own state.

b)

It does not use props.

c)

It does not have lifecycle methods.

d)

It cannot be reused.

30.

Which of the following is a primary use of the useEffect hook in React?

a)

To manage state

b)

To perform side effects in functional components

c)

To handle events

d)

To define components