About React JS

Following are some of the multiple choice questions on the React JS with answers that will help the students in developing their knowledge.

React JS MCQ

1. In React what is used to pass data to a component from outside?

  • setState
  • render with arguments
  • props
  • PropTypes

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?

  • 2 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. 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}>

8. Which method is not part of ReactDOM?

  • ReactDOM.destroy()
  • ReactDOM.hydrate()
  • ReactDOM.createPortal()
  • ReactDOM.findDOMNode()

9. Which of the following API is a MUST for every ReactJS component?

  • getInitialState
  • render
  • renderComponent
  • None of the above

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

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

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

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

  • state & props
  • services & components

14. Everything in react is

  • Package
  • Model
  • Method
  • Component

15. What function allows you to render React content in an HTML page?

  • React.mount()
  • ReactDOM.start()
  • ReactDOM.render()
  • React.render()

16. What is JSX?

  • it is a syntax extension to JavaScript.
  • JSX produces data.
  • Tool to control the data
  • none of the above

17. What function can be used to update state?

  • setState()
  • updateState()
  • upState()
  • downState()

18. Who Develop React.js?

  • Apple
  • Facebook
  • Twitter
  • Google

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

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

21. What is state in React?

  • A persistant storage.
  • An internal data store (object) of a component.

22. Life cycle methods of a components fall under following categories?

  • Mounting, Unmounting
  • Mounting, Updating
  • Mounting, Updating, Unmounting
  • All of above

23. One can define default values for properties, props, using which of the following method?

  • getDefaultProps
  • getPropsValue
  • getInitialState
  • None of these

24. React.js Covers only the view layer of the app.

  • Yes
  • No

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. Is React.JS is paid?

  • Yes
  • No

29. Axios is an __________?

  • Framework
  • Library
  • Package
  • All These Above

30. . .............. helps react for keeping their data unidirectional.

  • JSX
  • Flux
  • Dom
  • Props

31. Who is the father of React.js?

  • Jordan mike
  • Jordan Walke
  • Nile
  • Nike John

32. Mit welchem Befehl starten wir die React App?

  • npm run dev
  • npm serve
  • npm start
  • npm build

33. What is ReactJS?

  • Server side Framework
  • User-interface framework
  • A Library for building interaction interfaces
  • None of the above

34. React is for building _________

  • Connectivity
  • User Interface
  • Database
  • All of above

35. What is Axios in Node?

  • npm component
  • Promise based HTTP client for the browser and node.js
  • A company
  • None of these

36. React.Js is a __________?

  • Framework
  • Library
  • None of these.

37. React.Js was created by ___________?

  • Google
  • Microsoft
  • Facebook
  • All of above

38. Which concept includes OOP's?

  • Functional Components
  • Class Components
  • Oriented Components
  • None of these

39. What is React.Js used for?

  • Server-Side
  • Client-Side
  • For Both
  • None of these

40. Will useEffect affect other data?

  • True
  • False

41. What was the Output?const [data , setData] = useState("Alex");console.log(data);

  • data
  • data Alex
  • Alex
  • none of the above

42. Perulangan dalam React JS dapat dilakukan dengan menggunakan

  • map
  • looping
  • loop
  • mapping for

43. Penulisan kode yang benar untuk array function

  • tambah = () = {}
  • tambah = () => {}
  • tambah = []
  • tambah = {}

44. Salah satu jenis Router dalam React JS

  • SearchRouter
  • FindRouter
  • BrowserRouter
  • GetRouter

45. _______ Home from './components/Home';Lengkapi Code di atas

  • import
  • di atas
  • Both A & B
  • none of the above

46. React JS memiliki sintaks ekstensi javascript yang disebut dengan

  • XML
  • HTML
  • JSE
  • JSX

47. React JS merupakan

  • bahasa pemograman server-side Java Script
  • framework User Interface PHP
  • framework User Interface Java
  • framework User Interface Java Script

48. Penulisan Sintaks dengan ekstensi Java Script yang benar adalah

  • onChange dan classname
  • className dan onClick
  • onclik dan OnChange
  • none of the above

49. Untuk menghubungkan Back-End dan Front-End diperlukan penggunaan ____

  • API
  • render
  • Both A & B
  • none of the above

50. Variabel yang dapat dipanggil di dalam komponen lain dalam React JS dan juga menghubungkan Komponen satu dengan yang lain

  • props
  • state
  • var
  • const

Enjoyed the Quiz. Share this with friends

Comments

Add Your Review

Your email address will not be published.

Subscribe to Newsletter!

Subscribe to get latest updates and information.