Olete.in
Articles
Mock Tests
🧪 Ext JS MCQ Quiz Hub
React JS MCQ
Choose a topic to test your knowledge and improve your Ext JS skills
1. In React what is used to pass data to a component from outside?
setState
render with arguments
props
Types
2. In which directory React Components are saved?
Inside js/components/
Inside vendor/components/
Inside external/components/
Inside vendor/
3. At the highest level, React components have lifecycle events that fall into
Initialization
State/Property Updates
Destruction
All of these
4. How many elements does a react component return?
Elements
1 Element
Multiple Elements
None of These
5. 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'}}
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
7. 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
8. 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}>
9. Which method is not part of ReactDOM?
ReactDOM.destroy()
ReactDOM.hydrate()
ReactDOM.createPortal()
ReactDOM.findDOMNode()
10. Which of the following API is a MUST for every ReactJS component?
getInitialState
render
renderComponent
None of the above
11. 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
12. 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
13. 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
14. What are the two ways that data gets handled in React?
state &amp; props
services &amp; components
Both A and B
None of These
15. Everything in react is
Package
Model
Method
Component
16. What function allows you to render React content in an HTML page?
React.mount()
ReactDOM.start()
ReactDOM.render()
React.render()
17. What is JSX?
it is a syntax extension to JavaScript.
JSX produces data.
Tool to control the data
None of the above
18. What function can be used to update state?
setState()
updateState()
upState()
downState()
19. Who Develop React.js?
Apple
Facebook
Twitter
Google
20. 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
21. Which of the following below act as the input of a class-based component?
class and factory
render and mount
props
none of the above
22. What is state in React?
A persistant storage.
An internal data store (object) of a component.
both (a) and (b)
None of the above
23. Life cycle methods of a components fall under following categories?
Mounting, Unmounting
Mounting, Updating
Mounting, Updating, Unmounting
All of the above
24. One can define default values for properties, props, using which of the following method?
getDefaultProps
getPropsValue
getInitialState
None of these
25. What is the DOM?
Document Object Model
Data Object Model
Data Option Model
Documentation Object Model
26. Variabel default React JS
Props
Statefull
Stateless
State
27. There are two types of components in React JS
UseState, Stateless
Statefull, Stateless
Unstatefull Statefull
None of these
28. Axios is an __________?
Framework
Library
Package
All These Above
29. .............. helps react for keeping their data unidirectional.
JSX
Flux
Dom
Props
30. Who is the father of React.js?
Jordan mike
Jordan Walke
Nile
Nike John
31. Mit welchem Befehl starten wir die React App?
npm run dev
npm serve
npm start
npm build
32. What is ReactJS?
Server side Framework
User-interface framework
A Library for building interaction interfaces
None of the above
33. React is for building _________
Connectivity
User Interface
Database
All of the above
34. What is Axios in Node?
npm component
Promise based HTTP client for the browser and node.js
A company
None of these
35. React.Js is a __________?
Framework
Library
both (a) and (b)
None of these.
36. React.Js was created by ___________?
Google
Microsoft
Facebook
All of above
37. Which concept includes OOP's?
Functional Components
Class Components
Oriented Components
None of the above
38. What is React.Js used for?
Server-Side
Client-Side
For Both
None of these
39. What was the Output?const [data , setData] = useState("Alex");console.log(data);
data
data
Alex
none of the above
40. Perulangan dalam React JS dapat dilakukan dengan menggunakan
map
looping
loop
mapping for
41. Penulisan kode yang benar untuk array function
tambah = () = {}
tambah = () =&gt; {}
tambah = []
tambah = {}
42. Salah satu jenis Router dalam React JS
SearchRouter
FindRouter
BrowserRouter
GetRouter
43. _____ Home from './components/Home';Lengkapi Code di atas
import
di atas
Both A &amp; B
none of the above
44. React JS memiliki sintaks ekstensi javascript yang disebut dengan
XML
HTML
JSE
JSX
45. React JS merupakan
bahasa pemograman server-side Java Script
framework User Interface PHP
framework User Interface Java
framework User Interface Java Script
46. Penulisan Sintaks dengan ekstensi Java Script yang benar adalah
onChange dan classname
className dan onClick
onclik dan OnChange
none of the above
47. Untuk menghubungkan Back-End dan Front-End diperlukan penggunaan __
API
render
Both A &amp; B
none of the above
48. Variabel yang dapat dipanggil di dalam komponen lain dalam React JS dan juga menghubungkan Komponen satu dengan yang lain
props
state
var
const
Submit