Q.1
In React what is used to pass data to a component from outside?
  • setState
  • render with arguments
  • props
  • PropTypes
Q.2
What is the DOM?
  • Document Object Model
  • Data Object Model
  • Data Option Model
  • Documentation Object Model
Q.3
Which of the following API is a MUST for every ReactJS component?
  • getInitialState
  • render
  • renderComponent
  • None of the above
Q.4
What is a good use case for using a function while rendering a dynamic list of items
  • If we need to compute a value based on properties of items in the loop.
  • None. Functions should not be used while rendering a dynamic list.
  • To make the code shorter
  • None of the above
Q.5
Which method is not part of ReactDOM?
  • ReactDOM.destroy()
  • ReactDOM.hydrate()
  • ReactDOM.createPortal()
  • ReactDOM.findDOMNode()
Q.6
Which of the following is correct syntax for a button click event handler, foo?
  • <button onclick=this.foo()>
  • <button onclick=this.foo>
  • <button onClick={this.foo()}>
  • <button onClick={foo}>
Q.7
What is a controlled input element?
  • An input element with the controlled flag
  • An input element whose value is being controlled by a component’s state
  • An input element that can only accept a list of characters
  • An input element that is controlled by the value of another input element
Q.8
How do you write an inline style specifying the font-size:12px and color:red; in JSX
  • style={{font-size:12,color:'red'}}
  • style={{fontSize:'12px',color:'red'}}
  • style={fontSize:'12px',color:'red'}
  • style={{font-size:12px,color:'red'}}
Q.9
At the highest level, React components have lifecycle events that fall into
  • Initialization
  • State/Property Updates
  • Destruction
  • All of these
Q.10
What is the second argument for setState useful for?
  • To invoke code after the setState operation is done
  • To replace the state completely instead of the default merge action
  • To access the previous state before the setState operation
  • None of the above
Q.11
What happens when the following render() method executes?<br /><br /> render(){<br /> let langs = ["Ruby","ES6","Scala"]<br /> return (<div><br /> {langs.map(it => <p>{it}</p>)}<br /> </div>)<br /> }<br />
  • 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
Q.12
How many elements does a react component return?
  • 2 Elements
  • 1 Element
  • Multiple Elements
  • None of These
Q.13
What are the two ways that data gets handled in React?
  • state & props
  • services & components
Q.14
Everything in react is
  • Component
  • Model
  • Method
  • Package
Q.15
What function allows you to render React content in an HTML page?
  • React.mount()
  • ReactDOM.start()
  • ReactDOM.render()
  • React.render()
Q.16
What is JSX?
  • it is a syntax extension to JavaScript.
  • JSX produces data.
  • Tool to control the data
Q.17
What function can be used to update state?
  • setState()
  • updateState()
  • upState()
  • downState()
Q.18
Who Develop React.js?
  • Apple
  • Facebook
  • Twitter
  • Google
Q.19
When it is recommended to pass this.setState as a function instead of an object?
  • When the new state should completely replace the old state
  • When the new state depends on the old state
  • When the new state does not depend on the old state
  • None of the above
Q.20
Which of the following below act as the input of a class-based component?
  • class and factory
  • render and mount
  • props
0 h : 0 m : 1 s