1What is the primary characteristic of Supervised Learning?
A.The model interacts with an environment and learns via a reward system.
B.The model learns from a labeled dataset containing input-output pairs.
C.The model groups data points based on inherent similarities without predefined categories.
D.The model learns from unlabeled data to find hidden patterns.
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.Grouping customers based on purchasing behavior.
B.Predicting whether an email is spam or not.
C.Classifying an image as a cat or a dog.
D.Predicting the price of a house based on its square footage.
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.Pandas
B.Matplotlib
C.Scikit-learn
D.NumPy
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.load_csv()
B.pd.read_excel()
C.pd.import_data()
D.pd.read_csv()
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.Converting the missing values to a specific category like "Unknown".
B.Replacing missing values with substituted values (e.g., mean, median, mode).
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.Pie Chart
B.Box Plot
C.Scatter Plot
D.Bar Chart
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 requires less memory.
B.It is faster to compute.
C.It prevents the model from assuming a mathematical order or rank between categories.
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 categorical variables are not encoded.
B.When the target variable is imbalanced.
C.When missing values are replaced by zeros.
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 remove outliers from the data.
B.To separate numerical and categorical columns.
C.To split the dataset into features () and target ().
D.To split the dataset into training and validation/test sets to evaluate generalization.
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 the variance of the data is too high.
B.When data is lost during file transfer.
C.When the model leaks sensitive user information.
D.When information from outside the training dataset (like the test set) is used to create the model.
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.Box Plot
B.Scatter 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 sum of all values in the dataframe.
B.The count of unique values in each column.
C.The total number of rows in the dataframe.
D.The count of missing values in each column.
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.stratify=y
B.random_state=42
C.shuffle=True
D.test_size=0.2
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.Principal Component Analysis (PCA)
B.Linear Regression
C.K-Nearest Neighbors
D.Logistic 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 error caused by using incorrect units of measurement.
B.Issues that arise when analyzing data in high-dimensional spaces (sparse data, increased computation).
C.The inability to add more features to a model.
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.Selecting the best hardware for training.
D.The process of using domain knowledge to extract or create new features from raw data.
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.linear_model
C.sklearn.metrics
D.sklearn.ensemble
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 contains only one unique value for all samples.
B.The feature has missing values.
C.The feature has a high correlation with the target.
D.The feature is normally distributed.
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.Images and Audio files.
B.A CSV file with labeled columns.
C.An Excel spreadsheet.
D.A SQL database table.
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 negative linear relationship.
C.No relationship.
D.A strong positive 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 removes the column.
B.It converts text labels into binary columns.
C.It scales the data between 0 and 1.
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.K-Means Clustering
B.Support Vector Machines (SVM)
C.Decision Trees
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 make predictions on new data.
B.To split the data.
C.To learn parameters (e.g., mean, coefficients) from the training data.
D.To calculate the accuracy of the model.
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.transform is only used for image data.
D.fit_transform is used on the test set; transform is used on the training set.
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.countplot()
C.sns.histplot() (or distplot)
D.sns.scatterplot()
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.remove_copies()
B.df.delete_repeats()
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 Eigenvalues
B.The Covariance matrix
C.The Principal Components (Eigenvectors)
D.The Mean vector
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.Encoding the target variable into a One-Hot vector.
D.Assigning random numbers to the target.
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.Mean = Median = Mode
B.The distribution is symmetrical.
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 concise summary of the DataFrame including index dtype, columns, non-null values, and memory usage.
B.A correlation heatmap.
C.A summary of statistical metrics.
D.The first 5 rows of the DataFrame.
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.Imputation
B.Vectorization (e.g., TF-IDF, Bag of Words)
C.Normalization
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.ROC Curve
B.Scatter plot of Feature vs Target
C.Heatmap of the Correlation Matrix
D.Confusion Matrix
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.Dropping the rows with missing values.
B.Replacing with a constant like -1.
C.Leaving them as NaN.
D.Using a complex prediction model.
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.Unsupervised Method
B.Filter Method
C.Wrapper Method
D.Embedded 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.(Total Elements,)
B.(Number of Columns, Number of Rows)
C.(Number of Unique Values,)
D.(Number of Rows, Number of Columns)
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.Polynomial Regression
B.Linear Regression
C.Ridge Regression
D.Logistic 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.3
B.1
C.1.5
D.10
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=0)
B.df.remove('ID')
C.df.delete('ID')
D.df.drop('ID', axis=1)
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 is required by the Python interpreter.
C.It increases the size of the dataset.
D.To understand data structure, detect anomalies, test assumptions, and determine preprocessing needs.
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.One-Hot Encoding
B.Target Encoding
C.Ordinal Encoding
D.Label 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 increases the dimensionality of the data.
B.It is computationally very expensive for small datasets.
C.The resulting Principal Components are often difficult to interpret in terms of original features.
D.It only works on categorical data.
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.
Incorrect! Try again.
Did this save you a night before the exam?
LPU Notes is free, and it stays free. Ads cover part of the server bill.
The rest comes out of a student's own pocket: the domain, the storage,
and keeping the site up through the weeks everyone needs it at once.
The payment button didn't load. An ad blocker or a filtered network is the usual reason.
to try again.
Nothing here is ever locked, and nothing unlocks. Chip in only if it was worth it.
What it pays for →