Aptitude Reasoning English GK Computer Knowledge Programming Skill Banking Software Testing



Question - 1

How many stages are there in React js life cycle

  • 1
  • 2
  • 3
  • 0
Solutions
Question - 2

Which of following is used to pass data to a component from outside?

  • PropTypes
  • setState
  • render with arguments
  • props
Solutions
Question - 3

How do you access a function getData() from a h1 element in JSX?

  • {getData()}
  • ${getData()}
  • {getData}
  • ${getData}
Solutions
Question - 4

What happens when the following render() method executes?
render(){
   let langs = ["PHP","ES6","JAVA"]
     return (<div>
       {langs.map(it => <p>{it}</p>)}
     </div>)
 }

  • Error. Cannot use direct JavaScript code in JSX
  • Error. Should be replaced with a for..loop for correct output
  • Displays the list of languages in the array
  • Displays nothing
Solutions
Question - 5

What function allows you to render React content in an HTML page?

  • React.mount()
  • ReactDOM.start()
  • ReactDOM.render()
  • React.render()
Solutions
Question - 6

Arbitrary inputs of components in React are called

  • Keys
  • Props
  • Elements
  • Ref
Solutions
Question - 7

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

  • this.state
  • this.values
  • this.getState()
  • this.prototype.stateValue
Solutions
Question - 8

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

  • ReactDOM.delete()
  • ReactDOM.destroy()
  • ReactDOM.unset()
  • None of the above
Solutions
Question - 9

Which of the following is the correct data flow sequence of flux concept?

  • Action->Dispatcher->View->Store
  • Action->Dispatcher->Store->View
  • Action->Store->Dispatcher->View
  • None of the above
Solutions
Question - 10

For controlled components in react

  • Source of truth is DOM
  • Source of truth can be anything
  • Source of truth is component state
  • None of the above
Solutions
Question - 11

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

  • Only function component can have life cycle
  • Only class components can have life cycle
  • Both type of components can have life cycle
  • None of above
Solutions
Question - 12

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.
Solutions
Question - 13

At the highest level, React components have lifecycle events that fall into

  • Destruction
  • Initialization
  • State/Property Updates
  • All the above
Solutions
Question - 14

Which method in a React Component should you override to stop the component from updating?

  • willComponentUpdate
  • shouldComponentUpdate
  • componentDidUpdate
  • componentDidMount
Solutions
Question - 15

What should the console read when the following code is run? const [, , animal] = ['Horse', 'Cow', 'Cat']; console.log(animal);

  • Horse
  • Cow
  • Cat
  • Error
Solutions
Question - 16

How do you handle passing through the component tree without having to pass props down manually at every level?

  • React Send
  • React Pinpoint
  • React Router
  • React Context
Solutions
Question - 17

What can you use to handle code splitting?

  • React.split
  • React.lazy
  • React.memo
  • React.fallback
Solutions
Question - 18

What is the children prop?

  • a property that lets you pass components as data to other components
  • a property that lets you pass data to child elements
  • a property that lets you set an array as a property
  • a property that adds child components to state
Solutions
Question - 19

When might you use React.PureComponent?

  • when you do not want your component to have state
  • when you have sibling components that need to be compared
  • when you want a default implementation of shouldComponentUpdate()
  • when you do not want your component to have props
Solutions
Question - 20

What is snapshot testing used for in react?

  • It allows us to test Javascript objects
  • It helps you write applications
  • It provides clear, enduring assertions
  • None of the above
Solutions
Tags:
React Js MCQ (Multiple Choice Questions), Advanced React Js MCQ, React Js MCQ Online test,React Js MCQ Questions and answers PDF, React Js Interview Questions With Answers, React Js Technical Questions with full explanation