Home Videos Exercises MCQ Q&A Quiz E-Store Services Blog Sign in Appointment Payment

React JS MCQ

Soopro Pathshala provides React JS MCQ(Multiple Choice Questions)


1. What is React.js?

a) Open-source JavaScript back-end library

b) JavaScript front-end library to create a database

c) Free and open-source JavaScript front-end library

d) None of the mentioned

View Answer

Answer: (c) Free and open-source JavaScript front-end library.



2. Who created React.js?

a) Jordan Mike

b) Jordan Walke

c) Tim Lee

d) Jordan Lee

View Answer

Answer: (b) Jordan Walke



3. In which language is React.js written?

a) Python

b) JavaScript

c) Java

d) PHP

View Answer

Answer: (b) JavaScript



4. What is the default port no of react?

a) 3000

b) 3306

c) 3030

d) 8080

View Answer

Answer: (a) 3000



5. Which of the following command is used to install create-react-app globally?

a) npm install create-react-app

b) npm install -f create-react-app

c) npm instal -g create-react-app

d) install -g create-react-app

View Answer

Answer: (c) npm install -g create-react-app



6. Which of the following is correct about props in react?

a) can be changed inside another component

b) can be changed inside the component

c) cannot be changed in the component

d) all of the mentioned

View Answer

Answer: (c) cannot be changed in the component



7. Which of the following is used to pass data to a component from outside in React?

a) props

b) render with arguments

c) setState

d) PropTypes

View Answer

Answer: (a) props



8. What is the use of the create-react-app command in the React.js application?

a) It is used to update a React app

b) It is used to create a new React app

c) It is used to install dependencies

d) none of the above

View Answer

Answer: (b) It is used to create a new React app



9. What does ES6 stand for?

a) ECMAScript 6

b) ECMA 6

c) ECMAJavaScript 6

d) EJavaScript 6

View Answer

Answer: (a) ECMAScript 6



10. What is the correct name of React.js?

a) React

b) React.js

c) ReactJS

d) All of the above

View Answer

Answer: (d) all of the above



11. Which advantage does JSX in React.js provide?

a) Enables server-side rendering.

b) Reduces the size of the React.js library.

c) Simplifies code readability and writing.

d) Automatically handles state management.

View Answer

Answer: (c) Simplifies code readability and writing.



12. What serves as input for class-based components in React?

a) Class

b) Factory

c) Render

d) Props

View Answer

Answer: (d) Props



13. In MVC what does react.js act as?

a) Model

b) Controller

c) View

d) Middleware

View Answer

Answer: (c) View



14. Using which of the following command can prevent default behaviour at in react?

a) preventDefault()

b) avoidDefault()

c) revokeDefault()

d) none of the above

View Answer

Answer: (a) preventDefault()



15. Which is ReactJs mainly used for building?

a) Database

b) Connectivity

c) UserInterface

d) Design platform

View Answer

Answer: (c) UserInterface



16. Which of the following is used to change the state of react component?

a) this.setState()

b) this.state()

c) this.setChangeState()

d) None of the above

View Answer

Answer: (a) this.setState()



17. Among the following which is used to create a class inheritance?

a) Inherits

b) Extends

c) Create

d) this

View Answer

Answer: (b) Extends



18. Total ways of defining variables in ES6 is?

a) 1

b) 2

c) 3

d) 4

View Answer

Answer: (c) 3



19. Which of the following are two ways to handle data in react?

a) state and props

b) services and components

c) state and services

d) state and components

View Answer

Answer: (a) state and props



20. Choose the method with refers to the parent class in react

a) this()

b) super()

c) inherits()

d) self()

View Answer

Answer: (b) super()



21. JSX stands for____

a) Javascript XML

b) Json XML

c) JSON

d) Javascript and AngularJs

View Answer

Answer: (a) Javascript XML



22. When was React.js initially released?

a) May 29, 2013

b) April 29, 2013

c) June 29, 2013

d) May 29, 2014

View Answer

Answer: (a) May 29, 2013



23. What is the virtual DOM in React.js used for?

a) Handling user authentication

b) Creating database queries

c) Improving performance by minimizing DOM manipulation

d) Styling React components

View Answer

Answer: (c) Improving performance by minimizing DOM manipulation



24. How to write comments in React?

a) Use single-line comments//

b) Use multi-line comments/* */

c) Use JSX comments {/ */}

d) All of the above

View Answer

Answer: (d) all of the above



25. Babel is a:

a) Compiler

b) Transpiler

c) Both a and b are correct

d) none of the above

View Answer

Answer: (c) both a and b are correct



26. What is the render() method in a React Component?

a) A method that returns a React element

b) A method that returns a DOM node

c) A method that updates the state of a component

d) none of the above

View Answer

Answer: (a) A method that returns a react element



27. What is the smallest building block of ReactJS?

a) Props

b) Elements

c) Components

d) none of the above

View Answer

Answer: (b) Elements



28. What is the function used to change the state of the React.js component?

a) this.setState

b) this.setChangeState

c) this.State{}

d) none of the above

View Answer

Answer: (a) this.setState



29. What are the two primary ways to manage data in React?

a) State & props

b) Services & Components

c) State & Services

d) State & Component

View Answer

Answer: (a) State & props



30. In react, the key should be?

a) Unique among his siblings only

b) unique in the DOM

c) Does not require to be unique

d) all of the above

View Answer

Answer: (a) Unique among his siblings only



31. React is a ____

a) Javascript framework

b) Javascript library

c) both a and b

d) none of the above

View Answer

Answer: (b) javascript library



32. Choose the library which is most often associated with react?

a) Sinon

b) Chai

c) Jest

d) Mocha

View Answer

Answer: (c) Jest



33. What is used to handle code-splitting?

a) React.lazy

b) React.memo

c) React.fallback

d) React.split

View Answer

Answer: (a) React.lazy



34. What is the purpose of React state?

a) To store static data

b) To store styles

c) To store dynamic data

d) To store function

View Answer

Answer: (c) To store dynamic data



35. What is the use of React hooks?

a) To manage state and side effects in functional components

b)To manage styles in functional components

c) To manage state and side effects in class components

d) To manage styles in class components

View Answer

Answer: (a) To manage state and side effects in functional component



36. What is the purpose of useEffect hook in React?

a) To add event listeners

b) To perform side effects

c) To render components

d) To manage state

View Answer

Answer: (b) To perform side effects



37. What is React Component?

a) Html document

b) A html elment

c) a css stylesheet

d) a javascript function

View Answer

Answer: (d) a javascript function



38. What is the difference between state and props in React?

a) Props are mutable, state is immutable

b) Both state and props are mutable

c) Both state and props are immutable

d) State is mutable, props are immutable

View Answer

Answer: (d) State is mutable, props are immutable



39. What is the purpose of React Router?

a) To handle routing in React applications

b) To handle styling in React applications

c) To handle state management in React applications

d) To handle data fetching in React applications

View Answer

Answer: (a) To handle routing in React applications



40. What is the purpose of Redux in React?

a) To manage component state in React applications

b) To manage component styles in React applications

c) To manage component events in React applications

d) To manage global state in React applications

View Answer

Answer: (d) To manage global state in React applications