ML Study Hub

Home / Past papers / MLP End Term / this paper

Machine Learning Practice - Bs In Data Science/ Electronic Systems 13 Sep 26 - 13 Sep 2026

MLP End Term30 questions100 marks13 MCQ · 9 SA · 8 MSQ
Elapsed 00:00
Q1MCQ4 marks
Consider the following pandas DataFrame representing employee training records: question figure We want to retrieve all records of employees who belong to departments where the average training score is strictly greater than 75. Which of the following code snippets correctly achieves this?
  1. df[df['Score'] > 75]
  2. df.groupby('Department').filter(lambda x: x['Score'].mean() > 75)
  3. df[df.groupby('Department')['Score'].transform('mean') >= 75]
  4. df.groupby('Department').apply(lambda x: x[x['Score'] > 75])
Q2MCQ4 marks
How many features remain in X_new after the transformation? question figure
  1. 0
  2. 1
  3. 2
  4. 3
Q3MCQ4 marks
Determine the output of the following text preprocessing pipeline: question figure
  1. ['red','blue','green','yellow']
  2. ['blue' 'red','yellow']
  3. ['blue' 'red']
  4. ['red','blue','green']
Q4MCQ4 marks
Four data points are given: A=(1,1), B=(2,2), C=(8,8), D=(10,10) A hierarchical agglomerative clustering algorithm using single linkage and Euclidean distance is applied. Initially, each point is considered as an individual cluster. Which two clusters will be merged in the first step?
  1. A and B
  2. C and D
  3. A and D
  4. B and C
Q5MCQ4 marks
A genre-based content recommender uses the 19 one-hot genre columns of each movie: question figure Which of the following statements is TRUE?
  1. With , the returned by are cosine similarities lying in .
  2. is used instead of because the nearest neighbour of any movie is the movie itself, which is then dropped via `indices.flatten()[1:]
  3. Because the genre vectors are binary, two movies that share no genre still receive a positive cosine similarity.
  4. Fitting on the genre vectors additionally requires the user–item ratings matrix.
Q6SA3 marks
What is the output of the following preprocessing pipeline code? (Round off to 2 decimal places if applicable) question figure
Q7SA3 marks
Suppose the orginal dataset has 10 rows (1 to 10) Which row/rows of the dataset will be printed if the following code is executed? question figure Enter the line number (1,2...,10) of the printed row. If multiple lines are printed enter the sum of the row numbers (i.e. if line 1 and 2 are printed enter 3)
Q8SA3 marks
The pipeline first imputes the missing value with the (mean) strategy and then standardizes the column. What is the value of (the transformed value of the first sample, whose original value is 2)? (Enter up to 2 decimals) question figure
Q9SA3 marks
Consider a 3 class classification problem where the training dataset contains 10 features. The given model is trained on the dataset. What is the output of the code given below? question figure
Q10SA3 marks
Assume both models in the code given below are fit on the same dataset (X_train) containing 10 features. question figure Enter the difference between the total number of learnable parameters in both the models. (Enter the absolute value of the difference)
Q11SA3 marks
What is the output of the following code? (Round Upto one decmimal) X = [[0], [1], [2], [3]] y = [0, 0, 1, 1] from sklearn.neighbors import RadiusNeighborsRegressor neigh = RadiusNeighborsRegressor(radius=1.0) neigh.fit(X, y) print(neigh.predict([[1.5]]))
Q12SA4 marks
Consider the following feature matrix with one missing entry, imputed using : question figure The nearest neighbours are decided using the nan-aware (weighted) Euclidean distance computed over the present coordinates. What is the imputed value at position ? (Enter up to 2 decimals)
Q13SA4 marks
A binary classification model was evaluated on a test set with 500 samples. The model correctly identified 90 positive samples and 360 negative samples. Out of all the samples predicted as positive, 120 were predicted as positive. There were 100 actual positive samples in the dataset. Compute the F1-score of the model. (Round to 2 decimals)
Q14MSQ2 marksselect all that apply
Select the false statements:
  1. StandardScaler ensures the features correspond to a uniform distribution after scaling.
  2. MinMaxScaler ensures that feature values follow a Gaussian Distribution
  3. OridnalEncoder is best for data which contains values corresponding to a Normal Distribution.
  4. Pipeline helps us apply separate transformations to numerical and categorical columns directly.
Q15MSQ2 marksselect all that apply
Which of the following metrics have their lower bound as 0?
  1. Accuracy
  2. F1-Score
  3. R2-Score
  4. Mean_Squared_Error
  5. Precision
Q16MSQ3 marksselect all that apply
Regarding building pipelines with and , select all statements that are correct.
  1. Every intermediate step of a must be a transformer, i.e. it must implement both and .
  2. The final estimator of a only needs to implement .
  3. requires the user to supply an explicit name for each step, just like .
  4. A object exposes the interface (e.g. ) of its last step.
Q17MSQ3 marksselect all that apply
Consider the following implementation of PCA: question figure Which of the following are correct?
  1. X_pca.shape[1] is equal to the original number of features.
  2. The sum of pca.explained_variance_ratio_ is at least 0.95.
  3. len(pca.explained_variance_ratio_) is equal to X_pca.shape[1].
  4. The principal components correspond to the original features with the highest variance.
Q18MCQ3 marks
Consider the following two ensemble regression architectures trained on the same dataset: question figure How do these two models differ in their output strategy to produce the final prediction for a given test instance, and how does adding more estimators affect them?
  1. ensemble1 computes a weighted sum of predictions where later trees have higher weights; ensemble2 takes a simple arithmetic mean of all trees.
  2. ensemble1 reduces variance by averaging independent predictions from 100 trees, meaning increasing n_estimators to 500 will ideally not cause overfitting.
  3. ensemble2 reduces bias sequentially, meaning increasing n_estimators to 500 carries no risk of overfitting.
  4. Both models output predictions by calculating the majority vote across the terminal leaf nodes of all individual base estimators.
Q19MCQ3 marks
Consider the following code snippet: question figure Which of the following holds true?
  1. The model performs no regularization.
  2. The model performs regularization and the regularization can also perfrom some feature selection.
  3. The model performs regularization and the regularization cant perfrom some feature selection.
  4. The model is very likely to be prone to overfitting
Q20MCQ3 marks
Consider the following assertion and reason. Select the correct option. Assertion (A): Increasing the number of estimators in AdaBoost can sometimes reduce the test accuracy, even though the training error continues to decrease. Reason (R): In AdaBoost, after each iteration, the weights of correctly classified training samples are increased so that future weak learners focus more on these correct samples. Choose the correct option:
  1. Both A and R are true, and R is the correct explanation of A.
  2. Both A and R are true, but R is not the correct explanation of A.
  3. A is true, but R is false.
  4. A is false, but R is true.
Q21MCQ3 marks
An email service develops a machine learning model to automatically identify phishing emails. Any email predicted as phishing is immediately moved to the user's spam folder without notification. A legitimate email incorrectly marked as phishing could cause users to miss important messages, while an actual phishing email that is not detected can still be reported manually by the user. The company wants to minimize the number of legitimate emails incorrectly classified as phishing. Which evaluation metric should be given the highest priority while selecting the model?
  1. Accuracy
  2. Precision
  3. Recall
  4. F1-score
Q22MCQ3 marks
Which data augumentation operation is being perfomed on the input image in the given code? question figure
  1. Rotation
  2. Cropping
  3. Magnification
  4. Flipping
Q23MCQ3 marks
Consider the following code: question figure Assuming the all the models are trained on the same dataset, which of the models is likely to converge the slowest?
  1. model1
  2. model2
  3. model3
  4. code sinppet for model3 is incorrect
Q24MCQ3 marks
A monthly airline-passenger series shows seasonal swings that grow larger as the overall level of the series rises over the years. It is decomposed as: question figure Which value should fill the blank, and for which reason?
  1. , because the trend is increasing over time.
  2. , because the seasonal amplitude scales with the level of the series.
  3. , because only supports additive seasonality.
  4. , because the residual component must always sum to zero.
Q25MSQ4 marksselect all that apply
Identify the lines with errors in the given code snippet: question figure
  1. There are no errors in the code
  2. Line1
  3. Line2
  4. Line3
Q26MSQ4 marksselect all that apply
Select the correct statements regarding the following code snippet: question figure
  1. model2 is more likely to have a lower bias and higher variance compared to model1.
  2. Increasing the value of C allowed model2 to penalize misclassification errors more strongly.
  3. model1 must always perform better on the test set because it has lower training accuracy.
  4. The gamma parameter has no effect because the kernel is already set to 'rbf'.
Q27MSQ4 marksselect all that apply
A company uses K-Means clustering to divide its customers into 4 groups based on their purchasing behavior. After training the model, the data science team observes the following: Two different runs of K-Means on the same dataset produce different customer groups. One cluster contains customers that are much farther away from their assigned cluster center compared to other clusters. Which of the following statements are most likely to explain these observations?
  1. K-Means can converge to different solutions because the initial placement of cluster centroids can affect the final clusters.
  2. The cluster with customers far from its centroid may indicate that the chosen value of K does not represent the natural grouping structure of the data.
  3. K-Means guarantees finding the globally optimal clustering solution regardless of initialization.
  4. K-Means assigns clusters by maximizing the distance between points within the same cluster.
Q28MSQ4 marksselect all that apply
Identify which of the following lines (marked in comments) contain errors in the given code snippet: question figure
  1. Line1
  2. Line2
  3. Line3
  4. Line4
Q29SA5 marks
Consider the following user–item rating matrix (rows = users, columns = items; a means not rated): question figure Using user–user collaborative filtering, the predicted rating is question figure taken over the users who have rated the target item, where is the similarity of those users to the target user and are their ratings of that item. Predict the rating that user U4 would give to item I5. (Answer up to 2 decimals.)
Q30MCQ2 marks
A forecasting model achieves an R2 score of 0.98 on the test set. However, it was trained using a feature that contains the sales value of the next day. Which of the following is the most appropriate conclusion?
  1. The model has low bias.
  2. The model has successfully captured seasonality.
  3. The evaluation is unreliable due to data leakage.
  4. The model has underfit the data.

Answer key

  1. Q1 (MCQ, 4 marks): B
  2. Q2 (MCQ, 4 marks): B
  3. Q3 (MCQ, 4 marks): C
  4. Q4 (MCQ, 4 marks): A
  5. Q5 (MCQ, 4 marks): B
  6. Q6 (SA, 3 marks): 2.50
  7. Q7 (SA, 3 marks): 7
  8. Q8 (SA, 3 marks): -1.6 to -1.3
  9. Q9 (SA, 3 marks): 4
  10. Q10 (SA, 3 marks): 1
  11. Q11 (SA, 3 marks): 0.5
  12. Q12 (SA, 4 marks): 5.50
  13. Q13 (SA, 4 marks): 0.80 to 0.83
  14. Q14 (MSQ, 2 marks): A, B, C, D
  15. Q15 (MSQ, 2 marks): A, B, D, E
  16. Q16 (MSQ, 3 marks): A, B, D
  17. Q17 (MSQ, 3 marks): B, C
  18. Q18 (MCQ, 3 marks): B
  19. Q19 (MCQ, 3 marks): B
  20. Q20 (MCQ, 3 marks): C
  21. Q21 (MCQ, 3 marks): B
  22. Q22 (MCQ, 3 marks): B
  23. Q23 (MCQ, 3 marks): B
  24. Q24 (MCQ, 3 marks): B
  25. Q25 (MSQ, 4 marks): B, D
  26. Q26 (MSQ, 4 marks): A, B
  27. Q27 (MSQ, 4 marks): A, B
  28. Q28 (MSQ, 4 marks): B, D
  29. Q29 (SA, 5 marks): 3.80 to 3.90
  30. Q30 (MCQ, 2 marks): C