MCQs > IT & Programming > React.js MCQs > Basic React.js MCQs

Basic React.js MCQ

1. What pattern is being used in this code? const { tree, lake } = nature;

Answer

Correct Answer: Destructuring assignment

Note: This Question is unanswered, help us to find answer for this one

2. Why might you use a React.ref?

Answer

Correct Answer: To directly access the DOM node

Note: This Question is unanswered, help us to find answer for this one

3. Which language can you not use with React?

Answer

Correct Answer: Swift.

Note: This Question is unanswered, help us to find answer for this one

4. When using the React Developer Tools Chrome extension, what does it mean if the React icon is red?

Answer

Correct Answer: You are using the development build of React.

Note: This Question is unanswered, help us to find answer for this one

5. What might you use webpack for?

Answer

Correct Answer: To split your app into smaller chunks that can be more easily loaded by the browser

Note: This Question is unanswered, help us to find answer for this one

6. When does the componentDidMount function fire?

Answer

Correct Answer: Right after the component is added to the DOM

Note: This Question is unanswered, help us to find answer for this one

7. You want to disable a button so that it does not emit any events onClick. Which prop do you use to acomplish this?

Answer

Correct Answer: Disabled

Note: This Question is unanswered, help us to find answer for this one

8. What syntax do you use to create a component in React?

Answer

Correct Answer: A function or a class

Note: This Question is unanswered, help us to find answer for this one

9. How might you check property types without using Flow or TypeScript?

Answer

Correct Answer: Use prop-types.

Note: This Question is unanswered, help us to find answer for this one

10. What is the JavaScript syntax extension that is commonly used to create React elements?

Answer

Correct Answer: JSX

Note: This Question is unanswered, help us to find answer for this one

11. Which tool is not part of Create React App?

Answer

Correct Answer: JQuery

Note: This Question is unanswered, help us to find answer for this one

12. What is the browser extension called that React developers use to debug applications?

Answer

Correct Answer: React Developer Tools

Note: This Question is unanswered, help us to find answer for this one

13. What command can you use to generate a React project?

Answer

Correct Answer: Create-react-app

Note: This Question is unanswered, help us to find answer for this one

14. React is an open-source project but is maintained by which company?

Answer

Correct Answer: Facebook

Note: This Question is unanswered, help us to find answer for this one

15. What is the process of deciding whether an update is necessary?

Answer

Correct Answer: Reconciliation

Note: This Question is unanswered, help us to find answer for this one

16. How would you generate the boilerplate code for a new app that you are building to collect underpants?

Answer

Correct Answer: Npx create-react-app collect-underpants

Note: This Question is unanswered, help us to find answer for this one

17. You are rendering a list with React when this warning appears in the console: "Warning: Each child in a list should have a unique 'key' prop." How do you fix this issue?

Answer

Correct Answer: When iterating over the list items, add a unique property to each list item.

Note: This Question is unanswered, help us to find answer for this one

18. What is the first file loaded by the browser in a basic React project?

Answer

Correct Answer: Public/index.html

Note: This Question is unanswered, help us to find answer for this one

19. What is this pattern called? const [count, setCount] = useState(0);

Answer

Correct Answer: Array destructuring

Note: This Question is unanswered, help us to find answer for this one

20. When using a portal, what is the second argument?ReactDOM.createPortal(x, y);

Answer

Correct Answer: The DOM element that exists outside of the parent component

Note: This Question is unanswered, help us to find answer for this one

21. Describe what is happening in this code? const { name: firstName } = person;

Answer

Correct Answer: It is assigning the value of the person object's name property to a constant called firstName.

Note: This Question is unanswered, help us to find answer for this one

22. What is setCount? const [count, setCount] = useState(0);

Answer

Correct Answer: A function to update the state

Note: This Question is unanswered, help us to find answer for this one

23. When using a portal, what is the first argument? ReactDOM.createPortal(x, y);

Answer

Correct Answer: The element to render

Note: This Question is unanswered, help us to find answer for this one

24. What is the first argument, x, that is sent to the createElement function?React.createElement(x, y, z);

Answer

Correct Answer: The element that should be created

Note: This Question is unanswered, help us to find answer for this one

26. Consider the following component. What is the default color for the star? const Star = ({ selected = false }) => ;

Answer

Correct Answer: Grey

Note: This Question is unanswered, help us to find answer for this one

27. Which function is used to update state variables in a React class component?

Answer

Correct Answer: SetState

Note: This Question is unanswered, help us to find answer for this one

28. Per the following code, when is the Hello component displayed? const greeting = isLoggedIn ? : null;

Answer

Correct Answer: When isLoggedIn is true

Note: This Question is unanswered, help us to find answer for this one

29. Which choice will not cause a React component to rerender?

Answer

Correct Answer: One of the component's siblings rerenders

Note: This Question is unanswered, help us to find answer for this one

30. Which library does the fetch() function come from?

Answer

Correct Answer: No library. fetch() is supported by most browsers.

Note: This Question is unanswered, help us to find answer for this one

31. Which answer best describes a function component?

Answer

Correct Answer: A function component accepts a single props object and returns a React element.

Note: This Question is unanswered, help us to find answer for this one

32. Currently, handleClick is being called instead of passed as a reference. How do you fix this?

Answer

Correct Answer:

Note: This Question is unanswered, help us to find answer for this one

33. What can you use to wrap Component imports in order to load them lazily?

Answer

Correct Answer: React.lazy

Note: This Question is unanswered, help us to find answer for this one

34. Q42. Which Hook could be used to update the document's title?

Answer

Correct Answer: UseEffect(function updateTitle() { document.title = name + ' ' + lastname; });

Note: This Question is unanswered, help us to find answer for this one

35. How do you set a default value for an uncontrolled form field?

Answer

Correct Answer: Use the defaultValue property.

Note: This Question is unanswered, help us to find answer for this one

36. What package contains the render() function that renders a React element tree to the DOM?

Answer

Correct Answer: ReactDOM

Note: This Question is unanswered, help us to find answer for this one

37. Why is it a good idea to pass a function to setState instead of an object?

Answer

Correct Answer: SetState is asynchronous and might result in out of sync values.

Note: This Question is unanswered, help us to find answer for this one

38. What is sent to an Array.map() function?

Answer

Correct Answer: A callback function that is called once for each element in the array

Note: This Question is unanswered, help us to find answer for this one

39. All React components must act like _ with respect to their props.

Answer

Correct Answer: Pure functions

Note: This Question is unanswered, help us to find answer for this one

40. React components are composed to create a user interface. How are components composed?

Answer

Correct Answer: By nesting components

Note: This Question is unanswered, help us to find answer for this one

41. In which lifecycle method do you make requests for data in a class component?

Answer

Correct Answer: ComponentDidMount

Note: This Question is unanswered, help us to find answer for this one

42. What do you call a React component that catches JavaScript errors anywhere in the child component tree?

Answer

Correct Answer: Error boundaries

Note: This Question is unanswered, help us to find answer for this one

43. To create a constant in JavaScript, which keyword do you use?

Answer

Correct Answer: Const

Note: This Question is unanswered, help us to find answer for this one

44. A representation of a user interface that is kept in memory and is synced with the "real" DOM is called what?

Answer

Correct Answer: Virtual DOM

Note: This Question is unanswered, help us to find answer for this one

45. When using webpack, why would you need to use a loader?

Answer

Correct Answer: To preprocess files

Note: This Question is unanswered, help us to find answer for this one

46. Which of these terms commonly describe React applications?

Answer

Correct Answer: Declarative

Note: This Question is unanswered, help us to find answer for this one

47. Which attribute do you use to replace innerHTML in the browser DOM?

Answer

Correct Answer: DangerouslySetInnerHTML

Note: This Question is unanswered, help us to find answer for this one

48. What is the children prop?

Answer

Correct Answer: A property that lets you pass components as data to other components

Note: This Question is unanswered, help us to find answer for this one

49. Why is it important to avoid copying the values of props into a component's state where possible?

Answer

Correct Answer: Because you want to allow a component to update in response to changes in the props

Note: This Question is unanswered, help us to find answer for this one

50. When might you use React.PureComponent?

Answer

Correct Answer: When you want a default implementation of shouldComponentUpdate()

Note: This Question is unanswered, help us to find answer for this one

51. When do you use useLayoutEffect?

Answer

Correct Answer: When you need the browser to paint before the effect runs

Note: This Question is unanswered, help us to find answer for this one

52. What can you use to handle code splitting?

Answer

Correct Answer: React.lazy

Note: This Question is unanswered, help us to find answer for this one

53. Consider the following code from React Router. What do you call :id in the path prop?

Answer

Correct Answer: This is a route parameter

Note: This Question is unanswered, help us to find answer for this one

54. Which props from the props object is available to the component with the following syntax?

Answer

Correct Answer: All of them

Note: This Question is unanswered, help us to find answer for this one

55. Why might you use useReducer over useState in a React component?

Answer

Correct Answer: When you need to manage more complex state in an app

Note: This Question is unanswered, help us to find answer for this one

56. What is the name of the tool used to take JSX and turn it into createElement calls?

Answer

Correct Answer: Babel

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: React Context

Note: This Question is unanswered, help us to find answer for this one

58. What is the testing library most often associated with React?

Answer

Correct Answer: Jest

Note: This Question is unanswered, help us to find answer for this one

59. If a function component should always render the same way given the same props, what is a simple performance optimization available for it?

Answer

Correct Answer: Wrap it in the React.memo higher-order component.

Note: This Question is unanswered, help us to find answer for this one

60. If you want to import just the Component from the React library, what syntax do you use?

Answer

Correct Answer: Import { Component } from 'react'

Note: This Question is unanswered, help us to find answer for this one

61. Can you render children components outside of a parent component?

Answer

Correct Answer: Yes

Note: This Question is unanswered, help us to find answer for this one

62. How can you bind a function to a component instance? (Check all that apply.)

Answer

Correct Answer: By Using .bind(this) in constructor.
By Declaring function as a class property.

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

63. How you can provide an initial value for uncontrolled input?

Answer

Correct Answer: With "defaultValue" attribute.

Note: This Question is unanswered, help us to find answer for this one

64. _____ function is used for attaching event listeners on markup rendered by ReactDOMServer.

Answer

Correct Answer: ReactDOM.hydrate

Note: This Question is unanswered, help us to find answer for this one

65. Can you access refs at a wrapped component in higher-order component technique?

Answer

Correct Answer: Yes

Note: This Question is unanswered, help us to find answer for this one

66. Which of following is true about componentWillReceiveProps and getDerivedStateFromProps? (Check all that apply.)

Answer

Correct Answer: getDerivedStateFromProps is called before the first render while componentWillReceiveProps don't.
You must call this.setState in componentWillReceiveProps in order to update component state.

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

67. What programming concept React use for DOM manipulation and updating?

Answer

Correct Answer: Virtual DOM

Note: This Question is unanswered, help us to find answer for this one

68. Can you return multiple elements from a single component?

Answer

Correct Answer: Yes, but you must use React Fragment.

Note: This Question is unanswered, help us to find answer for this one

69. How can you stop event propagation in React? (Check all that apply.)

Answer

Correct Answer: With stopPropagation function.
With preventDefault function.

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

70. What happens when an error is not caught by error boundary?

Answer

Correct Answer: Whole React component tree gets unmounted.

Note: This Question is unanswered, help us to find answer for this one

71. What is the name of a pseudo-global variable that determines whether the environment is development or production?

Answer

Correct Answer: __DEV__

Note: This Question is unanswered, help us to find answer for this one

72. What is a recommended way of sharing data between multiple components? (Check all that apply.)

Answer

Correct Answer: Using Context.
Using flux architecture.

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

73. What is a purpose of shallow rendering in React?

Answer

Correct Answer: For unit testing.

Note: This Question is unanswered, help us to find answer for this one

74. What is the difference between renderToString and renderToStaticMarkup ReactDOMServer's functions?

Answer

Correct Answer: renderToString creates extra DOM attributes while renderToStaticMarkup don't.

Note: This Question is unanswered, help us to find answer for this one

75. ____ is flux architecture component that receives actions and broadcast payloads to registered callbacks.

Answer

Correct Answer: Dispatcher

Note: This Question is unanswered, help us to find answer for this one

76. Which of the following are valid properties of the React Router's Route component? (Check all that apply.)

Answer

Correct Answer: component
path
render

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

77. Jest and Enzyme are suggested libraries for what purpose?

Answer

Correct Answer: Testing

Note: This Question is unanswered, help us to find answer for this one

78. How can type checking in React be done? (Check all that apply.)

Answer

Correct Answer: Using static type checkers like Flow and TypeScript.
Using PropTypes.

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

79. When should you use React.PureComponent?

Answer

Correct Answer: If your React component’s render() function renders the same result given the same props and state.

Note: This Question is unanswered, help us to find answer for this one

80. Which function is invoked just before render() during component update?

Answer

Correct Answer: shouldcomponentUpdate()

Note: This Question is unanswered, help us to find answer for this one

81. Which of the following is true about keys in React?

Answer

Correct Answer: All of the above

Note: This Question is unanswered, help us to find answer for this one

82. Static object allows the defining of static methods and also means that these methods do not have access to or ?

Answer

Correct Answer: Props, state

Note: This Question is unanswered, help us to find answer for this one

83. What is the difference between props and state?

Answer

Correct Answer: State is similar to props, but it is private and fully controlled by the component.

Note: This Question is unanswered, help us to find answer for this one

84. Which of the following is true about React Library?Which of the following is true about React Library? (choose all that apply)

Answer

Correct Answer: Updates DOM-tree
Reacts on events

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

85.

Can a single component render multiple nodes?

Answer

Correct Answer: Only if all children are wrapped with some node

Note: This Question is unanswered, help us to find answer for this one

86.

How can SyntheticEvent be stopped?

Answer

Correct Answer: Fire stopPropagation on event object
Fire preventDefaults on event object

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

87.

The defaultValue and defaultChecked props are only used during initial __?

Answer

Correct Answer: render

Note: This Question is unanswered, help us to find answer for this one

88.

What will be removed by JSX from the string inside node? 

Answer

Correct Answer: New lines in the middle of a string

Note: This Question is unanswered, help us to find answer for this one

89.

Which value will render nothing? (Check all that apply)

Answer

Correct Answer: null
false
undefined

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

90.

Is it possible to create ReactJS components without JSX? 

Answer

Correct Answer: Yes

Note: This Question is unanswered, help us to find answer for this one

91.

Which of the following is a correct JSX code? 

Answer

Correct Answer: <button onClick={activate}>Activate</button>

Note: This Question is unanswered, help us to find answer for this one

92.

Which of the following are valid properties of the input node in ReactJS? 

Answer

Correct Answer: All of the above

Note: This Question is unanswered, help us to find answer for this one

93.

What is true about forceUpdate method in component? 

Answer

Correct Answer: It will re-render component skipping shouldComponentUpdate event

Note: This Question is unanswered, help us to find answer for this one

94.

What is true about context inside a component? 

Answer

Correct Answer: nextContext can be accessed at shouldComponentUpdate

Note: This Question is unanswered, help us to find answer for this one

95.

What is the correct value of the children proptype? propTypes: { children: React.PropTypes.string.isRequired } 

Answer

Correct Answer: 'test1'

Note: This Question is unanswered, help us to find answer for this one

96.

Which of the following is the correct data flow in a flux application? 

Answer

Correct Answer: Action->Dispatcher->Store->View

Note: This Question is unanswered, help us to find answer for this one

97.

What can be stored in the Stores while building with flux architecture? 

Answer

Correct Answer: Application state and logic

Note: This Question is unanswered, help us to find answer for this one

98.

Which statement is valid for ReactDOM.findDOMNode() function? 

Answer

Correct Answer: It returns the corresponding native browser DOM element

Note: This Question is unanswered, help us to find answer for this one

99.

What values can be passed as children of a ReactJs component? 

Answer

Correct Answer: All of the above

Note: This Question is unanswered, help us to find answer for this one

100.

Which function is invoked just before render() during initial rendering? 

Answer

Correct Answer: componentWillMount()

Note: This Question is unanswered, help us to find answer for this one

101.

What would happen if the state is updated in componentWillMount? 

Answer

Correct Answer: State can't be updated in this method

Note: This Question is unanswered, help us to find answer for this one

102.

Which of the following will not allow an event to be accessed? 

Answer

Correct Answer: Asynchronous

Note: This Question is unanswered, help us to find answer for this one

103.

Which of the following properties are available for a wheel event? (Check all that apply)

Answer

Correct Answer: deltaMode
deltaX

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

104.

Which of the following are valid component life cycle events? (Check all that apply)

Answer

Correct Answer: componentWillUnmount
componentWillUpdate

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

105.

Which of the following is a valid Composition Event? 

Answer

Correct Answer: onCompositionUpdate

Note: This Question is unanswered, help us to find answer for this one

106.

Which of the following functions belong to ReactDOM? (Check all that apply)

Answer

Correct Answer: render()
findDOMNode()

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

107.

What are component methods? (choose all that apply)

Answer

Correct Answer: replaceState(newState)
setState(changes)
forceUpdate():

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

108.

In controlled components, which is the correct way to select multiple values using the select drop-down?

Answer

Correct Answer: <select defaultValue={["lahore", "london"]} multiple={true}> <option value="lahore">welcome lahore!</option> <option value="london">welcome london!</option> <option value="toronto">welcome toronto</option> </select>

Note: This Question is unanswered, help us to find answer for this one

109.

Which following method is used for updating the state of the component?

Answer

Correct Answer: setState()

Note: This Question is unanswered, help us to find answer for this one

110.

What are the Animation Events? (choose all that follow)

Answer

Correct Answer: onAnimationStart
onAnimationEnd
onAnimationIteration

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

111.

Which of the following code examples is correct for State object usage?

Answer

Correct Answer: this.setState(function(previousState, currentProps) { return {counter: previousState.counter + 1}; });

Note: This Question is unanswered, help us to find answer for this one

112.

What are the Component properties? (choose all that apply)

Answer

Correct Answer: this.isMounted
this.props
this.state

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

113.

The lifecycle methods can be grouped into the following categories?

Answer

Correct Answer: unmounting
updating
mounting

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

114.

What are the Composition Events? (choose all that apply)

Answer

Correct Answer: onCompositionUpdate
onCompositionStart
onCompositionEnd

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

115.

The state of the application is stored in the _____, from where the data then flows to the views?

Answer

Correct Answer: stores

Note: This Question is unanswered, help us to find answer for this one

116.

How can you set the state of a component, retrieve that state, create properties when initializing the component? I'm learning ReactJs! {this.props.name}

Answer

Correct Answer: var stateComp = React.createClass({ propTypes : { name : React.PropTypes.string }, getDefaultProps : function(){ return { name : "Mike" } }, getInitialState : function(){ return { value : 1 } }, render : function(){ return (

{this.state.value}
) } });

Note: This Question is unanswered, help us to find answer for this one

117.

In Redux a store has the following responsibilities? (choose all that apply)

Answer

Correct Answer: Makes possible to unregister listeners by calling the function returned
Registers new listeners with subscribe(listener)
Holding application state

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

118.

Lifecycle methods will receive context and SETSTATE() TRIGGERS AN UPDATE as follows? (choose all that apply)

Answer

Correct Answer: shouldComponentUpdate
componentWillReceiveProps

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

119.

Referencing context in lifecycle methods, the following lifecycle methods will receive an additional parameter in the context object? (check all that apply)

Answer

Correct Answer: componentWillReceiveProps(nextProps, nextContext)
shouldComponentUpdate(prevProps, prevState, prevContext)

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

120.

Which of the following code syntax is True in createClass?

class MyComponent extends React.Component { render () { return
; }
var MyComponent = React.createClass({ render: function () { return
; } });
var MyComponent = React.createClass( render () { return
; } }
class MyComponent extends React.Component ({ render: function () { return
; } });
Answer

Correct Answer: var MyComponent = React.createClass({ render: function () { return

; } });

Note: This Question is unanswered, help us to find answer for this one

121.

Which of the following are basic principles of Redux? (choose all that apply)

Answer

Correct Answer: Changes are made with pure function
State is read-only

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

122.

Which of the following types can be the ReactNode?

Answer

Correct Answer: Array of React Nodes, Plain Object, Array of Strings
ReactElement, String, number

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

123.

Which validator is used to check if property value is a number?

Answer

Correct Answer: React.PropTypes.number

Note: This Question is unanswered, help us to find answer for this one

124.

What is incorrect with the following component? class MyComponent extends React.Component { render() { return ( This is a component ); } }

Answer

Correct Answer: react render

Note: This Question is unanswered, help us to find answer for this one

125.

How many nodes should render() method return?

Answer

Correct Answer: 1

Note: This Question is unanswered, help us to find answer for this one

126.

Which of the following correctly explains the term "mounting"?

Answer

Correct Answer: A component is being inserted into the DOM.

Note: This Question is unanswered, help us to find answer for this one

127.

Do you need to add key property on ReactJs elements?

Answer

Correct Answer: Keys must be provided for list elements so ReactJs will know which element changed when state or props changes

Note: This Question is unanswered, help us to find answer for this one

128.

How to set ReactJS global configuration?

Answer

Correct Answer: ReactJs does not provide global configuration

Note: This Question is unanswered, help us to find answer for this one

129.

Which of the following is correct transformation of the following JSX syntax code?

Answer

Correct Answer: None of the above

Note: This Question is unanswered, help us to find answer for this one

130.

Which of the following is true about componentDidMount method?

Answer

Correct Answer: It's invoked immediately after a component is mounted.

Note: This Question is unanswered, help us to find answer for this one

131.

ReactJS is developed by _____?

Answer

Correct Answer: Facebook

Note: This Question is unanswered, help us to find answer for this one

132.

How write comments in JSX code?

Answer

Correct Answer: {/*your comment*/}

Note: This Question is unanswered, help us to find answer for this one

133.

Which of the following is/are not a valid component event?

Answer

Correct Answer: ondblclick
onblink

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

134.

Which is correct function to render ReactJs component at server side as static html page?

Answer

Correct Answer: ReactDOMServer.renderToStaticMarkup

Note: This Question is unanswered, help us to find answer for this one

135.

What visual design guidelines must be used to build web UIs with ReactJs?

Answer

Correct Answer: None

Note: This Question is unanswered, help us to find answer for this one

136.

Which of the following are mounting methods?

Answer

Correct Answer: componentWillMount, componentDidMount, render

Note: This Question is unanswered, help us to find answer for this one

137.

What does acronym JSX mean?

Answer

Correct Answer: JavaScript XML

Note: This Question is unanswered, help us to find answer for this one

138.

Can you use ReactJs with AngularJs on same web application?

Answer

Correct Answer: Yes

Note: This Question is unanswered, help us to find answer for this one

139.

Will and if yes, when and how immutable data will make big ReactJs application faster?

Answer

Correct Answer: For complicated data structure immutable data provides faster comparison

Note: This Question is unanswered, help us to find answer for this one

140.

What is default css display value for ReactJs web application?

Answer

Correct Answer: browser dependent

Note: This Question is unanswered, help us to find answer for this one

141.

Which statement about ReactJs is incorrect?

Answer

Correct Answer: ReactJs alone can be used to write native applications for Android and iOS

Note: This Question is unanswered, help us to find answer for this one

142.

How set custom html inside ReactJs component?

Answer

Correct Answer: div dangerouslySetInnerHTML={{__html: 'Some custom html'}} />

Note: This Question is unanswered, help us to find answer for this one

143.

Can you use ReactJs with NodeJS?

Answer

Correct Answer: Yes, you can render ReactJs application on NodeJs server and deliver it to browser

Note: This Question is unanswered, help us to find answer for this one

144.

Which of the following is the primary mental data flow in Flux?

Answer

Correct Answer: action -> dispatcher -> store -> view

Note: This Question is unanswered, help us to find answer for this one

145.

PropTypes is used for ___ ?

Answer

Correct Answer: typechecking

Note: This Question is unanswered, help us to find answer for this one

146.

Can you use ReactJs without flux?

Answer

Correct Answer: Yes

Note: This Question is unanswered, help us to find answer for this one

147.

Which of the following methods can be used to define any default props which can be accessed via this.props?

Answer

Correct Answer: getDefaultProps

Note: This Question is unanswered, help us to find answer for this one

148.

Which of the following is true about Flux Dispatcher?

Answer

Correct Answer: The dispatcher is used to broadcast payloads to registered callbacks.

Note: This Question is unanswered, help us to find answer for this one

149.

Which JSX syntax is incorrect?

Answer

Correct Answer: Buttons.Fab />

Note: This Question is unanswered, help us to find answer for this one

150.

Which of the following is the correct way to create links for the react component?

Answer

Correct Answer: a href={'https://www.facebook.com/'}>Link1

Note: This Question is unanswered, help us to find answer for this one

151.

How to use comments in React JSX?

Answer

Correct Answer: {/* */}

Note: This Question is unanswered, help us to find answer for this one

152.

When use mixins?

Answer

Correct Answer: Mixins are same as interval functions, just it clears interval when component is destroyed after unmount

Note: This Question is unanswered, help us to find answer for this one

153.

React ____ only render subcomponents.

Answer

Correct Answer: libraries

Note: This Question is unanswered, help us to find answer for this one

154.

Which statement about propTypes is incorrect?

Answer

Correct Answer: It provides easier checking of production code

Note: This Question is unanswered, help us to find answer for this one

155.

How can you create ReactJs component?

Answer

Correct Answer: JS functions, ES6 classes extending React.Component or React.createClass function

Note: This Question is unanswered, help us to find answer for this one

156.

Which of the following are Flux Elements?

Answer

Correct Answer: All of the above

Note: This Question is unanswered, help us to find answer for this one

157.

What is wrong with the following code? MyComponent.propTypes = { name: React.PropTypes.string } MyComponent.defaultProps = { name: 'My name' }

Answer

Correct Answer: default value is not necessary

Note: This Question is unanswered, help us to find answer for this one

158.

Which of the following is not a flux element?

Answer

Correct Answer: Model

Note: This Question is unanswered, help us to find answer for this one

159.

What is the role of actions in Redux?

Answer

Correct Answer: Actions are payloads of information that send data from your application to your store.

Note: This Question is unanswered, help us to find answer for this one

160.

Which of the following attributes is used to set the default value of an input field?

Answer

Correct Answer: Both of the above

Note: This Question is unanswered, help us to find answer for this one

161.

ReactJS renders HTML tags if the element is defined in __

Answer

Correct Answer: Lowercase

Note: This Question is unanswered, help us to find answer for this one

162.

What does the following code do? componentDidMount () { this.context.router.replace('login')) }

Answer

Correct Answer: redirect router directory

Note: This Question is unanswered, help us to find answer for this one

163.

By default ReactTransitionGroup renders as a ___?

Answer

Correct Answer: span

Note: This Question is unanswered, help us to find answer for this one

164.

Which of the following mounting methods is/are invoked before the component is inserted into DOM?

Answer

Correct Answer: getInitialState, componentWillMount

Note: This Question is unanswered, help us to find answer for this one

165.

Change or update to large number of nodes is optimized using which of the following techniques?

Answer

Correct Answer: Both of the above

Note: This Question is unanswered, help us to find answer for this one

166.

Which of the following is used to pass the data from parent to child?

Answer

Correct Answer: Props

Note: This Question is unanswered, help us to find answer for this one

167.

What is Jest?

Answer

Correct Answer: Javascript Unit testing framework for React applications.

Note: This Question is unanswered, help us to find answer for this one

168.

Which statement about ReacJs is correct?

Answer

Correct Answer: With ReactJs you can write HTML in JS with JSX

Note: This Question is unanswered, help us to find answer for this one

169.

What does ReactJs provide?

Answer

Correct Answer: Sync between DOM and data

Note: This Question is unanswered, help us to find answer for this one

170.

Which of the following are correct React PropTypes? Check all that apply.

Answer

Correct Answer: symbol
node
array

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

171.

Why do you need dispatcher in flux?

Answer

Correct Answer: To register store's callbacks

Note: This Question is unanswered, help us to find answer for this one

172.

What will the following code do?

Answer

Correct Answer: LogoutContainer

Note: This Question is unanswered, help us to find answer for this one

173.

Pre and post lifecycle methods of components are represented using ___

Answer

Correct Answer: Will, Did

Note: This Question is unanswered, help us to find answer for this one

174.

How transform JSX code in browser?

Answer

Correct Answer: Standard Babel and react preset

Note: This Question is unanswered, help us to find answer for this one

175.

To use native javascript as an attribute value, the expression should be wrapped within

Answer

Correct Answer: curly-braces

Note: This Question is unanswered, help us to find answer for this one

176.

What kind of application architecture is widely used together with ReactJs?

Answer

Correct Answer: Flux

Note: This Question is unanswered, help us to find answer for this one

177.

What is needed to write ReactJs application with ES6 classes and have cross-browser support?

Answer

Correct Answer: Babel with react and es2015 presets

Note: This Question is unanswered, help us to find answer for this one

178.

What will happen if parent component will fire render function?

Answer

Correct Answer: Child components will fire shouldComponentUpdate

Note: This Question is unanswered, help us to find answer for this one

179.

Which of the following methods enables to set the initial state value, that is accessible inside the component via this.state?

Answer

Correct Answer: getInitialState

Note: This Question is unanswered, help us to find answer for this one

180.

Which of the following method is called after getInitialState method?

Answer

Correct Answer: render

Note: This Question is unanswered, help us to find answer for this one

181.

Which function is invoked immediately before the initial rendering occurs?

Answer

Correct Answer: componentWillMount()

Note: This Question is unanswered, help us to find answer for this one

182.

Which of the following Lifecycle Methods does React include?

Answer

Correct Answer: ComponentWillMount
ShouldComponentUpdate

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

183.

What will happen to the state if you click the

constructor() { super(); this.state = { status: 'no status' }; } handleClick() { this.setState({status: 'I am fine!'}); } render() { return (
click me
); } }

Answer

Correct Answer: updates the status state to 'I am fine'

Note: This Question is unanswered, help us to find answer for this one

184.

Which is true for ReactJS components defined as pure JS functions?

Answer

Correct Answer: It's possible to set defaultProps for pure function component

Note: This Question is unanswered, help us to find answer for this one

185.

Which of the following methods initiates custom state for the component?

Answer

Correct Answer: getInitialState

Note: This Question is unanswered, help us to find answer for this one

186.

Which of the following methods change the state of the component?

Answer

Correct Answer: Both of the above

Note: This Question is unanswered, help us to find answer for this one

187.

Which of the following is used for trigger a UI render update?

Answer

Correct Answer: State

Note: This Question is unanswered, help us to find answer for this one

188.

Which of the following is used to trigger a UI update?

Answer

Correct Answer: props

Note: This Question is unanswered, help us to find answer for this one

189.

What is the first place to start optimizing speed of ReactJs application?

Answer

Correct Answer: Use component events to reduce render function calls

Note: This Question is unanswered, help us to find answer for this one

190.

Which event is best used to update state after props were changed?

Answer

Correct Answer: componentWillReceiveProps

Note: This Question is unanswered, help us to find answer for this one

191.

____ function is invoked immediately before updating occurs?

Answer

Correct Answer: componentWillUpdate()

Note: This Question is unanswered, help us to find answer for this one

192.

To disable animations, you can add _____?

Answer

Correct Answer: transitionEnter={false}
transitionLeave={false}

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

193.

What will happen if this code is present in ReactJs component written as ES6 class: shouldComponentUpdate(nextProps, nextState) { return false; }

Answer

Correct Answer: Component will not render any changes

Note: This Question is unanswered, help us to find answer for this one

194. Which of the following commands can be used for running Jest?

Answer

Correct Answer: jest testname.js
npm test testname.js

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

195. Which of the following statements are correct about def‌ining the CSS rules inside a React component?

Answer

Correct Answer: By making styles inline allows a user to limit the scope that is affected.
It provides f‌lexibility.

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

196. Which of the following are the correct parameters used by the setState() function that is used for informing the React of a state change?

Answer

Correct Answer: data
ReactText

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

197. In relation to testing Reducers, which of the following functions are used by Jest for setting up tests?

Answer

Correct Answer: describe
It

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

198. In relation to the React cloneElement() method, which of the following options from the original element are preserved during cloning?

Answer

Correct Answer: key
ref

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

199. In ReactJS, which of the following options is/are used for passing data to a render() function using the React API?

Answer

Correct Answer: this.props
this.state

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

200. In relation to React Test Renderer, which of the following options are used for returning an object that represents the rendered tree?

Answer

Correct Answer: testRenderer.toTree()
testRenderer.toJSON()

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

201. Which of the following options are the child components of the React StreamTweet component?

Answer

Correct Answer: Header
Tweet

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

202. Which of the following Options can be a type of the React parameter, type?

Answer

Correct Answer: string
ReactClass

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

203. In relation to test if an entire website can be reached and used with the keyboard only. which of the following keys should be used for browsing?

Answer

Correct Answer: Tab
Shift+Tab

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

204. Which Of the following statements is correct about React f‌indDOMNode() method?

Answer

Correct Answer: This method is used for reading values out of the DOM.
It can only be used on the mounted components.

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

205. Which of the following arguments are passed to the componentWillUpdate() method that is called immediately before React updates the DOM?

Answer

Correct Answer: nextProps
nextState

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

206. Which of the following options is the correct default value of shouldComponentUpdate() method invoked in the component lifecycle's updating phase?

Answer

Correct Answer: true

Note: This Question is unanswered, help us to find answer for this one

207. In relation to React ES6, which of the following options is used for importing Shallow Renderer?

Answer

Correct Answer: import ShallowRenderer from 'react-test-renderer/shallow';

Note: This Question is unanswered, help us to find answer for this one

208.

In relation to ReacUS, which of the following content should be added to the .eslintrc f‌ile which is created in the root of the project for enabling more accessibility rules?


Answer

Correct Answer:

{

"extends": ["react—app", "plugin:jsx—aily/recommended'].

"plugins": ["jsx—a11y"]

L



Note: This Question is unanswered, help us to find answer for this one

209. While setting ReactJS. which of the following commands is used for creating a root folder named reactApp and placing it on desktop?

Answer

Correct Answer: C:\Users\username\Desktop>mkdir reactApp

Note: This Question is unanswered, help us to find answer for this one

210. Which of the following functions is used for importing the React library?

Answer

Correct Answer: require()

Note: This Question is unanswered, help us to find answer for this one

211. While setting up the ReactJS environment, which of the following options must be installed?

Answer

Correct Answer: Nodejs

Note: This Question is unanswered, help us to find answer for this one

212.

After installing Jest CLI. the below given script object of packagejson file are edited. It should be replaced with which of the following options?


Answer

Correct Answer:

"scripts":[

"test": "jest"

}



Note: This Question is unanswered, help us to find answer for this one

213.

In ReactJS, which of the following key syntaxes should be used if you do not have stable IDs for rendered items?


Answer

Correct Answer:

const exampleItems = examples.map((example, index) =>

  <li key={index}>

   {example.text}

  </li>

); 



Note: This Question is unanswered, help us to find answer for this one

214. What happens if the rendero is called again when the React element was previously rendered into container?

Answer

Correct Answer: It will perform an update on it and will only mutate the DOM as necessary for ref‌lecting the latest React element.

Note: This Question is unanswered, help us to find answer for this one

215.

Which of the following code snippets should be there in place of "???" in the below given program so that the following output is printed on the console?

Program

function ListItem(props) {

  return <li>{props.value}</li>;

}

function NList(props) {

  const numbers = props.numbers;

  return (

   <ul>

???

   </ul>

  );

}

const numbers = [8, 6, 4, 2, 1];

ReactDOM.render(

  <NList numbers={numbers} />,

  document.getElementById('root')

);

Output

•  8

•  6

•  4

•  2

•  1


Answer

Correct Answer:

{numbers.map((number) =>

    <ListItem key={number.toString()}

            value={number} />

  )} 


Note: This Question is unanswered, help us to find answer for this one

216.

Consider the given render method which is required to return the content enclosed inside parentheses.

render: function0{


return (


<div> Render me here </div>

);

}

In relation to the given information, which of the following statements is/ are true?

1. If JSX starts on the same line as the return. then parentheses are not needed.

2. Without the parentheses, JavaScript will ignore the given lines and return without a value.


Answer

Correct Answer:

Both statements 1 and 2


Note: This Question is unanswered, help us to find answer for this one

217.

Select True or False.

If the order of items may change in React then the use of indexes should be used for keys.


Answer

Correct Answer:

False 


Note: This Question is unanswered, help us to find answer for this one

218. Which of the following statements is/are correct about the React method, createFactory()?

Answer

Correct Answer: It returns a function that is used for producing React elements of a given type.

Note: This Question is unanswered, help us to find answer for this one

219. Which of the following is a correct module provided by the Deque System. that is used for reporting the accessibility f‌indings directly to the console while developing and debugging?

Answer

Correct Answer: react-axe

Note: This Question is unanswered, help us to find answer for this one

220. In relation to testing Reducers, which of the following is the correct command for installing babel-jest package?

Answer

Correct Answer: npm install --save-dev babel-jest

Note: This Question is unanswered, help us to find answer for this one

221. Which of the following commands is run for creating an ESLint conf‌iguration?

Answer

Correct Answer: eslint --init

Note: This Question is unanswered, help us to find answer for this one

222. In relation to ReactJS Flux, which of the following properties is used by JavaScript Objects Actions for informing about the data that should be sent to the store?

Answer

Correct Answer: type

Note: This Question is unanswered, help us to find answer for this one

223. In relation to React Test Renderer, which of the following options is NOT a TestRenderer instance?

Answer

Correct Answer: testInstance.type

Note: This Question is unanswered, help us to find answer for this one

224.

Which of the following statements are correct about Flux?

i) The application parts are coupled.

ii) Maintenance of the application is easy.


Answer

Correct Answer:

Only option ii). 


Note: This Question is unanswered, help us to find answer for this one

225. Which of the following statements is/are NOT correct about shallowRenderer.render() method in ReactJS?

Answer

Correct Answer: It requires DOM.

Note: This Question is unanswered, help us to find answer for this one

226.

Which of the given render methods is correctly written?


Answer

Correct Answer:

render(){

return (<div>

[this.renderThis()]

[this.renderThat0]

</div>);

return [

<li key="List1">List1<lli>,

<li key="List2">List 2</li>,

<|i key="List3">List 3<l|i>.


];




Note: This Question is unanswered, help us to find answer for this one

227. Which of the following is NOT a correct advantage of ReactJS?

Answer

Correct Answer: It covers the view and controller layers of an application.

Note: This Question is unanswered, help us to find answer for this one

228. From the given Options, choose the correct guideline(s) that should be followed while planning a React application.

Answer

Correct Answer: Multiple React components should be composed into a single React component.

Note: This Question is unanswered, help us to find answer for this one

229. Which of the following components is used by react for rendering multiple elements without a wrapper?

Answer

Correct Answer: React.Fragment

Note: This Question is unanswered, help us to find answer for this one

230. In relation to Flux programming concept. which of the following statements is correct about the data?

Answer

Correct Answer: The data flow is uni-directional.

Note: This Question is unanswered, help us to find answer for this one

231. Which of the following types of brackets are used for including collections of elements in JSX?

Answer

Correct Answer: {}

Note: This Question is unanswered, help us to find answer for this one

232.

Which of the following commands are used for installing React and React DOM? (Consider reactApp as the root folder.)


Answer

Correct Answer:

C:\Users\username\Desktop\reactApp>npm install react --save

C:\Users\username\Desktop\reactApp>npm install react-dom --save 



Note: This Question is unanswered, help us to find answer for this one

233. In relation to React Test Renderer, which of the following arguments is/are passed to testInstance.find ()?

Answer

Correct Answer: Test

Note: This Question is unanswered, help us to find answer for this one

234. Which of the following React methods is used for verifying that the children has a single child (a React element) only and returning it?

Answer

Correct Answer: React.Children.only(children)

Note: This Question is unanswered, help us to find answer for this one

235. Which of the following options is the correct signature of the React.Children.map method?

Answer

Correct Answer: React.Children.map(object, children, function[(thisArg)])

Note: This Question is unanswered, help us to find answer for this one

236.

Which of the following options is the correct syntax for creating a new folder named Dispatcher in a project's ”/snapterest/ source/exampleDispatch directory?


Answer

Correct Answer:

var Dispatcher = require('f‌iux‘).Dispatchen

module.exports = new Dispatchero;   



Note: This Question is unanswered, help us to find answer for this one

237.

Which of the following is the correct syntax for creating a ReactElement of type h1 having the properties object and a ReactText as its only child?


Answer

Correct Answer:

[


render: function 0{


return React.createElement('h1'. [ className: ‘header' ], ‘React

Component‘);


I




Note: This Question is unanswered, help us to find answer for this one

238.

Which of the following is the correct syntax of React function that will enforce that names are written with all uppercase letters?


Answer

Correct Answer:

handleChange(event)[

this.setState({valuezeventtarget.value.toUpperCase0));



Note: This Question is unanswered, help us to find answer for this one

239. Which of the following options is the correct syntax for installing Redux via command prompt?

Answer

Correct Answer: npm install --save react-redux

Note: This Question is unanswered, help us to find answer for this one

240. Which of the following is the correct syntax for adding a file named index.html via command prompt to your React environment? (Consider that reactApp is the root folder.)

Answer

Correct Answer: C:\Users\username\Desktop\reactApp>touch index.html

Note: This Question is unanswered, help us to find answer for this one

241. Which of the following options is the correct syntax for installing React CSS Transitions Group?

Answer

Correct Answer: npm install react-addons-css-transition-group

Note: This Question is unanswered, help us to find answer for this one

242. While testing Reducers, which of the following commands is used for installing Jest and the Jest CLI globally?

Answer

Correct Answer: sudo npm install —g jest

Note: This Question is unanswered, help us to find answer for this one

243. Which of the following Options is used by the StreamTweet component for incrementing the number of displayed tweets in the global object?

Answer

Correct Answer: componentDidUpdate()

Note: This Question is unanswered, help us to find answer for this one

244. Which of the following options is the correct Jest function that is used for each test?

Answer

Correct Answer: It

Note: This Question is unanswered, help us to find answer for this one

245. Which of the following options is the correct signature of React createPortaI() method?

Answer

Correct Answer: ReactDOM.createPortaI(child, container)

Note: This Question is unanswered, help us to find answer for this one

246.

While validating React component properties. a custom validator function is used for validating the tweet property. Which of the following parameters are passed to this function?

i) properties


ii) propertyName


iii) media


iv) componentName


Answer

Correct Answer:

Only options i), ii) and iv). 


Note: This Question is unanswered, help us to find answer for this one

247. Which of the following Lifecycle methods of ReactJS Component is/are used to clear up the memory Space?

Answer

Correct Answer: componentWillUpdate()

Note: This Question is unanswered, help us to find answer for this one

248. In relation to React Flux, which of the following arguments is/are passed to the connect function which is used to connect the root component to the store?

Answer

Correct Answer: Only select function

Note: This Question is unanswered, help us to find answer for this one

249. Which of the following packages is used for providing a React renderer that is used for rendering React components to pure JavaScript objects, without depending on the DOM or a native mobile environment?

Answer

Correct Answer: Test Renderer

Note: This Question is unanswered, help us to find answer for this one

250. A browser's native events are wrapped into which of the following objects by React for ensuring that all the supported events behave identically in Internet Explorer 8 and higher versions?

Answer

Correct Answer: SynthetiCEvent

Note: This Question is unanswered, help us to find answer for this one

251. Which of the following is the correct syntax of the ReactDOM.render() method that is used for rendering React elements?

Answer

Correct Answer: ReactDOM.render(ReactElement. DOMElement. callback);

Note: This Question is unanswered, help us to find answer for this one

252. Which of the following React components is responsible for displaying the collection controls and a list of tweets?

Answer

Correct Answer: Collection

Note: This Question is unanswered, help us to find answer for this one

253. Choose the correct type(s) of React component(s).

Answer

Correct Answer: Both options a and b.

Note: This Question is unanswered, help us to find answer for this one

254.

Choose True or False

In relation to React Flux, only the root component should be aware of a redux.


Answer

Correct Answer:

True 


Note: This Question is unanswered, help us to find answer for this one

255. In relation to react test utilities, which of the following options is used for checking the user supplied instance and returning true if instance is a user-def‌ined component. such as a class?

Answer

Correct Answer: isCompositeComponent()

Note: This Question is unanswered, help us to find answer for this one

256. In relation to React Forms. which of the following attributes is used by the