Numpy
Numpy
**
- A) Numerical Python
- B) Number Python
- C) Numerical Pylab
- B) `import np`
- D) `import numpy`
- A) `np.arr()`
- B) `np.array()`
- C) `np.create_array()`
- D) `np.make_array()`
**Answer:** B) `np.array()`
4. **Which function is used to generate evenly spaced values within a given interval?**
- A) `np.linspace()`
- B) `np.arrange()`
- C) `np.arange()`
- D) `np.spaced()`
**Answer:** C) `np.arange()`
- A) `int`
- B) `float`
- C) `str`
- D) `bool`
**Answer:** B) `float`
- A) `np.zeros()`
- B) `np.ones()`
- C) `np.zero()`
- D) `np.full()`
**Answer:** A) `np.zeros()`
- A) `array.size()`
- B) `array.shape()`
- C) `array.shape`
- D) `array.size`
**Answer:** C) `array.shape`
- A) `np.reshape(array)`
- B) `array.reshape()`
- C) `np.shape(array)`
- D) `array.change_shape()`
**Answer:** B) `array.reshape()`
- A) `np.matrix()`
- B) `np.ones()`
- C) `np.identity()`
- D) `np.eye()`
**Answer:** D) `np.eye()`
10. **What function concatenates two NumPy arrays along a specified axis?**
- A) `np.concat()`
- B) `np.vstack()`
- C) `np.hstack()`
- D) `np.concatenate()`
**Answer:** D) `np.concatenate()`
- A) `[1, 2, 3, 4]`
- B) `[4, 6]`
- C) `6`
- D) `[1, 5, 9]`
- A) `np.max()`
- B) `np.min()`
- C) `np.argmax()`
- D) `np.maximum()`
**Answer:** A) `np.max()`
- A) `np.order()`
- B) `np.sort()`
- C) `np.arrange()`
- D) `np.list_sort()`
**Answer:** B) `np.sort()`
14. **What function returns the sum of all elements in a NumPy array?**
- A) `np.add()`
- B) `np.sum()`
- C) `np.total()`
- D) `np.total_sum()`
**Answer:** B) `np.sum()`
15. **What does the `axis` parameter control in many NumPy functions?**
---
16. **How do you create a NumPy array with random values between 0 and 1?**
- A) `np.random.random()`
- B) `np.random.rand()`
- C) `np.random.rnd()`
- D) `np.random.randint()`
**Answer:** B) `np.random.rand()`
17. **Which function will return the dot product of two arrays?**
- A) `np.multiply()`
- B) `np.dot()`
- C) `np.cross()`
- D) `np.matmul()`
**Answer:** B) `np.dot()`
18. **What is the output of `np.arange(1, 10, 3)`?**
- A) `[1, 3, 6]`
- B) `[1, 4, 7]`
- C) `[1, 4, 8]`
- D) `[1, 4, 9]`
- A) `np.inverse()`
- B) `np.linalg.inv()`
- C) `np.inv()`
- D) `np.linalg.solve()`
**Answer:** B) `np.linalg.inv()`
- A) `np.determinant()`
- B) `np.linalg.det()`
- C) `np.linalg.detm()`
- D) `np.det()`
**Answer:** B) `np.linalg.det()`
21. **What function will return the cumulative sum of elements along a given axis?**
- A) `np.sum_cumulative()`
- B) `np.cumsum()`
- C) `np.add_cum()`
- D) `np.cumprod()`
**Answer:** B) `np.cumsum()`
- A) `np.std()`
- B) `np.variance()`
- C) `np.sqrt()`
- D) `np.stdev()`
**Answer:** A) `np.std()`
23. **Which of the following function finds the index of the minimum value in an array?**
- A) `np.min()`
- B) `np.argmin()`
- C) `np.index_min()`
- D) `np.arg_index()`
**Answer:** B) `np.argmin()`
- A) `np.flat()`
- B) `np.reshape(1D)`
- C) `np.ravel()`
- D) `np.flatten()`
**Answer:** D) `np.flatten()`
- A) `np.vstack()`
- B) `np.hstack()`
- C) `np.concatenate(1)`
- D) `np.concat_v()`
**Answer:** A) `np.vstack()`
- A) `np.transpose()`
- B) `array.transpose()`
- C) `np.flip()`
- D) `array.T`
**Answer:** D) `array.T`
27. **What does the `np.all()` function check for in an array?**
- A) `np.addaxis()`
- B) `np.newaxis()`
- C) `np.expand_dims()`
- D) `np.add_dimension()`
**Answer:** C) `np.expand_dims()`
- D) A 3D array
- A) Returns the
- A) `np.linalg.solve()`
- B) `np.solve()`
- C) `np.linear_solve()`
- D) `np.linalg.equation()`
**Answer:** A) `np.linalg.solve()`
33. **Which of the following NumPy functions returns the eigenvalues and eigenvectors of a matrix?
**
- A) `np.linalg.eig()`
- B) `np.eigen()`
- C) `np.linalgeigen()`
- D) `np.linalg.ev()`
**Answer:** A) `np.linalg.eig()`
- A) `np.outer()`
- B) `np.outerprod()`
- C) `np.prod_outer()`
- D) `np.multiply()`
**Answer:** A) `np.outer()`
- A) `np.pinv()`
- B) `np.inv()`
- C) `np.linalg.mpinv()`
- D) `np.inverse()`
**Answer:** A) `np.pinv()`
36. **What function will return the singular value decomposition of a matrix?**
- A) `np.svd()`
- B) `np.decompose()`
- C) `np.linsvd()`
- D) `np.linalg.svd()`
**Answer:** D) `np.linalg.svd()`
- A) `np.linalg.qr()`
- B) `np.qr_decompose()`
- C) `np.qr()`
- D) `np.decomp_qr()`
**Answer:** A) `np.linalg.qr()`
- A) `np.rank()`
- B) `np.linalg.matrix_rank()`
- C) `np.linalg.rank()`
- D) `np.matrix_rank()`
**Answer:** B) `np.linalg.matrix_rank()`
- B) `np.linalg.det() == 0`
- C) `np.matrix_singular()`
- D) `np.linalg.is_singular()`
**Answer:** B) `np.linalg.det() == 0`
40. **Which NumPy function is used for element-wise multiplication of two arrays?**
- A) `np.matmul()`
- B) `np.dot()`
- C) `np.multiply()`
- D) `np.prod()`
**Answer:** C) `np.multiply()`
- A) `np.linalg.norm()`
- B) `np.norm_frob()`
- C) `np.frobenius()`
- D) `np.matrix_norm()`
**Answer:** A) `np.linalg.norm()`
42. **Which function will return the cross product of two vectors?**
- A) `np.dot()`
- B) `np.cross()`
- C) `np.prod()`
- D) `np.outer()`
**Answer:** B) `np.cross()`
44. **What function is used to calculate the product of array elements over a given axis?**
- A) `np.prod()`
- B) `np.product()`
- C) `np.multiply()`
- D) `np.cumprod()`
**Answer:** A) `np.prod()`
45. **Which function computes the covariance matrix of a set of data in NumPy?**
- A) `np.cov()`
- B) `np.covar()`
- C) `np.covmat()`
- D) `np.covar_matrix()`
**Answer:** A) `np.cov()`
46. **How can you find the number of non-zero elements in an array?**
- A) `np.count_nonzero()`
- B) `np.nonzero()`
- C) `np.count_zeros()`
- D) `np.sum_nonzero()`
**Answer:** A) `np.count_nonzero()`
- A) `np.nonzero()`
- B) `np.arg_nonzero()`
- C) `np.count_nonzero()`
- D) `np.nonzero_idx()`
**Answer:** A) `np.nonzero()`
49. **How can you create a structured array in NumPy with named fields?**
- A) `np.dtype()`
- B) `np.structured()`
- C) `np.record()`
- D) `np.array(named=True)`
**Answer:** A) `np.dtype()`
50. **What function is used to stack arrays along a new dimension in NumPy?**
- A) `np.stack()`
- B) `np.concatenate()`
- C) `np.vstack()`
- D) `np.newstack()`
**Answer:** A) `np.stack()`