React JS MCQ

React JS MCQ

  • Admin
  • 27th Oct, 2022

React JS MCQ

Following are mostly asked React js MCQ test that are designed for professionals like you to crack you interviews. You can take this React js online test before appearing to you real interview. This React js quiz there are around 30+ multiple choice questions on React js with four options.

1) What is React Js?

  • A. Javascript framework
  • B. Javascript library
  • C. Javascript file
  • D. None of the Above

2) What does ReactJS cover?

  • A. Data layer in an application
  • B. User Interface layer in an application
  • C. Both A & B
  • D. All are Correct

3) What does ReactJS use to increase performance?

  • A. Virtual DOM
  • B. Original DOM
  • C. Local DOM
  • D. None of the Above

4) React is ............ Javascript library

  • A. Module based
  • B. Component based
  • C. System based
  • D. All are Correct

5) A valid react component can return ...... number of elements.

  • A. 1
  • B. 2
  • C. 3
  • D. None of the Above
Download Free : React JS MCQ PDF

6) For controlled components in react

  • A. Source of truth is DOM
  • B. Source of truth is component state
  • C. Source of truth can be anything
  • D. None of above

7) For uncontrolled components in react

  • A. Source of truth is DOM
  • B. Source of truth is component state
  • C. Source of truth can be anything
  • D. None of above

8) Number of elements, a valid react component can return

  • A. 1
  • B. 2
  • C. 3
  • D. 5

9) React is a ________

  • A. Javascript library
  • B. Javascript framework
  • C. Both of above
  • D. None of above

10) Which of the following API is a MUST for every ReactJS component?

  • A. getInitialState
  • B. render
  • C. renderComponent
  • D. None

11) How can you access the state of a component from inside of a member function?

  • A. this.getState()
  • B. this.state
  • C. this.prototype.stateValue
  • D. this.values

12) What is a good use case for using a function while rendering a dynamic list of items

  • A. If we need to compute a value based on properties of items in the loop.
  • B. None. Functions should not be used while rendering a dynamic list.
  • C. To make the code shorter

13) What is the second argument for setState useful for?

  • A. To invoke code after the setState operation is done
  • B. To replace the state completely instead of the default merge action
  • C. To access the previous state before the setState operation

14) ReactJS uses _____ to increase performance

  • A. Virtual DOM
  • B. Original DOM
  • C. Both of above
  • D. None of above

15) What is the default port for webpack dev server?

  • A. 3000
  • B. 8080
  • C. 3306
  • D. 8809

16) What are two ways data gets handled in react?

  • A. state & props
  • B. services & components
  • C. state & services
  • D. state & component

17) React Js is developed by

  • A. Google
  • B. Microsoft
  • C. Facebook
  • D. None of above

18) What are the limitations of ReactJS?

  • A. React is only for view layer of the app so we still need the help of other technologies to get a complete tooling set for development
  • B. React is using inline templating and JSX. This can seem awkward to some developers
  • C. The library of react is too large
  • D. All of these

19) How many stages are there in React js life cycle

  • A. 1
  • B. 2
  • C. 3
  • D. 0

20) In relation to React js component lifecycle, which statement is true

  • A. only function component can have life cycle
  • B. Only class components can have life cycle
  • C. Both type of components can have life cycle
  • D. None of above

21) In react, this is used to pass data to component from outside?

  • A. set state
  • B. render with argument
  • C. props
  • D. propTypes

22) Ref in react component is used to assign reference to DOM elements. Ref can be created by

  • A. Calling React.createRef method
  • B. Assigning a value to ref attribute in JSX
  • C. Both of above
  • D. None of above

23) Everything in react is __________

  • A. module
  • B. component
  • C. package
  • D. class

24) How many elements does a react component returns?

  • A. 1
  • B. 0
  • C. Multiple elements with one root element
  • D. None of the above

25) Which of the following is a correct definition of state in react?

  • A. A persistent storage
  • B. An internal data store (object) of component
  • C. Both
  • D. None

26) The state in react can be updated by call to setState method. These calls are

  • A. Synchronous in nature
  • B. Asynchronous in nature
  • C. Are asynchronous but can be made synchronous when required
  • D. None of above

27) Keys are given to a list of elements in react. These keys should be

  • A. Unique in the DOM
  • B. Unique among the siblings only
  • C. Do not requires to be unique
  • D. None of above

28) Regarding React js components, which of following statement is true?

  • A. function components can have state
  • B. function components are light weight
  • C. class components are light weight
  • D. class components are faster than function component

29) To update state in react forcefully, which method is used

  • A. setState
  • B. forceUpdate
  • C. Both of above
  • D. None of above

30) What will happen if you render an input element with disabled = {false}

  • A. It will be rendered as enabled
  • B. It will be rendered as disabled
  • C. It will not be rendered at all

React Js Online Test Questions (React Js FAQs)

1) What is a React js?

React JS is a JavaScript library used in web development to build interactive elements on websites. It helps the developers build user interfaces or UIs easily.

2) What is state in React?

State is a JavaScript object that stores a component's dynamic data and it enables a component to keep track of changes between renders. AS we know State is Dynamic so we can't use it for static React projects.

3) List different types of component in React js?

There are 7 types of React Components :

  • Functional Components
  • Class Components
  • Higher-Order Components
  • Dumb Components
  • Smart Components
  • Presentational Components
  • Container components

4) How many number of elements a valid react component can return?

A valid react component can return only one element.

5) What is the second argument for setstate() method in React?

The second argument to setState() is an optional callback function that will be executed once setState is completed and the component is re-rendered.

6) In which directory react components are saved?

React components are saved in "Inside js/components/".

7) What does the webpack command do?

The webpack command build's our application based on the configuration made available in the file.

8) What are the interactive properties in react?

9) What is NPX?

The npx stands for Node Package Execute, npx is a CLI tool whose purpose is to make it easy to install and manage dependencies hosted in the npm registry.

10) What are props in react js?

Props are arguments passed into React components. Props are passed to components via HTML attributes.

Leave A Comment :

Valid name is required.

Valid name is required.

Valid email id is required.

Related MCQ/Quiz

Drupal MCQ
Perl MCQ