Unit 8: NumPy functions - Subjective Questions

ECAP776 • Practice Questions with Detailed Answers

20 questions

1

Define NumPy universal functions. Explain their main features with suitable examples.

2

Explain the arithmetic functions provided by NumPy. How do they differ from ordinary Python arithmetic on lists?

3

Describe NumPy trigonometric functions and explain how angles can be converted between degrees and radians.

4

Explain exponential, logarithmic, square-root, and absolute-value functions in NumPy with examples.

5

Compare np.floor(), np.ceil(), np.trunc(), and np.round().

6

Explain the use of np.sum(), np.prod(), np.cumsum(), and np.cumprod(). Illustrate how the axis parameter affects their results.

7

Define mean, median, and weighted average. Explain how NumPy calculates them.

8

Derive the formulas for variance and standard deviation, and explain how ddof affects NumPy calculations.

9

Explain minimum, maximum, range, peak-to-peak, and the functions used to locate extreme values in a NumPy array.

10

Describe percentiles and quantiles. Explain how they are computed in NumPy and state their relationship.

11

How are missing values handled by NumPy statistical functions? Compare regular functions with their nan variants.

12

Explain np.sort() and discuss sorting by axis in one-dimensional and two-dimensional arrays.

13

Distinguish between np.sort() and np.argsort(). How can np.argsort() be used to reorder related data?

14

Explain stable sorting and the kind parameter of NumPy sorting functions. Why can sorting stability be important?

15

Describe np.lexsort() and explain how it performs indirect sorting using multiple keys.

16

Explain the different forms of np.where(). Show how it can be used both for locating and conditionally replacing values.

17

Compare np.nonzero(), np.argwhere(), and np.flatnonzero().

18

Describe np.searchsorted(). Explain the meaning of side="left" and side="right", and state its main precondition.

19

Explain np.count_nonzero() and show how its result changes when an axis or condition is supplied.

20

Compare np.unique(), np.bincount(), and np.histogram() as counting functions. State when each should be used.