Question 1. 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'}}
Explanation:-
Answer: Option C. -> style={fontSize:'12px',color:'red'}
Question 2. Which of the following API is a MUST for every ReactJS component?
getInitialState
render
renderComponent
None of the above
Explanation:-
Answer: Option B. -> render
Question 3. Which of the following is correct syntax for a button click event handler, foo?
Explanation:-
Answer: Option B. -> render
Question 4. At the highest level, React components have lifecycle events that fall into
Initialization
State/Property Updates
Destruction
All of these
Explanation:-
Answer: Option D. -> All of these
Question 5. How many elements does a react component return?
2 Elements
1 Element
Multiple Elements
None of These
Explanation:-
Answer: Option B. -> 1 Element
Question 6. 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
Explanation:-
Answer: Option A. -> If we need to compute a value based on properties of items in the loop.
Question 7. What happens when the following render() method executes?<br /><br /> render(){<br /> let langs = ["Ruby","ES6","Scala"]<br /> return (<div><br /> {langs
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
Explanation:-
Answer: Option A. -> Displays the list of languages in the array
Question 8. What is a controlled input element?
An input element with the controlled flag
An input element that is controlled by the value of another input element
An input element that can only accept a list of characters
An input element whose value is being controlled by a component’s state
Explanation:-
Answer: Option D. -> An input element whose value is being controlled by a component’s state
Question 9. 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
Explanation:-
Answer: Option A. -> To invoke code after the setState operation is done