React.js Quiz | Set-1

Last Updated : 27 Sep, 2023

Question 1
Which of the following command is used to create react-js-app ?
Tick
npx create-react-app appname
Cross
npm install create-react-app
Cross
npx install create-react-app -g
Cross
install - l create-react-app


Question 1-Explanation: 
The correct syntax for installing react app is npx create-react-app app name where app name is the name of the app you want to create.
Question 2
In React.js which one of the following is used to create a class for Inheritance ?
Cross
Create
Tick
Extends
Cross
Inherits
Cross
Delete


Question 2-Explanation: 
The meaning of Extends in react.js is to create a class for the Inheritance So the correct answer is Extend.
Question 3
What is the default port number in which the application run ?
Tick
3000
Cross
8080
Cross
5000
Cross
3030


Question 3-Explanation: 
The default port number in which react application runs are 3000.
Question 4
Which of the following valid component return type of React ?
Cross
2
Cross
5
Tick
1
Cross
3


Question 4-Explanation: 
The only valid component return type of React. The return type in React is by render() function.
Question 5
Which of the following is a way to handle data in React.js ?
Tick
State & Props
Cross
Services & Components
Cross
State & Services
Cross
State & Component


Question 5-Explanation: 
State and Props are ways to handle data in React.js where the state is mutable and props are unchangeable.
Question 6
Which of the following is must for the API in React.js ?
Cross
SetinitialComponent
Tick
renderComponent
Cross
render
Cross
All of the above


Question 6-Explanation: 
The renderComponent is not a function that is used as API for the React.js.
Question 7
Which of the following is true regarding Babel ?
Cross
Compiler
Cross
Transpilar
Tick
Both of the above
Cross
None of the above


Question 7-Explanation: 
Babel is both compiler and Transpiler which is used to run the react.js application.
Question 8
In React.js, how we can pass the data from one component to another in React.js ?
Cross
SetState
Cross
Render with arguments
Tick
Props
Cross
PropTypes


Question 8-Explanation: 
Props can help to pass the data from one component from another in react.js. Props are un-mutable so that they cant be changed.
Question 9
Which of the following function is true about changing the state in React.js ?
Cross
this.State{}
Tick
this.setState
Cross
this.setChangeState
Cross
All of the above


Question 9-Explanation: 
The this.setState is used for changing the state in React.js whenever the state changes in react then it re-render the component in the browser.
Question 10
Which of the following method is true about referring parent class in React.js ?
Cross
self()
Cross
inherits()
Cross
this()
Tick
super()


Question 10-Explanation: 
The super() is a method in which referring the parent class in react.js. It is the way for calling the constructor in React.js.
There are 15 questions to complete.


Share your thoughts in the comments

Similar Reads