Loading

Quipoin Menu

Learn • Practice • Grow

react / map() Function in React
mcq
Direction: Choose the correct option

Q1.

What does the map() function return when used on an array?
A. A new array of the same length
B. A boolean
C. The original array
D. A string
Direction: Choose the correct option

Q2.

In React, what do you typically return inside a map callback?
A. A string
B. An object
C. A number
D. A React element (JSX)
Direction: Choose the correct option

Q3.

Given const numbers = [1,2,3]; What does numbers.map(n =>
  • {n}
  • ) produce?
    A. A string
    B. An error
    C. An array of li elements
    D. A single li
    Direction: Choose the correct option

    Q4.

    Where should you place the key prop when using map?
    A. On each child inside the map
    B. On the outermost element returned by map
    C. On the map function
    D. On the parent container
    Direction: Choose the correct option

    Q5.

    What happens if you forget to return something in a map callback?
    A. An error is thrown
    B. The array contains null
    C. The map doesn't run
    D. The array contains undefined