React JS/React JS Mcq Question Set 1 Sample Test,Sample questions

Question:
 Does React.js create a VIRTUAL DOM in the memory?

1.TRUE

2.FALSE

3.Can be true or false

4.Cannot say


Question:
 In which condition is the React.js Lifecycle method static getDerivedSateFromProps(props, state) is called?

1. When the state of the component is updated

2.When a component is created for the first time

3.Both of the mentioned

4.None of the mentioned


Question:
 In which of the following condition, the React.js Lifecycle method static getDerivedSateFromProps(props, state) is called?

1.The component is created for the first time.

2.The state of the component is updated.

3.Both of the above.

4.None of the above.


Question:
 In which of the following directory React Components are saved?

1.Inside js/components/

2.Inside components/js/

3.Inside vendor/js/components/

4.Inside vendor/components/


Question:
 What does ES6 stand for?

1.ECMAScript 6

2.ECMA 6

3.ECMAJavaScript 6

4.EJavaScript 6


Question:
 What is React.js?

1.Open-source JavaScript back-end library

2.JavaScript front-end library to create a database

3.Free and open-source JavaScript front-end library

4.None of the mentioned


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

1.It is used to update a React app.

2.It is used to create a new React app.

3.It is used to install dependencies.

4.None of the above.


Question:
 Which of the following are the advantages of React.js?

1.React.js can increase the application's performance with Virtual DOM.

2.React.js is easy to integrate with other frameworks such as Angular, BackboneJS since it is only a view library.

3.React.js can render both on client and server side.

4.All of the above


Question:
 Which of the following keyword is used to create a class inheritance?

1.Create

2.Inherits

3.Extends

4.This


Question:
 Which of the following statement is true for uncontrolled components in React.js?

1.The source of truth is DOM.

2.The source of truth is a component state.

3.The source of truth can be anything.

4.none of the above


Question:
A class is a type of function, but instead of using the keyword function to initiate it, which keyword do we use?

1.Constructor

2.Class

3.Object

4.DataObject


Question:
How can you set a default value for an uncontrolled form field?

1.By using the value property

2.By using the defaultValue property

3.By using the default property

4.It is assigned automatically.


Question:
How many elements can a valid react component return?

1.React doesn’t return element

2.1 Element

3.More than 1 element

4.None of the mentioned


Question:
How many numbers of elements a valid react component can return?

1.1

2.2

3.4

4.5


Question:
How many ways of defining your variables in ES6?

1.1

2.3

3.4

4.5


Question:
In which of the following directory React.js components are saved?

1.Inside the js/components/

2.Inside the vendor/components/

3.Inside the external/components/

4.Inside the vendor/


Question:
React.js is written in which of the following language?

1.C

2.C++

3.JavaScript

4. Java


Question:
We can update the state in React.js by calling to setState() method. These calls are:

1.Synchronous in nature.

2.Asynchronous in nature.

3.Are asynchronous but can be made synchronous when required.

4.None of the above.


Question:
What are the two ways to handle data in React?

1.State & Props

2.Services & Components

3.State & Services

4.State & Component


Question:
What changes would appear in the component as soon as the state of the React component is changed?

1.It will do nothing; you have to call render method to render the component again.

2.It will re-render the component.

3.It can be created again from scratch.

4.None of the above.


Question:
What is a state in React?

1.A permanent storage.

2.Internal storage of the component.

3.External storage of the component.

4.None of the above.


Question:
What is the declarative way to render a dynamic list of components based on values in an array?

1.Using the reduce array method

2.Using the <Each /> component

3.Using the Array.map() method

4.With a for/while loop


Question:
What is the default port where webpack-server runs?

1.3000

2.8080

3.3030

4.6060


Question:
What is the use of "webpack" command in React.js?

1.The "webpack" command is used to transpile all the JavaScript down into one file.

2.It runs React local development server.

3.It is a module bundler.

4.None of the above.


Question:
What is true for the keys given to a list of elements in React?

1.Unique in the DOM.

2.Unique among the siblings only.

3.Do not require to be unique.

4.None of the above.


Question:
What of the following is used in React.js to increase performance?

1.Original DOM

2.Virtual DOM

3.Both A and B.

4.None of the above.


Question:
What will happen if you render an input element with disabled = {false}?

1.It will be rendered as disabled

2.It will not be rendered at all

3.It will be rendered as enabled

4.You cannot set it false.


Question:
Which of the following acts as the input of a class-based component?

1.Class

2.Props

3. Factory

4.None of the mentioned


Question:
Which of the following best defines the "key" prop?

1."Key" prop is used to look pretty, and there is no benefit whatsoever.

2."Key" prop is a way for React to identify a newly added item in a list and compare it during the "diffing" algorithm.

3.It is one of the attributes in HTML.

4.It is NOT commonly used in an array.


Question:
Which of the following command is used to Install create-react-app?

1.npm install create-react-app

2. npm install -f create-react-app

3.npm install -g create-react-app

4.install -g create-react-app


Question:
Which of the following function is called to render HTML to the web page in React?

1.render()

2.render()

3.ReactDOM_render()

4.render()


Question:
Which of the following function is used to change the state of the React.js component?

1.this.setState

2.this.setChangeState

3.this.State{}

4.None of the above.


Question:
Which of the following is a must API for every React.js component?

1.SetinitialComponent

2.renderComponent

3.render

4.All of the above


Question:
Which of the following is correct about prop in react?

1. Can be changed inside another component

2. Can be changed inside the component

3.Cannot be changed in the component

4.All of the Mentioned


Question:
Which of the following is method is not a part of ReactDOM?

1.ReactDOM.hydrate()

2. ReactDOM.destroy()

3. ReactDOM.createPortal()

4.All of the Mentioned


Question:
Which of the following is not a disadvantage of React.js?

1.React.js has only a view layer. We have put your code for Ajax requests, events and so on.

2.The library of React.js is pretty large.

3.The JSX in React.js makes code easy to read and write.

4.The learning curve can be steep in React.js.


Question:
Which of the following is the correct name of React.js?

1.React

2.React.js

3.ReactJS

4.All of the above


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

1.SetState

2.Render with arguments

3.Props

4.PropTypes


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

1.props

2.render with arguments

3.setState

4.PropTypes


Question:
Which of the following lifecycle events React components have at the highest level?

1.Destruction

2.Initialization

3.State/Property Updates

4.All of the above.


Question:
Which of the following method is not a part of ReactDOM?

1.ReactDOM.destroy()

2.ReactDOM.hydrate()

3.ReactDOM.createPortal()

4.ReactDOM.findDOMNode()


Question:
Which of the following method refers to the parent class in React.js?

1.inherits()

2.self()

3.super()

4.this()


Question:
Which of the following option is correct in the case of the Babel?

1.Babel is a Compiler.

2.Babel is a Transpilar.

3.None of the above.

4.Both A and B are correct.


Question:
Which of the following statement is true for controlled components in React.js?

1.The source of truth is DOM.

2.The source of truth can be anything.

3.The source of truth is a component state.

4.None of the above.


Question:
Why is the usage of setState?

1.Invoke code after the setState operation is done.

2.Replace the state completely instead of the default merge action.

3.Access the previous state before the setState operation.

4.None of the above.


More MCQS

  1. React JS Mcq Question Set 1
Search
Olete Team
Online Exam TestTop Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on Online Exam Testwebsite is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!