MauryaHub PYQ Practice

Deep Learning · End Term · Jan 2026 · FN

Deep Learning · End Term · Jan 2026 FN

← Course papers · Start practice / exam

Questions and published explanations below are available without starting a test. Some questions may not have a published solution yet.

18 / 20 published solutions

Question 2 MCQ · 2.0 marks

Consider a two-dimensional image of size
Source diagram or notation
and a square filter of size
Source diagram or notation
. How much padding would you need on each side to keep the output height and width equal to the input height and width? Assume a stride of 1.
6406536956323.Source diagram or notation
6406536956324.Source diagram or notation
6406536956325.Source diagram or notation
6406536956326.Source diagram or notation

Published solution

With stride 1, output size is \(L+2P-F+1\). Set it equal to L: \(L+2P-F+1=L\), so \(P=(F-1)/2\) on each side. Equal integer padding on both sides therefore gives exact same-size output for odd F. For even F, a same-padding implementation generally uses asymmetric integer padding rather than a fractional number of pixels. **Answer: B.** A: **Incorrect:** Would make the output two pixels larger than intended. B: **Correct:** Solves the stride-1 output-size equation. C: **Incorrect:** Gives a total padding one pixel too large for the equation. D: **Incorrect:** Overpads relative to the kernel's F-1 total padding requirement.

Report a correction for Q2

Question 3 MCQ · 2.0 marks

Consider a vanilla Recurrent Neural Network (RNN) and an LSTM network with the same input dimension, hidden dimension, and output dimension. **Statement 1:** The number of trainable parameters in a vanilla RNN is higher than that in an LSTM network. **Statement 2:** An LSTM has a higher number of parameters because it contains multiple gates (input gate, forget gate, output gate, and candidate state), each having separate weight matrices and biases. Choose the correct option from the following.
6406536956363.
Statement 1 is true, and Statement 2 is the correct reason.
6406536956364.
Statement 1 is true, but Statement 2 is false.
6406536956365.
Statement 1 is false, but Statement 2 is true.
6406536956366.
Statement 1 is false, and Statement 2 is false.

Published solution

For input size d and hidden size h, a vanilla recurrent layer has \(hd+h^2+h\) parameters. A standard LSTM has four corresponding affine transforms (input, forget, output and candidate), giving \(4(hd+h^2+h)\), before any common output layer. Thus the vanilla RNN does not have more parameters: Statement 1 is false. Statement 2 correctly explains why the LSTM has more. **Answer: C.** A: **Incorrect:** Statement 1 reverses the actual parameter comparison. B: **Incorrect:** Both truth labels are wrong. C: **Correct:** Correctly marks Statement 1 false and Statement 2 true. D: **Incorrect:** The multiple-gate explanation in Statement 2 is true.

Report a correction for Q3

Question 4 MCQ · 3.0 marks

Which of the functions given below has the steepest slope at the point
Source diagram or notation
?
6406536956327.Source diagram or notation
6406536956328.Source diagram or notation
6406536956329.Source diagram or notation
6406536956330.Source diagram or notation

Published solution

Compare derivatives at x=1. \(d\log_{10}x/dx=1/(x\ln10)\), giving about 0.4343. \(d\ln(x^2)/dx=2/x\), giving 2. \(d\sqrt{x}/dx=1/(2\sqrt{x})\), giving 0.5. \(d(x^3)/dx=3x^2\), giving 3. The largest slope is therefore that of x cubed. **Answer: D.** A: **Incorrect:** Its slope at 1 is approximately 0.4343. B: **Incorrect:** Its slope at 1 is 2, below 3. C: **Incorrect:** Its slope at 1 is 0.5. D: **Correct:** Its slope at 1 is 3, the largest of the four.

Report a correction for Q4

Question 5 MCQ · 3.0 marks

Consider a XOR function for input
Source diagram or notation
, where the points
Source diagram or notation
belong to one class and
Source diagram or notation
belong to another class. It is not possible to separate these two classes by using a linear decision boundary. We consider a neural network with: • Input
Source diagram or notation
• One hidden layer with 2 neurons and ReLU activation • Output layer: one neuron with linear activation
Source diagram or notation
The network is defined as:
Source diagram or notation
Consider the weight matrices:
Source diagram or notation
Can this network correctly classify XOR using a threshold at
Source diagram or notation
?
6406536956344.
Yes
6406536956345.
No

Published solution

The hidden preactivations are \(x_1-x_2\) and \(x_2-x_1\). ReLU keeps only their positive parts, and the output sums them: \(\hat y=\max(0,x_1-x_2)+\max(0,x_2-x_1)=|x_1-x_2|\). It gives 0 on (0,0),(1,1) and 1 on (1,0),(0,1). A threshold at 0.5 therefore separates the two XOR classes exactly. **Answer: A.** A: **Correct:** The computed values 0 and 1 lie on opposite sides of 0.5 for the required classes. B: **Incorrect:** The hidden nonlinear transformation makes the classes separable, even though one linear input boundary cannot.

Report a correction for Q5

Question 6 MCQ · 3.0 marks

Match the attention mechanism in Column I with the correct description in Column II.
Source diagram or notation
6406536956350.Source diagram or notation
6406536956351.Source diagram or notation
6406536956352.Source diagram or notation
6406536956353.Source diagram or notation

Published solution

Encoder self-attention allows source tokens to attend to source tokens: P–3. Masked decoder self-attention blocks future target tokens: Q–2. Decoder cross-attention uses decoder queries with encoder keys and values: R–1. The feed-forward sublayer acts independently at each position after attention: S–4. Distinguish which sequence supplies queries and whether future positions are visible. **Answer: C.** A: **Incorrect:** Swaps the encoder and masked-decoder roles. B: **Incorrect:** Swaps masked self-attention with decoder-to-encoder cross-attention. C: **Correct:** Matches P–3, Q–2, R–1, S–4. D: **Incorrect:** Misassigns the positionwise feed-forward and encoder-attention roles.

Report a correction for Q6

Question 7 NAT · 2.0 marks

Consider a neural network with the following architecture: • Input:
Source diagram or notation
, Output:
Source diagram or notation
. •
Source diagram or notation
hidden layers with sigmoid(logistic) as the activation function, where each hidden layer has
Source diagram or notation
neurons. One neuron in the output layer with sigmoid as the activation function. • All the weights are initialized as zero. Ignore the biases. Based on the above data, answer the given subquestions.
What will be the output
Source diagram or notation
? Enter the answer correct to one decimal place.

Published solution

Every layer's affine preactivation is zero because all weights are zero and biases are ignored. The sigmoid is \(\sigma(z)=1/(1+e^{-z})\), so each hidden unit outputs sigma(0)=0.5. The output layer still has zero preactivation because its own weights are zero, and its sigmoid therefore outputs 0.5. The input values and depth do not change this initial forward result. **Answer: 0.5.**

Report a correction for Q7

Question 8 NAT · 2.0 marks

Consider a neural network with the following architecture: • Input:
Source diagram or notation
, Output:
Source diagram or notation
. •
Source diagram or notation
hidden layers with sigmoid(logistic) as the activation function, where each hidden layer has
Source diagram or notation
neurons. One neuron in the output layer with sigmoid as the activation function. • All the weights are initialized as zero. Ignore the biases. Based on the above data, answer the given subquestions.
What will be the output
Source diagram or notation
if we change the activation function in the outer layer to linear?

Published solution

Hidden activations remain 0.5, but the output weights are all zero and there is no bias. Thus the output preactivation is a sum of zero-weighted hidden activations, equal to zero. A linear output returns that value unchanged, so the answer is 0 rather than the sigmoid output 0.5. **Answer: 0.**

Report a correction for Q8

Question 9 MSQ · 3.0 marks

Consider a neural network with the following architecture: • Input:
Source diagram or notation
, Output:
Source diagram or notation
. •
Source diagram or notation
hidden layers with sigmoid(logistic) as the activation function, where each hidden layer has
Source diagram or notation
neurons. One neuron in the output layer with sigmoid as the activation function. • All the weights are initialized as zero. Ignore the biases. Based on the above data, answer the given subquestions.
Suppose you perform the backpropagation using the original configuration of the network and update the parameters of the network using stochastic gradient descent. Let
Source diagram or notation
be the weight associated with the first hidden layer to input. Then, which among the following will be true for
Source diagram or notation
?
6406536956333.
It remains the same after the first update using stochastic gradient descent.
6406536956334.
Different neurons in the first hidden layer will receive different gradient updates.
6406536956335.
All the elements in
Source diagram or notation
will be zero after the first update.
6406536956336.
Entries in
Source diagram or notation
is either all positive or all negative.

A published solution is not available for this question yet.

Report a correction for Q9

Question 10 NAT · 2.0 marks

For a binary classification task, consider an image
Source diagram or notation
of size
Source diagram or notation
passed through a toy convolutional network that has the following architecture: • **ConvLayer:** filter size =
Source diagram or notation
, and number of filter/channels = 1, with stride 1 and no padding. • Convolved output is passed through a ReLU activation function. • **Max-Pool Layer:** filter size =
Source diagram or notation
, with stride 2 and padding not applied. • Output of Max-pool layer is taken as
Source diagram or notation
. • Ignore the bias. Following are the image and the kernel matrix
Source diagram or notation
:
Source diagram or notation
Based on the above data, answer the given subquestions.
Find the total number of parameters in the network.

Published solution

The input has one channel and the convolution uses one 3×3 filter with no bias. Its parameter count is \(3\cdot3\cdot1\cdot1=9\). ReLU and max pooling have no learned coefficients. The filter is reused at every spatial position, so output size does not multiply the number of trainable parameters. **Answer: 9.**

Report a correction for Q10

Question 11 NAT · 3.0 marks

For a binary classification task, consider an image
Source diagram or notation
of size
Source diagram or notation
passed through a toy convolutional network that has the following architecture: • **ConvLayer:** filter size =
Source diagram or notation
, and number of filter/channels = 1, with stride 1 and no padding. • Convolved output is passed through a ReLU activation function. • **Max-Pool Layer:** filter size =
Source diagram or notation
, with stride 2 and padding not applied. • Output of Max-pool layer is taken as
Source diagram or notation
. • Ignore the bias. Following are the image and the kernel matrix
Source diagram or notation
:
Source diagram or notation
Based on the above data, answer the given subquestions.
Source diagram or notation
Source diagram or notation
The loss is defined as
Source diagram or notation
. If then compute .

Published solution

Using the CNN's cross-correlation convention, the convolution map is \(\begin{bmatrix}3&9&1\\-3&-1&3\\-3&-5&-7\end{bmatrix}\). ReLU replaces negatives with zero. The 2×2 stride-2 pool takes the upper-left 2×2 block, whose unique maximum is 9 at convolution position (row 1,column 2) in one-based indexing. Thus yhat=9. For the selected convolution output, W12 multiplies the image entry at row 1,column 3, which is 0. Consequently \(\partial L/\partial W_{12}=(9-1)\cdot1\cdot1\cdot0=0\). The zero comes from the selected input coefficient, not from a zero residual. **Answer: 0.**

Report a correction for Q11

Question 12 MSQ · 2.0 marks

After training a neural network, the training error is observed to be 10%. It gives the test error to be 56%. Which of the following methods can be used to reduce the test error?
6406536956339.
Adam
6406536956340.
ReLu activation
6406536956341.
Injecting noise at input
6406536956342.
Maxout
6406536956343.
L2 regularization

Published solution

Training error 10% versus test error 56% suggests poor generalisation, consistent with overfitting. Input noise can encourage robustness and L2 regularisation can discourage excessively large weights. These can help, though neither guarantees a particular test error. Switching optimiser or activation alone does not specifically constrain overfitting. Evaluation should also check that training and test distributions and labels are comparable. **Answer: C, E.** A: **Incorrect:** Adam changes optimisation dynamics but is not a direct regularisation remedy by itself. B: **Incorrect:** ReLU is an activation choice, not a direct response to this generalisation gap. C: **Correct:** Input noise can act as regularisation and improve robustness. D: **Incorrect:** Maxout changes the activation/model capacity and is not the targeted regularisation method here. E: **Correct:** An L2 penalty can reduce overfitting by constraining weight magnitudes.

Report a correction for Q12

Question 13 MSQ · 3.0 marks

Consider a transformer model using scaled dot-product attention:
Source diagram or notation
Assume a fixed input size and embedding dimension
Source diagram or notation
. The model may use either single-head or multi-head attention. Which of the following statements are correct?
6406536956346.
Scaling by
Source diagram or notation
helps prevent the dot-product values from becoming too large when
Source diagram or notation
is high.
6406536956347.
In multi-head attention, all heads share the same learned projections of
Source diagram or notation
.
6406536956348.
If all attention heads learn identical projection matrices, multi-head attention behaves equivalently to single-head attention.
6406536956349.
For a fixed embedding dimension, increasing the number of heads always increases the total number of parameters in the query, key, and value projections.

Published solution

A query-key dot product sums dk component products; its variance can grow with dk. Dividing by \(\sqrt{d_k}\) controls scale before softmax and helps avoid saturation. Standard heads have separate learned projections. If every head has identical Q,K,V projections and scaling, each computes the same attention distribution and output, so repetition supplies no distinct attention pattern; their concatenation followed by a linear output projection can be represented by an effective single such head. At fixed model dimension, splitting projections across more narrower heads need not increase total Q,K,V parameters. **Answer: A, C.** A: **Correct:** The square-root scale counteracts growth in dot-product magnitude with key dimension. B: **Incorrect:** Standard multi-head attention learns separate projections for its heads. C: **Correct:** Identical heads are redundant under the stated identical-projection/scaling interpretation; the output projection can combine their repeated output. D: **Incorrect:** With fixed total projection dimensions, the number of heads alone need not change total projection weights.

Report a correction for Q13

Question 14 NAT · 3.0 marks

A text corpus contains the following three sentences: 1. students read the books in library 2. teachers read the books after class 3. students and teachers discuss in library After removing the stop words "the'', "in", and "and'', the vocabulary becomes:
Source diagram or notation
Assume the context window size is
Source diagram or notation
(one word to the left and one word to the right). Based on the above data, answer the given subquestions.
Construct the co-occurrence matrix
Source diagram or notation
, where rows represent target words and columns represent context words. Let
Source diagram or notation
denote the element in the
Source diagram or notation
-th row and
Source diagram or notation
-th column. Enter the value of
Source diagram or notation
.

Published solution

Remove the specified stop words before forming adjacent contexts. The sequences become [students,read,books,library], [teachers,read,books,after,class], and [students,teachers,discuss,library]. In the first two sentences, books is immediately to the right of read, contributing one occurrence each to row read, column books. The third sentence contains neither read nor books. Therefore X[read,books]=2. **Answer: 2.**

Report a correction for Q14

Question 15 MCQ · 3.0 marks

A text corpus contains the following three sentences: 1. students read the books in library 2. teachers read the books after class 3. students and teachers discuss in library After removing the stop words "the'', "in", and "and'', the vocabulary becomes:
Source diagram or notation
Assume the context window size is
Source diagram or notation
(one word to the left and one word to the right). Based on the above data, answer the given subquestions.
Based on the co-occurrence matrix constructed previously, determine whether
Source diagram or notation
is positive, zero, or negative. (Use natural log).
6406536956355.
Positive
6406536956356.
Zero
6406536956357.
Negative

Published solution

The filtered sentences have lengths 4,5,4. With one context word on each side, their total directed context pairs number \(2(3+4+3)=20\). The read-books pair occurs twice, and read and books each have marginal context counts 4. Thus \[PMI(read,books)=\ln\frac{2/20}{(4/20)(4/20)}=\ln(2.5)>0.\] They co-occur more often than this marginal-independence model predicts. **Answer: A.** A: **Correct:** The observed joint probability 0.1 exceeds the marginal product 0.04. B: **Incorrect:** Zero would require equality between the joint probability and marginal product. C: **Incorrect:** Negative PMI would require the joint probability to be smaller than the marginal product.

Report a correction for Q15

Question 16 MSQ · 3.0 marks

A text corpus contains the following three sentences: 1. students read the books in library 2. teachers read the books after class 3. students and teachers discuss in library After removing the stop words "the'', "in", and "and'', the vocabulary becomes:
Source diagram or notation
Assume the context window size is
Source diagram or notation
(one word to the left and one word to the right). Based on the above data, answer the given subquestions.
Which of the following problems of the co-occurrence matrix are addressed by applying Singular Value Decomposition (SVD)? Choose all the correct options.
6406536956358.
High dimensional representation
6406536956359.
Sparse matrix with many zeros
6406536956360.
Captures latent semantic similarity between words
6406536956361.
Increases vocabulary size
6406536956362.
Produces dense low-dimensional embeddings

A published solution is not available for this question yet.

Report a correction for Q16

Question 17 NAT · 2.0 marks

You are given a transformer attention setup with the following configuration: • Sequence Length :
Source diagram or notation
• Number of Heads :
Source diagram or notation
• Embedding dimension :
Source diagram or notation
• Input
Source diagram or notation
•
Source diagram or notation
•
Source diagram or notation
•
Source diagram or notation
•
Source diagram or notation
•
Source diagram or notation
Based on the above data, answer the given subquestions.
Suppose
Source diagram or notation
,
Source diagram or notation
,
Source diagram or notation
and
Source diagram or notation
. The scaled dot-product attention operation for a single head, given by:
Source diagram or notation
Compute the total number of elements in the resulting attention output.

Published solution

For one head, attention weights have shape t×t. Multiplying them by the value vectors produces one dv-dimensional result per token, hence output shape t×dv (or its transpose under column-vector notation). With t=32 and dv=16, the number of elements is \(32\cdot16=512\). Do not multiply by the number of heads because the question asks for a single head. **Answer: 512.**

Report a correction for Q17

Question 18 NAT · 2.0 marks

You are given a transformer attention setup with the following configuration: • Sequence Length :
Source diagram or notation
• Number of Heads :
Source diagram or notation
• Embedding dimension :
Source diagram or notation
• Input
Source diagram or notation
•
Source diagram or notation
•
Source diagram or notation
•
Source diagram or notation
•
Source diagram or notation
•
Source diagram or notation
Based on the above data, answer the given subquestions.
Suppose
Source diagram or notation
,
Source diagram or notation
,
Source diagram or notation
and
Source diagram or notation
. What will be the number of parameters in the Multihead Attention ? (ignore the bias)

Published solution

Here dmodel=64, h=2, and dk=dq=64/2=32, while dv=16. Each head has Q and K projections of size 32×64 and a V projection of size 16×64. Across two heads this gives \(2(2048+2048+1024)=10240\). The output projection has shape 64×(2×16), adding 2048. Total=10240+2048=12288. Biases are excluded, and sequence length affects computation rather than these shared parameters. **Answer: 12288.**

Report a correction for Q18

Question 19 NAT · 2.0 marks

You are given a transformer attention setup with the following configuration: • Sequence Length :
Source diagram or notation
• Number of Heads :
Source diagram or notation
• Embedding dimension :
Source diagram or notation
• Input
Source diagram or notation
•
Source diagram or notation
•
Source diagram or notation
•
Source diagram or notation
•
Source diagram or notation
•
Source diagram or notation
Based on the above data, answer the given subquestions.
Assume a Feed-Forward Network (FFN) follows the Multi-Head Attention layer in the encoder. The FFN consists of two linear transformations:
Source diagram or notation
Calculate the total number of parameters in the FFN layer (including bias terms), where
Source diagram or notation
and
Source diagram or notation
.

Published solution

The first FFN map goes from 64 to 256 dimensions, so it has \(64\cdot256=16384\) weights and 256 biases. The second returns from 256 to 64, adding 16384 weights and 64 biases. ReLU adds none. Thus total \(=16384+256+16384+64=33088\). These same maps are applied at every token; do not multiply by sequence length. **Answer: 33088.**

Report a correction for Q19

Question 20 NAT · 2.0 marks

Assume that your CBOW model outputs a probability distribution over a vocabulary of 20,000 words for a given context. If the correct target word is word number 150, and the model's predicted probability for this word is 0.2, calculate the cross-entropy loss for this prediction. Enter the answer correct to two decimal places. (use natural log)

Published solution

For a one-hot target, cross entropy is \(-\sum_i y_i\ln p_i\). Every target entry is zero except the correct word, so the loss reduces to \(-\ln(0.2)=\ln5\approx1.609438\). Rounded to two decimals, it is 1.61. The vocabulary size and the target's index identify the classification task but do not introduce additional terms in this one-hot loss. **Answer: 1.61.**

Report a correction for Q20

Question 21 NAT · 3.0 marks

In the Skip-gram model with a window size of 2 (on each side), how many **unique** pairs of target and context words will be generated for the following sentence. Note: Ignore punctuation in your calculation '**Learning from data helps build intelligent systems for society**'

Published solution

There are nine distinct words. With two context positions on each side, the context counts from the first to last target are 2,3,4,4,4,4,4,3,2. Their sum is 30. Equivalently there are 8 adjacent unordered position pairs and 7 distance-two pairs, each producing both target-context directions: 2×(8+7)=30. Since every word is distinct, no two ordered word pairs collapse as duplicates. Contexts do not extend beyond sentence boundaries. **Answer: 30.**

Report a correction for Q21