0% found this document useful (0 votes)
7 views12 pages

NumPy Outer Product Function Guide

The document contains a series of questions and answers related to NumPy, a popular Python library for numerical computing. It covers basic to advanced topics, including array creation, manipulation, mathematical operations, and functions for linear algebra. Each question is multiple-choice, providing the correct answer alongside the options.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views12 pages

NumPy Outer Product Function Guide

The document contains a series of questions and answers related to NumPy, a popular Python library for numerical computing. It covers basic to advanced topics, including array creation, manipulation, mathematical operations, and functions for linear algebra. Each question is multiple-choice, providing the correct answer alongside the options.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1. **What does NumPy stand for?

**

- A) Numerical Python

- B) Number Python

- C) Numerical Pylab

- D) None of the above

**Answer:** A) Numerical Python

2. **Which of the following is the correct way to import NumPy?**

- A) `import numpy as np`

- B) `import np`

- C) `import numpy as nump`

- D) `import numpy`

**Answer:** A) `import numpy as np`

3. **What function is used to create an array in NumPy?**

- A) `[Link]()`

- B) `[Link]()`

- C) `np.create_array()`

- D) `np.make_array()`

**Answer:** B) `[Link]()`

4. **Which function is used to generate evenly spaced values within a given interval?**

- A) `[Link]()`

- B) `[Link]()`

- C) `[Link]()`

- D) `[Link]()`

**Answer:** C) `[Link]()`

5. **What is the default data type of elements in a NumPy array?**

- A) `int`
- B) `float`

- C) `str`

- D) `bool`

**Answer:** B) `float`

6. **What function creates an array of all zeros?**

- A) `[Link]()`

- B) `[Link]()`

- C) `[Link]()`

- D) `[Link]()`

**Answer:** A) `[Link]()`

7. **How do you check the shape of a NumPy array?**

- A) `[Link]()`

- B) `[Link]()`

- C) `[Link]`

- D) `[Link]`

**Answer:** C) `[Link]`

8. **How do you change the shape of an existing NumPy array?**

- A) `[Link](array)`

- B) `[Link]()`

- C) `[Link](array)`

- D) `array.change_shape()`

**Answer:** B) `[Link]()`

9. **Which function creates an identity matrix?**

- A) `[Link]()`

- B) `[Link]()`

- C) `[Link]()`

- D) `[Link]()`
**Answer:** D) `[Link]()`

10. **What function concatenates two NumPy arrays along a specified axis?**

- A) `[Link]()`

- B) `[Link]()`

- C) `[Link]()`

- D) `[Link]()`

**Answer:** D) `[Link]()`

11. **What is the result of `[Link]([1, 2], [3, 4])`?**

- A) `[1, 2, 3, 4]`

- B) `[4, 6]`

- C) `6`

- D) `[1, 5, 9]`

**Answer:** B) `[4, 6]`

12. **Which function is used to return the maximum element of an array?**

- A) `[Link]()`

- B) `[Link]()`

- C) `[Link]()`

- D) `[Link]()`

**Answer:** A) `[Link]()`

13. **Which method sorts an array in NumPy?**

- A) `[Link]()`

- B) `[Link]()`

- C) `[Link]()`

- D) `np.list_sort()`

**Answer:** B) `[Link]()`

14. **What function returns the sum of all elements in a NumPy array?**
- A) `[Link]()`

- B) `[Link]()`

- C) `[Link]()`

- D) `np.total_sum()`

**Answer:** B) `[Link]()`

15. **What does the `axis` parameter control in many NumPy functions?**

- A) The function behavior

- B) The size of the array

- C) The dimension along which to apply the function

- D) The type of array

**Answer:** C) The dimension along which to apply the function

---

### **Intermediate Level (16–30)**

16. **How do you create a NumPy array with random values between 0 and 1?**

- A) `[Link]()`

- B) `[Link]()`

- C) `[Link]()`

- D) `[Link]()`

**Answer:** B) `[Link]()`

17. **Which function will return the dot product of two arrays?**

- A) `[Link]()`

- B) `[Link]()`

- C) `[Link]()`

- D) `[Link]()`

**Answer:** B) `[Link]()`
18. **What is the output of `[Link](1, 10, 3)`?**

- A) `[1, 3, 6]`

- B) `[1, 4, 7]`

- C) `[1, 4, 8]`

- D) `[1, 4, 9]`

**Answer:** B) `[1, 4, 7]`

19. **Which of the following function computes the inverse of a matrix?**

- A) `[Link]()`

- B) `[Link]()`

- C) `[Link]()`

- D) `[Link]()`

**Answer:** B) `[Link]()`

20. **Which function is used to find the determinant of a matrix?**

- A) `[Link]()`

- B) `[Link]()`

- C) `[Link]()`

- D) `[Link]()`

**Answer:** B) `[Link]()`

21. **What function will return the cumulative sum of elements along a given axis?**

- A) `np.sum_cumulative()`

- B) `[Link]()`

- C) `np.add_cum()`

- D) `[Link]()`

**Answer:** B) `[Link]()`

22. **How do you find the standard deviation of a NumPy array?**

- A) `[Link]()`

- B) `[Link]()`
- C) `[Link]()`

- D) `[Link]()`

**Answer:** A) `[Link]()`

23. **Which of the following function finds the index of the minimum value in an array?**

- A) `[Link]()`

- B) `[Link]()`

- C) `np.index_min()`

- D) `np.arg_index()`

**Answer:** B) `[Link]()`

24. **What function will flatten a multi-dimensional array to one dimension?**

- A) `[Link]()`

- B) `[Link](1D)`

- C) `[Link]()`

- D) `[Link]()`

**Answer:** D) `[Link]()`

25. **Which function can be used to stack arrays vertically?**

- A) `[Link]()`

- B) `[Link]()`

- C) `[Link](1)`

- D) `np.concat_v()`

**Answer:** A) `[Link]()`

26. **How do you transpose a matrix in NumPy?**

- A) `[Link]()`

- B) `[Link]()`

- C) `[Link]()`

- D) `array.T`

**Answer:** D) `array.T`
27. **What does the `[Link]()` function check for in an array?**

- A) If all values are zero

- B) If all values are non-zero

- C) If all elements satisfy a condition

- D) If all values are integers

**Answer:** C) If all elements satisfy a condition

28. **How do you add a new axis to a NumPy array?**

- A) `[Link]()`

- B) `[Link]()`

- C) `np.expand_dims()`

- D) `np.add_dimension()`

**Answer:** C) `np.expand_dims()`

29. **What does `[Link](1, 10, size=(3, 3))` generate?**

- A) A 1D array of integers from 1 to 10

- B) A 2D array of size 3x3 with integers between 1 and 10

- C) A 2D array of size 3x3 with integers between 0 and 9

- D) A 3D array

**Answer:** B) A 2D array of size 3x3 with integers between 1 and 10

30. **What does `[Link](array)` do?**

- A) Returns the

square root of each element in the array

- B) Squares each element in the array

- C) Returns the sum of the square roots

- D) Returns an array of integers

**Answer:** A) Returns the square root of each element in the array


---

### **Advanced Level (31–50)**

31. **Which method is used to solve a system of linear equations in NumPy?**

- A) `[Link]()`

- B) `[Link]()`

- C) `np.linear_solve()`

- D) `[Link]()`

**Answer:** A) `[Link]()`

32. **What does `[Link]()` do?**

- A) Randomizes the array generation

- B) Controls the random number generator for reproducibility

- C) Generates random seeds

- D) Sets the seed value

**Answer:** B) Controls the random number generator for reproducibility

33. **Which of the following NumPy functions returns the eigenvalues and eigenvectors of a matrix?
**

- A) `[Link]()`

- B) `[Link]()`

- C) `[Link]()`

- D) `[Link]()`

**Answer:** A) `[Link]()`

34. **What function computes the outer product of two arrays?**

- A) `[Link]()`

- B) `[Link]()`

- C) `np.prod_outer()`

- D) `[Link]()`
**Answer:** A) `[Link]()`

35. **Which of the following computes the Moore-Penrose inverse of a matrix?**

- A) `[Link]()`

- B) `[Link]()`

- C) `[Link]()`

- D) `[Link]()`

**Answer:** A) `[Link]()`

36. **What function will return the singular value decomposition of a matrix?**

- A) `[Link]()`

- B) `[Link]()`

- C) `[Link]()`

- D) `[Link]()`

**Answer:** D) `[Link]()`

37. **Which function computes the QR decomposition of a matrix?**

- A) `[Link]()`

- B) `np.qr_decompose()`

- C) `[Link]()`

- D) `np.decomp_qr()`

**Answer:** A) `[Link]()`

38. **How do you find the rank of a matrix in NumPy?**

- A) `[Link]()`

- B) `[Link].matrix_rank()`

- C) `[Link]()`

- D) `np.matrix_rank()`

**Answer:** B) `[Link].matrix_rank()`

39. **What function is used to check if a matrix is singular?**


- A) `np.is_singular()`

- B) `[Link]() == 0`

- C) `np.matrix_singular()`

- D) `[Link].is_singular()`

**Answer:** B) `[Link]() == 0`

40. **Which NumPy function is used for element-wise multiplication of two arrays?**

- A) `[Link]()`

- B) `[Link]()`

- C) `[Link]()`

- D) `[Link]()`

**Answer:** C) `[Link]()`

41. **How can you calculate the Frobenius norm of a matrix?**

- A) `[Link]()`

- B) `np.norm_frob()`

- C) `[Link]()`

- D) `np.matrix_norm()`

**Answer:** A) `[Link]()`

42. **Which function will return the cross product of two vectors?**

- A) `[Link]()`

- B) `[Link]()`

- C) `[Link]()`

- D) `[Link]()`

**Answer:** B) `[Link]()`

43. **What will be the result of `[Link]([Link]((3, 3)))`?**

- A) A lower triangular matrix of ones

- B) A diagonal matrix of ones

- C) An upper triangular matrix of ones


- D) An identity matrix

**Answer:** A) A lower triangular matrix of ones

44. **What function is used to calculate the product of array elements over a given axis?**

- A) `[Link]()`

- B) `[Link]()`

- C) `[Link]()`

- D) `[Link]()`

**Answer:** A) `[Link]()`

45. **Which function computes the covariance matrix of a set of data in NumPy?**

- A) `[Link]()`

- B) `[Link]()`

- C) `[Link]()`

- D) `np.covar_matrix()`

**Answer:** A) `[Link]()`

46. **How can you find the number of non-zero elements in an array?**

- A) `np.count_nonzero()`

- B) `[Link]()`

- C) `np.count_zeros()`

- D) `np.sum_nonzero()`

**Answer:** A) `np.count_nonzero()`

47. **What does `np.r_` do in NumPy?**

- A) Joins arrays row-wise

- B) Joins arrays column-wise

- C) Creates a range of values

- D) Computes the rank of a matrix

**Answer:** A) Joins arrays row-wise


48. **Which NumPy function will return the indices of the non-zero elements in an array?**

- A) `[Link]()`

- B) `np.arg_nonzero()`

- C) `np.count_nonzero()`

- D) `np.nonzero_idx()`

**Answer:** A) `[Link]()`

49. **How can you create a structured array in NumPy with named fields?**

- A) `[Link]()`

- B) `[Link]()`

- C) `[Link]()`

- D) `[Link](named=True)`

**Answer:** A) `[Link]()`

50. **What function is used to stack arrays along a new dimension in NumPy?**

- A) `[Link]()`

- B) `[Link]()`

- C) `[Link]()`

- D) `[Link]()`

**Answer:** A) `[Link]()`

You might also like