Module 5 Test: Deep Learning
This is your progress tracker . 20 questions: 5 Easy, 10 Moderate, 5 Hard . First solve all the questions yourself (before running the code in Colab, think of the output in your head), then check with the Answer Key.
| Score | Meaning |
|---|---|
| 18 to 20 | Excellent! Your grip on Module 5 is strong. |
| 12 to 17 | Good. Re-read the Key Takeaways of the chapters where you made mistakes. |
| Below 12 | No worries. Re-read the chapters, run the code yourself, and take the test again. |
EASY
Q1. How does a neuron produce its output?
A) It only adds up the inputs
B) It computes a weighted sum + bias and passes it through an activation function
C) It only applies an activation function
D) By reducing the loss
EASY
Q2. Which activation function is usually the first choice in hidden layers?
A) Softmax B) Sigmoid C) ReLU
D) None
EASY
Q3. What should be the last layer for multiclass classification with 10 classes (integer labels)?
A) Dense(1, activation="sigmoid")
B) Dense(10, activation="softmax")
C) Dense(10) (no activation)
D) Dense(1, activation="relu")
EASY
Q4. What does Max Pooling do in a CNN?
A) Sets the weights to zero B) Encodes the labels C) Increases overfitting
D) Reduces the size of the feature map and keeps the largest number of each region
EASY
Q5. In an LSTM, which gate decides how much of the old memory (cell state) to forget?
A) Forget gate B) Input gate C) Output gate
D) Reset gate
MODERATE
Q6. A Dense(16) layer receives an input with 20 features. How many parameters does this layer have?
A) 320 B) 336 C) 16 D) 356
MODERATE
Q7. A Conv2D(32, (3, 3)) layer (padding="valid") has an input of shape (28, 28, 1). How many parameters does this layer have?
A) 288 B) 296 C) 320 D) 896
MODERATE
Q8. Apply the conv output-size formula: input 28x28, filter 5x5, padding 0, stride 1. What will the output size be?
A) 24x24 B) 23x23 C) 28x28 D) 25x25
MODERATE
Q9. The training loss keeps falling but after some point the validation loss starts to rise. What is this a sign of? A) Underfitting B) Overfitting C) The learning rate being exactly zero
D) The data being scaled
MODERATE
Q10. What is the correct meaning of applying Dropout(0.3)?
A) 70% of the weights are removed permanently B) 30% of the neurons are switched off during testing C) The learning rate becomes 0.3
D) During training, at each step roughly 30% of the neurons are randomly switched off
MODERATE
Q11. What is the correct way to split train/test in time series forecasting?
A) Random shuffle, then 80/20 B) Older data for train, and the newer data after it for test
C) Test first and train afterwards
D) K-Fold with shuffling
MODERATE
Q12. What will be the output of this code?
scores = np.array([2.0, 1.0, 0.1])
e = np.exp(scores)
p = e / e.sum()
print(p.argmax(), round(p.sum(), 1))
A) 2 1.0 B) 0 3.1 C) 0 1.0 D) 1 1.0
MODERATE
Q13. In Transfer Learning, what happens when you write base.trainable = False?
A) The weights of the pre-trained base are frozen, and only the new head is trained
B) The whole model is deleted
C) The weights of the base become random
D) Data augmentation starts
MODERATE
Q14. An autoencoder was trained only on normal data. In testing, what is the reconstruction error of an anomaly (an unusual item) usually like?
A) Lower than normal data B) Exactly zero C) Always equal D) Higher than normal data
MODERATE
Q15. Which statement about the Adam optimizer is correct?
A) It is just plain SGD B) It is built by combining the ideas of Momentum and RMSprop C) It has no learning rate at all D) It is only for CNNs
HARD
Q16. The input of a Conv2D(64, (3, 3)) layer has 32 channels. How many parameters does this layer have? A) 18,432 B) 2,080 C) 18,496 D) 576
HARD
Q17. An LSTM(32) layer receives only 1 feature at each time step. How many parameters does this layer have? A) 4,352 B) 3,360 C) 1,088 D) 4,224
HARD
Q18. What will be the output size of the Flatten layer?
model = keras.Sequential([
keras.Input(shape=(28, 28, 1)),
layers.Conv2D(8, 3, padding="same", activation="relu"),
layers.MaxPooling2D(2),
layers.Conv2D(16, 3, activation="relu"),
layers.MaxPooling2D(2),
layers.Flatten(),
])
A) 784 B) 1024 C) 400 D) 576
HARD
Q19. During the training of a GAN, the Generator's loss keeps falling. What conclusion can be drawn from this?
A) The generated samples are certainly excellent
B) The Discriminator has become bad
C) Nothing can be said for sure: the two losses are tied to each other, so one should look at the samples D) It is time to stop training
HARD
Q20. What will be the shapes of X and y from this code?
def make_windows(values, window):
X, y = [], []
for i in range(window, len(values)):
X.append(values[i - window:i])
y.append(values[i])
return np.array(X), np.array(y)
X, y = make_windows(np.arange(10), 4)
print(X.shape, y.shape)
A) (10, 4) and (10,) B) (6, 4) and (6,) C) (4, 6) and (6,)
D) (6, 4) and (6, 4)
Module 5 Answer Key (Answers and explanations)
| # | Level | Answer | Explanation |
|---|---|---|---|
| 1 | Easy | B) It computes a weighted sum + bias and passes it through an activation function | A neuron first multiplies by the weights and adds up, adds the bias, and then applies an activation (such as ReLU/sigmoid). |
| 2 | Easy | C) ReLU | ReLU is fast and simple and reduces the vanishing gradient problem. Softmax is for the last layer of multiclass. |
| 3 | Easy | B) Dense(10, activation="softmax") | 10 neurons and softmax for 10 classes (the probabilities sum to 1). Loss: sparse_categorical_crossentropy. |
| 4 | Easy | D) Reduces the size of the feature map and keeps the largest number of each region | Max Pooling reduces the spatial size (less computation) and keeps the strongest signal of each region. |
| 5 | Easy | A) Forget gate | The forget gate gives a number between 0 and 1: 0 means forget everything, 1 means remember everything. The reset gate belongs to GRU. |
| 6 | Moderate | B) 336 | Weights 20 x 16 = 320 and biases 16, total 336. Formula: (inputs + 1) x neurons. |
| 7 | Moderate | C) 320 | (3 x 3 x 1 + 1) x 32 = 320. 288 is the weights only, without the biases (32). 896 is the answer for an input with three channels (RGB). |
| 8 | Moderate | A) 24x24 | floor((28 + 2x0 - 5) / 1) + 1 = 24. |
| 9 | Moderate | B) Overfitting | Doing better on train and worse on validation is overfitting. Cures: Early Stopping, Dropout, L2, more data. |
| 10 | Moderate | D) During training, at each step roughly 30% of the neurons are randomly switched off | Dropout switches off random neurons only during training. In testing all the neurons work. |
| 11 | Moderate | B) Older data for train, and the newer data after it for test | Future data must not enter training, otherwise there is leakage. Always split by time. |
| 12 | Moderate | C) 0 1.0 | After softmax the probabilities sum to 1.0 and the largest score (2.0) is at index 0, so argmax is 0. |
| 13 | Moderate | A) The weights of the pre- trained base are frozen, and only the new head is trained | Freezing preserves the learned knowledge and only the new final part is trained. |
| 14 | Moderate | D) Higher than normal data | The network has learned to compress only normal things; it rebuilds the unusual thing badly, so the error is large. |
| 15 | Moderate | B) It is built by combining the ideas of Momentum and RMSprop | Adam uses both the first moment (like momentum) and the second moment (like RMSprop). The usual default lr = 0.001. |
| 16 | Hard | C) 18,496 | (3 x 3 x 32 + 1) x 64 = 18,496. 18,432 does not include the biases (64). |
| 17 | Hard | A) 4,352 | 4 x (1 + 32 + 1) x 32 = 4,352. 3,360 is the answer for GRU(32) (3 parts, two biases). |