wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Unit 8: Data Processing with NumPy & Pandas

Total questions: 77

Worksheet time: 13mins

Name
Class
Date
1.

Which of the following statements is TRUE about NumPy arrays?

a)

NumPy arrays are slower than Python lists

b)

NumPy arrays are only for one-dimensional data

c)

NumPy arrays are faster and more efficient than Python lists

d)

NumPy arrays cannot be used for scientific computing

2.

Fill in the blank: To import the NumPy package in Python, you use the command: ________

a)

import numpy as np

b)

import np as numpy

c)

from numpy import np

d)

import numpy

3.

Which code snippet creates a 2D array (matrix) in NumPy?

a)

A) a = np.array([1, 2, 3, 4])

b)

B) b = np.array([[1, 2, 3], [4, 5, 6]])

c)

C) a = np.empty([2, 2], dtype = int)

d)

D) b = np.empty(3, dtype = int)

4.

Which function is used to create an empty array in NumPy?

a)

np.array()

b)

np.zeros()

c)

np.empty()

d)

np.ones()

5.

Which Numpy function creates an array from a Python list or tuple?

a)

np.zeros()

b)

np.ones()

c)

np.array()

d)

np.empty()

6.

Fill in the blank: np.zeros() creates an array filled with _______.

a)

zeros

b)

ones

c)

random values

d)

NaNs

7.

Fill in the blank: np.ones() creates an array filled with _______.

a)

ones

b)

zeros

c)

random values

d)

infinity

8.

Fill in the blank: np.empty() creates an _______ array without initializing its contents.

a)

empty

b)

full

c)

random

d)

zero

9.

Which Numpy function creates an array with evenly spaced values within a given interval?

a)

np.array()

b)

np.arange()

c)

np.ones()

d)

np.empty()

10.

Fill in the blank: np.linspace() creates an array with a specified number of evenly spaced values over a given _______.

a)

interval

b)

matrix

c)

function

d)

index

11.

What is the output of print(add_ans)?

a)

[ 7 77 23 130]

b)

[ 7 77 23 30]

c)

[ 7 77 23 13]

d)

[ 7 77 23 10]

12.

What is the output of print(add_ans)?

a)

[ 7 77 23 130]

b)

[ 7 77 23 13]

c)

[ 7 77 23 30]

d)

[ 7 77 23 120]

13.

What is the output of print(add_ans)?

a)

[ 8 79 26 134]

b)

[ 8 79 26 34]

c)

[ 8 79 25 134]

d)

[ 8 78 26 134]

14.

What is the output of print(add_ans)?

a)

[ 8 79 26 134]

b)

[ 8 79 26 34]

c)

[ 8 79 26 124]

d)

[ 8 79 26 104]

15.

Which NumPy functions are used for arithmetic operations?

a)

np.add(), np.subtract(), np.multiply(), np.divide(), np.power(), np.sqrt()

b)

np.sin(), np.cos(), np.tan()

c)

np.log(), np.exp()

d)

np.mean(), np.median()

16.

Which NumPy functions are used for trigonometric operations?

a)

np.add(), np.subtract()

b)

np.sin(), np.cos(), np.tan()

c)

np.log(), np.exp()

d)

np.mean(), np.median()

17.

Which NumPy functions are used for logarithmic and exponential operations?

a)

np.add(), np.subtract()

b)

np.sin(), np.cos(), np.tan()

c)

np.log(), np.exp()

d)

np.mean(), np.median()

18.

Which NumPy functions are used for statistical operations?

a)

np.mean(), np.median(), np.std(), np.var(), np.min(), np.max(), np.sum()

b)

np.add(), np.subtract()

c)

np.sin(), np.cos(), np.tan()

d)

np.log(), np.exp()

19.

What is the output of print(a.shape) if a is a NumPy array with 4 elements?

a)

(4,)

b)

(1,4)

c)

(4,1)

d)

4

20.

What is the output of print(b.shape) if b is a NumPy array with 2 rows and 3 columns?

a)

(2, 3)

b)

(3, 2)

c)

(2, 2)

d)

(3, 3)

21.

What does print(a.ndim) return for a 1-dimensional NumPy array?

a)

1 dimension

b)

0 dimensions

c)

2 dimensions

d)

3 dimensions

22.

What does print(b.ndim) return for a 2-dimensional NumPy array?

a)

2 dimensions

b)

1 dimension

c)

3 dimensions

d)

0 dimensions

23.

What does print(a.size) return for a NumPy array with ?

a)

4 elements

b)

2 elements

c)

8 elements

d)

1 element

24.

Given the sample marks array: marks = np.array([65, 78, 49, 82, 90, 55, 33, 71, 88, 92]), which NumPy function would you use to compute the average score?

a)

np.mean()

b)

np.max()

c)

np.min()

d)

np.sum()

25.

Given the sample marks array: marks = np.array([65, 78, 49, 82, 90, 55, 33, 71, 88, 92]), which NumPy function would you use to compute the highest mark?

a)

np.mean()

b)

np.max()

c)

np.min()

d)

np.sum()

26.

Given the sample marks array: marks = np.array([65, 78, 49, 82, 90, 55, 33, 71, 88, 92]), which NumPy function would you use to compute the lowest mark?

a)

np.mean()

b)

np.max()

c)

np.min()

d)

np.sum()

27.

Given the sample marks array: marks = np.array([65, 78, 49, 82, 90, 55, 33, 71, 88, 92]), which NumPy function would you use to compute the standard deviation?

a)

np.mean()

b)

np.std()

c)

np.var()

d)

np.sum()

28.

What is Pandas?

a)

A powerful, fast, and open-source library built on NumPy for data manipulation and real-world data analysis in Python.

b)

A Python web development framework.

c)

A machine learning algorithm.

d)

A database management system.

29.

Which of the following is NOT a main use of Pandas?

a)

Web page designing

b)

Data cleaning

c)

Table processing

d)

Excel/CSV reading & writing

e)

Statistics

30.

Fill in the blank: Pandas DataFrame is a way to represent and work with ______ data. It organizes data into rows and columns, making it a two-dimensional data structure.

a)

tabular

b)

circular

c)

linear

d)

hierarchical

31.

Which function is used to read a CSV file and load it into a Pandas DataFrame?

a)

pd.read_csv

b)

pd.load_data

c)

pd.import_csv

d)

pd.read_table

32.

What does data_frame.head() display by default?

a)

The first five rows

b)

The last five rows

c)

All rows

d)

The first row only

33.

What function is used to display the first five rows of a DataFrame in Python?

a)

display(data_frame.head())

b)

data_frame.show()

c)

data_frame.first()

d)

data_frame.top()

34.

What function is used to display the last five rows of a DataFrame in Python?

a)

display(data_frame.tail())

b)

display(data_frame.head())

c)

display(data_frame.last())

d)

display(data_frame.show())

35.

Which code snippet prints all the column names of a DataFrame?

a)

print(data_frame.columns)

b)

print(list(data_frame.columns))

c)

print(data_frame.head())

d)

print(data_frame.tail())

36.

Which function prints the summary of a DataFrame, including data type, number of rows, columns, non-null values, and memory usage?

a)

data_frame.head()

b)

data_frame.tail()

c)

data_frame.info()

d)

data_frame.sum()

37.

Which function detects missing values in a DataFrame and returns a boolean object indicating if the values are NA?

a)

data_frame.info()

b)

data_frame.isnull()

c)

data_frame.sum()

d)

data_frame.head()

38.

To find the number of missing values in the dataset, which code should be used?

a)

data_frame.isnull().sum()

b)

data_frame.dropna()

c)

data_frame.fillna(0)

d)

data_frame.count()

39.

What does the data_frame.dropna() function do in Python?

a)

Removes duplicate rows

b)

Removes columns or rows which contain at least one missing value

c)

Adds new columns

d)

Renames rows

40.

Fill in the blank: By default, data_frame.dropna() drops the rows where at least one element is _________.

a)

missing

b)

zero

c)

duplicated

d)

sorted

41.

Which argument should be used with data_frame.dropna() to drop columns where at least one element is missing?

a)

A) axis = 0

b)

B) axis = 1

c)

C) inplace = True

d)

D) value = None

42.

Fill in the blank: To fill all null values in a data frame with a specific value, use the function data_frame.________(value).

a)

fillna

b)

replace

c)

dropna

d)

isnull

43.

Which function is used to drop a row at a particular index in a data frame?

a)

dropna()

b)

fillna()

c)

drop(index)

d)

rename()

44.

Fill in the blank: To rename the rows or columns of a data frame, use the function data_frame.________({0:"First",1:"Second"}).

a)

rename

b)

drop

c)

sort

d)

filter

45.

Fill in the blank: To create a new column with all the values equal to 1, use the following code: data_frame['col'] = data_frame['col'].________(1)

a)

fillna

b)

replace

c)

map

d)

apply

46.

In the given data frame, what is the age of Jeevan?

a)

25

b)

30

c)

22

d)

28

47.

In the given data frame, what is the qualification of Geeta?

a)

MCA

b)

B.Tech

c)

MBA

d)

B.Sc

48.

Fill in the blank: In the given data frame, who has the qualification 'Phd'?

a)

Bheem

b)

Raju

c)

Chutki

d)

Jaggu

49.

Fill in the blank: In the given data frame, who is 24 years old?

a)

Raavan

b)

Ram

c)

Lakshman

d)

Bharat

50.

The sort_values() function in pandas is used to:

a)

Sort a DataFrame by the values of one or more columns

b)

Remove duplicate rows from a DataFrame

c)

Replace missing values in a DataFrame

d)

Group data based on column values

51.

Which function in pandas is used for standard database join operations?

a)

merge()

b)

concat()

c)

groupby()

d)

pivot_table()

52.

The sort_values() function sorts the array in descending order by default.

a)

True

b)

False

53.

Which columns are used to sort the data frame in the code: data_frame.sort_values(by=['Age','Annual Income (k$)']).head(10)?

a)

Age and Qualification

b)

Age and Annual Income (k$)

c)

Name and Age

d)

Qualification and Annual Income (k$)

54.

What is the salary of Jeevan in the data frame?

a)

100000

b)

50000

c)

75000

d)

120000

55.

What is the qualification of Geeta in the merged data frame?

a)

MCA

b)

B.Tech

c)

MBA

d)

B.Sc

56.

What is the age of Raavan in the merged data frame?

a)

24

b)

21

c)

27

d)

30

57.

Fill in the blank: What is the name of the person with a salary of 40000 in the data frame?

a)

Bheem

b)

Raju

c)

Seema

d)

Anil

58.

What will be the value of 'Customer Satisfaction' for CustomerID 1 with a Spending Score of 39?

a)

No

b)

Yes

c)

Maybe

d)

Not Available

59.

What will be the value of 'Customer Satisfaction' for CustomerID 2 with a Spending Score of 81?

a)

Yes

b)

No

c)

Maybe

d)

Not Available

60.

What will be the value of 'Customer Satisfaction' for CustomerID 3 with a Spending Score of 6?

a)

No

b)

Yes

c)

Maybe

d)

Not Available

61.

What will be the value of 'Customer Satisfaction' for CustomerID 4 with a Spending Score of 77?

a)

Yes

b)

No

c)

Maybe

d)

Not Available

62.

What will be the value of 'Customer Satisfaction' for CustomerID 5 with a Spending Score of 40?

a)

No

b)

Yes

c)

Maybe

d)

Not Available

63.

What will be the value of 'Customer Satisfaction' for CustomerID 6 with a Spending Score of 76?

a)

Yes

b)

No

c)

Maybe

d)

Not Available

64.

What will be the value of 'Customer Satisfaction' for CustomerID 7 with a Spending Score of 6?

a)

No

b)

Yes

c)

Maybe

d)

Not Available

65.

What will be the value of 'Customer Satisfaction' for CustomerID 8 with a Spending Score of 94?

a)

Yes

b)

No

c)

Maybe

d)

Not Available

66.

What will be the value of 'Customer Satisfaction' for CustomerID 9 with a Spending Score of 3?

a)

No

b)

Yes

c)

Maybe

d)

Not Available

67.

What will be the value of 'Customer Satisfaction' for CustomerID 10 with a Spending Score of 72?

a)

Yes

b)

No

c)

Maybe

d)

Not Available

68.

What is the Customer Satisfaction for CustomerID 1?

a)

Yes

b)

No

c)

Neutral

d)

Not Available

69.

What is the Genre of CustomerID 2?

a)

Female

b)

Male

c)

Other

d)

Unknown

70.

What is the Spending Score (1-100) for CustomerID 3?

a)

77

b)

42

c)

59

d)

88

71.

What is the Age value for CustomerID 4?

a)

0.442857

b)

0.512345

c)

0.389123

d)

0.601234

72.

Which Python function is generally used to apply log transformations and normalize the data to bring it in the range of 0 to 1 for particular columns of the data?

a)

lambda

b)

plot

c)

head

d)

max

73.

What is the purpose of the plot() function in Python as described in the worksheet?

a)

To apply log transformations

b)

To make plots of the data frames

c)

To normalize data

d)

To create new columns

74.

What type of plot is shown in the first output image?

a)

Bar plot

b)

Scatter plot

c)

Line plot

d)

Pie chart

75.

Fill in the blank: The plot.hist() function is used to make ______ of the data frames.

a)

plots

b)

tables

c)

arrays

d)

strings

76.

What does the histogram in the second output image represent?

a)

Distribution of CustomerID only

b)

Distribution of Age only

c)

Distribution of the data (CustomerID, Age, Annual Income, Spending Score)

d)

Distribution of Annual Income only

77.

To analyze school performance using the provided dataset and tools, which key metrics should you focus on and why?

a)

Student achievement, attendance rates, and graduation rates because they directly reflect school performance.

b)

Classroom wall colors, school mascot, and lunch menu because they influence student mood.

c)

Number of sports trophies, school logo design, and parking lot size because they show school prestige.

d)

Teacher handwriting style, school bell sound, and hallway length because they affect daily routines.