Olete.in
Articles
Mock Tests
🧪 React JS MCQ Quiz Hub
React JS Mcq Question Set 1
Choose a topic to test your knowledge and improve your React JS skills
1. What is React.js?
Open-source JavaScript back-end library
JavaScript front-end library to create a database
Free and open-source JavaScript front-end library
None of the mentioned
2. Which of the following acts as the input of a class-based component?
Class
Props
Factory
None of the mentioned
3. React.js is written in which of the following language?
C
C++
JavaScript
Java
4. How many elements can a valid react component return?
React doesn’t return element
1 Element
More than 1 element
None of the mentioned
5. In which of the following directory React Components are saved?
Inside js/components/
Inside components/js/
Inside vendor/js/components/
Inside vendor/components/
6. Which of the following command is used to Install create-react-app?
npm install create-react-app
npm install -f create-react-app
npm install -g create-react-app
install -g create-react-app
7. In which condition is the React.js Lifecycle method static getDerivedSateFromProps(props, state) is called?
When the state of the component is updated
When a component is created for the first time
Both of the mentioned
None of the mentioned
8. Which of the following is method is not a part of ReactDOM?
ReactDOM.hydrate()
ReactDOM.destroy()
ReactDOM.createPortal()
All of the Mentioned
9. Which of the following is correct about prop in react?
Can be changed inside another component
Can be changed inside the component
Cannot be changed in the component
All of the Mentioned
10. Which of the following is used to pass data to a component from outside in React?
props
render with arguments
setState
PropTypes
11. Which of the following is the correct name of React.js?
React
React.js
ReactJS
All of the above
12. Which of the following are the advantages of React.js?
React.js can increase the application's performance with Virtual DOM.
React.js is easy to integrate with other frameworks such as Angular, BackboneJS since it is only a view library.
React.js can render both on client and server side.
All of the above
13. Which of the following is not a disadvantage of React.js?
React.js has only a view layer. We have put your code for Ajax requests, events and so on.
The library of React.js is pretty large.
The JSX in React.js makes code easy to read and write.
The learning curve can be steep in React.js.
14. What of the following is used in React.js to increase performance?
Original DOM
Virtual DOM
Both A and B.
None of the above.
15. A class is a type of function, but instead of using the keyword function to initiate it, which keyword do we use?
Constructor
Class
Object
DataObject
16. Which of the following keyword is used to create a class inheritance?
Create
Inherits
Extends
This
17. What is the default port where webpack-server runs?
3000
8080
3030
6060
18. How many numbers of elements a valid react component can return?
1
2
4
5
19. What is the declarative way to render a dynamic list of components based on values in an array?
Using the reduce array method
Using the <Each /> component
Using the Array.map() method
With a for/while loop
20. How many ways of defining your variables in ES6?
1
3
4
5
21. What is a state in React?
A permanent storage.
Internal storage of the component.
External storage of the component.
None of the above.
22. What are the two ways to handle data in React?
State & Props
Services & Components
State & Services
State & Component
23. In which of the following directory React.js components are saved?
Inside the js/components/
Inside the vendor/components/
Inside the external/components/
Inside the vendor/
24. Which of the following is a must API for every React.js component?
SetinitialComponent
renderComponent
render
All of the above
25. Which of the following option is correct in the case of the Babel?
Babel is a Compiler.
Babel is a Transpilar.
None of the above.
Both A and B are correct.
26. Does React.js create a VIRTUAL DOM in the memory?
TRUE
FALSE
Can be true or false
Cannot say
27. What is the use of "webpack" command in React.js?
The "webpack" command is used to transpile all the JavaScript down into one file.
It runs React local development server.
It is a module bundler.
None of the above.
28. Which of the following is used to pass data to a component from outside in React.js?
SetState
Render with arguments
Props
PropTypes
29. What does ES6 stand for?
ECMAScript 6
ECMA 6
ECMAJavaScript 6
EJavaScript 6
30. Which of the following function is used to change the state of the React.js component?
this.setState
this.setChangeState
this.State{}
None of the above.
31. Which of the following method refers to the parent class in React.js?
inherits()
self()
super()
this()
32. What will happen if you render an input element with disabled = {false}?
It will be rendered as disabled
It will not be rendered at all
It will be rendered as enabled
You cannot set it false.
33. Which of the following function is called to render HTML to the web page in React?
render()
render()
ReactDOM_render()
render()
34. Which of the following lifecycle events React components have at the highest level?
Destruction
Initialization
State/Property Updates
All of the above.
35. Why is the usage of setState?
Invoke code after the setState operation is done.
Replace the state completely instead of the default merge action.
Access the previous state before the setState operation.
None of the above.
36. Which of the following best defines the "key" prop?
"Key" prop is used to look pretty, and there is no benefit whatsoever.
"Key" prop is a way for React to identify a newly added item in a list and compare it during the "diffing" algorithm.
It is one of the attributes in HTML.
It is NOT commonly used in an array.
37. Which of the following method is not a part of ReactDOM?
ReactDOM.destroy()
ReactDOM.hydrate()
ReactDOM.createPortal()
ReactDOM.findDOMNode()
38. How can you set a default value for an uncontrolled form field?
By using the value property
By using the defaultValue property
By using the default property
It is assigned automatically.
39. We can update the state in React.js by calling to setState() method. These calls are:
Synchronous in nature.
Asynchronous in nature.
Are asynchronous but can be made synchronous when required.
None of the above.
40. Which of the following statement is true for controlled components in React.js?
The source of truth is DOM.
The source of truth can be anything.
The source of truth is a component state.
None of the above.
41. What changes would appear in the component as soon as the state of the React component is changed?
It will do nothing; you have to call render method to render the component again.
It will re-render the component.
It can be created again from scratch.
None of the above.
42. Which of the following statement is true for uncontrolled components in React.js?
The source of truth is DOM.
The source of truth is a component state.
The source of truth can be anything.
none of the above
43. In which of the following condition, the React.js Lifecycle method static getDerivedSateFromProps(props, state) is called?
The component is created for the first time.
The state of the component is updated.
Both of the above.
None of the above.
44. What is the use of the create-react-app command in the React.js application?
It is used to update a React app.
It is used to create a new React app.
It is used to install dependencies.
None of the above.
45. What is true for the keys given to a list of elements in React?
Unique in the DOM.
Unique among the siblings only.
Do not require to be unique.
None of the above.
Submit