0% found this document useful (0 votes)
17 views

Numpy Interview Questions

NumPy is a powerful library for numerical computing in Python, offering support for large, multi-dimensional arrays and efficient mathematical operations. It differs from Python lists by being more memory-efficient and enabling element-wise operations through broadcasting. Key functions include creating arrays of zeros or ones, generating ranges, and computing statistical measures like mean and standard deviation.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Numpy Interview Questions

NumPy is a powerful library for numerical computing in Python, offering support for large, multi-dimensional arrays and efficient mathematical operations. It differs from Python lists by being more memory-efficient and enabling element-wise operations through broadcasting. Key functions include creating arrays of zeros or ones, generating ranges, and computing statistical measures like mean and standard deviation.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

NumPy Theoretical Interview Questions & Answers

1. What is NumPy?

NumPy (Numerical Python) is a powerful library for numerical computing in Python. It provides
support for large, multi-dimensional arrays and matrices, along with a collection of mathematical
functions to operate on these arrays efficiently.

2. How is NumPy different from Python lists?

NumPy arrays are more efficient than Python lists because they consume less memory and provide
faster execution for numerical computations. Unlike lists, NumPy arrays support element-wise
operations and broadcasting, making vectorized operations possible.

3. How do you create a NumPy array?

You can create a NumPy array using the `numpy.array()` function by passing a list or tuple.
Example:
import numpy as np
arr = np.array([1, 2, 3, 4, 5])

4. What is broadcasting in NumPy?

Broadcasting is a feature in NumPy that allows arrays with different shapes to be operated on
together. NumPy automatically expands smaller arrays to match the shape of larger ones, making
element-wise operations efficient.

5. What are some key functions in NumPy?

Some commonly used NumPy functions include:


- `np.zeros(shape)`: Creates an array of zeros.
- `np.ones(shape)`: Creates an array of ones.
- `np.arange(start, stop, step)`: Generates a range of values.
- `np.linspace(start, stop, num)`: Generates evenly spaced numbers.
- `np.mean(array)`: Computes the mean.
- `np.std(array)`: Computes the standard deviation.

You might also like