
DC-302-Midterm-Quiz

Quiz
•
Computers
•
University
•
Medium
Ian Claros
Used 1+ times
FREE Resource
15 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Which of the following is true about the state in ReactJS?
State is immutable and cannot be changed after being set.
State can only be used in functional components.
State can hold data that may change over time and affect the rendering of the component.
State is used to pass data from a parent component to a child component.
2.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Which of the following is true about ReactJS components?
A component can return multiple elements without wrapping them in a single container.
Components in React can only be class-based.
A React component must be written in JavaScript and cannot use JSX.
Functional components can use hooks like useState and useEffect to manage state and side effects.
3.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Which statement is true about props in ReactJS?
Props are mutable and can be changed within the component that receives them.
Props are used to pass data from a child component to a parent component.
Props can be passed to components to allow them to be reused with different inputs.
Props are used to manage the internal state of a component.
4.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the correct way to create a functional component in ReactJS?
function Component { return ( <h1>Hello World!</h1> ); }
function Component() { return ( <h1>Hello World!</h1> ); }
const Component = function() { return <h1>Hello World!</h1>; }
const Component = () => { <h1>Hello World!</h1>; }
5.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Which of the following is the correct way to initialize and update state in a functional component using React Hooks?
const [count, setCount] = this.state(0);
const count = useState(0); setCount(count + 1);
const [count, setCount] = useState(0); setCount(count + 1);
this.state = { count: 0 }; setCount(count + 1);
6.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Which of the following correctly uses props in a functional React component?
function Greeting(props) { return <h1>Welcome, {props.name}!</h1>; }
function Greeting() { return <h1>Welcome, props.name!</h1>; }
function Greeting(props) { return <h1>Welcome, this.props.name!</h1>; }
function Greeting(props) { return <h1>Welcome, {name}!</h1>; }
7.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Which of the following is the correct way to handle an event in a ReactJS functional component?
<button onclick="handleClick()">Click me</button>
<button onClick={handleClick()}>Click me</button>
<button onClick={handleClick}>Click me</button>
<button OnClick={handleClick}>Click me</button>
Create a free account and access millions of resources
Similar Resources on Wayground
11 questions
Basic HTML & HTML5

Quiz
•
University
15 questions
Online World revision quiz

Quiz
•
University
17 questions
HTML

Quiz
•
12th Grade - University
15 questions
HTML

Quiz
•
University
16 questions
Principles of Information Technology

Quiz
•
9th Grade - University
10 questions
tkinter quiz

Quiz
•
University
20 questions
HTML

Quiz
•
KG - University
20 questions
KUIZ 1

Quiz
•
University
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
10 questions
UPDATED FOREST Kindness 9-22

Lesson
•
9th - 12th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
20 questions
US Constitution Quiz

Quiz
•
11th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
10 questions
Would you rather...

Quiz
•
KG - University
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)

Quiz
•
8th Grade - University
7 questions
Force and Motion

Interactive video
•
4th Grade - University
10 questions
The Constitution, the Articles, and Federalism Crash Course US History

Interactive video
•
11th Grade - University
7 questions
Figurative Language: Idioms, Similes, and Metaphors

Interactive video
•
4th Grade - University
20 questions
Levels of Measurements

Quiz
•
11th Grade - University
16 questions
Water Modeling Activity

Lesson
•
11th Grade - University
10 questions
ACT English prep

Quiz
•
9th Grade - University