NEW
Font size
S
M
L
XL
WorksheetsWarmup - Python - Machine Learning
Total questions: 30
Worksheet time: 15mins
Name
Class
Date
1.
What is the correct file extension for Python files?
a)
.pyth
b)
.pt
c)
.py
d)
.pyt
2.
Which keyword is used to define a function in Python?
a)
func
b)
define
c)
def
d)
function
3.
Which of these data types is immutable in Python?
a)
List
b)
Tuple
c)
Dictionary
d)
Set
4.
How do you insert comments in Python code?
a)
/* comment */
b)
<!-- comment -->
c)
// comment
d)
# comment
5.
What does the len() function do in Python?
a)
Returns the type of a variable
b)
Returns the number of items in an object
c)
Returns the memory address
d)
None of the above
6.
Which of the following is used to handle exceptions in Python?
a)
try-except
b)
do-catch
c)
handle-except
d)
error-catch
7.
Which method is used to add an item to a list?
a)
add()
b)
append()
c)
insert()
d)
push()
8.
Which of these is not a valid Python loop?
a)
for
b)
while
c)
loop
d)
None of the above
9.
How do you create a variable with the numeric value 5?
a)
x == 5
b)
x := 5
c)
x = 5
d)
x <− 5
10.
Which operator is used for exponentiation in Python?
a)
^
b)
**
c)
exp()
d)
^^
11.
Which function is used to create a NumPy array?
a)
array()
b)
list()
c)
np.create()
d)
np.make_array()
12.
How do you get the shape of a NumPy array 'arr'?
a)
arr.size
b)
arr.shape()
c)
shape(arr)
d)
arr.shape
13.
Which function in NumPy returns evenly spaced values within a range?
a)
np.linspace()
b)
np.range()
c)
np.arange()
d)
np.space()
14.
What does the Pandas function head() do?
a)
Returns the last 5 rows
b)
Deletes the first 5 rows
c)
Returns the first 5 rows
d)
Sorts the DataFrame
15.
Which Pandas function reads a CSV file?
a)
pd.load()
b)
pd.read_csv()
c)
pd.open_csv()
d)
pd.csv_read()
16.
What is the use of 'groupby' in Pandas?
a)
To group rows for aggregation
b)
To filter missing values
c)
To visualize data
d)
To merge DataFrames
17.
Which Matplotlib function plots a line graph?
a)
plot.line()
b)
plt.plot()
c)
line()
d)
plt.line()
18.
How do you display a Matplotlib plot?
a)
plt.draw()
b)
plt.show()
c)
show()
d)
plot.display()
19.
Which function is used to plot a histogram in Matplotlib?
a)
plt.hist()
b)
plt.bars()
c)
plt.pie()
d)
plt.distribution()
20.
What does the 'alpha' parameter in Matplotlib control?
a)
Line width
b)
Font size
c)
Transparency
d)
Label position
21.
Which of these is a supervised learning algorithm?
a)
K-Means
b)
Linear Regression
c)
PCA
d)
DBSCAN
22.
What does 'overfitting' mean in ML?
a)
Model performs well on test data
b)
Model generalizes well
c)
Model performs well on training but poorly on test data
d)
Model is too simple
23.
Which evaluation metric is used for classification problems?
a)
Accuracy
b)
RMSE
c)
MAE
d)
R-squared
24.
Which library is used for building ML models in Python?
a)
NumPy
b)
Pandas
c)
Scikit-learn
d)
Matplotlib
25.
What is the role of the activation function in neural networks?
a)
Adds bias
b)
Normalizes input
c)
Introduces non-linearity
d)
Reduces dimensions
26.
Which algorithm is used for clustering?
a)
Linear Regression
b)
Decision Tree
c)
K-Means
d)
SVM
27.
Which one is not a step in the ML pipeline?
a)
Data Collection
b)
Feature Engineering
c)
Model Training
d)
Software Testing
28.
Which of the following is a loss function for regression?
a)
Cross-Entropy
b)
Mean Squared Error
c)
Hinge Loss
d)
Jaccard Index
29.
What does PCA do?
a)
Classifies data
b)
Clusters data
c)
Reduces dimensionality
d)
Detects outliers
30.
What is the purpose of splitting data into train/test sets?
a)
To improve accuracy
b)
To evaluate model performance on unseen data
c)
To speed up training
d)
To balance the classes
Reset
