0% found this document useful (0 votes)
105 views

React MCQ

The document contains 30 multiple choice questions about React.js concepts and features such as: - The correct name of React.js - Advantages of React.js like increased performance with Virtual DOM - Commands used to install create-react-app and increase performance - Keywords like class and extends used to define classes and inheritance - Methods like setState() to change component state - Default port where webpack-server runs

Uploaded by

AZM academy
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
105 views

React MCQ

The document contains 30 multiple choice questions about React.js concepts and features such as: - The correct name of React.js - Advantages of React.js like increased performance with Virtual DOM - Commands used to install create-react-app and increase performance - Keywords like class and extends used to define classes and inheritance - Methods like setState() to change component state - Default port where webpack-server runs

Uploaded by

AZM academy
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

1) Which of the following is the correct name of React.js?

a. React
b. React.js
c. ReactJS
d. All of the above

2) Which of the following are the advantages of React.js?


a. React.js can increase the application's performance with Virtual
DOM.
b. React.js is easy to integrate with other frameworks such as
Angular, BackboneJS since it is only a view library.
c. React.js can render both on client and server side.
d. All of the above

3) Which of the following is not a disadvantage of React.js?


a. React.js has only a view layer. We have put your code for Ajax
requests, events and so on.
b. The library of React.js is pretty large.
c. The JSX in React.js makes code easy to read and write.
d. The learning curve can be steep in React.js.

4) Which of the following command is used to install create-react-


app?
00:00/04:47
a. npm install -g create-react-app
b. npm install create-react-app
c. npm install -f create-react-app
d. install -g create-react-app

5) What of the following is used in React.js to increase performance?


a. Original DOM
b. Virtual DOM
c. Both A and B.
d. None of the above.

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

7) Which of the following acts as the input of a class-based


component?
a. Class
b. Factory
c. Render
d. Props
8) Which of the following keyword is used to create a class
inheritance?
a. Create
b. Inherits
c. Extends
d. This

9) What would be the output of the following example?


1. var Helloword=(props)=>
2. {
3. return(
4. <div>
5. Hello World 1
6. </div>
7. <div>
8. Hello World 2
9. </div>
10. );
11. }
12. ReactDOM.render(<Helloworld/>,mountNode)
a. Hello World 1
b. Hello World 2
c. Hello World 1 Hello World 2
d. Error
10) What is the default port where webpack-server runs?
a. 3000
b. 8080
c. 3030
d. 6060

11) How many numbers of elements a valid react component can


return?
a. 1
b. 2
c. 4
d. 5

12) What is the declarative way to render a dynamic list of


components based on values in an array?
a. Using the reduce array method
b. Using the <Each /> component
c. Using the Array.map() method
d. With a for/while loop

13) How many ways of defining your variables in ES6?


a. 1
b. 3
c. 4
d. 5

14) What is a state in React?


a. A permanent storage.
b. Internal storage of the component.
c. External storage of the component.
d. None of the above.

15) What are the two ways to handle data in React?


a. State & Props
b. Services & Components
c. State & Services
d. State & Component

16) In which of the following directory React.js components are


saved?
a. Inside the js/components/
b. Inside the vendor/components/
c. Inside the external/components/
d. Inside the vendor/

17) Which of the following is a must API for every React.js


component?
a. SetinitialComponent
b. renderComponent
c. render
d. All of the above

18) Which of the following option is correct in the case of the Babel?
a. Babel is a Compiler.
b. Babel is a Transpilar.
c. None of the above.
d. Both A and B are correct.

19) Does React.js create a VIRTUAL DOM in the memory?


a. TRUE
b. FALSE
c. Can be true or false
d. Cannot say

20) What is the use of "webpack" command in React.js?


a. The "webpack" command is used to transpile all the JavaScript
down into one file.
b. It runs React local development server.
c. It is a module bundler.
d. None of the above.

21) Which of the following is used to pass data to a component from


outside in React.js?
a. SetState
b. Render with arguments
c. Props
d. PropTypes

22) What does ES6 stand for?


a. ECMAScript 6
b. ECMA 6
c. ECMAJavaScript 6
d. EJavaScript 6

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{}
d. None of the above.

24) Which of the following method refers to the parent class in


React.js?
a. inherits()
b. self()
c. super()
d. this()

25) What will happen if you render an input element with disabled =
{false}?
a. It will be rendered as disabled
b. It will not be rendered at all
c. It will be rendered as enabled
d. You cannot set it false.

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()

27) Which of the following lifecycle events React components have


at the highest level?
a. Destruction
b. Initialization
c. State/Property Updates
d. All of the above.

28) Why is the usage of setState?


a. Invoke code after the setState operation is done.
b. Replace the state completely instead of the default merge
action.
c. Access the previous state before the setState operation.
d. None of the above.
29) Which of the following best defines the "key" prop?
a. "Key" prop is used to look pretty, and there is no benefit
whatsoever.
b. "Key" prop is a way for React to identify a newly added item in
a list and compare it during the "diffing" algorithm.
c. It is one of the attributes in HTML.
d. It is NOT commonly used in an array.

30) Which of the following method is not a part of ReactDOM?


a. ReactDOM.destroy()
b. ReactDOM.hydrate()
c. ReactDOM.createPortal()
d. ReactDOM.findDOMNode()

You might also like