SchoolWhool
Quizzes and saved progress, freeSign in freeSign in
Data Tools · Module 1Module material

NumPy interview questions

22 questions interviewers ask on numpy, from first principles to the follow-ups. The first 3 model answers are free to read; Pro opens the rest.

  1. What distinguishes a numeric NumPy array from a Python list?

    A numeric array has a homogeneous, fixed-width buffer and a shape; a list stores references to Python objects, whose types may differ.

  2. Is NumPy always faster?

    No. Conversion and allocation have costs. Benchmark the full operation, especially when starting from a list.

  3. What do shape, ndim and size report?

    Axis lengths, number of axes, and total element count. For (365, 8), they are (365, 8), 2 and 2,920.

  4. What does dtype control?
  5. What must be true before reshape?
  6. Does reshape always avoid a copy?
  7. How do basic slicing and fancy indexing differ?
  8. What does a boolean mask do?
  9. Why does and fail between two array comparisons?
  10. What is broadcasting?
  11. Can broadcasting produce a valid but wrong result?
  12. What does axis=0 mean for the revenue grid?
  13. Why use keepdims=True?
  14. What does argmax return?
  15. How does nan affect mean?
  16. How do * and @ differ?
  17. What does .T do to a one-dimensional array?
  18. Why solve a linear system instead of explicitly inverting?
  19. What if feature columns are linearly dependent?
  20. What does a seed guarantee?
  21. Why is one permutation used for features and labels?
  22. How do you compare floating-point arrays?