Bird
0
0

Why does fancy indexing with repeated indices in NumPy return repeated elements in the output array?

hard📝 Conceptual Q10 of 15
NumPy - Indexing and Slicing
Why does fancy indexing with repeated indices in NumPy return repeated elements in the output array?
ABecause NumPy merges duplicates automatically
BBecause fancy indexing creates a new array copying elements at each index
CBecause fancy indexing returns a view that shares data
DBecause repeated indices cause an error
Step-by-Step Solution
Solution:
  1. Step 1: Understand fancy indexing behavior

    Fancy indexing returns a new array copying elements at specified indices, including duplicates.
  2. Step 2: Explain repeated elements

    Repeated indices cause repeated copies of those elements in the output array.
  3. Final Answer:

    Because fancy indexing creates a new array copying elements at each index -> Option B
  4. Quick Check:

    Repeated indices produce repeated elements by copying [OK]
Quick Trick: Repeated indices produce repeated elements in output [OK]
Common Mistakes:
  • Thinking duplicates are merged
  • Assuming view is returned
  • Expecting error on repeats

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More NumPy Quizzes