Extraai
Extraai
Answer: A) To minimize the sum of squared distances between points and their respective cluster
centroids
6. Which of the following is an advantage of clustering?
Answer: B) The results can be highly sensitive to the choice of distance metric
Answer: B) scikit-learn
Answer: B) KMeans()
Answer: A) n_clusters
Answer: A) fit()
Answer: B) fit()
7. Which Python library is commonly used for implementing Support Vector Machines (SVM)?
Answer: B) scikit-learn
9. Which function in scikit-learn is used to split data into training and testing sets?
Answer: A) train_test_split()
Answer: C) Accuracy
Q.1 Which of the following is not a valid Python data type?
Answer: d) real
Answer: b) 3
x=5
y = 10
x += y
print(x)
Answer: c) 15
Q.4 Which of the following operators is used for string concatenation in Python?
Answer: c) +
x = "Hello"
y = 'World'
print(x + y)
Answer: b) HelloWorld
Answer: b) 1
Answer: c) 8
Q.8 Which of the following is the correct way to declare a variable and assign the value 10 to it in
Python?
Answer: b) x=10
Q.9 Which of the following methods can be used to convert a string to an integer in Python?
Answer: b) str()
Answer: b) 10
Q.2 Which arithmetic operator is used to find the remainder of the division? Answer: C) %
Q.3 What will be the output of the following code?
x=5
if x > 3:
print("Hello")
else:
print("Goodbye")
Answer: A) Hello
Answer: C) if x == 5:
Q.6 Which of the following can be used to check multiple conditions in an if statement?
Answer: B) if-elif-else
Answer: C) x != y
x=0
if x:
print("True")
else:
print("False")
Answer: B) False
Answer: C) if x == 5
x = 15
if x > 10:
if x > 20:
else:
if x == 15:
print("x is 15")
Answer: b) x is 15
Q.3 Which of the following is the correct syntax for nested if-else in Python?
x = -10
if x > 0:
if x % 2 == 0:
print("Positive even")
else:
print("Positive odd")
else:
if x % 2 == 0:
print("Negative even")
else:
print("Negative odd")
Q.6 Which statement can be used to terminate a while loop prematurely? Answer: a) break
x=5
while x > 0:
x -= 1
if x == 2:
break
Answer: d) while x == 5:
Q.1 How can you iterate through a set s using a for loop?
A. for i in s: Answer: A
Q,2 What is the correct syntax to use a for loop to print each item in the list fruits?
B. range() Answer: B
Q.4 What is the correct syntax for a for loop in Python to iterate over a list named numbers?
B. for i in numbers:
print(i)
B. 5 6 7 Answer: B
print(i)
B. 2 4 6 8 Answer: B
if i == 3:
break
print(i)
B. 1 2 Answer: B
for i in range(3):
for j in range(2):
print(i, j)
Q.9 How can you iterate through a set s using a for loop?
A. for i in s:
for i in range(2):
for j in range(3):
print(i + j)
Answer: D 0 1 2 0 1 2
1. Which library in Python is commonly used for data manipulation and analysis?
Answer: B) Pandas
2. Which Python library is primarily used for scientific computing and handling large
multidimensional arrays and matrices? Answer: C) NumPy
3. Which Python library would you use for creating static, interactive, and animated visualizations?
Answer: B) Matplotlib
4. Which library is used for machine learning and provides simple and efficient tools for data mining
and data analysis?
Answer: C) Scikit-learn
5. Which library provides high-level neural networks API, written in Python and capable of running
on top of TensorFlow, CNTK, or Theano?
Answer: A) Keras
6. Which Python library is designed for data visualization and is based on Matplotlib but provides a
higher-level interface for drawing attractive and informative statistical graphics?
Answer: B) Seaborn
7. Which library is used for numerical optimization, integration, interpolation, eigenvalue problems,
and other advanced mathematical operations?
Answer: B) SciPy
8. Which library provides an easy interface for creating static, interactive, and animated
visualizations in Python?
Answer: B) Plotly
Answer: A) TensorFlow
10. Which library would you use to work with data visualization specifically designed for statistical
graphics in Python?
Answer: B) Seaborn
1. Which function in the Pandas library is used to display the first few rows of a DataFrame?
Answer: A) .head()
2. Which method in Pandas provides a summary of statistics pertaining to the DataFrame columns?
Answer: B) .describe()
3. Which method would you use to check for missing values in a DataFrame?
Answer: A) .isnull()
Answer: B) plt.plot()
Answer: B) sns.heatmap()
Answer: B) .unique()
7. Which Pandas method provides a quick overview of the DataFrame, including the number of non-
null entries and the data type of each column?
Answer: C) .info()
Answer: C) plt.bar()
Answer: A) pd.read_csv()
Answer: B) plt.hist()
Question 1: Which library is primarily used for data manipulation and analysis in Python?
Answer: D) Pandas
Question 2: Which Python library is most commonly used for numerical computing and handling
arrays?
Answer: B) NumPy
Question 3: Which library provides functions for scientific and technical computing such as
optimization, integration, and interpolation?
Answer: B) SciPy
Question 4: Which library is widely used for data visualization in Python, offering a wide range of
static, animated, and interactive plots?
Answer: C) Matplotlib
Answer: C) plt.plot()
Question 6: Which of the following libraries can be used to create scatter plots in Python?
Answer: B) plt.bar()
Question 8: Which parameter in plt.plot() can be used to specify the color of the line?
Answer: C) color
Question 9: Which Python library is used for working with large multidimensional arrays and
matrices, and includes a large collection of mathematical functions?
Answer: B) NumPy
Question 10: Which library is used for interactive visualizations and dashboards in Python?
Answer: C) Plotly
B. def myFunction():
Q.2 Which of the following is the correct way to call a function named calculate with no arguments?
C. calculate();
Q.3 What is the default return value of a function in Python if no return statement is used?
B. None
Q.5 What is the correct way to define a function that takes no parameters and returns no value?
return x + y
print(add(5)) A. 15
return a < b
print(func(5, 3))
A. False
1. Which method is used to replace missing values in a Data Frame with the mean value of a
column? c. fillna()
2. What value is used to replace missing values when using the mode method in data pre-
processing?
3. What value is used to replace missing values when using the median method in data pre-
processing?
4. Which pandas method is used to convert a column of dates into a standard date format?
b. to_datetime()
5. How can you remove rows with NULL values after converting a column to a standard date format?
a. df.dropna(subset=['Date'], inplace=True)
6. Which of the following is a common method for handling cells with wrong data formats?
b. drop_duplicates()
8. Which encoding method is used to convert categorical labels into numeric form?
b. Label Encoding
9. Which method is used to replace missing values with the most frequently occurring value in a
column?
d. fillna(x.mode()[0])