React.js Quiz | Set-1
Question 1 |
Which of the following command is used to create react-js-app ?
npx create-react-app appname | |
npm install create-react-app | |
npx install create-react-app -g | |
install - l create-react-app |
Discuss it
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 ?
Create | |
Extends | |
Inherits | |
Delete |
Discuss it
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 ?
3000 | |
8080 | |
5000 | |
3030 |
Discuss it
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 ?
2 | |
5 | |
1 | |
3 |
Discuss it
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 ?
State & Props | |
Services & Components | |
State & Services | |
State & Component |
Discuss it
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 ?
SetinitialComponent | |
renderComponent | |
render | |
All of the above |
Discuss it
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 ?
Compiler | |
Transpilar | |
Both of the above | |
None of the above |
Discuss it
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 ?
SetState | |
Render with arguments | |
Props | |
PropTypes |
Discuss it
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 ?
this.State{} | |
this.setState | |
this.setChangeState | |
All of the above |
Discuss it
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 ?
self() | |
inherits() | |
this() | |
super() |
Discuss it
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.