Ai ML Unit 2
Ai ML Unit 2
o b) Text processing
o c) Image editing
o d) Creating GUIs
o a) np.array() ✅
o b) np.create()
o c) np.list()
o d) np.ndarray()
o a) np.arange(10) ✅
o b) np.range(10)
o c) np.linspace(0, 9)
o d) np.create(0,9)
o a) float64 ✅
o b) int32
o c) string
o d) object
python
CopyEdit
o a) (2,3) ✅
o b) (3,2)
o c) (6,)
o d) (1,6)
6. Which of the following is used to access the element at row index 1, column index 2 in a
2D array?
o a) arr[1,2] ✅
o b) arr[2,1]
o c) arr(1,2)
o d) arr[2][1]
o a) arr.reshape(3,3) ✅
o b) arr.resize(3,3)
o c) arr.shape(3,3)
o d) arr.to(3,3)
8. What function is used to find the mean of all elements in a NumPy array?
o a) np.mean(arr) ✅
o b) np.avg(arr)
o c) arr.mean()
o d) arr.median()
o a) arr1 * arr2 ✅
o b) np.dot(arr1, arr2)
o c) arr1 @ arr2
o d) arr1.add(arr2)
a) np.eye() ✅
b) np.identity()
c) np.matrix()
d) np.ones()
b) Machine learning
c) Creating websites
d) File compression
a) pd.DataFrame() ✅
b) pd.create()
c) pd.array()
d) pd.list()
13. What method is used to read a CSV file into a Pandas DataFrame?
a) pd.read_csv() ✅
b) pd.load_csv()
c) pd.import_csv()
d) pd.file_csv()
14. How can you display the first five rows of a DataFrame?
a) df.head() ✅
b) df.top()
c) df.first()
d) df.start()
b) df.summary()
c) df.stats()
d) df.info()
d) Cluster data
b) Computing eigenvalues
d) Visualizing data
20. Which library provides PCA implementation in Python?
a) scikit-learn ✅
b) NumPy
c) Pandas
d) TensorFlow
a) plt.plot(x, y) ✅
b) plt.line(x, y)
c) plt.scatter(x, y)
d) plt.show(x, y)
a) plt.show() ✅
b) plt.display()
c) plt.render()
d) plt.view()
a) plt.bar() ✅
b) plt.graph()
c) plt.barchart()
d) plt.plot()
a) linestyle ✅
b) linestyle_width
c) border
d) style
a) plt.hist() ✅
b) plt.barh()
c) plt.scatter()
d) plt.line()
a) plt.subplot() ✅
b) plt.subplots()
c) plt.figure()
d) plt.plot()
a) plt.title("My Plot") ✅
b) plt.heading("My Plot")
c) plt.name("My Plot")
d) plt.show_title("My Plot")
a) plt.xlabel() ✅
b) plt.xlabels()
c) plt.axis_label()
d) plt.labelx()
a) plt.pie() ✅
b) plt.chart()
c) plt.bar()
d) plt.piechart()
30. Which library is commonly used along with Matplotlib for visualization?
a) Seaborn ✅
b) TensorFlow
c) OpenCV
31. What function is used to compute the dot product of two NumPy arrays?
a) np.dot(arr1, arr2) ✅
b) arr1 * arr2
c) np.multiply(arr1, arr2)
d) np.cross(arr1, arr2)
32. How can you find the index of the maximum value in a NumPy array?
a) np.argmax(arr) ✅
b) np.max(arr)
c) arr.index(max)
d) np.argmax(arr, axis=1)
d) Creates a DataFrame
b) np.hstack()
c) np.stack()
d) np.append()
36. Which function is used to check for missing values in a Pandas DataFrame?
a) df.isnull() ✅
b) df.null()
c) df.check_missing()
d) df.missing()
37. How can you drop rows with missing values from a Pandas DataFrame?
a) df.dropna() ✅
b) df.remove_missing()
c) df.fillna()
d) df.clean()
a) df.groupby("column_name") ✅
b) df.merge("column_name")
c) df.sort("column_name")
d) df.select("column_name")
a) pd.merge(df1, df2) ✅
b) df1.join(df2)
c) df1.append(df2)
d) df1.concat(df2)
40. Which Pandas function is used to reset the index of a DataFrame?
a) df.reset_index() ✅
b) df.drop_index()
c) df.reindex()
d) df.modify_index()
b) Gradient Descent
c) Neural Networks
d) Decision Trees
43. What method is commonly used to decide how many principal components to keep in
PCA?
c) K-Means clustering
d) Decision trees
b) Unsupervised learning
c) Neural networks
d) Feature extraction
a) color ✅
b) linewidth
c) marker
d) fontsize
b) plt.axis_labels()
c) plt.labels()
d) plt.set_axis()
a) plt.figure(figsize=(width, height)) ✅
b) plt.size(width, height)
c) plt.dimensions(width, height)
d) plt.set_size()
49. What is the purpose of plt.legend() in Matplotlib?
d) Adds a title
a) plt.savefig("filename.png") ✅
b) plt.export("filename.png")
c) plt.write("filename.png")
d) plt.store("filename.png")
51. Which NumPy function is used to compute the cumulative sum of an array?
a) np.cumsum() ✅
b) np.sum()
c) np.accumulate()
d) np.cumprod()
c) Creates a DataFrame
a) arr.flatten() ✅
b) arr.reshape()
c) arr.squeeze()
d) arr.expanded()
a) df.rename(columns={'old_name': 'new_name'}) ✅
b) df.rename_columns({'old_name': 'new_name'})
c) df.columns.rename({'old_name': 'new_name'})
d) df.set_columns({'old_name': 'new_name'})
b) df.filter('column', value)
c) df.select('column', value)
d) df.rows('column', value)
a) df.fillna(value) ✅
b) df.replace_null(value)
c) df.fill_missing(value)
d) df.complete_na(value)
a) df.sort_values('column_name') ✅
b) df.order_by('column_name')
c) df.arrange('column_name')
d) df.set_order('column_name')
a) df.drop(columns=['column_name']) ✅
b) df.remove_column('column_name')
c) df.delete_column('column_name')
d) df.pop('column_name')
b) Removing outliers
b) Clustering
c) Image processing
d) Feature scaling
b) One-hot encoding
c) Feature selection
d) Data cleaning
a) By explained variance ✅
c) By their correlation
d) By feature count
c) Data is unlabeled
66. How can you change the figure background color in Matplotlib?
a) plt.figure(facecolor='color') ✅
b) plt.background('color')
c) plt.colorize('color')
d) plt.theme('color')
68. What function is used to change the size of text labels in Matplotlib?
a) fontsize parameter ✅
b) textsize
c) labelsize
d) markersize
69. How can you save a Matplotlib figure with a transparent background?
a) plt.savefig('figure.png', transparent=True) ✅
b) plt.export('figure.png', background=None)
c) plt.store('figure.png', clear_bg=True)
d) plt.write('figure.png', bg=0)