Skip to content
Kuza Ndoto Academy

Machine Learning Quiz

IntermediateChapter 7 · Page 26 of 264 min readUpdated 15 Nov 2026

Test your understanding of the whole Machine Learning series. Try each question before opening the answer. If you get one wrong, follow the link back to the page that covers it.

Foundations and data

1. A model predicts next month's electricity bill in KES. What kind of task is this?

  • A. Classification
  • B. Regression
  • C. Clustering
  • D. Reinforcement learning
Show answer

B. Regression. The output is a number, not a category. See Types of Machine Learning.

2. Which statement about AI, ML and deep learning is correct?

  • A. All AI is deep learning
  • B. Deep learning is a subset of machine learning, which is a subset of AI
  • C. Machine learning is a subset of deep learning
  • D. They are three unrelated fields
Show answer

B. The terms are nested circles. See AI vs. ML vs. Deep Learning.

3. You're predicting loan default. Which feature causes target leakage: monthly income, age, or "number of recovery calls made"?

Show answer

Number of recovery calls made. It is only recorded after a borrower falls behind, so it won't exist when a new loan is assessed. See Features & Labels.

4. Ages 20, 30 and 40 are min-max scaled. What does 30 become?

Show answer

0.5. (30 − 20) / (40 − 20) = 0.5. See Feature Scaling.

5. What is wrong with calling StandardScaler().fit_transform(X) on the full dataset and then splitting it?

Show answer

Data leakage. The mean and standard deviation include test rows, so the test set influences training. Split first and fit the scaler on training data only. See Train/Test Split.

Supervised and unsupervised learning

6. A line fitted to data is y = 7.5x + 21.5. What does it predict for x = 4?

Show answer

51.5. 7.5 × 4 + 21.5 = 30 + 21.5 = 51.5. See Linear Regression.

7. In logistic regression, what probability does the sigmoid give when z = 0?

  • A. 0
  • B. 0.5
  • C. 1
  • D. It depends on the features
Show answer

B. 0.5. 1 / (1 + e0) = 1 / 2. This is the decision boundary. See Logistic Regression.

8. A tree node holds 4 "yes" and 6 "no" examples. What is its Gini impurity?

Show answer

0.48. 1 − (0.4² + 0.6²) = 1 − 0.52 = 0.48. See Decision Trees.

9. What is the Euclidean distance between the points (1, 2) and (4, 6)?

Show answer

5. √(3² + 4²) = √25 = 5. See K-Nearest Neighbours.

10. What two sources of randomness make the trees in a random forest different from each other?

Show answer

Bootstrap samples of the rows, and random subsets of features at each split. See Random Forests.

11. K-means has clusters {1, 2, 3} and {8, 9, 10}. Where do the centroids move in the update step?

Show answer

To 2 and 9, the means of each cluster. See K-Means Clustering.

Evaluation

12. A fraud model has TP = 2, FP = 1, FN = 2 and TN = 5. What are its precision and recall?

Show answer

Precision ≈ 0.667 and recall = 0.5. Precision = 2 / (2 + 1); recall = 2 / (2 + 2). See Evaluation Metrics.

13. A model scores 100% on training data and 70% on test data. What is most likely happening, and name one fix.

Show answer

Overfitting. Fixes include more data, a simpler model (e.g. a lower max_depth), regularisation or an ensemble. See Overfitting & Underfitting and Cross-Validation.

Deep learning, GenAI and responsible AI

14. What does a large language model fundamentally do when generating text?

  • A. Looks up answers in a database of facts
  • B. Repeatedly predicts the next token from probabilities
  • C. Copies whole paragraphs from its training data
  • D. Runs a search engine for every word
Show answer

B. It predicts one token at a time, which is also why it can hallucinate fluent but false statements. See How Large Language Models Work, and RAG for grounding answers in documents.

15. Group A's loan approval rate is 0.6 and group B's is 0.2. What is the disparate impact ratio, and is it a concern under the four-fifths rule?

Show answer

About 0.33, and yes. 0.2 / 0.6 ≈ 0.33, well below the 0.8 warning level. See Bias & Fairness and AI Ethics & Safety.

Key points

  • 12 or more correct: you have a strong grasp of the series.
  • 8 to 11: revisit the pages linked from the questions you missed.
  • Fewer than 8: work through the series again, running every code example yourself.
  • Next step: apply these skills to a real dataset, starting with Project: Sales Analysis.
You've reached the end of the seriesGet certified in AI/MLContinue in Kuza Ndoto Academy with projects, mentor feedback and a certificate.
→

Tip: use the ← and → keys to move between pages.