ML Study Hub

Home / Past papers / MLP End Term / this paper

Machine Learning Practice - Bs In Data Science/ Electronic Systems 13 Sep 26 (Session 2) - 13 Sep 2026

MLP End Term29 questions100 marks13 MCQ · 9 SA · 7 MSQ
Elapsed 00:00
Q1MCQ4 marks
Analyze the following code block: question figure Which products are included in filtered_df?
  1. Laptop, Mouse, Monitor
  2. Mouse, Keyboard
  3. Laptop, Mouse
  4. Laptop, Mouse, Cable
Q2MCQ4 marks
In the following question an Assertion (A) is followed by a Reason (R). Choose the correct option. Assertion (A): In a scikit-learn , the last step must be a transformer that implements both and . Reason (R): Only the intermediate steps of a are required to implement ; the final estimator only needs to implement .
  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
  5. Both A and R are false
Q3MCQ4 marks
Consider the following code: question figure After the model is fit raises an error. Why?
  1. VotingRegressor deletes the original estimator.
  2. VotingRegressor internally clones every estimator before fitting.
  3. LinearRegression does not store coefficients.
  4. VotingRegressor converts all models to RandomForest since it is the best model out of the 3 due to ensemble learning.
Q4MCQ4 marks
A news article dataset contains 10,000 documents. The word "government" appears in 9,500 documents, while the word "cryptocurrency" appears in only 200 documents. A TF-IDF vectorizer is applied to this dataset. Which of the following statements is most likely true?
  1. The TF value of "government" will always be lower than the TF value of "cryptocurrency" because it appears in more documents.
  2. The IDF contribution of "cryptocurrency" will be higher than that of "government", even if both words occur the same number of times in a document.
  3. If "government" appears 50 times in one article, its TF-IDF score must be higher than "cryptocurrency" appearing once in the same article.
  4. Removing "government" from the vocabulary will always decrease model performance because it appears in most documents.
Q5MCQ4 marks
What is being done to the input image in the given code? question figure
  1. The image has been rotated by 90 degrees clockwise.
  2. The image has been vertically flipped.
  3. The image has been horizontally flipped.
  4. The image has been mean centered.
Q6MCQ4 marks
A matrix-factorization recommender is set up on MovieLens-100k as follows: question figure Which of the following statements is TRUE?
  1. Evaluating the expression returns the full predicted-rating matrix, of shape .
  2. The model has trainable parameters.
  3. Increasing reduces the risk of overfitting on the sparse rating matrix.
  4. The predicted rating of user for item is the cosine similarity between and .
Q7MCQ4 marks
Which statement correctly pairs each test's null hypothesis with its decision rule?
  1. ADF: H0 = non-stationary, conclude stationary if p < 0.05. KPSS: H0 = (trend) stationary, conclude non-stationary if p < 0.05.
  2. ADF: H0 = stationary, conclude non-stationary if p < 0.05. KPSS: H0 = non- stationary, conclude stationary if p < 0.05.
  3. Both ADF and KPSS have H0 = non-stationary; both conclude stationary when p < 0.05.
  4. Both ADF and KPSS have H0 = stationary; both conclude non-stationary when p < 0.05.
Q8SA3 marks
What is the output of the given code? question figure
Q9SA3 marks
applies both transformers in parallel and concatenates their outputs side-by-side. How many columns does have? (Enter an integer) question figure
Q10SA3 marks
What is the output of the following code? import pandas as pd from sklearn.preprocessing import OneHotEncoder df = pd.DataFrame({ "Color": ["Red", "Blue", "Green", "Blue", "Red"], "Size": ["S", "M", "L", "XL", "M"] }) encoder = OneHotEncoder(drop="first", sparse_output=False) X = encoder.fit_transform(df) print(X.shape[1])
Q11SA3 marks
What is the output of the given code? (Round upto one decimal) question figure
Q12SA3 marks
A K-Means algorithm has a cluster centroid: C=(6,6) During the next iteration, a new data point: (10,10) is assigned to this cluster. Before the update step, this cluster contained 4 data points. The individual points are not available, but the centroid of the cluster before adding the new point was: (6,6) After adding the new point and performing the centroid update step, the new centroid becomes: (6.8,6.8) What is the sum of the coordinates of the original 4 data points combined?
Q13SA4 marks
After scaling, what is the SUM of the transformed values of all samples whose ORIGINAL value equals 4? (Enter up to 2 decimals) question figure
Q14SA4 marks
A regression model achieves an R2 score of 0.92 on a test set. The sum of squared deviations of the true target values from their mean is 625. Compute the sum of squared prediction errors made by the model.
Q15SA4 marks
What is the output of the print statement in the given code? Enter an integer question figure
Q16MSQ3 marksselect all that apply
The following categorical-encoding transformers are available in scikit-learn: , , , . Select ALL statements that are correct.
  1. can transform only 1-D data, whereas can operate on multi-dimensional (multi-feature) data.
  2. By default (with no dropping), creates K binary columns for a feature with K distinct categories.
  3. is designed to encode samples where each sample is associated with a set of labels.
  4. is preferred over for nominal (unordered) categories because it prevents the model from assuming any ordering among the categories.
Q17MSQ3 marksselect all that apply
Consider the following code: question figure Which of the following are correct?
  1. X_new contains exactly 5 features.
  2. selector.support_.sum() is equal to 5.
  3. RFE selects the first 5 columns of X.
  4. RFE repeatedly removes the least important features according to the estimator.
Q18MSQ3 marksselect all that apply
In the given code snippet certain lines are marked with comments. Identify which of those lines dont have any errors. question figure
  1. Line1
  2. Line2
  3. Line3
  4. Line4
Q19MSQ3 marksselect all that apply
Which of the following parameters of a DecisionTreeClassifier in Sklearn can be adjusted if the model has a high varience?
  1. ccp_alpha
  2. random_state
  3. min_samples_split
  4. max_depth
Q20MSQ3 marksselect all that apply
Which of the following statements comparing STL decomposition with classical are correct?
  1. STL can adapt to a seasonal pattern whose shape changes slowly over time, whereas classical decomposition assumes a fixed seasonal component.
  2. STL, being based on LOESS smoothing, is more robust to outliers than classical decomposition.
  3. Classical decomposition supports only additive models, while STL supports both additive and multiplicative models.
  4. Classical can be run in either additive or multiplicative mode.
Q21MSQ4 marksselect all that apply
Consider two regularization models, Model A (Ridge) and Model B (Lasso), trained on a dataset where two input features are highly collinear ( X1≈X2 ). question figure Which of the following statements accurately describe the expected behavior of these models and their evaluation metrics under severe collinearity?
  1. Model B (Lasso) will distribute the regression coefficients evenly across both X1 and X2 to balance the penalty, while Model A (Ridge) will force one of the coefficients to be exactly zero.
  2. Model A (Ridge) will shrink the coefficients of X1 and X2 toward zero but keep them roughly equal, whereas Model B (Lasso) will unstablely select one feature to keep and drive the coefficient of the other exactly to zero.
  3. If the target variable y contains extreme outliers, evaluating these models using Mean Squared Error (MSE) will penalize those large errors more heavily than Mean Absolute Error (MAE).
  4. Minimizing the MSE loss function during the training of Model A and Model B mathematically guarantees that the sum of the residual errors ( y−ŷ ) will always equal zero.
Q22MSQ4 marksselect all that apply
Consider the following code: question figure Select the correct statements:
  1. The algorithm starts by selecting two random centroids and iteratively updates them.
  2. The algorithm initially treats every point as a separate cluster and repeatedly merges clusters based on the complete linkage criterion.
  3. The final labels represent the two groups formed after cutting the dendrogram to obtain two clusters.
  4. Changing n_clusters=2 to n_clusters=3 will change the entire merging process from the first step.
  5. The output labels will always be [0,0,0,1,1] because the first three points are closer to each other.
Q23MCQ3 marks
Consider the following models: question figure Which of the following explains the two models correctly?
  1. model1 will apply weaker regularization compared to model2, resulting in smaller coefficients.
  2. model2 will apply stronger regularization compared to model1, resulting in more coefficients close to zero.
  3. model1 is more likely to have smaller magnitude coefficients because it uses stronger regularization.
  4. Both models apply the same amount of regularization because the penalty type is the same.
Q24MCQ3 marks
In the following question an Assertion (A) is followed by a Reason (R). Choose the correct option. Assertion (A): The order in which training samples are presented to the Perceptron can affect the final learned weight vector, even when the training data is linearly separable. Reason (R): If a dataset is linearly separable, the Perceptron algorithm is guaranteed to converge after a finite number of weight updates.
  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.
Q25MCQ3 marks
What evaluation metric does code the compute? question figure
  1. R2 Score
  2. Recall
  3. Accuracy
  4. Precision
  5. F1 Score
Q26MCQ3 marks
A hospital develops a machine learning model to identify patients who may have a rare but life-threatening disease. Only about 1% of patients actually have the disease. Every patient predicted as positive is referred for an inexpensive follow-up blood test. However, missing an actual patient with the disease could delay treatment and have severe consequences. Which evaluation metric should be given the highest priority while selecting the model?
  1. Accuracy
  2. Precision
  3. Recall
  4. F1-score
Q27MCQ3 marks
After training a KMeans clustering algorithm on a dataset we find a data point is sitting exactly on or extremely close to the decision boundary between two neighboring clusters. Which of the following values will the silhouette score be close / equal to?
  1. 1
  2. 0
  3. -1
  4. infinity
Q28MCQ2 marks
The decision rule for a Naive Bayes varient is based on the following formula: Identify the Naive Bayes varient.
  1. GaussianNB
  2. BernoulliNB
  3. CategoricalNB
  4. MultinomialNB
Q29SA5 marks
Consider the following item–user rating matrix (rows = items, columns = users; a means not rated): question figure Using item–item collaborative filtering, the predicted score for an item the user has not rated is question figure where are the cosine similarities of the target item to the items the user has rated, and are the corresponding ratings by that user. Predict the rating that user U4 would give to item I4. (Answer up to 2 decimals.)

Answer key

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