1What is the primary characteristic of Supervised Learning?
A.The model interacts with an environment and learns via a reward system.
B.The model groups data points based on inherent similarities without predefined categories.
C.The model learns from unlabeled data to find hidden patterns.
D.The model learns from a labeled dataset containing input-output pairs.
Correct Answer: The model learns from a labeled dataset containing input-output pairs.
Explanation:
In supervised learning, the algorithm is trained on a labeled dataset, meaning the data includes both the input features and the corresponding correct output (target).
Incorrect! Try again.
2Which of the following scenarios is a Regression problem?
A.Predicting the price of a house based on its square footage.
B.Predicting whether an email is spam or not.
C.Grouping customers based on purchasing behavior.
D.Classifying an image as a cat or a dog.
Correct Answer: Predicting the price of a house based on its square footage.
Explanation:
Regression deals with predicting continuous numerical values (like price), whereas the other options represent classification (categorical output) or clustering.
Incorrect! Try again.
3Which library in Python is the standard for implementing classic machine learning algorithms like Decision Trees and SVMs?
A.NumPy
B.Matplotlib
C.Scikit-learn
D.Pandas
Correct Answer: Scikit-learn
Explanation:
Scikit-learn (sklearn) is the most widely used Python library for implementing standard machine learning algorithms, preprocessing, and model evaluation.
Incorrect! Try again.
4In a dataset, Ordinal Data refers to:
A.Binary data (e.g., True/False).
B.Categorical data with no intrinsic order (e.g., Red, Blue, Green).
C.Categorical data with a clear ordering or ranking (e.g., Low, Medium, High).
D.Continuous numerical data (e.g., Height, Weight).
Correct Answer: Categorical data with a clear ordering or ranking (e.g., Low, Medium, High).
Explanation:
Ordinal data is a type of categorical data where the values have a meaningful order or rank, but the intervals between the ranks may not be equal.
Incorrect! Try again.
5Which Pandas function is primarily used to load data from a Comma Separated Values file?
A.pd.read_csv()
B.pd.read_excel()
C.pd.load_csv()
D.pd.import_data()
Correct Answer: pd.read_csv()
Explanation:
The function pd.read_csv() is the standard Pandas method for loading data from CSV files into a DataFrame.
Incorrect! Try again.
6What is the purpose of the df.describe() method in Pandas?
A.To provide summary statistics (mean, std, min, max) for numerical columns.
B.To visualize the correlation matrix.
C.To show the data types and non-null counts of columns.
D.To drop missing values from the dataframe.
Correct Answer: To provide summary statistics (mean, std, min, max) for numerical columns.
Explanation:
df.describe() generates descriptive statistics including those that summarize the central tendency, dispersion, and shape of a dataset’s distribution.
Incorrect! Try again.
7When handling missing data, what is Imputation?
A.Ignoring the column containing missing values.
B.Replacing missing values with substituted values (e.g., mean, median, mode).
C.Converting the missing values to a specific category like "Unknown".
Imputation refers to the process of replacing missing data with substituted values to retain the data point for analysis.
Incorrect! Try again.
8Which visualization is most effective for identifying Outliers in a numerical feature?
A.Bar Chart
B.Scatter Plot
C.Pie Chart
D.Box Plot
Correct Answer: Box Plot
Explanation:
A Box Plot visually depicts groups of numerical data through their quartiles and explicitly indicates outliers as individual points beyond the 'whiskers'.
Incorrect! Try again.
9In the context of outlier detection, what does the IQR (Interquartile Range) represent?
A.The distance between the mean and the median.
B.The difference between the maximum and minimum values.
C.The standard deviation of the dataset.
D.The difference between the 75th percentile () and the 25th percentile ().
Correct Answer: The difference between the 75th percentile () and the 25th percentile ().
Explanation:
. It measures the statistical spread of the middle 50% of the data and is used to define the bounds for outliers.
Incorrect! Try again.
10What is the formula for Min-Max Scaling (Normalization)?
A.
B.
C.
D.
Correct Answer:
Explanation:
Min-Max scaling transforms features by scaling each feature to a given range, usually [0, 1], using the minimum and maximum values of that feature.
Incorrect! Try again.
11Which scaling technique transforms data to have a mean of 0 and a standard deviation of 1?
Standardization (using StandardScaler in sklearn) centers the distribution around 0 and scales it to unit variance.
Incorrect! Try again.
12Why is One-Hot Encoding preferred over Label Encoding for nominal categorical variables?
A.It is faster to compute.
B.It prevents the model from assuming a mathematical order or rank between categories.
C.It requires less memory.
D.It handles missing values automatically.
Correct Answer: It prevents the model from assuming a mathematical order or rank between categories.
Explanation:
Label encoding assigns integers (0, 1, 2...) to categories, which some algorithms might misinterpret as an ordinal relationship (2 > 1). One-Hot encoding avoids this.
Incorrect! Try again.
13What is the Dummy Variable Trap?
A.When the target variable is imbalanced.
B.When missing values are replaced by zeros.
C.When categorical variables are not encoded.
D.When independent variables are highly correlated (multicollinearity) due to including all dummy variables.
Correct Answer: When independent variables are highly correlated (multicollinearity) due to including all dummy variables.
Explanation:
The Dummy Variable Trap occurs when one variable can be predicted from the others (e.g., Female = 1 - Male). This multicollinearity can break some models like linear regression. It is solved by dropping one dummy column.
Incorrect! Try again.
14Which technique is commonly used to handle Class Imbalance by generating synthetic samples for the minority class?
Wrapper methods, like RFE, select features by recursively training the model on subsets of features and evaluating performance.
Incorrect! Try again.
17What is the purpose of train_test_split in machine learning?
A.To split the dataset into training and validation/test sets to evaluate generalization.
B.To split the dataset into features () and target ().
C.To remove outliers from the data.
D.To separate numerical and categorical columns.
Correct Answer: To split the dataset into training and validation/test sets to evaluate generalization.
Explanation:
Splitting data ensures the model is evaluated on unseen data, preventing the estimation of performance based on data the model has already memorized.
Incorrect! Try again.
18What is Data Leakage?
A.When data is lost during file transfer.
B.When information from outside the training dataset (like the test set) is used to create the model.
C.When the variance of the data is too high.
D.When the model leaks sensitive user information.
Correct Answer: When information from outside the training dataset (like the test set) is used to create the model.
Explanation:
Data leakage occurs when the model unknowingly has access to the target or test distribution during training (e.g., scaling before splitting), leading to overly optimistic performance estimates.
Incorrect! Try again.
19Which plot is best for visualizing the relationship between two continuous variables?
A.Scatter Plot
B.Box Plot
C.Bar Chart
D.Histogram
Correct Answer: Scatter Plot
Explanation:
Scatter plots map individual data points on an X-Y plane, making them ideal for observing correlations between two continuous variables.
Incorrect! Try again.
20In the context of Pandas, what does df.isnull().sum() return?
A.The count of unique values in each column.
B.The sum of all values in the dataframe.
C.The count of missing values in each column.
D.The total number of rows in the dataframe.
Correct Answer: The count of missing values in each column.
Explanation:
isnull() returns a boolean mask, and sum() counts the True values (which represent missing data) per column.
Incorrect! Try again.
21When performing a train-test split on an imbalanced dataset, which parameter ensures the class distribution is preserved in both sets?
A.random_state=42
B.shuffle=True
C.test_size=0.2
D.stratify=y
Correct Answer: stratify=y
Explanation:
The stratify parameter ensures that the proportion of values in the sample produced will be the same as the proportion of values provided in the target array y.
Incorrect! Try again.
22Which of the following is a technique for Dimensionality Reduction?
A.K-Nearest Neighbors
B.Logistic Regression
C.Principal Component Analysis (PCA)
D.Linear Regression
Correct Answer: Principal Component Analysis (PCA)
Explanation:
PCA is a technique used to reduce the dimensionality of datasets, increasing interpretability but minimizing information loss by creating new uncorrelated variables.
Incorrect! Try again.
23The Curse of Dimensionality refers to:
A.The inability to add more features to a model.
B.The error caused by using incorrect units of measurement.
C.Issues that arise when analyzing data in high-dimensional spaces (sparse data, increased computation).
D.The difficulty of visualizing 3D data.
Correct Answer: Issues that arise when analyzing data in high-dimensional spaces (sparse data, increased computation).
Explanation:
As the number of features increases, the volume of the space increases exponentially, making the data sparse and distance metrics less meaningful.
Incorrect! Try again.
24What is Feature Engineering?
A.Removing all categorical variables.
B.Downloading datasets from the internet.
C.The process of using domain knowledge to extract or create new features from raw data.
D.Selecting the best hardware for training.
Correct Answer: The process of using domain knowledge to extract or create new features from raw data.
Explanation:
Feature engineering involves creating new input features from the existing ones (e.g., extracting 'Year' from a 'Date' column) to improve model performance.
Incorrect! Try again.
25Which Scikit-learn module contains StandardScaler and MinMaxScaler?
A.sklearn.preprocessing
B.sklearn.ensemble
C.sklearn.metrics
D.sklearn.linear_model
Correct Answer: sklearn.preprocessing
Explanation:
The sklearn.preprocessing package provides several common utility functions and transformer classes to change raw feature vectors into a representation suitable for downstream estimators.
Incorrect! Try again.
26If a feature has a Variance of 0, what does it imply?
A.The feature has a high correlation with the target.
B.The feature is normally distributed.
C.The feature has missing values.
D.The feature contains only one unique value for all samples.
Correct Answer: The feature contains only one unique value for all samples.
Explanation:
Variance measures spread. If variance is 0, the values do not spread at all, meaning all values are identical. Such features carry no information and should be removed.
Incorrect! Try again.
27Which of the following is considered Unstructured Data?
A.A SQL database table.
B.Images and Audio files.
C.A CSV file with labeled columns.
D.An Excel spreadsheet.
Correct Answer: Images and Audio files.
Explanation:
Unstructured data does not have a predefined data model or is not organized in a pre-defined manner (like tables), examples include text, images, and audio.
Incorrect! Try again.
28What does a correlation coefficient of -0.9 indicate between two features?
A.A weak negative linear relationship.
B.A strong positive linear relationship.
C.No relationship.
D.A strong negative linear relationship.
Correct Answer: A strong negative linear relationship.
Explanation:
Correlation coefficients range from -1 to 1. A value close to -1 indicates that as one variable increases, the other decreases strongly.
Incorrect! Try again.
29When using LabelEncoder, how is the data transformed?
A.It scales the data between 0 and 1.
B.It converts text labels into binary columns.
C.It removes the column.
D.It converts text labels into integers (0, 1, 2, ...).
Correct Answer: It converts text labels into integers (0, 1, 2, ...).
Explanation:
LabelEncoder replaces unique categories with integer codes.
Incorrect! Try again.
30Which algorithm is generally NOT sensitive to the scale of features?
A.Support Vector Machines (SVM)
B.Decision Trees
C.K-Means Clustering
D.K-Nearest Neighbors (KNN)
Correct Answer: Decision Trees
Explanation:
Decision Trees and Random Forests split nodes based on thresholds of single features, so the absolute scale of the feature does not affect the structure of the tree. Distance-based models (KNN, SVM, K-Means) are highly sensitive.
Incorrect! Try again.
31In Scikit-Learn, what is the role of the fit() method?
A.To learn parameters (e.g., mean, coefficients) from the training data.
B.To make predictions on new data.
C.To calculate the accuracy of the model.
D.To split the data.
Correct Answer: To learn parameters (e.g., mean, coefficients) from the training data.
Explanation:
fit() triggers the training process where the algorithm learns the internal parameters from the provided data.
Incorrect! Try again.
32What is the difference between fit_transform() and transform()?
A.fit_transform is used on the training set to learn parameters and apply them; transform is used on the test set using learned parameters.
B.They are identical and can be used interchangeably.
C.fit_transform is used on the test set; transform is used on the training set.
D.transform is only used for image data.
Correct Answer: fit_transform is used on the training set to learn parameters and apply them; transform is used on the test set using learned parameters.
Explanation:
We use fit_transform on training data to calculate means/SDs and scale the data. We use transform on test data to scale it using the training means/SDs to prevent data leakage.
Incorrect! Try again.
33Which Seaborn plot is used to visualize the Distribution of a single numerical variable?
A.sns.heatmap()
B.sns.scatterplot()
C.sns.histplot() (or distplot)
D.sns.countplot()
Correct Answer: sns.histplot() (or distplot)
Explanation:
Histograms (histplot or the deprecated distplot) are designed to show the frequency distribution of a single continuous variable.
Incorrect! Try again.
34How do you handle Duplicate Rows in Pandas?
A.df.delete_repeats()
B.df.remove_copies()
C.df.unique()
D.df.drop_duplicates()
Correct Answer: df.drop_duplicates()
Explanation:
drop_duplicates() is the Pandas method to remove duplicate rows from a DataFrame.
Incorrect! Try again.
35In PCA, what represents the direction of maximum variance in the data?
A.The Covariance matrix
B.The Principal Components (Eigenvectors)
C.The Mean vector
D.The Eigenvalues
Correct Answer: The Principal Components (Eigenvectors)
Explanation:
The first Principal Component is the eigenvector associated with the largest eigenvalue, representing the direction of maximum variance.
Incorrect! Try again.
36What is Target Encoding (or Mean Encoding)?
A.Encoding categorical variables based on the mean of the target variable for that category.
B.Replacing the target with the mean of the features.
C.Assigning random numbers to the target.
D.Encoding the target variable into a One-Hot vector.
Correct Answer: Encoding categorical variables based on the mean of the target variable for that category.
Explanation:
Target encoding replaces a categorical feature value with the average value of the target variable for that specific category. It is powerful but risks overfitting.
Incorrect! Try again.
37Which of the following indicates a skewed distribution?
A.The distribution is symmetrical.
B.Mean = Median = Mode
C.The tail of the distribution is longer on one side than the other.
D.The standard deviation is 0.
Correct Answer: The tail of the distribution is longer on one side than the other.
Explanation:
Skewness refers to asymmetry in the distribution. A long tail to the right is positive skew; a long tail to the left is negative skew.
Incorrect! Try again.
38What is the result of executing df.info()?
A.A summary of statistical metrics.
B.A correlation heatmap.
C.The first 5 rows of the DataFrame.
D.A concise summary of the DataFrame including index dtype, columns, non-null values, and memory usage.
Correct Answer: A concise summary of the DataFrame including index dtype, columns, non-null values, and memory usage.
Explanation:
df.info() is essential for initial exploration to check data types and identify missing values structurally.
Incorrect! Try again.
39Before feeding text data into a supervised learning model, it must be converted into numerical vectors. This process is called:
A.Vectorization (e.g., TF-IDF, Bag of Words)
B.Normalization
C.Imputation
D.Classification
Correct Answer: Vectorization (e.g., TF-IDF, Bag of Words)
Explanation:
Machine learning models require numerical input. Text vectorization transforms text strings into numerical vectors.
Incorrect! Try again.
40Which method helps in identifying Multicollinearity among features?
A.Scatter plot of Feature vs Target
B.Confusion Matrix
C.Heatmap of the Correlation Matrix
D.ROC Curve
Correct Answer: Heatmap of the Correlation Matrix
Explanation:
A correlation heatmap visualizes the correlation coefficients between all pairs of features. High values between two independent features indicate multicollinearity.
Incorrect! Try again.
41If a dataset has missing values that are MCAR (Missing Completely At Random), which handling method is generally safe if the dataset is large?
A.Replacing with a constant like -1.
B.Leaving them as NaN.
C.Using a complex prediction model.
D.Dropping the rows with missing values.
Correct Answer: Dropping the rows with missing values.
Explanation:
If data is MCAR, the missingness implies no hidden bias. If the dataset is large enough, dropping these rows does not introduce bias, though it reduces sample size.
Incorrect! Try again.
42What is the advantage of using a Pipeline in Scikit-Learn?
A.It creates a graphical user interface.
B.It allows for parallel processing on GPUs.
C.It chains together multiple processing steps (scaling, encoding, modeling) into a single object, preventing data leakage.
D.It automatically selects the best algorithm.
Correct Answer: It chains together multiple processing steps (scaling, encoding, modeling) into a single object, preventing data leakage.
Explanation:
Pipelines ensure that preprocessing steps (like scaling) are applied correctly during cross-validation (fitting only on train folds), preventing leakage.
Incorrect! Try again.
43Which feature selection method uses a model's coef_ or feature_importances_ attribute to select features?
A.Embedded Method
B.Wrapper Method
C.Filter Method
D.Unsupervised Method
Correct Answer: Embedded Method
Explanation:
Embedded methods (like Lasso or Random Forest) perform feature selection during the model training process, assigning weights or importance scores to features.
Incorrect! Try again.
44What is the shape of the output of df.shape in Pandas?
A.(Number of Columns, Number of Rows)
B.(Number of Unique Values,)
C.(Number of Rows, Number of Columns)
D.(Total Elements,)
Correct Answer: (Number of Rows, Number of Columns)
Explanation:
df.shape returns a tuple representing the dimensionality of the DataFrame in the format (rows, columns).
Incorrect! Try again.
45Which of the following is a Classification algorithm?
A.Ridge Regression
B.Logistic Regression
C.Linear Regression
D.Polynomial Regression
Correct Answer: Logistic Regression
Explanation:
Despite the name, Logistic Regression is a classification algorithm used to predict binary outcomes (probabilities).
Incorrect! Try again.
46When detecting outliers using the Z-score method, a common threshold to identify an outlier is a Z-score absolute value greater than:
A.1.5
B.3
C.10
D.1
Correct Answer: 3
Explanation:
In a normal distribution, 99.7% of data points lie within 3 standard deviations. Points beyond are typically considered outliers.
Incorrect! Try again.
47What is the correct syntax to drop a column named 'ID' from a Pandas DataFrame df?
A.df.drop('ID', axis=1)
B.df.delete('ID')
C.df.remove('ID')
D.df.drop('ID', axis=0)
Correct Answer: df.drop('ID', axis=1)
Explanation:
axis=1 refers to columns. axis=0 refers to rows.
Incorrect! Try again.
48Why is Data Exploration (EDA) a critical first step?
A.It automatically trains the model.
B.It increases the size of the dataset.
C.To understand data structure, detect anomalies, test assumptions, and determine preprocessing needs.
D.It is required by the Python interpreter.
Correct Answer: To understand data structure, detect anomalies, test assumptions, and determine preprocessing needs.
Explanation:
EDA allows the data scientist to understand the nature of the data, relationships between variables, and quality issues before attempting to model.
Incorrect! Try again.
49Which encoding technique creates a binary column for every category level?
A.Label Encoding
B.Target Encoding
C.One-Hot Encoding
D.Ordinal Encoding
Correct Answer: One-Hot Encoding
Explanation:
One-Hot Encoding expands a categorical column into multiple binary columns (0 or 1), one for each unique category.
Incorrect! Try again.
50What is the main drawback of PCA?
A.It only works on categorical data.
B.The resulting Principal Components are often difficult to interpret in terms of original features.
C.It increases the dimensionality of the data.
D.It is computationally very expensive for small datasets.
Correct Answer: The resulting Principal Components are often difficult to interpret in terms of original features.
Explanation:
PCA transforms original features into linear combinations (Principal Components). While this reduces dimensions, the physical meaning of the original features is lost in the transformation.