NumPy Array Operations

Challenge your grasp of array manipulation,broadcasting,and indexing in NumPy.

1. What does np.arange(3, 15, 3) produce?
2. What is the shape of the array created by np.array([[1,2,3], [4,5,6]])?
3. By default, what data type does np.zeros(5) return?
4. Given arr = np.array([[1,2],[3,4],[5,6]]), what is the result of np.sum(arr, axis=1)?
5. Which method modifies the original array in-place when changing its shape?
6. Which of the following perform element-wise addition of two arrays `a` and `b`?
7. Which of the following are attributes of a NumPy array?
8. When does NumPy broadcasting apply?
9. The expression `np.array([1,2,3]) + np.array([4,5])` is valid due to NumPy broadcasting.
10. The `flatten()` method returns a view of the original array.
11. What function computes the mean of an array? (full name)
12. What abbreviation is used for the function that concatenates arrays vertically? (lowercase)
13. What is the output of `np.array([[1,2,3],[4,5,6]])[1, ::2]`?
14. What does `np.eye(4)` create?
15. What is the result of `np.max(np.array([[5,1],[3,9]]), axis=0)`?
16. Which functions return a new array (do not modify the original)?
17. `np.dot(a, b)` is equivalent to matrix multiplication for 2D arrays `a` and `b`.
18. What is the data type of `np.array([1, 2.5, 3])`?
19. What term describes the process of converting a multi-dimensional array to 1D? (starts with 'f')
20. Which of the following create a 2x3 array of zeros?
Answered 0 of 0 — 0 correct