NEW
Font size
WorksheetsReact and Express Quiz
Total questions: 30
Worksheet time: 15mins
What does MERN stand for?
MongoDB, Express.js, React, Node.js
MySQL, Express.js, React, Node.js
MongoDB, Express.js, Ruby, Node.js
MySQL, Express.js, Ruby, Node.js
Which command is used to create a new React application using Create React App?
create-react-app new-app
npx create-react-app new-app
npm create-react-app new-app
npx new-react-app new-app
What is the primary purpose of React components?
To manage state
To encapsulate UI elements
To handle API requests
To style the application
In React, what is state?
A method for managing asynchronous calls
An object that holds data that may change over time
A library for styling components
A tool for routing in applications
Which method is used to update the state in a class component?
updateState()
setState()
changeState()
modifyState()
What does the Express framework primarily facilitate?
Data visualization
Building web applications and APIs
State management
Component styling
How do you define a route in Express to handle GET requests?
app.route('GET', '/path', callback)
app.get('/path', callback)
app.on('GET', '/path', callback)
app.request('GET', '/path', callback)
What is the purpose of Webpack in a React application?
To optimize database queries
To bundle JavaScript files and manage assets
To provide styling for components
To handle routing in applications
Which of the following is a way to handle routing in a React application?
React Router
Redux
Axios
Webpack
What is a key benefit of server-side rendering (SSR) in React?
Improved client-side performance
Better SEO and faster initial load times
Simplified component management
Enhanced user state tracking
In which file do you typically configure Webpack in a React project?
webpack.config.js
package.json
.babelrc
server.js
What is the primary function of the useState hook in functional components?
To manage side effects
To render components
To manage state
To handle props
In React Router, which component is used to define a link to a route?
RouteLink
NavLink
Link
Route
When creating a RESTful API, which HTTP method is typically used to delete a resource?
GET
POST
PUT
DELETE
What is the purpose of middleware in Express?
To serve static files
To handle requests and responses
To connect to databases
To style components
Which statement correctly describes a functional component in React?
It can hold state and lifecycle methods.
It is an ES6 class.
It is a plain JavaScript function that returns JSX.
It cannot accept props.
Which of the following is NOT a lifecycle method in React?
componentDidMount
componentWillUnmount
componentShouldUpdate
componentDidUpdate
How can you pass data from a parent component to a child component in React?
By using props
By using state
By using context
By using hooks
Which command do you use to install React Router in your project?
npm install react-router
npm install react-router-dom
npm install react-router-native
npm install react-router-core
What does the ReactDOMServer.renderToString() method do?
Renders a React component to a string for server-side rendering
Renders a component to the DOM
Converts JSX to JavaScript
Compiles React components into HTML
Which of the following describes how React manages updates to the UI?
It updates the entire DOM
It directly manipulates the DOM
It uses a virtual DOM to optimize updates
It requires manual updates by the developer
In a REST API, what does CRUD stand for?
Create, Read, Update, Delete
Create, Render, Update, Delete
Create, Read, Upload, Delete
Create, Read, Update, Deploy
What is the primary role of the package.json file in a Node.js project?
To define project dependencies and scripts
To configure Webpack settings
To define routes for the Express server
To write CSS styles for the application
Which React lifecycle method is called immediately after a component is added to the DOM?
componentDidUpdate
componentDidMount
componentWillUnmount
componentDidReceiveProps
Which of the following can be used to optimize the performance of a React application?
Using functional components with hooks
Avoiding the use of props
Using class components exclusively
Limiting state management
What is the purpose of the npm start command in a React application?
To build the application for production
To start the development server
To install dependencies
To run tests
In Express, how can you handle errors in your application?
By using the next() function
By throwing exceptions
By defining an error-handling middleware
By using try-catch blocks
What is the primary advantage of using modularization in a React application?
Simplifying the API
Making code easier to maintain and reuse
Reducing the number of components
Speeding up server requests
What characterizes a stateless functional component in React?
It manages its own state.
It does not use props.
It does not have lifecycle methods.
It cannot be reused.
Which of the following is a primary use of the useEffect hook in React?
To manage state
To perform side effects in functional components
To handle events
To define components
