DC-302-Midterm-Quiz

DC-302-Midterm-Quiz

University

15 Qs

quiz-placeholder

Similar activities

conhecimentos de HTML Caique

conhecimentos de HTML Caique

University

10 Qs

CodeFlix

CodeFlix

University

20 Qs

Review

Review

University - Professional Development

15 Qs

HTML5  and CSS3 -Revision

HTML5 and CSS3 -Revision

University

20 Qs

POST TEST WEB STATIC

POST TEST WEB STATIC

University - Professional Development

20 Qs

HTML

HTML

University

10 Qs

DASAR HTML

DASAR HTML

University

20 Qs

conhecimentos de HTML

conhecimentos de HTML

University

10 Qs

DC-302-Midterm-Quiz

DC-302-Midterm-Quiz

Assessment

Quiz

Computers

University

Medium

Created by

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

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?