DigiBacc

Practice questionsIB Computer ScienceMachine learning
IB Computer Science

Machine learning practice questions.

76 exam-style questions on Machine learning with answers and explanations. Six real samples below — the full set is free with an account.

Syllabus

Topics covered

Try it

Sample questions

A postal company wants software that reads handwritten postcodes. Rather than a programmer stating a rule for every possible shape, the company supplies thousands of scanned postcodes together with the characters they contain. Which statement best describes why this is a machine learning approach?

  • The rules separating one character from another are derived from the supplied examples.
  • The program stores every supplied image and returns the one that is asked for.
  • A programmer states every rule in advance and the software applies them in order.
  • The software is translated into machine code before it is executed on the sorting machine.

Answer: The rules separating one character from another are derived from the supplied examples.

Machine learning is defined by where the rules come from: the model infers them from data instead of receiving them from a programmer. Storing and retrieving the examples unchanged would be a lookup, not learning.

An online grocer holds two years of purchase records but has never sorted its customers into any categories. It now wants software to find groups of customers who shop in similar ways. Which description fits this task?

  • Supervised classification, because each customer already belongs to a known group.
  • Unsupervised learning, because the groups are not known before the data is examined.
  • Supervised regression, because the amount each customer spends is a numerical value.
  • Supervised learning, because the purchase history acts as the label for each customer.

Answer: Unsupervised learning, because the groups are not known before the data is examined.

No correct output exists for any customer, so nothing can supervise the algorithm; the structure has to be discovered in the inputs alone. A purchase history is a set of features, never a label.

A model reaches 99 % accuracy on the data it was trained with but only 62 % on a fresh sample drawn from the same population. Which explanation is the most likely?

  • The model is underfitting, because it is too simple to represent the pattern.
  • The training data contained too few features for the model to work with.
  • The model has overfitted, learning detail that is specific to the training examples.
  • The fresh sample must have been labelled incorrectly by the people who first collected it.

Answer: The model has overfitted, learning detail that is specific to the training examples.

A large gap between training and unseen performance is the signature of overfitting: the model has memorised noise that does not repeat. Underfitting would show poor accuracy on both sets, not on one.

A screening model is built from 990 healthy patients and 10 patients with a rare condition. It predicts 'healthy' for every patient and is reported as 99 % accurate. Which statement about this result is correct?

  • The stated accuracy is wrong; predicting one class every time cannot reach 99 %.
  • The model has clearly learned the pattern, because 99 % is very close to perfect.
  • Accuracy is the fairest measure here precisely because the two classes are unequal.
  • Its recall on the rare condition is 0, so accuracy hides that it finds no cases.

Answer: Its recall on the rare condition is 0, so accuracy hides that it finds no cases.

With a 99:1 class split the majority-class guess scores 99 % while being useless, so accuracy is exactly the wrong measure. Recall on the rare class exposes the failure because the model finds none of the 10 cases.

The table records how a two-class classifier performed on 200 test samples. Calculate its precision for the positive class.

  • 0.64
  • 0.75
  • 0.80
  • 0.25

Answer: 0.75

Precision looks only at what the model flagged: 60 samples were predicted positive and 45 of them really were, so 45 / 60 = 0.75. The value 0.64 is the recall (45 / 70) and 0.80 is the accuracy (160 / 200).

A school wants a model that predicts the mark a student will obtain in a 100-mark examination from their homework record. Which type of task is this?

  • Binary classification, because a student either passes or fails the examination.
  • Clustering, because students with similar homework records are grouped together.
  • Regression, because the quantity predicted is a number on a continuous scale.
  • Multi-class classification, because there are 101 possible marks the model may return.

Answer: Regression, because the quantity predicted is a number on a continuous scale.

The task is decided by the output: a numerical quantity on a scale means regression, even though the marks happen to be whole numbers. Treating each mark as its own class would throw away the ordering between 61 and 62.

76 Machine learning questions — free with an account. Spaced repetition, streaks and full exam simulations included.

Practise them free
All subjects Pricing For teachers

This platform is independently developed and is not endorsed by, affiliated with, or sponsored by the International Baccalaureate Organization. “International Baccalaureate” and “IB” are registered trademarks of the IBO.