Questions and published explanations below are available without starting a test. Some questions may not have a published solution yet.
19 / 19 published solutions
Question 2 NAT · 3.0 marks
Consider the following data point and weight vector in a simple single layer neural network.
(Assume that there is no bias.)
x = [1,0]
w = [0,1]
Once the data flows through the simple network and is passed through the activation function,
the final output comes out to be 0.5.
Once you have identified the activation function, enter the maximum value that the derivative of
the activation function can take.
Published solution
**1. Compute pre-activation:** With no bias, \(z=w^Tx=0(1)+1(0)=0\). The standard logistic sigmoid satisfies \(\sigma(0)=0.5\).
**2. Maximize its derivative:** Writing \(s=\sigma(z)\), \[\sigma\prime(z)=s(1-s)=\frac14-(s-\tfrac12)^2\le\frac14.\] Equality occurs at z=0, so the maximum is 0.25.
**Answer: 0.25.**
**Convention note:** This uses the intended logistic sigmoid. A single input-output observation alone cannot uniquely identify an arbitrary activation function.
A BatchNorm layer is applied to the output of a convolutional layer. The output feature map has
dimensions:
where:
• 32 = Batch size (number of images in the mini-batch)
• 28 = Height of each feature map
• 28 = Width of each feature map
• 64 = Number of channels
How many learnable parameters does this BatchNorm layer contain?
Published solution
**1. Identify trainable quantities:** Standard convolutional BatchNorm learns one scale γ and one shift β per channel, shared over batch and spatial positions.
**2. Count channels:** There are 64 channels, hence \(64+64=128\) learnable parameters. Running means and variances are buffers rather than learned parameters.
**Answer: 128.**
Consider a McCulloch-Pitts (MP) neuron with binary inputs, unit positive weights, and no inhibitory
connections.
Given the following data points:
a = [0,0]
b = [1,1]
c = [1,0]
The neuron must satisfy:
a → 0
b → 0
c → 1
Which of the following statements is TRUE (θ is the threshold for the neuron to fire.)?
6406537022880.
This is possible with
= 1
6406537022881.
This is possible with
= 2
6406537022882.
This is possible with some threshold value
6406537022883.
This is impossible for a standard MP neuron
Published solution
**1. Compare input sums:** With unit positive weights, a,b,c have sums 0,2,1, respectively.
**2. Apply threshold monotonicity:** Making c fire requires \(1\ge\theta\). Then b, with sum 2, must also fire, contradicting its required output 0. No threshold can satisfy all labels.
**Answer: D — This is impossible for a standard MP neuron.**
A: **Incorrect:** Threshold 1 makes both b and c fire.
B: **Incorrect:** Threshold 2 makes b fire and c remain silent, reversing the required labels.
C: **Incorrect:** The necessary inequalities θ≤1 and θ>2 conflict.
D: **Correct:** A positive-weight threshold neuron is monotone and cannot meet these labels.
**1. Track shared storage:** y=x.view(4) is a view of x, so assigning y[1]=10 changes x to \(\begin{pmatrix}1&10\\3&4\end{pmatrix}\).
**2. Sum along dimension 1:** This sums each row, giving 1+10=11 and 3+4=7.
**Answer: D — tensor([11., 7.]).**
A: **Incorrect:** It ignores the in-place modification through the view.
B: **Incorrect:** It both ignores the modification and reverses the row sums.
C: **Incorrect:** Only the first row is changed; the second sum remains 7.
D: **Correct:** The row sums after the shared-storage update are 11 and 7.
A student is training a neural network for regression problem with a sigmoid activation at the
output layer
to predict the continuous value between 0 and 1. The true mathematical error term
for Mean Squared Error (MSE) loss is
. However, due to a coding mistake, the student implements the error term for Binary Cross-
Entropy (BCE) loss instead, calculating it as
. Assuming the network has not yet
reached zero error (
), which of the following correctly describes the relationship between the
implemented
and the true
?
6406537022896.
The student's
equals the true
because the error term
always holds
regardless of loss function.
6406537022897.
The student's
is always at least 4 times larger in magnitude than true
.
6406537022898.
The student's
is smaller than the true
because sigmoid squashes the
gradient.
6406537022899.
The student's
equals the true
only when
, since
is
maximum there and cancels with the MSE factor.
Published solution
**1. Write the output errors:** Under the intended half-squared-error convention, \(\delta_{MSE}=(\hat y-y)\hat y(1-\hat y)\), while sigmoid with BCE gives \(\delta_{BCE}=\hat y-y\).
**2. Compare nonzero magnitudes:** \[\frac{|\delta_{BCE}|}{|\delta_{MSE}|}=\frac1{\hat y(1-\hat y)}\ge4.\] Equality in this ratio occurs at prediction 0.5; the two errors are still unequal there.
**Answer: B — B — at least four times the true error magnitude.**
**Convention note:** The PDF does not explicitly define the MSE normalization. The key uses ½(ŷ−y)². For unscaled (ŷ−y)², the true derivative has an extra factor 2 and the lower bound is 2 instead of 4.
A: **Incorrect:** The activation derivative depends on the chosen loss and does not always cancel.
B: **Correct:** The sigmoid derivative is at most 1/4, making the ratio at least 4.
C: **Incorrect:** The mistaken BCE expression omits the shrinking factor and is larger in magnitude.
D: **Incorrect:** At prediction 0.5 the ratio is 4, not 1.
An input image of size 32×32 is passed through a CNN containing three convolution layers:
• Conv1: 3x3, stride 1
• Conv2: 3x3, stride 1
• Conv3: 3x3, stride 1
Find the receptive field of a neuron in Conv3.
6406537022906.
3x3
6406537022907.
4x4
6406537022908.
5x5
6406537022909.
6x6
6406537022910.
7x7
6406537022911.
8x8
Published solution
**1. Start with one input pixel:** The receptive-field side length begins at r0=1. Each stride-one 3×3 convolution adds 2.
**2. Accumulate three layers:** \(r_1=3,r_2=5,r_3=7\). Thus the third-layer neuron covers a 7×7 input region.
**Answer: E — 7×7.**
A: **Incorrect:** This is the first-layer receptive field.
B: **Incorrect:** Three such stride-one layers give an odd side length of 7.
C: **Incorrect:** This is the second-layer receptive field.
D: **Incorrect:** The recurrence gives 7, not 6.
E: **Correct:** Three increments of 2 give 1+6=7.
F: **Incorrect:** The recurrence gives 7, not 8.
For a convolution layer, suppose the input feature map has size 28x28x64. A 1x1 convolution with
32 filters is applied to it. What will be the output size? (Assume stride = 1 and no padding.)
6406537022912.
28x28x64
6406537022913.
28x28x32
6406537022914.
32x32x28
6406537022915.
64x64x32
Published solution
**1. Compute spatial dimensions:** \(H_{out}=W_{out}=(28-1)/1+1=28\). A 1×1 filter mixes channels without changing spatial size.
**2. Count output channels:** Each of the 32 filters produces one channel, giving 28×28×32.
**Answer: B — 28×28×32.**
A: **Incorrect:** The output channel count is the number of filters, 32.
B: **Correct:** Spatial dimensions stay 28×28 and 32 filters give 32 channels.
C: **Incorrect:** The filter count does not become the height or width.
D: **Incorrect:** No operation increases the spatial size to 64×64.
A convolution operation is applied to an input image of size 64x64 using a single 3x3 filter. The
convolution uses:
• Kernel size = 3x3
• Padding = 1
• Stride = 1
What will be the size of the output feature map produced by this filter?
6406537022916.
62x62
6406537022917.
64x64
6406537022918.
66x66
6406537022919.
60x60
Published solution
**1. Apply the convolution size formula:** \[n_{out}=\left\lfloor\frac{n+2p-k}{s}\right\rfloor+1=\frac{64+2-3}{1}+1=64.\]
**2. Apply to both axes:** One pixel of padding offsets the two-pixel reduction from a 3×3 kernel, producing 64×64.
**Answer: B — 64×64.**
A: **Incorrect:** This would be the result with zero padding.
B: **Correct:** Padding 1 preserves the spatial size at stride 1.
C: **Incorrect:** This counts padded input size without the kernel reduction.
D: **Incorrect:** It subtracts too much spatial extent.
Consider the following PyTorch convolutional layer:
How many total learnable parameters (including biases) does this layer contain?
6406537022921.
4,800
6406537022922.
9,600
6406537022923.
9,664
6406537022924.
4,864
Published solution
**1. Count filter weights:** Each filter has \(3\times5\times5=75\) weights. Sixty-four filters require \(64(75)=4800\).
**2. Include biases:** One bias per output channel adds 64, giving \(4800+64=4864\).
**Answer: D — 4,864.**
A: **Incorrect:** This counts weights but omits the 64 biases.
B: **Incorrect:** It doubles the actual weight count.
C: **Incorrect:** It doubles the weight count before adding biases.
D: **Correct:** It includes 4800 weights and 64 biases.
Consider the following image preprocessing pipeline:
Which of the following statements is correct about the above preprocessing pipeline?
6406537022925.
Steps A, B, and C add randomness to training images, helping the model
generalize better.
6406537022926.
The Normalize step should be placed before converting the image to a tensor
for correct scaling.
6406537022927.
Data Augmentation should be added in test pipeline otherwise the code won't
work.
6406537022928.
The ColorJitter operation is applied after normalization, so pixel values stay
between 0 and 1.
Published solution
**1. Locate stochastic augmentation:** A randomly flips images, B randomly rotates them and C randomly changes colour properties. These perturbations diversify training inputs.
**2. Check pipeline order:** ToTensor precedes Normalize, which applies channelwise \((x-\mu)/\sigma\). The test pipeline can use deterministic resizing and normalization.
**Answer: A — Steps A, B, and C add randomness to training images, helping the model .**
A: **Correct:** All three operations randomly augment training inputs.
B: **Incorrect:** Normalize expects a tensor here and therefore follows ToTensor.
C: **Incorrect:** Random augmentation is not required for a valid test pipeline.
D: **Incorrect:** ColorJitter comes before normalization, which does not generally preserve [0,1].
A perceptron in 2D is defined by a linear decision function:
Suppose a classification rule satisfies:
1. All points with x1 + x2 = 1 are classified as +1
2. All points with x1 + x2 = 0 are classified as -1
3. All points with x1 + x2 = 2 are classified as -1
Which of the following is TRUE?
6406537022884.
The problem is linearly separable because classes depend only on x1 + x2
6406537022885.
The problem is not linearly separable
6406537022886.
A linear separator exists only if w1 = w2
6406537022887.
The problem is linearly separable when w1 = -w2
Published solution
**1. Choose a contradictory triple:** Points a=(0,0) and b=(2,0) must be negative, while their midpoint m=(1,0) must be positive.
**2. Use linearity:** For an affine score f, \(f(m)=[f(a)+f(b)]/2\). If both endpoint scores are negative, the midpoint score is negative too. A single linear separator cannot produce the required labels.
**Answer: B — The problem is not linearly separable.**
A: **Incorrect:** Dependence on a sum does not guarantee a single threshold can isolate its middle value.
B: **Correct:** The midpoint argument proves nonseparability, even if a bias were allowed.
C: **Incorrect:** Equal weights still give only one threshold on the sum.
D: **Incorrect:** Opposite weights cannot resolve the midpoint contradiction.
**1. Forward through ReLU:** ReLU maps (−2,0,3) to (0,0,3); the subsequent sum gives upstream derivative 1 for every element.
**2. Backpropagate elementwise:** PyTorch uses ReLU derivatives 0 at negative inputs, 0 at zero and 1 at positive inputs. Thus x.grad=(0,0,1).
**Answer: A — tensor([0., 0., 1.]).**
A: **Correct:** These are PyTorch’s three elementwise ReLU derivatives.
B: **Incorrect:** The positive input 3 has derivative 1.
C: **Incorrect:** PyTorch chooses derivative 0 at the kink x=0.
D: **Incorrect:** The gradient has one entry per input, not a single entry.
A student is using a single neuron with activation
where
Can this single neuron represent XOR exactly for the four binary input pairs?
6406537022900.
A suitable choice of parameters can represent XOR exactly.
6406537022901.
XOR always requires at least one hidden layer, hence it can not represent XOR
exactly for the four binary input pairs.
6406537022902.
It can not represent XOR exactly for the four binary input pairs but only when
.
6406537022903.
It can not represent XOR exactly for the four binary input pairs because a
single neuron can only represent linear decision boundaries.
Published solution
**1. Construct parameters:** Choose \(w_1=1,w_2=-1,b=0\). The neuron computes \(f=(x_1-x_2)^2\).
**2. Check every binary input:** For 00,01,10,11, the outputs are respectively 0,1,1,0, exactly XOR. Squaring can map both −1 and +1 to the positive output.
**Answer: A — A suitable choice of parameters can represent XOR exactly..**
A: **Correct:** The explicit parameter choice represents all four XOR values exactly.
B: **Incorrect:** That limitation applies to a threshold-linear separator, not this square activation.
C: **Incorrect:** Equal weights would fail, but they are not required; opposite weights work.
D: **Incorrect:** The square activation permits a nonmonotone response to the linear score.
A part of which classical CNN architecture is represented by the above code?
6406537022929.
VGG
6406537022930.
GoogleNet
6406537022931.
Resnet
6406537022932.
Alexnet
Published solution
**1. Recognize the module:** The code has parallel 1×1, 1×1→3×3 and 1×1→5×5 branches. The initial 1×1 layers reduce channel depth before more expensive spatial convolutions.
**2. Identify the architecture:** Parallel multiscale convolution branches are the characteristic Inception design used by GoogLeNet.
**Answer: B — GoogLeNet.**
A: **Incorrect:** VGG primarily stacks sequential 3×3 convolutions.
B: **Correct:** GoogLeNet uses Inception modules with parallel multiscale branches.
C: **Incorrect:** A characteristic ResNet block adds a residual shortcut.
D: **Incorrect:** This parallel Inception pattern is not the AlexNet design.
In deep CNN architectures like VGGNet, multiple 3×3 convolutional layers are stacked instead of
using a single large kernel (e.g.,7×7).
Which of the following statements best explains the advantage of this design choice?
6406537022933.
It increases the receptive field and parameter count simultaneously,
improving representational power.
6406537022934.
It provides a similar effective receptive field as a larger kernel while
introducing more non-linearities and fewer parameters.
6406537022935.
It reduces the receptive field size, but compensates with more skip
connections to retain context.
6406537022936.
It limits model depth to avoid overfitting by reducing the total number of
convolutional layers.
Published solution
**1. Compare receptive fields:** Three stride-one 3×3 convolutions give the same 7×7 receptive-field extent as one 7×7 convolution.
**2. Compare equal-width weights:** With C input, intermediate and output channels, the stack uses \(3(9C^2)=27C^2\) weights versus \(49C^2\) for one large kernel. Intermediate activations also add nonlinear transformations.
**Answer: B — It provides a similar effective receptive field as a larger kernel while .**
**Convention note:** The parameter comparison assumes comparable channel widths and ignores the small bias difference.
A: **Incorrect:** At equal channel width the stack reduces, rather than increases, weight count.
B: **Correct:** It preserves receptive-field extent while reducing weights and allowing more nonlinearities.
C: **Incorrect:** This design does not require skip connections or shrink the receptive-field extent.
D: **Incorrect:** Stacking small convolutions increases network depth.
A CNN produces an output feature map of size 10x10x64. Global Average Pooling (GAP) is applied
to this feature map. What is the dimension of the output after applying the GAP?
6406537022937.
10×10×64
6406537022938.
1×1×64
6406537022939.
1×1×1
6406537022940.
64×64×64
Published solution
**1. Average spatially within each channel:** GAP replaces the 100 positions of channel c by \(g_c=\frac1{100}\sum_{h,w}x_{hwc}\).
**2. Preserve channels:** There is one result for each of 64 channels, giving 1×1×64, equivalently a 64-element vector.
**Answer: B — 1×1×64.**
A: **Incorrect:** GAP collapses the two spatial dimensions.
B: **Correct:** It averages each channel to one scalar and retains all 64 channels.
C: **Incorrect:** It does not average across the channel axis.
D: **Incorrect:** GAP reduces spatial size rather than expanding it.
Consider the following neural network and answer the given subquestions.
A feedforward neural network has 2 input neurons, one hidden layer (l = 1) with 2 neurons, and
one output neuron (l = 2). Every neuron uses the sigmoid activation
.
For each layer
:
,
Here
is the input. Binary cross entropy loss is being used.
Compute the pre-activation input to the output neuron,
, and the final output
. Give
correct to four decimal places.
Published solution
**1. Compute hidden pre-activations:** \(z_1=0.2(0.5)+0.4(0.3)+0.1=0.32\); \(z_2=-0.3(0.5)+0.5(0.3)-0.2=-0.2\).
**2. Activate the hidden layer:** \(a_1=\sigma(0.32)\approx0.579324\), \(a_2=\sigma(-0.2)\approx0.450166\).
**3. Compute output pre-activation and activation:** \[z^{[2]}=0.6a_1-0.4a_2+0.2\approx0.367528,\qquad\hat y=\sigma(z^{[2]})\approx0.5908616.\] The requested four-decimal output is 0.5909.
**Answer: 0.5909.**
Consider the following neural network and answer the given subquestions.
A feedforward neural network has 2 input neurons, one hidden layer (l = 1) with 2 neurons, and
one output neuron (l = 2). Every neuron uses the sigmoid activation
.
For each layer
:
,
Here
is the input. Binary cross entropy loss is being used.
Compute i.e., the gradient of the loss with respect to the hidden-layer weight
(connecting input
to hidden neuron
).Give the value correct upto four decimal places.
Published solution
**1. Forward pass:** Hidden activations are \(a_1=\sigma(0.32)\approx0.579324\), \(a_2=\sigma(-0.2)\approx0.450166\), and \(\hat y=\sigma(0.6a_1-0.4a_2+0.2)\approx0.5908616\).
**2. Differentiate BCE through the output sigmoid:** With y=1, \(\delta^{[2]}=\hat y-y\approx-0.4091384\).
**3. Follow the path to the specified weight:** \[\frac{\partial L}{\partial W^{[1]}_{21}}=(\hat y-y)(-0.4)a_2(1-a_2)x_1\approx0.0202537.\] Hence the four-decimal gradient is +0.0203.
**Answer: 0.0203.**
Which statement is guaranteed by the Universal Approximation Theorem (UAT)?
6406537022941.
A sufficiently large neural network can always be trained successfully using
gradient descent.
6406537022942.
The theorem provides a bound on the number of neurons required for a given
approximation error.
6406537022943.
The theorem provides a bound on the amount of training data required.
6406537022944.
None of these
Published solution
**1. State the relevant guarantee:** The classical UAT is an existence theorem: networks of sufficient width with suitable activation can approximate continuous functions arbitrarily closely on compact domains.
**2. Distinguish existence from learning:** It does not itself guarantee gradient-descent success or provide the stated general neuron-count or training-sample bounds.
**Answer: D — None of these.**
A: **Incorrect:** Existence of suitable weights does not guarantee gradient descent finds them.
B: **Incorrect:** The classical qualitative UAT does not supply this quantitative complexity bound.
C: **Incorrect:** It is an approximation theorem rather than a sample-complexity guarantee.
D: **Correct:** None of A–C is the classical UAT guarantee.