Week 3 Quiz :Natural Language Processing in TensorFlow (DeepLearning.AI TensorFlow Developer Professional Certificate) Answers 2025
1. Question 1
When stacking LSTMs, how do you feed the next LSTM in the sequence?
-
❌ Ensure same number of units
-
❌ Do nothing
-
❌ return_sequences = True on all
-
✅ return_sequences = True only on units that feed another LSTM
Explanation:
Only LSTM layers feeding into another LSTM must output a sequence → set return_sequences=True.
2. Question 2
How does an LSTM capture long-range meaning?
-
❌ Load all words into cell state
-
❌ They don’t
-
✅ Earlier word values can be carried forward via the cell state
-
❌ Shuffle words randomly
Explanation:
LSTMs maintain memory through a cell state that flows across time steps.
3. Question 3
Best way to avoid overfitting in NLP datasets?
-
❌ LSTMs
-
❌ GRUs
-
❌ Conv1D
-
✅ None of the above
Explanation:
Overfitting isn’t solved by architecture choice → use regularization, dropout, augmentation, more data.
4. Question 4
Which Keras layer allows LSTMs to read forward and backward?
-
❌ Bilateral
-
❌ Unilateral
-
❌ Bothdirection
-
✅ Bidirectional
Explanation:Bidirectional() wraps an LSTM so it processes the sequence forward and backward.
5. Question 5
Why does sequence matter for semantics?
-
❌ It doesn’t
-
❌ Because order dictates their impact on meaning
-
❌ Order doesn’t matter
-
✅ Because the order in which words appear dictates their meaning
Explanation:
Word order changes meaning entirely:
“dog bites man” ≠ “man bites dog”.
6. Question 6
How do RNNs help understand sequence meaning?
-
❌ They don’t
-
❌ They shuffle the words
-
❌ They look at whole sentence at once
-
✅ They carry meaning from one cell to the next
Explanation:
RNNs pass hidden states between time steps → sequence-aware understanding.
7. Question 7
Output shape of a bidirectional LSTM with 64 units?
-
❌ (128,1)
-
❌ (128,None)
-
❌ (None,64)
-
✅ (None,128)
Explanation:
Bidirectional doubles the units:
64 forward + 64 backward = 128.
8. Question 8
Sentence = 120 tokens → Conv1D with 128 filters, kernel size = 5.
What is output shape?
-
❌ (None, 120, 124)
-
✅ (None, 116, 128)
-
❌ (None, 116, 124)
-
❌ (None, 120, 128)
Explanation:
Conv1D output length (no padding):
120 − 5 + 1 = 116
Filters = 128 channels.
🧾 Summary Table
| Q# | Correct Answer | Key Concept |
|---|---|---|
| 1 | return_sequences=True for stacked LSTMs | Stacking LSTMs |
| 2 | Cell state carries info | LSTM long-range dependencies |
| 3 | None of the above | Overfitting not solved by architecture |
| 4 | Bidirectional | Forward + backward context |
| 5 | Sequence dictates meaning | NLP semantics |
| 6 | Carry meaning between cells | RNN sequence modeling |
| 7 | (None, 128) | Bidirectional doubles units |
| 8 | (None, 116, 128) | Conv1D output shape |