MS Artificial Intelligence

Deep Learning — Lecture 2, Set 04

Take the Deep Learning — Lecture 2, Set 04: 20 multiple-choice questions (30 minutes) with instant scoring and a full answer review. Covers 20 Deep…

What this test covers

Sample questions with answers

The first 5 questions of this test, with the correct answer and explanation.

  1. Q1. In the printed training output, what are the loss and accuracy after Epoch 1 of 5?

    • A. loss 0.1035 and accuracy 0.9692
    • B. loss 0.2524 and accuracy 0.9273 ✓
    • C. loss 0.0000 and accuracy 1.0000
    • D. loss 2.3026 and accuracy 0.1000

    Answer: B. loss 0.2524 and accuracy 0.9273

    Explanation: Epoch 1/5 prints loss: 0.2524 and acc: 0.9273; by Epoch 2 the loss has fallen to 0.1035 with acc 0.9692.

  2. Q2. Before any preprocessing, what does train_labels contain?

    • A. One-hot vectors of length 10
    • B. Floating-point values between 0 and 1
    • C. An array of digit values such as [5, 0, 4, ...] with dtype uint8 ✓
    • D. Strings naming each digit

    Answer: C. An array of digit values such as [5, 0, 4, ...] with dtype uint8

    Explanation: train_labels is an array of digit values, array([5, 0, 4, ..., 5, 6, 8], dtype=uint8), with 60000 entries.

  3. Q3. The naive_relu function loops over every entry and sets x[i, j] = max(x[i, j], 0). What is the optimised NumPy equivalent?

    • A. z = np.dot(x, 0)
    • B. z = x.reshape(-1)
    • C. z = np.sum(x, axis=0)
    • D. z = np.maximum(x, 0) ✓

    Answer: D. z = np.maximum(x, 0)

    Explanation: NumPy runs the same loops in optimised C: z = np.maximum(x, 0) for relu, and z = x + y for addition.

  4. Q4. Which of these is NOT an element-wise operation?

    • A. relu applied to an activation tensor
    • B. The dot product between a batch and a weight matrix ✓
    • C. sigmoid applied to an activation tensor
    • D. The addition of two activation tensors

    Answer: B. The dot product between a batch and a weight matrix

    Explanation: relu, sigmoid, tanh and the addition of two activations are all element-wise; the dot product combines entries across axes and is not.

  5. Q5. If x has shape (300, 20), what is the shape of x.T, and what does transposition do?

    • A. (20, 300), swapping axes so that x.T[i, j] = x[j, i] ✓
    • B. (300, 20), leaving the shape unchanged but reversing the rows
    • C. (6000,), flattening the tensor
    • D. (300, 300), making the matrix square

    Answer: A. (20, 300), swapping axes so that x.T[i, j] = x[j, i]

    Explanation: Transposition swaps axes: x of shape (300, 20) becomes (20, 300), with x.T[i, j] = x[j, i].

The other 15 questions

Take the timed test (free, no sign-up) to see your score and the answer and explanation for every question.

  1. Q6. Why does the lecture say transposition matters?

    • A. It halves the memory needed for a weight matrix
    • B. It converts a tensor to a lower precision data type
    • C. It is what makes the shape rule of the dot product line up
    • D. It is required before every element-wise operation
  2. Q7. Plain vector data is stored as which kind of tensor?

    • A. 1D tensors of shape (features,)
    • B. 2D tensors of shape (samples, features)
    • C. 3D tensors of shape (samples, time-steps, features)
    • D. 4D tensors of shape (samples, height, width, channels)
  3. Q8. Video data is stored as which kind of tensor?

    • A. 3D tensors of shape (samples, frames, features)
    • B. 4D tensors of shape (samples, frames, height, width)
    • C. 5D tensors of shape (samples, frames, height, width, channels)
    • D. 6D tensors of shape (samples, frames, height, width, channels, time)
  4. Q9. In the geometric view, what is a 784-pixel MNIST image?

    • A. A point in 784-dimensional space
    • B. A line in 28-dimensional space
    • C. A plane in 10-dimensional space
    • D. A scalar value between 0 and 1
  5. Q10. What does multiplying by W do to space, in the geometric view?

    • A. It folds the negative half of every axis onto zero
    • B. It translates every point by the same amount
    • C. It rotates, scales and shears space, but keeps straight lines straight and the origin fixed
    • D. It projects every point onto a single axis
  6. Q11. What does training search for, in the geometric description of a deep network?

    • A. The shortest chain of transformations that preserves the input exactly
    • B. The chain of transformations that untangles the classes, so a final flat boundary separates the digits
    • C. The transformation that maps every image to the origin
    • D. The rotation that aligns the data with the coordinate axes
  7. Q12. What is the formula for the sigmoid function, and what is its output range?

    • A. max(0, x), with range [0, infinity)
    • B. 1 / (1 + e to the minus x), with range (0, 1)
    • C. (e^x - e^-x) / (e^x + e^-x), with range (-1, 1)
    • D. e^z_i divided by the sum of e^z_j, with range (0, 1) summing to 1
  8. Q13. What is the output range of tanh, and where is it typically used?

    • A. (0, 1); output layer for binary classification
    • B. [0, infinity); default for hidden layers
    • C. (-1, 1); hidden layers in recurrent nets, because it is zero-centred
    • D. (0, 1) summing to 1; output layer for K classes
  9. Q14. What is the derivative of the sigmoid function?

    • A. sigma(x) times (1 - sigma(x))
    • B. 1 - tanh squared of x
    • C. 1 if x > 0, else 0
    • D. sigma(x) times x
  10. Q15. What does it mean that sigmoid and tanh saturate, and what problem does it cause?

    • A. Their output grows without bound, causing numerical overflow
    • B. Their derivative becomes exactly 1, causing exploding gradients
    • C. They produce only negative values, blocking the forward pass
    • D. For |x| greater than about 4 their derivative is close to 0, so the gradient reaching earlier layers shrinks at every layer
  11. Q16. What is a dead ReLU unit, and what variant is suggested to avoid it?

    • A. A unit whose weights have grown too large; softmax is used instead
    • B. A unit with x < 0 for all inputs, which has zero gradient and never recovers; Leaky ReLU, max(0.01x, x), keeps a small slope
    • C. A unit that outputs the same value for every input; batch normalisation fixes it
    • D. A unit removed by dropout; increasing the dropout rate avoids it
  12. Q17. Why is softmax applied to the whole vector of scores rather than entry by entry?

    • A. Because it would otherwise return negative values
    • B. Because the scores must be sorted first
    • C. Because raising one score lowers every other probability, which is what a K-way choice requires
    • D. Because entry-by-entry application would be too slow
  13. Q18. How does the lecture relate sigmoid to softmax?

    • A. Sigmoid is softmax with K = 2: with scores (z, 0), the first output equals sigma(z)
    • B. Softmax is sigmoid applied twice in sequence
    • C. They are unrelated functions used in different eras
    • D. Sigmoid is softmax with the exponential replaced by a logarithm
  14. Q19. With three scores one unit apart, what ratio does softmax produce between the probabilities, and what about a gap of 5?

    • A. A ratio of 2 for a gap of 1, and 10 for a gap of 5
    • B. A ratio of e, about 2.7, for a gap of 1, and about 150 for a gap of 5
    • C. A ratio of 1 for any gap, since softmax is shift-invariant
    • D. A ratio of 5 for a gap of 1, and 25 for a gap of 5
  15. Q20. How do libraries avoid overflow when computing softmax, and why is it valid?

    • A. They clip all scores to the range (-10, 10), which changes the result only slightly
    • B. They use float64 instead of float32, which removes the overflow
    • C. They compute softmax(z - max z), which is the same function by the shift property
    • D. They normalise the scores to sum to 1 before exponentiating