Python  Programming for Data Mining MCQs (Pandas, NumPy, Scikit-Learn)

Pandas
Which function in Pandas is used to read a CSV file?
a) pandas.load_csv()
b) pandas.read_csv()
c) pandas.import_csv()
d) pandas.open_csv()
Answer: b) pandas.read_csv()

How do you check the first few rows of a DataFrame df in Pandas?
a) df.start()
b) df.first()
c) df.head()
d) df.preview()
Answer: c) df.head()

Which method is used to remove missing values from a DataFrame?
a) dropna()
b) remove_na()
c) delete_na()
d) discard_na()
Answer: a) dropna()

How do you create a new column in a Pandas DataFrame?
a) df.new_column()
b) df[‘new_column’] = values
c) df.add_column(values)
d) df.insert_column(values)
Answer: b) df[‘new_column’] = values

What is the function to concatenate two DataFrames along rows?
a) pd.concat([df1, df2])
b) pd.append([df1, df2])
c) pd.merge([df1, df2])
d) pd.bind([df1, df2])
Answer: a) pd.concat([df1, df2])

NumPy
Which function is used to create an array in NumPy?
a) numpy.array()
b) numpy.arr()
c) numpy.create_array()
d) numpy.new_array()
Answer: a) numpy.array()

How do you create an array of zeros with shape (3, 4) in NumPy?
a) np.zeros([3, 4])
b) np.zeros(3, 4)
c) np.zeros((3, 4))
d) np.zeros_array(3, 4)
Answer: c) np.zeros((3, 4))

Which function returns the mean of an array?
a) np.average(array)
b) np.mean(array)
c) np.median(array)
d) np.mode(array)
Answer: b) np.mean(array)

How do you find the shape of a NumPy array arr?
a) arr.size
b) arr.shape
c) arr.dim()
d) arr.length
Answer: b) arr.shape

Which method would you use to stack arrays vertically in NumPy?
a) np.vstack()
b) np.hstack()
c) np.stack()
d) np.concat()
Answer: a) np.vstack()

Scikit-Learn
Which module in Scikit-Learn is used for classification algorithms?
a) sklearn.classification
b) sklearn.cluster
c) sklearn.tree
d) sklearn.neighbors
Answer: c) sklearn.tree

How do you split a dataset into training and testing sets in Scikit-Learn?
a) train_test_split()
b) split_data()
c) test_train_split()
d) data_split()
Answer: a) train_test_split()

What is the main purpose of the StandardScaler in Scikit-Learn?
a) To standardize features by removing the mean and scaling to unit variance
b) To normalize data between 0 and 1
c) To encode categorical variables
d) To reduce dimensionality of data
Answer: a) To standardize features by removing the mean and scaling to unit variance

Which class is used to perform linear regression in Scikit-Learn?
a) sklearn.linear.LinearRegressor
b) sklearn.regression.LinearModel
c) sklearn.linear_model.LinearRegression
d) sklearn.model.LinearRegressor
Answer: c) sklearn.linear_model.LinearRegression

What is the fit method used for in Scikit-Learn?
a) To train a machine learning model
b) To make predictions on new data
c) To preprocess data
d) To evaluate the model
Answer: a) To train a machine learning model

General Python for Data Mining
Which library is commonly used for data manipulation and analysis in Python?
a) Matplotlib
b) Seaborn
c) Pandas
d) SciPy
Answer: c) Pandas

Which of the following is used for numerical computations in Python?
a) Numpy
b) BeautifulSoup
c) Flask
d) TensorFlow
Answer: a) Numpy

What does the function pd.merge(df1, df2, on=’key’) do?
a) Concatenates df1 and df2 along the ‘key’ column
b) Joins df1 and df2 based on the ‘key’ column
c) Adds a new column ‘key’ to df1 and df2
d) Deletes the ‘key’ column from df1 and df2
Answer: b) Joins df1 and df2 based on the ‘key’ column

Which Scikit-Learn function is used to perform k-means clustering?
a) KMeans()
b) kmeans_cluster()
c) ClusterKMeans()
d) KMeansCluster()
Answer: a) KMeans()

How do you calculate the correlation matrix of a DataFrame df in Pandas?
a) df.corr()
b) df.correlate()
c) df.correlation()
d) df.matrix()
Answer: a) df.corr()

More Next Data Mining MCQs

  1. Repeated Data Mining MCQs
  2. Classification in Data mining MCQs
  3. Clustering in Data mining MCQs
  4. Data Analysis and Experimental Design MCQs
  5. Basics of Data Science MCQs
  6. Big Data MCQs
  7. Caret Data Science MCQs 
  8. Binary and Count Outcomes MCQs
  9. CLI and Git Workflow

 

  1. Data Preprocessing MCQs
  2. Data Warehousing and OLAP MCQs
  3. Association Rule Learning MCQs
  4. Classification
  5. Clustering
  6. Regression MCQs
  7. Anomaly Detection MCQs
  8. Text Mining and Natural Language Processing (NLP) MCQs
  9. Web Mining MCQs
  10. Sequential Pattern Mining MCQs
  11. Time Series Analysis MCQs

Data Mining Algorithms and Techniques MCQs

  1. Frequent Itemset Mining MCQs
  2. Dimensionality Reduction MCQs
  3. Ensemble Methods MCQs
  4. Data Mining Tools and Software MCQs
  5. Python  Programming for Data Mining MCQs (Pandas, NumPy, Scikit-Learn)
  6. R Programming for Data Mining(dplyr, ggplot2, caret) MCQs
  7. SQL Programming for Data Mining for Data Mining MCQs
  8. Big Data Technologies MCQs