• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

ReactJS Quiz Set - 4

Question 1

React is mainly used for building ___.

  • Database

  • Connectivity

  • User interface

  • Design Platform

Question 2

The lifecycle methods are mainly used for ___.

  • keeping track of event history

  • enhancing components

  • freeing up resources

  • none of the above

Question 3

___ can be done while multiple elements need to be returned from a component

  • Abstraction

  • Packing

  • Insulation

  • Wrapping

Question 4

Which is the right way of accessing a function fetch() from an h1 element in JSX?

  • <h1>{fetch()}</h1>

  • <h1>${fetch()}</h1>

  • <h1>{fetch}</h1>

  • <h1>${fetch}</h1>

Question 5

Which of the following methods in a React Component should be overridden to stop the component from updating?

  • willComponentUpdate

  • shouldComponentUpdate

  • componentDidUpdate

  • componentDidMount

Question 6

What is used to pass data to a component from outside?

  • setState

  • render with arguments

     

  • PropTypes

  • props

Question 7

Which of the following methods in a React Component is called after the component is rendered for the first time?

  • componentDidUpdate

  • componentDidMount

  • componentMounted
     

  • componentUpdated

Question 8

Which of the following is the correct syntax for a button click event handler foo?

  • <button onclick={this.foo()}>


     

  • <button onclick={this.foo}>

  • <button onClick={this.foo()}>

  • <button onClick={this.foo}>

Question 9

What will happen if you call setState() inside render() method?

  • Repetitive output appears on the screen

     

  • Duplicate key error


  • Stack overflow error

  • Nothing happens

Question 10

What will happen if the following render() method executes?
render(){
let langs = ["Ruby","ES6","Scala"]
return <div>{langs.map(it => <p>{it}</p>)}</div>
}

  • Displays the list of languages in the array

  • Error. Cannot use direct JavaScript code in JSX

     

  • Displays nothing

  • Error. Should be replaced with a for..loop for correct output

There are 15 questions to complete.

Last Updated :
Take a part in the ongoing discussion