W3 Docs React Basic Course Free Certification | W3 docs React Basic Quiz Answers 2022

Quiz React Basic

Start Quiz

Test your knowledge with W3docs’ basic quiz made especially for beginners in React JS. Pass the test and get a Certificate of achievement!

The Test

The test contains 20 questions and there is no time limit. The test is not official, it’s just a nice way to see how much you know about React JS.

Count Your Score

You will get 5% for each correct answer. At the end of the Quiz, your total score will be displayed out of 100% maximum score.

Apply Link

Enrich your knowledge

At the end of the quiz you can see all the questions with the right answers. There will also be notes about the answers which will lead you to the appropriate page on the platform to enrich your knowledge. Read our HTML tutorial if you are not sure that you are ready for the quiz.

Quiz Answers

React is mainly used for building _.

Database

Connectivity

User interface

Design Platform

Ans. User interface

The lifecycle methods are mainly used for _.

keeping track of event history

enhancing components

freeing up resources

none of the above

Ans. freeing up resources

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

Abstraction

Packing

Insulation

Wrapping

Ans. Wrapping

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

{fetch()}

${fetch()}

{fetch}

${fetch}

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

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

willComponentUpdate

shouldComponentUpdate

componentDidUpdate

componentDidMount

Ans shouldComponentUpdate

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

setState

render with arguments

PropTypes

props

Ans. Props

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

componentDidUpdate

componentDidMount

componentMounted

componentUpdated

Ans. componentDidMount

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

Ans. button onClick={this.foo}

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

Repetitive output appears on the screen

Duplicate key error

Stack overflow error

Nothing happens

Ans. Stack overflow error

What will happen if the following render() method executes?

render(){
let langs = [“Ruby”,”ES6″,”Scala”]
return ( {langs.map(it => {it})} )
}

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

Ans. Displays the list of languages in the array

How do you write an inline style which specifies 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’}}

Ans. style={{fontSize:’12px’,color:’red’}}

What advantages does ReactJS have?

Increases the application’s performance with Virtual DOM

JSX makes a code that is easy to read and write

It renders both on client and server side

Easy to integrate with other frameworks(Angular, BackboneJS) since it is only a view library

All of the above

Ans. All of the above

What is state in React?

A persistant storage.

An internal data store (object) of a component.

Ans. An internal data store (object) of a component.

What is ReactJS?

Server side Framework

User-interface framework

Library for building interaction interfaces

Ans. Library for building interaction interfaces

What are the two ways that data gets handled in React?

state & props

services & components

Ans. state & props

What disadvantages does ReactJS have?

It is only a view layer. You have to plug your code for Ajax requests, events and so on.

The library is pretty large.

The learning curve can be slow.

All of the above options

Ans. All of the above options

Choose the right answer about JSX.

JSX is faster as it performs optimization while compiling code to JavaScript

JSX is a syntax notation for JavaScript XML

JSX provides expressiveness of JavaScript along with HTML, like template syntax

All of the above options

Ans. All of the above options

React merges the object provided into the current state using _.

setState()

State()

Ans. setState()

The arbitrary inputs of components are called _.

Keys

Props

Elements

Ref

Ans. Props

Ref is used for referring an element or component returned by _.

react()

render()

reduce()

refer()

Ans. render()

error: Content is protected !!
Scroll to Top