{ "@context": "https://schema.org", "@type": "Organization", "name": "Brainscape", "url": "https://www.brainscape.com/", "logo": "https://www.brainscape.com/pks/images/cms/public-views/shared/Brainscape-logo-c4e172b280b4616f7fda.svg", "sameAs": [ "https://www.facebook.com/Brainscape", "https://x.com/brainscape", "https://www.linkedin.com/company/brainscape", "https://www.instagram.com/brainscape/", "https://www.tiktok.com/@brainscapeu", "https://www.pinterest.com/brainscape/", "https://www.youtube.com/@BrainscapeNY" ], "contactPoint": { "@type": "ContactPoint", "telephone": "(929) 334-4005", "contactType": "customer service", "availableLanguage": ["English"] }, "founder": { "@type": "Person", "name": "Andrew Cohen" }, "description": "Brainscape’s spaced repetition system is proven to DOUBLE learning results! Find, make, and study flashcards online or in our mobile app. Serious learners only.", "address": { "@type": "PostalAddress", "streetAddress": "159 W 25th St, Ste 517", "addressLocality": "New York", "addressRegion": "NY", "postalCode": "10001", "addressCountry": "USA" } }

Programming Part 3 Flashcards

(25 cards)

1
Q

What is NumPy used for?

A

Efficient numerical computing with arrays.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the main data structure in NumPy?

A

The ndarray (n-dimensional array).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How do you import NumPy?

A

import numpy as np

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How do you create a NumPy array from a list?

A

np.array([1, 2, 3])

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How do you create an array of zeros?

A

np.zeros((rows, cols))

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How do you get the shape of a NumPy array?

A

Using array.shape

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How do you reshape an array?

A

Using array.reshape(new_shape)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What does np.arange() do?

A

Creates an array with regularly spaced values.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What does np.linspace() do?

A

Generates evenly spaced values over a specified range.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is broadcasting in NumPy?

A

Automatic expansion of arrays with different shapes for element-wise operations.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How do you slice a NumPy array?

A

Using array[start:stop:step]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How do you index a 2D array?

A

Using array[row, column]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is boolean indexing in NumPy?

A

Using a boolean array to filter values.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How do you access a single row in a 2D array?

A

Using array[row_index, :]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How do you access a single column in a 2D array?

A

Using array[:, col_index]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How do you compute the sum of an array?

A

Using np.sum(array)

17
Q

How do you compute the mean of an array?

A

Using np.mean(array)

18
Q

How do you compute the standard deviation?

A

Using np.std(array)

19
Q

How do you find the max value in an array?

A

Using np.max(array)

20
Q

How do you compute element-wise multiplication?

A

Using array1 * array2

21
Q

How do you generate random numbers in NumPy?

A

Using np.random

22
Q

How do you set the random seed in NumPy?

A

np.random.seed(42)

23
Q

Why is NumPy faster than regular Python lists?

A

Because it uses fixed-typed, contiguous memory and vectorized operations.

24
Q

What is vectorization?

A

Replacing explicit loops with array operations.

25
What does np.dot() do?
Computes the dot product of two arrays.