Unit 4: Array Operations using NumPy - Subjective Questions

ECE181 — Introduction To Python • Practice Questions with Detailed Answers

20 questions

1

Distinguish between NumPy arrays and Python lists. Explain at least four key differences with examples.

2

Define a NumPy array. Explain the different ways to create arrays in NumPy with examples.

3

Explain the concept of data types (dtype) in NumPy. Why is specifying a data type important?

4

Describe the various arithmetic operations that can be performed on NumPy arrays with examples.

5

What is broadcasting in NumPy? Explain the broadcasting rules with examples.

6

Explain the commonly used statistical functions in NumPy with examples.

7

Explain array indexing and slicing in NumPy with suitable examples.

8

Compare vectorized operations with traditional loop-based operations in Python. Why are vectorized operations faster?

9

Describe the important attributes of a NumPy array such as shape, ndim, size, and dtype with examples.

10

Explain reshaping of arrays in NumPy. Discuss the reshape(), flatten(), and ravel() methods.

11

What are aggregate functions in NumPy? Explain how the axis parameter affects their behavior in multidimensional arrays.

12

Explain the difference between a copy and a view of a NumPy array. Why is this distinction important?

13

Describe how to perform matrix operations like matrix multiplication, transpose, and dot product using NumPy.

14

Explain boolean masking and fancy indexing in NumPy with examples.

15

Derive and demonstrate how broadcasting works when adding a 1D array to a 2D array of different shapes. Include shape analysis.

16

Explain in detail the advantages of using NumPy over standard Python data structures for scientific computing. Support your answer with performance and functionality aspects.

17

Explain the functions used to join and split arrays in NumPy, such as concatenate(), vstack(), hstack(), and split().

18

Explain universal functions (ufuncs) in NumPy. Give examples of mathematical and trigonometric ufuncs.

19

Given an array of exam scores, explain how you would compute descriptive statistics (mean, median, standard deviation, min, max) and interpret the results. Provide code and formulas.

20

Explain type casting and type promotion in NumPy operations. What happens when arrays of different data types are combined?