Bird
0
0

Why does using fancy indexing (like arr[[1, 3, 4]]) create a copy instead of a view in NumPy?

hard📝 Conceptual Q10 of 15
NumPy - Indexing and Slicing
Why does using fancy indexing (like arr[[1, 3, 4]]) create a copy instead of a view in NumPy?
ABecause fancy indexing changes the array shape
BBecause fancy indexing modifies the original array
CBecause fancy indexing only works on 2D arrays
DBecause fancy indexing returns a new array with copied data
Step-by-Step Solution
Solution:
  1. Step 1: Understand difference between views and copies

    Views share data with original array; copies have separate data.
  2. Step 2: Know fancy indexing behavior

    Fancy indexing returns a new array with copied data, not a view.
  3. Final Answer:

    Because fancy indexing returns a new array with copied data -> Option D
  4. Quick Check:

    Fancy indexing = returns copy, not view [OK]
Quick Trick: Fancy indexing always returns a copy, not a view [OK]
Common Mistakes:
  • Thinking fancy indexing modifies original
  • Believing fancy indexing only works on 2D
  • Assuming fancy indexing changes shape

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More NumPy Quizzes