React - Js MCQ (Multiple Choice Questions) - Javatpoint
React - Js MCQ (Multiple Choice Questions) - Javatpoint
ADVERTISEMENT
Webflow
OPEN
Download free marketing report
a. React
b. React.js
c. ReactJS
Answer: D is the correct option. React.js is a free, open-source front-end JavaScript library used
for building user interfaces or UI components. It is also known as React or ReactJS.
b. React.js is easy to integrate with other frameworks such as Angular, BackboneJS since it is only
a view library.
Answer: D is the correct option as all of the above statements are the advantages of React.js.
https://www.javatpoint.com/reactjs-mcq 2/21
7/22/24, 4:51 PM React.js MCQ (Multiple Choice Questions) - javatpoint
a. React.js has only a view layer. We have put your code for Ajax requests, events and so on.
Answer: C is the correct answer. "The JSX in React.js makes code easy to read and write" is an
advantage of React.js.
d. install -g create-react-app
https://www.javatpoint.com/reactjs-mcq 3/21
7/22/24, 4:51 PM React.js MCQ (Multiple Choice Questions) - javatpoint
Answer: A is the correct answer. The "npm install -g create-react-app" command is used to
install the create-react-app.
a. Original DOM
b. Virtual DOM
c. Both A and B.
Answer: B is the correct answer. Virtual DOM is used in React.js to increase performance.
6) A class is a type of function, but instead of using the keyword function to initiate it, which keyword do we
use?
a. Constructor
b. Class
c. Object
d. DataObject
Answer: B is the correct answer. A class is a type of function, but instead of using the keyword
function to initiate it, we use the keyword class.
a. Class
b. Factory
https://www.javatpoint.com/reactjs-mcq 4/21
7/22/24, 4:51 PM React.js MCQ (Multiple Choice Questions) - javatpoint
c. Render
d. Props
a. Create
b. Inherits
c. Extends
d. This
Answer: C is the correct answer. The "Extends" keyword is used to create a class inheritance.
var Helloword=(props)=>
{
return(
<div>
Hello World 1
</div>
<div>
Hello World 2
</div>
);
}
ReactDOM.render(<Helloworld/>,mountNode)
https://www.javatpoint.com/reactjs-mcq 5/21
7/22/24, 4:51 PM React.js MCQ (Multiple Choice Questions) - javatpoint
a. Hello World 1
b. Hello World 2
d. Error
Answer: D is the correct option. The two adjacent elements in JSX should be wrapped in an
element so, this program will result an error.
a. 3000
b. 8080
c. 3030
d. 6060
Answer: B is the correct answer. The default port for webpack-server is 8080.
11) How many numbers of elements a valid react component can return?
https://www.javatpoint.com/reactjs-mcq 6/21
7/22/24, 4:51 PM React.js MCQ (Multiple Choice Questions) - javatpoint
a. 1
b. 2
c. 4
d. 5
Answer: A is the correct answer. In react component, we can return only one element.
12) What is the declarative way to render a dynamic list of components based on values in an array?
Answer: C is the correct option. The Array.map() method is used to render a dynamic list of
components based on values in an array.
a. 1
b. 3
c. 4
d. 5
Answer: B is the correct option. In ES6, there are three ways of defining your variables: var, let,
https://www.javatpoint.com/reactjs-mcq 7/21
7/22/24, 4:51 PM React.js MCQ (Multiple Choice Questions) - javatpoint
and const.
a. A permanent storage.
https://www.javatpoint.com/reactjs-mcq 8/21
7/22/24, 4:51 PM React.js MCQ (Multiple Choice Questions) - javatpoint
Answer: A is the correct option. The React.js components are saved in "Inside the
js/components/."
17) Which of the following is a must API for every React.js component?
a. SetinitialComponent
b. renderComponent
c. render
Answer: B is the correct option. The renderComponent is a must API for every React.js
component.
18) Which of the following option is correct in the case of the Babel?
a. Babel is a Compiler.
b. Babel is a Transpilar.
https://www.javatpoint.com/reactjs-mcq 9/21
7/22/24, 4:51 PM React.js MCQ (Multiple Choice Questions) - javatpoint
Answer: D is the correct option as both of the above statements are correct.
a. TRUE
b. FALSE
d. Cannot say
Answer: A is the correct option as React.js creates a VIRTUAL DOM in the memory.
ADVERTISEMENT
a. The "webpack" command is used to transpile all the JavaScript down into one file.
c. It is a module bundler.
https://www.javatpoint.com/reactjs-mcq 10/21
7/22/24, 4:51 PM React.js MCQ (Multiple Choice Questions) - javatpoint
21) Which of the following is used to pass data to a component from outside in React.js?
a. SetState
c. Props
d. PropTypes
a. ECMAScript 6
b. ECMA 6
c. ECMAJavaScript 6
d. EJavaScript 6
Answer: A is the correct option. ES6 stands for ECMAScript 6. ECMAScript was created to
standardize JavaScript. ES6 is the 6th version of ECMAScript published in 2015. It is also known
as ECMAScript 2015.
ADVERTISEMENT
https://www.javatpoint.com/reactjs-mcq 11/21
7/22/24, 4:51 PM React.js MCQ (Multiple Choice Questions) - javatpoint
23) Which of the following function is used to change the state of the React.js component?
a. this.setState
b. this.setChangeState
c. this.State{}
Answer: A is the correct option. The "this.setState" function is used to change the state of the
React.js component.
24) Which of the following method refers to the parent class in React.js?
a. inherits()
b. self()
c. super()
d. this()
Answer: C is the correct answer. The super() method refers to the parent class. If you want to call
the parent's constructor method and get access to the parent's properties and methods, you can
achieve it by calling the super() method in the constructor.
25) What will happen if you render an input element with disabled = {false}?
https://www.javatpoint.com/reactjs-mcq 12/21
7/22/24, 4:51 PM React.js MCQ (Multiple Choice Questions) - javatpoint
Answer: C is the correct answer. If you render an input element with disabled = {false}, it will be
rendered as enabled.
26) Which of the following function is called to render HTML to the web page in React?
a. render()
b. render()
c. ReactDOM_render()
d. render()
Answer: A is the correct option. React renders HTML to the web page by using a function called
ReactDOM.render().
27) Which of the following lifecycle events React components have at the highest level?
a. Destruction
b. Initialization
c. State/Property Updates
https://www.javatpoint.com/reactjs-mcq 13/21
7/22/24, 4:51 PM React.js MCQ (Multiple Choice Questions) - javatpoint
ADVERTISEMENT
Powered by Atlassian
b. "Key" prop is a way for React to identify a newly added item in a list and compare it during the
"diffing" algorithm.
Answer: B is the correct answer. It is used to identify any new item in a list when re-rendering. It
improves performance and efficiency also.
https://www.javatpoint.com/reactjs-mcq 14/21
7/22/24, 4:51 PM React.js MCQ (Multiple Choice Questions) - javatpoint
a. ReactDOM.destroy()
b. ReactDOM.hydrate()
c. ReactDOM.createPortal()
d. ReactDOM.findDOMNode()
31) How can you set a default value for an uncontrolled form field?
d. It is assigned automatically.
Answer: B is the correct option. We can set a default value for an uncontrolled form field by
using the defaultValue property.
32) We can update the state in React.js by calling to setState() method. These calls are:
a. Synchronous in nature.
b. Asynchronous in nature.
https://www.javatpoint.com/reactjs-mcq 15/21
7/22/24, 4:51 PM React.js MCQ (Multiple Choice Questions) - javatpoint
Answer: B is the correct answer. The call to setState() method in React.js is asynchronous, and
multiple calls can be batched for better performance.
33) Which of the following statement is true for controlled components in React.js?
34) What changes would appear in the component as soon as the state of the React component is changed?
a. It will do nothing; you have to call render method to render the component again.
Answer: B is the correct answer. In React.js, as soon as the state is updated, the component re-
renders itself.
35) Which of the following statement is true for uncontrolled components in React.js?
ADVERTISEMENT ADVERTISEMENT
https://www.javatpoint.com/reactjs-mcq 16/21
7/22/24, 4:51 PM React.js MCQ (Multiple Choice Questions) - javatpoint
36) In which of the following condition, the React.js Lifecycle method static getDerivedSateFromProps(props,
state) is called?
37) What is the use of the create-react-app command in the React.js application?
38) What is true for the keys given to a list of elements in React?
https://www.javatpoint.com/reactjs-mcq 17/21
7/22/24, 4:51 PM React.js MCQ (Multiple Choice Questions) - javatpoint
Answer: B is the correct option. Keys given to the list of elements in React should be unique
among the siblings only.
← Prev Next →
ADVERTISEMENT ADVERTISEMENT
Feedback
https://www.javatpoint.com/reactjs-mcq 18/21