Unit 5: Matrices - Subjective Questions

CSR101 — Python Programming • Practice Questions with Detailed Answers

20 questions

1

Explain how random numbers are generated in Python. Discuss the use of the random module and NumPy's random-number functions, including the importance of setting a seed.

2

What is NumPy? Explain the structure and advantages of a NumPy array compared with a Python list.

3

Describe indexing and slicing in one-dimensional and multidimensional NumPy arrays with suitable examples.

4

Explain the important attributes of a NumPy array and illustrate each of them using an example.

5

Explain element-wise arithmetic operations on NumPy arrays. Distinguish them from matrix multiplication.

6

Explain broadcasting in NumPy. State the rules of broadcasting and demonstrate the concept with an example.

7

Describe commonly used NumPy array creation and manipulation functions such as reshape(), ravel(), flatten(), and resize().

8

Explain the use of transpose(), concatenate(), vstack(), hstack(), and split() for array manipulation.

9

Explain the reduction and statistical functions in NumPy, including sum(), mean(), min(), max(), and the use of the axis parameter.

10

Derive the determinant and inverse of a matrix and explain how NumPy can be used to compute them.

11

Explain matrix decomposition and compare LU, QR, and singular value decomposition.

12

Describe how NumPy can be used to solve a system of simultaneous linear equations. Explain the mathematical method and provide Python code.

13

What are sparse matrices? Explain why they are useful and distinguish them from dense matrices.

14

Explain the COO, CSR, and CSC sparse matrix formats and compare their associated data structures.

15

Describe SciPy and explain how scipy.linalg extends the matrix-related capabilities of NumPy.

16

Explain eigenvalues and eigenvectors and show how SciPy can be used to calculate them for a matrix.

17

Compare dense and sparse matrix operations in SciPy. Explain the situations in which a sparse representation should be preferred.

18

What is vectorization in Python? Explain how vectorized NumPy code differs from an explicit loop and discuss its advantages.

19

Explain NumPy universal functions, or ufuncs, and describe their role in vectorized mathematical computation.

20

Design and explain a vectorized NumPy solution for computing the Euclidean distance between corresponding points in two-dimensional arrays.