Summary unavailable.

Questions

Question 1

What are the four internal components of a NumPy ndarray object?

View answer and explanation
Question 2

For a typical C order 3 x 4 x 5 array of float64 (8-byte) values, what are the strides?

View answer and explanation
Question 3

Which NumPy function is used to check if an array's data type is a subclass of a general type like np.integer or np.floating?

View answer and explanation
Question 4

What is the primary difference between the NumPy `ravel` and `flatten` array methods?

View answer and explanation
Question 5

What is the result of reshaping the array `arr = np.arange(12).reshape((3, 4))` using `arr.ravel('F')`?

View answer and explanation
Question 6

Which pair of NumPy functions are convenience functions for concatenating arrays by rows (axis 0) and by columns (axis 1) respectively?

View answer and explanation
Question 7

According to the Broadcasting Rule in NumPy, when are two arrays compatible for broadcasting?

View answer and explanation
Question 8

To subtract the row means from a 4x3 array named `arr`, the 1D array of row means, `row_means`, must be reshaped. What is the correct shape for `row_means` to enable broadcasting over axis 1?

View answer and explanation
Question 9

What is the purpose of the `np.newaxis` attribute in NumPy?

View answer and explanation
Question 10

What does the `np.add.reduce` method do on a 1D array?

View answer and explanation
Question 11

Given the array `arr = np.arange(10)`, what is the output of `np.add.reduceat(arr, [0, 5, 8])`?

View answer and explanation
Question 12

What is the primary function of the `outer` ufunc method, for example, `np.multiply.outer(x, y)`?

View answer and explanation
Question 13

How is a typical structured data type specified when creating a NumPy structured array?

View answer and explanation
Question 14

When you access a single field of a structured array, like `sarr['x']`, what is returned?

View answer and explanation
Question 15

What is a key advantage of using NumPy structured arrays compared to pandas DataFrames for certain applications?

View answer and explanation
Question 16

What is the fundamental difference between `arr.sort()`, an instance method, and `np.sort(arr)`, a top-level function?

View answer and explanation
Question 17

Which sorting algorithm in NumPy is the only one guaranteed to be stable?

View answer and explanation
Question 18

What is the purpose of the `numpy.partition` function?

View answer and explanation
Question 19

What is the main difference in the output of functions created with `numpy.frompyfunc` versus `numpy.vectorize`?

View answer and explanation
Question 20

What is the primary purpose of the Numba library in the context of NumPy?

View answer and explanation
Question 21

In NumPy, what is a memory-mapped file?

View answer and explanation
Question 22

When you assign data to a slice of a NumPy `memmap` object, when are the changes guaranteed to be written to the on-disk file?

View answer and explanation
Question 23

What does it mean for a NumPy array's memory layout to be 'C-contiguous'?

View answer and explanation
Question 24

How can you check the memory layout flags, such as `C_CONTIGUOUS` and `F_CONTIGUOUS`, for a NumPy array named `arr`?

View answer and explanation
Question 25

If `arr_f` is a FORTRAN-contiguous array, what will be the boolean value of `arr_f.copy('C').flags.C_CONTIGUOUS`?

View answer and explanation
Question 26

What is the purpose of the strides tuple in a NumPy ndarray's internal structure?

View answer and explanation
Question 27

When using the `reshape` method on a NumPy array, what does passing -1 as one of the dimension values signify?

View answer and explanation
Question 28

Given `arr = np.arange(15)`, what is the shape of the resulting array after executing `arr.reshape((5, -1))`?

View answer and explanation
Question 29

In the context of NumPy's advanced array manipulation, what is the key difference in how C/row-major order and FORTRAN/column-major order traverse dimensions?

View answer and explanation
Question 30

Which ufunc method produces an array of intermediate 'accumulated' values, similar to how `cumsum` is related to `sum`?

View answer and explanation
Question 31

Given a 2D array `arr = np.arange(15).reshape((3, 5))`, what is the result of `np.add.accumulate(arr, axis=1)`?

View answer and explanation
Question 32

What is the primary purpose of `numpy.lexsort`?

View answer and explanation
Question 33

When using `numpy.lexsort((first_name, last_name))`, which array is used as the primary sort key?

View answer and explanation
Question 34

Given `values = np.array(['2:first', '2:second', '1:first', '1:second', '1:third'])` and `key = np.array([2, 2, 1, 1, 1])`, what is the output of `values.take(key.argsort(kind='mergesort'))`?

View answer and explanation
Question 35

Which two Python projects are mentioned as providing NumPy-friendly interfaces for storing array data in the HDF5 format?

View answer and explanation
Question 36

Which of the following is NOT a performance tip mentioned for getting the best performance out of NumPy?

View answer and explanation
Question 37

What is the method resolution order (MRO) for the `np.float64` data type shown in the text?

View answer and explanation
Question 38

Which special objects in the NumPy namespace provide a concise way to stack arrays, for example, vertically like `vstack`?

View answer and explanation
Question 39

How does the `repeat` method work on a multidimensional array if you pass an array of integers instead of a single integer?

View answer and explanation
Question 40

What is the key difference between `tile` and `repeat` in NumPy?

View answer and explanation
Question 41

What is the output of `np.tile(arr, (2, 1))` where `arr` is a 2x2 array?

View answer and explanation
Question 42

What are the NumPy equivalents of fancy indexing `arr[inds]` for getting and setting values on a single axis?

View answer and explanation
Question 43

What does `numpy.searchsorted` return when searching for a value in a sorted array?

View answer and explanation
Question 44

Given `arr = np.array([0, 1, 7, 12, 15])`, what is the output of `arr.searchsorted([0, 8, 11, 16])`?

View answer and explanation
Question 45

In the context of Numba, what is the purpose of the `nopython=True` option in the `jit` function?

View answer and explanation
Question 46

When opening an existing memory map file with `np.memmap`, what information must you still specify?

View answer and explanation
Question 47

If an array is C-contiguous, what is generally the fastest way to perform an operation like summing its elements?

View answer and explanation
Question 48

When you create a view on a C-contiguous array using a slice like `arr_c[:, :50]`, is the resulting view guaranteed to be contiguous?

View answer and explanation
Question 49

In a NumPy structured array, if a field is defined with a shape, such as `('x', np.int64, 3)`, what does accessing that field on a single record, like `arr[0]['x']`, return?

View answer and explanation
Question 50

If you have a 3D array `arr` with shape (3, 4, 5) and a 2D array `means` with shape (3, 4) representing the means over axis 2, how must you reshape `means` to subtract it from `arr` using broadcasting?

View answer and explanation