Skip to main content

Quiz: Metrics and neural networks

How to use this quiz

Nine exam-style questions on sections 3.3 and 3.4 of the syllabus. Questions 1 to 3 are K3 calculations: in the exam such a question is worth 2 points. Keep a calculator or a piece of paper ready, and answer each question before you open the explanation.

Quiz

1. (K3) A defect-prediction model is tested on 500 software modules. It flags 80 modules as defective; 60 of them really are defective. In total 100 of the 500 modules are defective. What is the recall?

  • A. 0.60
  • B. 0.75
  • C. 0.80
  • D. 0.88
Show answer
A. TP = 60, FN = 100 − 60 = 40. Recall = 60 / (60 + 40) = 0.60. Precision would be 60 / 80 = 0.75 (option B). Lesson: Metrics from a confusion matrix.
Quiz

2. (K3) Same model as question 1. What is the accuracy?

  • A. 0.80
  • B. 0.84
  • C. 0.88
  • D. 0.92
Show answer
C. Write out all four cells first: TP 60, FP 80 − 60 = 20, FN 40, TN = 500 − 60 − 20 − 40 = 380. Accuracy = (60 + 380) / 500 = 440 / 500 = 0.88. Filling in the four cells is the step where most exam mistakes happen. Lesson: Metrics from a confusion matrix.
Quiz

3. (K3) A classifier has a precision of 0.75 and a recall of 0.60. What is its F1-score?

  • A. 0.667
  • B. 0.675
  • C. 0.700
  • D. 0.450
Show answer
A. F1 = 2 × 0.75 × 0.60 / (0.75 + 0.60) = 0.9 / 1.35 = 0.667. Option B is the ordinary average, which F1 is not. Lesson: Metrics from a confusion matrix.
Quiz

4. Which metric is most important for a model that screens patients for a serious disease, where “sick” is the positive class and missing a sick patient is dangerous?

  • A. Precision
  • B. Recall
  • C. Accuracy
  • D. Specificity
Show answer
B. Recall measures how many of the actually sick patients are found. Lesson: Hands-on: evaluate a model with metrics.
Quiz

5. A team compares four algorithms on two versions of a dataset. What should be kept the same for a fair comparison?

  • A. The algorithm
  • B. The test data and the metrics
  • C. The training time
  • D. The hyperparameters of all algorithms
Show answer
B. Lesson: Hands-on: model and dataset combinations.
Quiz

6. What happens during backpropagation?

  • A. Data flows from the input layer to the output layer
  • B. The error is propagated back through the network and weights and biases are adjusted to reduce it
  • C. Neurons are removed from the network
  • D. The test data is used to tune the network
Show answer
B. A is the forward pass. Lesson: How a deep neural network works.
Quiz

7. What is the role of the activation function in a neuron?

  • A. It stores the training data
  • B. It adds non-linearity, so the network can learn more than straight-line relationships
  • C. It sets the learning rate
  • D. It counts the number of epochs
Show answer
B. Lesson: How a deep neural network works.
Quiz

8. A perceptron is trained on a problem for 10,000 epochs and never reaches zero errors. What is the most likely cause?

  • A. The learning rate is too low
  • B. The problem is not linearly separable, so a single perceptron cannot learn it
  • C. The perceptron needs more epochs
  • D. The perceptron is overfitting
Show answer
B. Like XOR. Lesson: Hands-on: implement a perceptron.
Quiz

9. A test input makes a neuron produce an output higher than any output it produced during training. Which coverage measure does this contribute to?

  • A. Neuron coverage only
  • B. Neuron boundary coverage
  • C. k-multisection neuron coverage
  • D. Statement coverage
Show answer
B. Outputs beyond the training minimum or maximum count for NBC; kMNC only counts sections within the training range. Lesson: Coverage measures for neural networks.

Your score

  • 8-9: ready for sections 3.3 and 3.4.
  • 6-7: redo the calculations you missed; the K3 questions are worth double.
  • 5 or fewer: go back to lesson 18 and practise more confusion matrices.