Question bank
Pick an answer to see if you're right — with an explanation.
All topicsPythonSQL / MySQLData ScienceNumPyPandasMatplotlibMachine LearningDeep LearningArtificial IntelligenceLarge Language ModelsDjangoAPIsGit & GitHubPower BIExcelStatistics
Machine LearningEasy
Predicting house prices is a…
aClassification task
bClustering task
cRegression task
dReinforcement task
Explanation: Predicting a continuous number is regression.
Machine LearningEasy
Logistic regression converts a weighted sum into a probability using which function?
aReLU
bSoftmax over features
cSigmoid
dStep function
Explanation: The sigmoid maps any real number into the range 0 to 1, which is read as a probability.
Machine LearningEasy
Why split data into train and test sets?
aTo evaluate on unseen data
bTo train faster
cTo reduce features
dTo balance classes
Explanation: Test data estimates real-world performance.
Machine LearningEasy
Which scikit-learn model tends to set some coefficients exactly to zero?
aLasso
bRidge
cLinearRegression
dKNeighborsRegressor
Explanation: The L1 penalty in Lasso can shrink weights all the way to zero, acting as feature selection.
Machine LearningEasy
Model performs great on train, poorly on test. This is…
aUnderfitting
bRegularisation
cNormalisation
dOverfitting
Explanation: Overfitting = memorising training data.
Machine LearningEasy
A random forest reduces overfitting mainly by…
aTraining trees sequentially on residuals
bAveraging many trees trained on bootstrap samples with random feature subsets
cPruning a single tree
dScaling the features
Explanation: Bagging plus random feature selection produces decorrelated trees whose average has lower variance.
Machine LearningMedium
Best metric for rare fraud detection?
aAccuracy
bRecall / PR-AUC
cR²
dMAE
Explanation: Accuracy is misleading on imbalanced data.
Machine LearningEasy
Why must features usually be scaled before k-means?
aK-means only accepts values between 0 and 1
bScaling makes it run on GPUs
cScaling removes outliers
dIt uses distances, so large-unit features would dominate
Explanation: Euclidean distance is dominated by features with large numeric ranges unless they are standardised.
Machine LearningEasy
K-Means is an example of…
aUnsupervised learning
bSupervised learning
cReinforcement learning
dDeep learning
Explanation: K-Means clusters without labels.
Machine LearningMedium
What does this code keep?
pca = PCA(n_components=0.95)
Z = pca.fit_transform(X_scaled)
aExactly 95 components
bEnough components to explain 95% of the variance
cThe 95% of rows with least noise
dComponents with variance above 0.95
Explanation: A float between 0 and 1 tells PCA to keep the smallest number of components reaching that explained-variance share.
Machine LearningMedium
What does `random_state=42` do here?
X_tr, X_te, y_tr, y_te = train_test_split(
X, y, test_size=0.2, random_state=42)
aIt uses 42% of the rows for testing
bIt trains 42 models
cIt makes the model more accurate
dIt fixes the shuffling seed so the same split is produced on every run
Explanation: A fixed random_state makes the split reproducible, which is what lets you compare experiments fairly.
Machine LearningMedium
For a churn dataset with only 3% positives, which scoring is most informative during tuning?
aaccuracy
br2
caverage_precision
dneg_mean_squared_error
Explanation: PR-AUC (average precision) focuses on the rare positive class, whereas accuracy is inflated by the majority class.
Machine LearningMedium
Precision answers which question?
aHow many of the actual positives did the model find?
bOf the cases predicted positive, how many really are positive?
cHow close are predictions to the average?
dHow quickly does the model train?
Explanation: Precision is TP / (TP + FP); recall is the metric that measures how many actual positives were found.
Machine LearningMedium
Which splitter should you use when validating a weekly sales forecasting model?
aTimeSeriesSplit
bKFold(shuffle=True)
cStratifiedKFold
dLeaveOneOut
Explanation: TimeSeriesSplit always validates on later periods, matching how the model is used in the future.
Machine LearningMedium
A `city` column holds Pune, Delhi and Mumbai with no natural order. Which encoding fits?
aLabel encoding as 0, 1, 2
bDropping the column
cOne-hot encoding
dStandard scaling
Explanation: One-hot encoding creates a binary column per city so the model does not read a false ordering into the numbers.