ReactJS Quiz Set - 4

Last Updated :
Discuss
Comments

Question 1

React is mainly used for building ___.

  • A

    Database

  • B

    Connectivity

  • C

    User interface

  • D

    Design Platform

Question 2

The lifecycle methods are mainly used for ___.

  • A

    keeping track of event history

  • B

    enhancing components

  • C

    freeing up resources

  • D

    none of the above

Question 3

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

  • A

    Abstraction

  • B

    Packing

  • C

    Insulation

  • D

    Wrapping

Question 4

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

  • A

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

  • B

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

  • C

    <h1>{fetch}</h1>

  • D

    <h1>${fetch}</h1>

Question 5

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

  • A

    willComponentUpdate

  • B

    shouldComponentUpdate

  • C

    componentDidUpdate

  • D

    componentDidMount

Question 6

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

  • A

    setState

  • B

    render with arguments

     

  • C

    PropTypes

  • D

    props

Question 7

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

  • A

    componentDidUpdate

  • B

    componentDidMount

  • C

    componentMounted
     

  • D

    componentUpdated

Question 8

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

  • A

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


     

  • B

    <button onclick={this.foo}>

  • C

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

  • D

    <button onClick={this.foo}>

Question 9

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

  • A

    Repetitive output appears on the screen

     

  • B

    Duplicate key error

  • C


    Stack overflow error

  • D

    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>
}

  • A

    Displays the list of languages in the array

  • B

    Error. Cannot use direct JavaScript code in JSX

     

  • C

    Displays nothing

  • D

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

There are 15 questions to complete.

Take a part in the ongoing discussion