ReactJS Fiverr Test

In relation to stateful React components, which of the following statements is correct?
i) React triggers the event handlers in the bubble phase, by default.
ii) For event handlers, CamelCase naming convention is used by React.
iii) React actually attaches event handlers to the DOM nodes themselves.

Only statements i) and ii) are correct.
Only statement ii) is correct.
Both statements i) and iii) are correct.
All statements i), ii) and iii) are correct.

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

In a web application, a single React component should represent multiple user interface elements.
Multiple React components should be composed into a single React component.
Both options i) and ii) are correct.
Neither option i) nor ii) is correct.

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?

Ctrl+Tab
Tab
Shift+Ctrl
Shift+Tab

Which of the following statements is/are correct about ReactJS?
i) It is mandatory to use JSX in React development.
ii) One-way data flow is implemented by React.

Only statement i) is correct.
Only statement ii) is correct.
Both statements i) and ii) are correct.
Neither statement i) nor ii) is correct.

Which of the following statements are correct about Flux?
i) The application parts are coupled.
ii) Maintenance of the application is easy.

Only option i).
Only option ii).
Both options i) and ii).
Neither option i) nor ii).

In relation to ReactJS Flux function, how many and which of the following parameters are passed to the reducer function?

Only one parameter is passed and that is state.
Two parameters are passed and that are state and action.
Only one parameter is passed and that is action.
Two parameters are passed and that are state and ReactElement.
Three parameters are passed and that are state, ReactElement and action.

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

require()
bundle()
React.DOM.ul()
render()

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

All options i), ii), iii) and iv).
Only options i), ii) and iii).
Only options ii), iii) and iv).
Only options i), ii) and iv).

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

React.Fragment
React.Children
React.Components
React.PureComponent

Which of the following options is the correct signature of React createPortal() method?

ReactDOM.createPortal(element, child, container)
ReactDOM.createPortal(container, component)
ReactDOM.createPortal(child, container)
ReactDOM.createPortal(container)

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?

Shallow Renderer
Test Renderer
React
None of the above.

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

The data flow is uni-directional.
The data flow is bi-directional.
None of the above.

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

Stream
StreamTweet
Collection
None of the above.

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

npm install react-redux
npm install react-redux -save
npm install --save react-redux
npm install --save –redux for react

In ReactJS, which of the following options is used for storing the read-only data that is passed from a parent, and that data belongs to the parent and cannot be changed by its children?

this.props
this.state
None of the above.

Which of the following options can be a type of the React parameter, type?

string
ReactClass
boolean
integer

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

It can be used for extracting the component's output.
It requires DOM.
It can only render a single level deep.
Both statements a and c are incorrect.
Both statements b and c are incorrect.

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

select
it
render
bundle

Which of the following is a React framework for creating animations?

React Addons
Redux
React Motion
React Fire

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

ReactDOM.render(ReactElement, ReactText, DOMElement, callback); ReactDOM.render(ReactText, DOMElement, callback);
ReactDOM.render(ReactElement, DOMElement, callback);
ReactDOM.render(ReactElement, Reacttext, callback);

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?

collectionTweets
state
SyntheticEvent
this.props

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

npm install --dev babel-jest
npm install --save-g babel-jest
npm install --g babel-jest
npm install --save-dev babel-jest

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.)

C:\Users\username\Desktop\reactApp>index.html
C:\Users\username\Desktop\reactApp>create index.html
C:\Users\username\Desktop\reactApp>touch index.html
C:\Users\username\Desktop\reactApp>createElement index.html

Consider the current state as following:
{
    isHidden: true,
    title: 'React new Example'
}
Suppose the this.setState(nextState) method is called and the current state is updated to the following:

{
    isHidden: false
}
Which of the following is the correct way in which React will merge these two states?

 {
    isHidden: false
}

 {
isHidden: true,
title: ' '
}

{
isHidden: true,
title: 'React new Example'
}

{
isHidden: false,
title: 'React new Example'
}

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

div
key
ref
span

Which of the following statements is NOT correct about the ReactDOM.render() method?

It is used for controlling the contents of the container node that the user passes in.
It is used for modifying the container node.
It can be used for returning a reference to the root ReactComponent instance.

While using React, keys help in the identification of which of the following options?
i) New added items.
ii) Removed items.
iii) Updated items.
iv) Total number of items.

Only options i) and iv).
Only options i), ii) and iv).
Only options i), ii) and iii).
All options i), ii), iii) and iv).

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

componentDidUpdate()
componentwillUpdate()
render()
shouldComponentUpdate()

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

    {numbers.map((NList) =>
       <ListItem.numbers.key=number.toString()
               value={number} />
     )}    

{numbers.map((number) =>
       <ListItem key={number.toString()}
               value={number} />
     )}    

{numbers.NList.map=>
       <ListItem key=number.toString() >
               value={number};
     )}    

{
      numbers.map=>
       <NList key={number.toString()}
               numbers.value={number} />
     )}

Which of the following methods is first invoked in the component lifecycle's updating phase and is called when a component receives new properties from its parent component?

shouldComponentUpdate()
componentWillUpdate()
componentWillReceiveProps()
render()

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

[]
{}
()
It does require the use of any kind of brackets.

In relation to ReactJS Flux, which of the following options is used for specifying the changes that are triggered in an application?

Actions
Reducers
Root Component
Store

This question is based on the graphic shown below.
Choose the correct output of below given React program from the options given in the image.
function Blog(props) {

  const sbar = (
   <ul>
     {props.posts.map((post) =>
       <li key={post.id}>
        {post.title}
       </li>
     )}
   </ul>
  );

  const content = props.posts.map((post) =>
   <div key={post.id}>
     <h3>{post.title}</h3>
     <p>{post.content}</p>
   </div>
  );
  return (
   <div>
     {sbar}
     <hr />
     {content}
   </div>
  );
}

const posts = [
  {id: 1, title: 'Learning React!', content: 'This is a React Example'},
];

ReactDOM.render(
  <Blog posts={posts} />,
  document.getElementById('root')
);

i)
ii)
iii)
iv)

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-defined component, such as a class?

isCompositeComponent()
isElementOfType()
isCompositeComponentWithType()
mockComponent()

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?

name
value
type
None of the above.

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

npm install react-addons-css-transition-group
npm install react-save-css-transition-group
npm install react --save-addons-css-transition-group
npm install react--addons.css.transition.group

Which of the following React classes can implement: shouldComponentUpdate()?

React.Component
React.PureComponent
Both options i) and ii).
Neither option i) nor ii).

In relation to React Forms, which of the following attributes is used by the <textarea> element for defining its text?

selected
name
value
It does not use any attribute but use its children elements, instead.

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

True
False

In relation to React test utilities, which of the following is the correct syntax of Simulate utility?

 eventName. Simulate (
  element, tree
  [eventData]
)

Simulate.{eventName}(
  element,
  [eventData]
)

eventName. Simulate (
  element, eventData
)

Simulate.{eventName}(
  element, eventData, tree
)

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

this.props
this.setState
this.state
this.handleClick

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

C:\Users\username\Desktop>create reactApp
C:\Users\username\Desktop>mkdir reactApp
C:\Users\username\Desktop>create dir reactApp
C:\Users\username\Desktop>reactApp mkdir

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

testInstance.type
testRenderer.root
testRenderer.update()
testRenderer.toJSON()

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

import new ShallowRenderer using 'react-test-renderer/shallow';
import ShallowRenderer = require('react-test-renderer/shallow');
import ShallowRenderer from 'react-test-renderer/shallow';
var ShallowRenderer =require( 'react-test-renderer/shallow');

Which of the following is a correct module provided by the Deque System, that is used for reporting the accessibility findings directly to the console while developing and debugging?

react-axe
NonVisual Desktop Access
aXe
WebAIM
Deque

Which of the following is the correct signature of React testRenderer.update method that is used for re-rendering the in-memory tree with a new root element?

testRenderer.update(element, options)
testRenderer.update(type, element)
testRenderer.update(element)
testRenderer.update(element, type, options)

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

jest testname.js
npm test testname.js
npm jest test testname.js
jest test testname.js

While using React, which of the following commands is used for creating a new project?

npm install -a create-react-app
create-react-app example-app

npm install -g create-react-app
create new react-app example-app

npm install -g create-react-app
create-react-app example-app

npm install -a create-react-app
create new app example-app

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

describe
select
require
it

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

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

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

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

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

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

nextProps
nextState
this.handleNewTweet
prevProps

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

With a state.
Without a state.
Both options a and b.
Neither option a nor b.

Which of the following methods is skipped on a component that triggered the update when the forceUpdate() method is called?

componentDidUpdate()
shouldComponentUpdate()
componentwillUpdate()
componentWillReceiveProps()
None of the above.

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

 handleChange(event) {
  this.setState({value:event.target.value.toUpperCase()});

} event.handleChange{
  this.setState({value= event.target.value.toUpperCase()});

} handleChange.event {
  this.setState({value:target.value.toUpperCase()});

} handleChange{
  event.setState({value: this.target.value.toUpperCase()});
}

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

test
type
props
All of the above.

In relation to React renderIntoDocument() function, which of the following options should be present globally before importing React?
i) window

ii) window.document
iii) window.document.createElement

Only option i).
Only options i) and ii).
Only options ii) and iii).
All options i), ii) and iii).

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

 {
  " react-app extends": ["plugin:jsx-a11y/recommended"],
  "plugins": ["jsx-a11y", "aXe-core"]
}

{
  extends: ["react-app", "plugin:jsx-a11y/recommended"],
  plugins: ["aXe-core"]
}

 {
  "extends": ["react-app", "plugin:jsx-a11y/recommended"],
  "plugins": ["jsx-a11y", "aXe-core"]
}

 {
  "extends": ["react-app", "plugin:jsx-a11y/recommended"],
  "plugins": ["jsx-a11y"]
}

In relation to React test utilities, which of the following options is used for finding all DOM elements of components in the rendered tree that have DOM components with the matching tag name?

scryRenderedDOMComponentsWithTag()
findRenderedDOMComponentWithTag()
findRenderedComponentWithType()
scryRenderedComponentsWithType()

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

AngularJS
NodeJs
Java
Perl

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

const exampleItems = examples.map((example) =>
    <li key={example.id}>
        {example.text}
    </li>
);

const exampleItems = examples.map((example, index) =>
  <li key={index}>
   {example.text}
  </li>
);

const exampleItems = examples.map((example, index) =>
  <li key={index. example.text}
  </li>
);

Either option b or c can be used.

In ReactJS, which of the following statements is correct about props parameter?

It is a JavaScript object that is passed from a parent element to a child element but not the other way around.
It is a JavaScript object that is passed from a child element to a parent element but not the other way around.
It is a JavaScript object that is either passed from a parent element to a child element or from a child element to a parent element.
It is used for creating a ReactClass.

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

testRenderer.toTree()
testRenderer.update()
testRenderer.root
testRenderer.toJSON()

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

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

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

It can be used on client and server side and also with other frameworks.
It supports better readability that helps in maintaining larger applications.
It covers the view and controller layers of an application.
It uses virtual DOM, which helps in improving the performance of the applications.

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?

state and select function
state and action
Only action
Only select function

In the below given code snippet, which of the following functions should be placed in place of "???" so that the values of numbers array are doubled?
const numbers= [2, 4, 6, 8, 10];

const increased = ???((numbers) => number * 2);
console.log(increased);

numbers.map
updateState
numbers.transform
updateState.map.numbers

ReactJS Test Fiverr 2020