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
- Repeated Data Mining MCQs
- Classification in Data mining MCQs
- Clustering in Data mining MCQs
- Data Analysis and Experimental Design MCQs
- Basics of Data Science MCQs
- Big Data MCQs
- Caret Data Science MCQs
- Binary and Count Outcomes MCQs
- CLI and Git Workflow
- Data Preprocessing MCQs
- Data Warehousing and OLAP MCQs
- Association Rule Learning MCQs
- Classification
- Clustering
- Regression MCQs
- Anomaly Detection MCQs
- Text Mining and Natural Language Processing (NLP) MCQs
- Web Mining MCQs
- Sequential Pattern Mining MCQs
- Time Series Analysis MCQs
Data Mining Algorithms and Techniques MCQs
- Frequent Itemset Mining MCQs
- Dimensionality Reduction MCQs
- Ensemble Methods MCQs
- Data Mining Tools and Software MCQs
- Python Programming for Data Mining MCQs (Pandas, NumPy, Scikit-Learn)
- R Programming for Data Mining(dplyr, ggplot2, caret) MCQs
- SQL Programming for Data Mining for Data Mining MCQs
- Big Data Technologies MCQs