RNN & Sequence Models Questions with Answers

18 practice questions on RNN & Sequence Models (AI & Machine Learning) with answers and step-by-step solutions. Try 10 samples below, then practise all 18 free in the AptiNest app.

Sample questions

Question 1Easy

LSTM stands for:

  1. Layered State Tensor Map
  2. Long Short-Term Memory
  3. Large Scale Text Machine
  4. Linear Sequence Transfer Model

Answer: B. Long Short-Term Memory

Explanation

LSTMs are gated RNNs that remember information over long sequences.

Step-by-step solution

  1. LSTM = Long Short-Term Memory.
  2. It keeps short-term memory over long spans.
  3. It is a gated recurrent network.

Why the other options are wrong

  • A. No such term.
  • C. No such term.
  • D. No such term.

Question 2Easy

Which data type is a natural fit for an RNN?

  1. An unordered set of IDs
  2. A list of file names sorted alphabetically
  3. A single static number
  4. A sentence of words

Answer: D. A sentence of words

Explanation

RNNs exploit the order of elements in a sequence.

Step-by-step solution

  1. RNNs process ordered sequences step by step.
  2. A sentence is an ordered sequence of words.
  3. So it suits an RNN.

Why the other options are wrong

  • A. An unordered set has no sequence order.
  • B. Alphabetical sorting is not a meaningful sequence to model.
  • C. A single number has no sequence.

Question 3Easy

LSTMs address vanishing gradients mainly through:

  1. Using convolutions
  2. Larger learning rates
  3. Removing the hidden state
  4. Gated cell state

Answer: D. Gated cell state

Explanation

Forget, input and output gates control a cell state that can carry information across many steps.

Step-by-step solution

  1. An LSTM keeps a separate cell state alongside the hidden state.
  2. Gates decide what to forget, add and output.
  3. The cell state updates mostly by addition, so gradients flow across many steps without vanishing.

Why the other options are wrong

  • A. Convolutions are not the mechanism LSTMs use.
  • B. Larger learning rates do not fix vanishing gradients.
  • C. LSTMs keep and extend the hidden state.

Question 4Easy

Recurrent neural networks are designed for:

  1. Sequential data
  2. Sorting algorithms
  3. Only images
  4. Only tabular data with no order

Answer: A. Sequential data

Explanation

An RNN processes one step at a time, carrying a hidden state forward.

Step-by-step solution

  1. RNNs process inputs one step at a time.
  2. They carry a hidden state from step to step.
  3. This suits sequences such as text, speech and time series.

Why the other options are wrong

  • B. Sorting does not need learning.
  • C. Images are mainly handled by CNNs.
  • D. Unordered tabular data has no sequence for recurrence to use.

Question 5Medium

In a sequence-to-sequence (encoder-decoder) model for translation, the encoder:

  1. Encodes the source sentence
  2. Only counts words
  3. Outputs the translated words directly
  4. Removes punctuation

Answer: A. Encodes the source sentence

Explanation

The decoder generates the target sentence conditioned on the encoder's output.

Step-by-step solution

  1. The encoder reads the source sentence.
  2. It converts it into internal representations (a context vector or a set of states).
  3. The decoder then generates the target sentence from them.

Why the other options are wrong

  • B. The encoder learns meaning, not word counts.
  • C. Producing translated words is the decoder's job.
  • D. Punctuation removal is preprocessing.

Question 6Medium

Backpropagation through time (BPTT) means:

  1. Skipping gradient computation
  2. Training only on the last time step
  3. Running the sequence backwards at inference
  4. Backprop over the unrolled steps

Answer: D. Backprop over the unrolled steps

Explanation

The unrolled network shares weights across steps, and gradients are summed over time.

Step-by-step solution

  1. Unroll the RNN across all time steps, like a deep network with shared weights.
  2. Run ordinary backpropagation through this unrolled graph.
  3. Add up the gradients for the shared weights from every step.

Why the other options are wrong

  • A. BPTT computes gradients; it does not skip them.
  • B. Loss can come from every step, and gradients flow to all of them.
  • C. BPTT is a training method, not a way of running inference.

Question 7Medium

Why do plain RNNs struggle with long-range dependencies?

  1. They cannot use activation functions
  2. Gradients vanish over many time steps
  3. They have no parameters
  4. They can only read one word

Answer: B. Gradients vanish over many time steps

Explanation

Repeated multiplication through time shrinks (or explodes) gradients, so early inputs barely influence learning.

Step-by-step solution

  1. Training an RNN backpropagates through every time step.
  2. The gradient is multiplied by similar factors at each step.
  3. Over many steps it shrinks towards zero, so early inputs barely affect learning.

Why the other options are wrong

  • A. RNNs do use activation functions such as tanh.
  • C. RNNs have weight matrices.
  • D. RNNs read whole sequences, one token at a time.

Question 8Medium

Which gate in an LSTM decides what information to discard from the cell state?

  1. Reset gate
  2. Forget gate
  3. Output gate
  4. Attention gate

Answer: B. Forget gate

Explanation

The forget gate scales the old cell state between 0 (discard) and 1 (keep).

Step-by-step solution

  1. The forget gate outputs values between 0 and 1 for each cell-state entry.
  2. Values near 0 erase that information; near 1 keep it.
  3. So it decides what to discard.

Why the other options are wrong

  • A. The reset gate belongs to the GRU.
  • C. The output gate decides what part of the cell state becomes the hidden state.
  • D. LSTMs have no 'attention gate'.

Question 9Hard

Why did Transformers largely replace RNNs for language modelling?

  1. RNNs have no parameters
  2. Attention parallelises well
  3. RNNs cannot process text
  4. Transformers need no data

Answer: B. Attention parallelises well

Explanation

RNNs process tokens sequentially; self-attention handles all positions at once and avoids long gradient paths.

Step-by-step solution

  1. RNNs must process tokens one after another.
  2. Self-attention compares all tokens at once, which runs in parallel on GPUs.
  3. Attention also links distant tokens directly, easing long-range dependencies.

Why the other options are wrong

  • A. RNNs have parameters.
  • C. RNNs can process text.
  • D. Transformers need large amounts of data.

Question 10Hard

A simple RNN layer has input size 10 and hidden size 20 (one bias vector). How many parameters does it have?

  1. 620
  2. 400
  3. 600
  4. 220

Answer: A. 620

Explanation

- W_xh: 10 x 20 = 200
- W_hh: 20 x 20 = 400
- bias 20.

Total 620.

Step-by-step solution

  1. Input-to-hidden weights: 10 x 20 = 200.
  2. Hidden-to-hidden weights: 20 x 20 = 400.
  3. Bias: 20. Total = 200 + 400 + 20 = 620.

Why the other options are wrong

  • B. 400 counts only the hidden-to-hidden weights.
  • C. 600 forgets the bias.
  • D. 220 forgets the recurrent weights.

Tip: Simple RNN params = h(i + h + 1) = 20 x 31.

Practise all 18 questions free

The full question bank with timed practice, progress tracking and Vidya, your AI tutor. Free, no ads.

Open this topic in the app →

Related topics

See all AI & Machine Learning topics · All topics