React.js Quiz | Set-1

  • Last Updated : 22 Oct, 2021

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


Writing code in comment? Please use ide.geeksforgeeks.org, generate link and share the link here.