wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Data Preprocessing - 1

Total questions: 40

Worksheet time: 38mins

Name
Class
Date
1.

What does np.random.rand(2,3) generate?

a)

2D array with random integers

b)

2D array with random floats between 0 and 1

c)

3D array with random integers

d)

Array with random Gaussian distribution

2.

What does np.linspace(0, 10, 5) produce?

a)

Five evenly spaced numbers from 0 to 10

b)

Ten evenly spaced numbers from 0 to 5

c)

Sequence of integers

d)

None of the above

3.

What is the output of np.eye(3)?

a)

3×3 identity matrix

b)

3×3 zero matrix

c)

3×3 matrix of ones

d)

None of the above

4.

Which NumPy method is used to check for NaN values?

a)

np.isnan()

b)

np.isnull()

c)

np.missing()

d)

np.check_nan()

5.

Which NumPy function is used to compute the cumulative sum?

a)

np.cumsum()

b)

np.sum()

c)

np.add()

d)

np.total()

6.

In NumPy, axis=1 in a sum function means:

a)

Sum across columns

b)

Sum across rows

c)

Sum diagonally

d)

Sum all elements

7.

Which function is used to write a DataFrame to a CSV file?

a)

to_csv()

b)

write_csv()

c)

save_csv()

d)

export_csv()

8.

What does df.head(3) do?

a)

Returns first 3 rows

b)

Returns last 3 rows

c)

Returns first 3 columns

d)

Returns first 3 values

9.

Which pandas function resets the index of a DataFrame?

a)

reset_index()

b)

drop_index()

c)

clear_index()

d)

set_index()

10.

Which function gives the count of non-null values per column?

a)

count()

b)

len()

c)

non_null()

d)

notnull()

11.

Which method is used to remove a specific column in pandas?

a)

drop()

b)

remove()

c)

delcol()

d)

delete()

12.

Which attribute of DataFrame shows the number of rows and columns?

a)

shape

b)

ndim

c)

size

d)

count

13.

Which pandas data structure is 1-dimensional?

a)

Series

b)

DataFrame

c)

Panel

d)

Array

14.

Which function is used to create a line plot in matplotlib?

a)

plt.plot()

b)

plt.line()

c)

plt.draw()

d)

plt.graph()

15.

Which function displays the plot on the screen?

a)

plt.show()

b)

plt.display()

c)

plt.plot()

d)

plt.render()

16.

Which function is used to set the title of a plot?

a)

plt.title()

b)

plt.heading()

c)

plt.caption()

d)

plt.head()

17.

Which matplotlib function is used to create a histogram?

a)

plt.hist()

b)

plt.bar()

c)

plt.histogram()

d)

plt.chart()

18.

How do you label the X-axis in matplotlib?

a)

plt.xlabel()

b)

plt.xaxis()

c)

plt.set_xlabel()

d)

plt.labelx()

19.

Which function is used for scatter plots?

a)

plt.scatter()

b)

plt.plot()

c)

plt.dotplot()

d)

plt.points()

20.

Which argument in plt.plot() is used for line style?

a)

linestyle

b)

line

c)

style

d)

ls

21.

What does plt.grid(True) do?

a)

Shows grid lines

b)

Removes grid lines

c)

Creates a table

d)

None of the above

22.

Which imputation method is preferred for continuous numeric data?

a)

Mean

b)

Mode

c)

Median

d)

None of the above

23.

Which library contains StandardScaler?

a)

scikit-learn

b)

pandas

c)

numpy

d)

matplotlib

24.

What is the purpose of label encoding?

a)

Convert categorical to numeric

b)

Normalize numeric values

c)

Remove missing values

d)

Detect outliers

25.

What does one-hot encoding create?

a)

Dummy variables

b)

Continuous features

c)

Missing values

d)

Labels

26.

Which library function is used for one-hot encoding?

a)

pd.get_dummies()

b)

np.dummies()

c)

plt.dummies()

d)

sklearn.get_dummies()

27.

Which method detects outliers using quartiles?

a)

IQR

b)

Z-score

c)

Boxplot

d)

Standard deviation

28.

Which measure of central tendency is the middle value?

a)

Mean

b)

Median

c)

Mode

d)

Range

29.

Which measure represents the spread of data?

a)

Variance

b)

Mean

c)

Median

d)

Mode

30.

Which distribution is symmetric and bell-shaped?

a)

Normal distribution

b)

Poisson distribution

c)

Binomial distribution

d)

Exponential distribution

31.

Which measure is most affected by outliers?

a)

Mean

b)

Median

c)

Mode

d)

Range

32.

What does standard deviation measure?

a)

Dispersion

b)

Central tendency

c)

Skewness

d)

Kurtosis

33.

What is the probability of an impossible event?

a)

0

b)

1

c)

0.5

d)

Undefined

34.

Which value divides the dataset into two equal halves?

a)

Median

b)

Mean

c)

Mode

d)

Range

35.

Which statistic measures the relationship between two variables?

a)

Correlation

b)

Variance

c)

Mean

d)

Standard deviation

36.

What does np.sum([1, 2, 3]) return?

a)

None of the above

b)

6

c)

1

d)

3

37.

What is the purpose of the dropna() function in pandas?

a)

Group data

b)

Sort values

c)

Fill missing values

d)

Remove missing values

38.

Which function is used to create a scatter plot in matplotlib?

a)

plt.bar()

b)

plt.plot()

c)

plt.line()

d)

plt.scatter()

39.

Which method is used to fill missing values in a DataFrame?

a)

fill_missing()

b)

impute()

c)

replace_na()

d)

fillna()

40.

What does the function pd.concat() do?

a)

Concatenates DataFrames

b)

Splits DataFrames

c)

Joins DataFrames

d)

Merges DataFrames