Create New Post

React JS MCQs 1

  1. What is React JS?

    • a) A JavaScript library for building user interfaces (Correct Answer)
    • b) A server-side scripting language
    • c) A relational database management system
    • d) An operating system
  2. What does JSX stand for in React JS?

    • a) JavaScript XML (Correct Answer)
    • b) JSON with XML
    • c) Java Standard Extensions
    • d) JavaScript Extensions
  3. Which of the following is NOT a core feature of React JS?

    • a) Virtual DOM
    • b) JSX syntax
    • c) Two-way data binding (Correct Answer)
    • d) Component-based architecture
  4. Which lifecycle method is used for fetching data in React JS?

    • a) componentWillMount()
    • b) componentDidMount() (Correct Answer)
    • c) componentDidUpdate()
    • d) componentWillReceiveProps()
  5. In React, which method is used to change the state of a component?

    • a) setState() (Correct Answer)
    • b) changeState()
    • c) updateState()
    • d) modifyState()
  6. What is the purpose of React Router?

    • a) To manage state in React components
    • b) To handle routing and navigation in React applications (Correct Answer)
    • c) To perform server-side rendering in React
    • d) To manage HTTP requests in React
  7. What is the role of props in React components?

    • a) Props are used for defining component state
    • b) Props are used for styling components
    • c) Props are used for passing data from parent to child components (Correct Answer)
    • d) Props are used for defining component methods
  8. Which function is used to render a React component into the DOM?

    • a) ReactDOM.render() (Correct Answer)
    • b) React.renderComponent()
    • c) ReactDOMComponent.render()
    • d) ReactComponent.render()
  9. Which of the following is used for creating reusable UI components in React?

    • a) Functions
    • b) Classes
    • c) Modules
    • d) Props (Correct Answer)
  10. What method is called once the component is removed from the DOM in React?

    • a) componentWillUnmount() (Correct Answer)
    • b) componentDidUpdate()
    • c) componentWillMount()
    • d) componentDidMount()

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

23838