React.js Quiz | Set-3

Question 1
What is the output of the below code snippets ?
import React from 'react';
import ReactDOM from 'react-dom';
const Component=()=>
{
        return <h1>This is Quiz Portal</h1>
}
 
ReactDOM.render(
    <Component />,
    document.getElementById("root")
);
Cross
Component
Tick
This is Quiz Portal
Cross
Error in code
Cross
None of the above


Question 1-Explanation: 
When the ReactDom will Reader and the component will call then it returns the ,This is Quiz Portal.
Question 2
Which of the below expression is required to write the JSX ?
Tick
{}
Cross
[]
Cross
\"\"
Cross
()


Question 2-Explanation: 
{} is the expression from the above all option which is used as a write expression in the JSX and JSX is used to write HTML in React.
Question 3
Which of the following is used to make data in-class components ?
Cross
componentWillMount
Cross
constructor
Tick
componentDidMount
Cross
componentWillReceiveProps


Question 3-Explanation: 
The componentDidMount is used to make data in CSS component. It is invoked when the component is mounted.
Question 4
What is the following is the use of ref in React.js ?
Tick
for direct access to the DOM node
Cross
for reference to another JS file
Cross
for bind the function
Cross
for calling a function


Question 4-Explanation: 
The use of ref in React.js is for direct access to the DOM node. It is used to access the DOM element.
Question 5
Which of the following is a way for webpack command to do in React.js?
Cross
Transpiles all of the javaScript into one
Tick
local development server
Cross
A and B are true
Cross
None of the above


Question 5-Explanation: 
The webpack command is used to run the local development server which is run at port no 8080.
Question 6
Which of the following is needed to change the code for compilation?
class date extends React.Component {
 render() {
   return <h1>Todays Date is :  {this.props.date}</h1>;
 }
}
Cross
Remove this
Tick
Capitalize date
Cross
Remove the render
Cross
The return value


Question 6-Explanation: 
From the above code the date is needed to change the code from compilation so the answer is Capitalize date.
Question 7
What is the correct way to set the default value for uncontrolled components ?
Cross
Value property
Tick
DefaultValue property
Cross
Default property
Cross
Assigns automatically


Question 7-Explanation: 
The correct way to set the default value for the uncontrolled component is the defaultValue property.
Question 8
What happens when a property is assigned to a method ?
Cross
get()
Tick
destructor()
Cross
constructor()
Cross
init()


Question 8-Explanation: 
The constructor() is created when assigned to a method in a React.js.
Question 9
Which of the following react components act like function with respect to props ?
Cross
Recursive functions
Cross
Monads
Tick
Pure functions
Cross
Higher-order functions


Question 9-Explanation: 
Pure function in React act like function with respect to props. It is the foundation of functional programming.
Question 10
Which of the following is true about the catch the JavaScript error ?
Cross
error helpers
Cross
error catchers
Cross
error bosses
Tick
error boundaries


Question 10-Explanation: 
Error boundaries have been used the catch the error in React.js application.
There are 15 questions to complete.

  • Last Updated : 27 Sep, 2023

Share your thoughts in the comments
Similar Reads