NEW
Font size
WorksheetsUnit 8: Data Processing with NumPy & Pandas
Total questions: 77
Worksheet time: 13mins
Which of the following statements is TRUE about NumPy arrays?
NumPy arrays are slower than Python lists
NumPy arrays are only for one-dimensional data
NumPy arrays are faster and more efficient than Python lists
NumPy arrays cannot be used for scientific computing
Fill in the blank: To import the NumPy package in Python, you use the command: ________
import numpy as np
import np as numpy
from numpy import np
import numpy
Which code snippet creates a 2D array (matrix) in NumPy?
A) a = np.array([1, 2, 3, 4])
B) b = np.array([[1, 2, 3], [4, 5, 6]])
C) a = np.empty([2, 2], dtype = int)
D) b = np.empty(3, dtype = int)
Which function is used to create an empty array in NumPy?
np.array()
np.zeros()
np.empty()
np.ones()
Which Numpy function creates an array from a Python list or tuple?
np.zeros()
np.ones()
np.array()
np.empty()
Fill in the blank: np.zeros() creates an array filled with _______.
zeros
ones
random values
NaNs
Fill in the blank: np.ones() creates an array filled with _______.
ones
zeros
random values
infinity
Fill in the blank: np.empty() creates an _______ array without initializing its contents.
empty
full
random
zero
Which Numpy function creates an array with evenly spaced values within a given interval?
np.array()
np.arange()
np.ones()
np.empty()
Fill in the blank: np.linspace() creates an array with a specified number of evenly spaced values over a given _______.
interval
matrix
function
index
What is the output of print(add_ans)?
[ 7 77 23 130]
[ 7 77 23 30]
[ 7 77 23 13]
[ 7 77 23 10]
What is the output of print(add_ans)?
[ 7 77 23 130]
[ 7 77 23 13]
[ 7 77 23 30]
[ 7 77 23 120]
What is the output of print(add_ans)?
[ 8 79 26 134]
[ 8 79 26 34]
[ 8 79 25 134]
[ 8 78 26 134]
What is the output of print(add_ans)?
[ 8 79 26 134]
[ 8 79 26 34]
[ 8 79 26 124]
[ 8 79 26 104]
Which NumPy functions are used for arithmetic operations?
np.add(), np.subtract(), np.multiply(), np.divide(), np.power(), np.sqrt()
np.sin(), np.cos(), np.tan()
np.log(), np.exp()
np.mean(), np.median()
Which NumPy functions are used for trigonometric operations?
np.add(), np.subtract()
np.sin(), np.cos(), np.tan()
np.log(), np.exp()
np.mean(), np.median()
Which NumPy functions are used for logarithmic and exponential operations?
np.add(), np.subtract()
np.sin(), np.cos(), np.tan()
np.log(), np.exp()
np.mean(), np.median()
Which NumPy functions are used for statistical operations?
np.mean(), np.median(), np.std(), np.var(), np.min(), np.max(), np.sum()
np.add(), np.subtract()
np.sin(), np.cos(), np.tan()
np.log(), np.exp()
What is the output of print(a.shape) if a is a NumPy array with 4 elements?
(4,)
(1,4)
(4,1)
4
What is the output of print(b.shape) if b is a NumPy array with 2 rows and 3 columns?
(2, 3)
(3, 2)
(2, 2)
(3, 3)
What does print(a.ndim) return for a 1-dimensional NumPy array?
1 dimension
0 dimensions
2 dimensions
3 dimensions
What does print(b.ndim) return for a 2-dimensional NumPy array?
2 dimensions
1 dimension
3 dimensions
0 dimensions
What does print(a.size) return for a NumPy array with ?
4 elements
2 elements
8 elements
1 element
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?
np.mean()
np.max()
np.min()
np.sum()
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?
np.mean()
np.max()
np.min()
np.sum()
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?
np.mean()
np.max()
np.min()
np.sum()
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?
np.mean()
np.std()
np.var()
np.sum()
What is Pandas?
A powerful, fast, and open-source library built on NumPy for data manipulation and real-world data analysis in Python.
A Python web development framework.
A machine learning algorithm.
A database management system.
Which of the following is NOT a main use of Pandas?
Web page designing
Data cleaning
Table processing
Excel/CSV reading & writing
Statistics
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.
tabular
circular
linear
hierarchical
Which function is used to read a CSV file and load it into a Pandas DataFrame?
pd.read_csv
pd.load_data
pd.import_csv
pd.read_table
What does data_frame.head() display by default?
The first five rows
The last five rows
All rows
The first row only
What function is used to display the first five rows of a DataFrame in Python?
display(data_frame.head())
data_frame.show()
data_frame.first()
data_frame.top()
What function is used to display the last five rows of a DataFrame in Python?
display(data_frame.tail())
display(data_frame.head())
display(data_frame.last())
display(data_frame.show())
Which code snippet prints all the column names of a DataFrame?
print(data_frame.columns)
print(list(data_frame.columns))
print(data_frame.head())
print(data_frame.tail())
Which function prints the summary of a DataFrame, including data type, number of rows, columns, non-null values, and memory usage?
data_frame.head()
data_frame.tail()
data_frame.info()
data_frame.sum()
Which function detects missing values in a DataFrame and returns a boolean object indicating if the values are NA?
data_frame.info()
data_frame.isnull()
data_frame.sum()
data_frame.head()
To find the number of missing values in the dataset, which code should be used?
data_frame.isnull().sum()
data_frame.dropna()
data_frame.fillna(0)
data_frame.count()
What does the data_frame.dropna() function do in Python?
Removes duplicate rows
Removes columns or rows which contain at least one missing value
Adds new columns
Renames rows
Fill in the blank: By default, data_frame.dropna() drops the rows where at least one element is _________.
missing
zero
duplicated
sorted
Which argument should be used with data_frame.dropna() to drop columns where at least one element is missing?
A) axis = 0
B) axis = 1
C) inplace = True
D) value = None
Fill in the blank: To fill all null values in a data frame with a specific value, use the function data_frame.________(value).
fillna
replace
dropna
isnull
Which function is used to drop a row at a particular index in a data frame?
dropna()
fillna()
drop(index)
rename()
Fill in the blank: To rename the rows or columns of a data frame, use the function data_frame.________({0:"First",1:"Second"}).
rename
drop
sort
filter
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)
fillna
replace
map
apply
In the given data frame, what is the age of Jeevan?
25
30
22
28
In the given data frame, what is the qualification of Geeta?
MCA
B.Tech
MBA
B.Sc
Fill in the blank: In the given data frame, who has the qualification 'Phd'?
Bheem
Raju
Chutki
Jaggu
Fill in the blank: In the given data frame, who is 24 years old?
Raavan
Ram
Lakshman
Bharat
The sort_values() function in pandas is used to:
Sort a DataFrame by the values of one or more columns
Remove duplicate rows from a DataFrame
Replace missing values in a DataFrame
Group data based on column values
Which function in pandas is used for standard database join operations?
merge()
concat()
groupby()
pivot_table()
The sort_values() function sorts the array in descending order by default.
True
False
Which columns are used to sort the data frame in the code: data_frame.sort_values(by=['Age','Annual Income (k$)']).head(10)?
Age and Qualification
Age and Annual Income (k$)
Name and Age
Qualification and Annual Income (k$)
What is the salary of Jeevan in the data frame?
100000
50000
75000
120000
What is the qualification of Geeta in the merged data frame?
MCA
B.Tech
MBA
B.Sc
What is the age of Raavan in the merged data frame?
24
21
27
30
Fill in the blank: What is the name of the person with a salary of 40000 in the data frame?
Bheem
Raju
Seema
Anil
What will be the value of 'Customer Satisfaction' for CustomerID 1 with a Spending Score of 39?
No
Yes
Maybe
Not Available
What will be the value of 'Customer Satisfaction' for CustomerID 2 with a Spending Score of 81?
Yes
No
Maybe
Not Available
What will be the value of 'Customer Satisfaction' for CustomerID 3 with a Spending Score of 6?
No
Yes
Maybe
Not Available
What will be the value of 'Customer Satisfaction' for CustomerID 4 with a Spending Score of 77?
Yes
No
Maybe
Not Available
What will be the value of 'Customer Satisfaction' for CustomerID 5 with a Spending Score of 40?
No
Yes
Maybe
Not Available
What will be the value of 'Customer Satisfaction' for CustomerID 6 with a Spending Score of 76?
Yes
No
Maybe
Not Available
What will be the value of 'Customer Satisfaction' for CustomerID 7 with a Spending Score of 6?
No
Yes
Maybe
Not Available
What will be the value of 'Customer Satisfaction' for CustomerID 8 with a Spending Score of 94?
Yes
No
Maybe
Not Available
What will be the value of 'Customer Satisfaction' for CustomerID 9 with a Spending Score of 3?
No
Yes
Maybe
Not Available
What will be the value of 'Customer Satisfaction' for CustomerID 10 with a Spending Score of 72?
Yes
No
Maybe
Not Available
What is the Customer Satisfaction for CustomerID 1?
Yes
No
Neutral
Not Available
What is the Genre of CustomerID 2?
Female
Male
Other
Unknown
What is the Spending Score (1-100) for CustomerID 3?
77
42
59
88
What is the Age value for CustomerID 4?
0.442857
0.512345
0.389123
0.601234
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?
lambda
plot
head
max
What is the purpose of the plot() function in Python as described in the worksheet?
To apply log transformations
To make plots of the data frames
To normalize data
To create new columns
What type of plot is shown in the first output image?
Bar plot
Scatter plot
Line plot
Pie chart
Fill in the blank: The plot.hist() function is used to make ______ of the data frames.
plots
tables
arrays
strings
What does the histogram in the second output image represent?
Distribution of CustomerID only
Distribution of Age only
Distribution of the data (CustomerID, Age, Annual Income, Spending Score)
Distribution of Annual Income only
To analyze school performance using the provided dataset and tools, which key metrics should you focus on and why?
Student achievement, attendance rates, and graduation rates because they directly reflect school performance.
Classroom wall colors, school mascot, and lunch menu because they influence student mood.
Number of sports trophies, school logo design, and parking lot size because they show school prestige.
Teacher handwriting style, school bell sound, and hallway length because they affect daily routines.
