Loading

Quipoin Menu

Learn • Practice • Grow

Direction: Choose the correct option

Q1.

How do you render a list of items in React?
A. Using a for loop
B. Using a template
C. Using a while loop
D. Using the map() function to transform array into JSX
Direction: Choose the correct option

Q2.

What is the purpose of the 'key' attribute when rendering lists?
A. To order the list
B. To uniquely identify each element for efficient updates
C. To style list items
D. To bind events
Direction: Choose the correct option

Q3.

What happens if you don't provide a key when rendering a list?
A. React uses index as key by default and shows a warning
B. React throws an error
C. It's fine, no issues
D. The list doesn't render
Direction: Choose the correct option

Q4.

Which of the following is a valid way to render a list?
A. {items.map(item => <li key={item.id}>{item.name}</li>)}
B. {items.map(item => <li>{item}</li>)}
C. {for (let item of items) { <li>{item}</li> }}
D. {items.forEach(item => <li>{item}</li>)}
Direction: Choose the correct option

Q5.

When should you use the array index as a key?
A. Always
B. Never
C. Only for class components
D. Only when the list is static and will not be reordered/filtered