Search Header Logo

FSD Quiz-2

Authored by Varalaxmi P N V

Computers

University

Used 2+ times

FSD Quiz-2
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Which one is a correct way of sending the value 'John' via the 'firstname' property to the Person component?

root.render(<Person firstname='John' />);

root.render(<Person props(firstname='John') />);

root.render(Person(firstname='John'));

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Which is a correct way of receiving, and using a prop named firstname, in a function class?

function Person(firstname) {
    return <h2>My name is { firstname }!</h2>;
}

function Person(props) {
    return <h2>My name is { props.firstname }!</h2>;
}

Both of the above is correct

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

In React, which is a correct way of adding a mouseover event to trigger a function called 'run_now'?

<div onmouseover='run_now()'>Lorum Ipsum</div>

<div onMouseover='run_now'>Lorum Ipsum</div>

<div onMouseover={run_now}>Lorum Ipsum</div>

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Which one of these two code blocks is a correct way of adding a conditional statement in React?

function Glass() {
    return (
        <>
            {5 > 2 && <h2>Hello</h2> }
        </>
    );
}

function Glass() {
    return (
        <>
            {5 > 2 &&} <h2>Hello</h2>
        </>
    );
}

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Consider the following code:function Family() {

    const names = ['Jane', 'John', 'Mike'];

    return (

        <>

            <ul>

                {names.map((x) => <li>{x}</li>)}

            </ul>

        </>

    );

What will be the return value?

Jane

       John

       Mike

Jane

Jane

      Jane

       Jane

6.

FILL IN THE BLANK QUESTION

1 min • 1 pt

Complete this statement to include a click event handler.

k Me!</button>

 }>Click Me!</button>

<button _________={handle} <click me></button>

7.

FILL IN THE BLANK QUESTION

1 min • 1 pt

Add the attribute that allows React to keep track of elements in lists.

function GroceryList() {

  const items = [

    {id: 1, name: 'bread'},

    {id: 2, name: 'milk'},

    {id: 3, name: 'eggs'}

  ];

 

  return (

    <>

      <h1>Grocery List</h1>

      <ul>

        {items.map((item) => <li _____ ={item.id}>{item.name}</li>)}

      </ul>

    </>

  );

}

 

const root = ReactDOM.createRoot(document.getElementById('root'));

root.render(<GroceryList />);

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?