wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

NumPy Worksheet

Total questions: 20

Worksheet time: 13mins

Name
Class
Date
1.

What does NumPy stand for?

a)

New Python

b)

Numerical Python

c)

Numeral Processor

d)

Nested Python

2.

Who created NumPy in 2005?

a)

Wes McKinney

b)

Travis Oliphant

c)

Guido van Rossum

d)

John D. Hunter

3.

Which of the following is NOT a domain NumPy provides functions for?

a)

Linear algebra

b)

Fourier transform

c)

Matrices

d)

Graphical user interfaces

4.

Why are NumPy arrays up to 50x faster than Python lists?

a)

They support different data types per element

b)

They are stored in contiguous memory

c)

They are slower for general-purpose objects

d)

They simulate 2D/3D with nested lists

5.

What is the core array object in NumPy called?

a)

list

b)

ndarray

c)

tuple

d)

dict

6.

Which NumPy function creates an array filled with zeros of shape (3,3)?

a)

np.ones((3,3))

b)

np.zeros((3,3))

c)

np.full((3,3), 1)

d)

np.eye(3)

7.

What does np.arange(0, 10, 2) return?

a)

array([0., 0.25, 0.5, 0.75, 1.])

b)

array([0, 2, 4, 6, 8])

c)

array([10., 31.62, 100., 316.23, 1000.])

d)

array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]])

8.

What is 2 + 2?

4 lines
9.

Fill in the blank: The capital of France is ____.

a)

Paris

b)

London

c)

Berlin

d)

Rome

10.

Which method creates a DataFrame from a dictionary of lists?

a)

pd.read_csv()

b)

pd.DataFrame({'col1': [1,2], 'col2': [3,4]})

c)

pd.Series([1,2])

d)

np.array()

11.

How do you read a CSV file into a DataFrame?

a)

pd.to_csv('file.csv')

b)

pd.read_json('file.csv')

c)

pd.read_csv('file.csv')

d)

pd.write_csv('file.csv')

12.

Which Pandas feature handles missing data represented as NaN?

a)

Easy handling of missing data

b)

Fourier transform

c)

Linear algebra

d)

Identity matrix creation

13.

What does boolean indexing do in Pandas filtering?

a)

Sorts data by columns

b)

Selects rows based on conditions

c)

Merges DataFrames

d)

Creates Series from dict

14.

Which method selects specific columns from a DataFrame?

a)

df.loc[['A','B']]

b)

df[['A','B']]

c)

df.groupby(['A','B'])

d)

df.sort_values(['A','B'])

15.

How do you access rows by label in Pandas?

a)

df.iloc[0]

b)

df.loc['label']

c)

df[0]

d)

df.sum()

16.

Which method groups data by one or more columns in Pandas?

a)

df.sort_values()

b)

df.groupby()

c)

df.merge()

d)

df.filter()

17.

What does df.sort_values(by='Score') do?

a)

Aggregates scores

b)

Sorts the DataFrame by 'Score' column

c)

Filters rows with 'Score'

d)

Merges on 'Score'

18.

Which aggregation function computes the average of a column?

a)

df['col'].sum()

b)

df['col'].mean()

c)

df['col'].min()

d)

df['col'].count()

19.

How do you merge two DataFrames on a common column 'Name'?

a)

pd.concat(df1, df2)

b)

pd.merge(df1, df2, on='Name')

c)

df1.groupby('Name')

d)

df1.sort_values('Name')

20.

What does df.to_csv('output.csv') do?

a)

Reads a CSV file

b)

Saves the DataFrame to a CSV file

c)

Creates a new DataFrame from CSV

d)

Filters the CSV data