Deep Learning
MCQ
Unit 1
[Link] of the following is an example of a deep neural network architecture?
A. K-Means Clustering
B. Linear Regression
C. Decision Trees
D. Convolutional Neural Network (CNN)
[Link] does Deep Learning relate to Machine Learning in the AI landscape?
A. Deep Learning is a subfield of Machine Learning
B. They are two entirely separate fields
C. Deep Learning is a more advanced form of reinforcement learning
D. Machine Learning is a part of Deep Learning
[Link] was the primary issue that the XOR problem highlighted for early neural
networks?
A. They were unable to solve non-linear problems
B. They could not classify images correctly
C. They could not recognize spoken words
D. They couldn't work with large datasets
[Link] is the key advantage of using Deep Learning models over traditional machine
learning algorithms?
A. Their ability to learn hierarchical features from data
B. Their simplicity in design and training
C. Their requirement for less computational power
D. Their reliance on manually designed features
[Link] do artificial neural networks (ANNs) solve problems that traditional algorithms
cannot?
A. By learning patterns from raw data and improving through experience
B. By performing tasks using hard-coded instructions
C. By mimicking human reasoning without data
D. By avoiding the need for training data
[Link] is the primary use of derivatives in deep learning?
A. To calculate the output of a network
B. To compute the loss function
C. To update weights in neural networks
D. To find the gradient for optimization
[Link] does a neural network generally learn in terms of its mathematical structure?
A. By randomly generating outputs
B. By adjusting weights through backpropagation
C. By scaling the inputs to a predefined range
D. By storing learned knowledge in a matrix
[Link] of the following is a probability distribution commonly used in deep learning?
A. Normal distribution
B. Exponential distribution
C. Poisson distribution
D. Geometric distribution
[Link] is the role of tensors in deep learning?
A. They store input data
B. They store weights for neurons
C. They represent multi-dimensional data arrays
D. They store activation functions
[Link] is the main advantage of using the matrix form in deep learning
computations?
A. It simplifies vector operations
B. It reduces the computational cost
C. It speeds up data processing and optimization
D. It eliminates the need for activation functions
[Link] of the following describes the purpose of a probability distribution in the
context of deep learning?
A. To update the network's weights during training
B. To calculate the network weights
C. To define the loss function
D. To model random variables that influence the output
[Link] does a vector represent in the context of deep learning?
A. A scalar value in a higher-dimensional space
B. A point in space with both magnitude and direction
C. A matrix that stores data
D. A random variable with a distribution
[Link] of the following is a key component of the general structure of a neural
network?
A. Input layer, hidden layer, and output layer
B. Activation function, loss function, and optimizer
C. Training data, test data, and validation data
D. Learning rate, activation function, and error function
[Link] deep learning, what does the derivative of the activation function help calculate?
A. The output of the neural network
B. The loss function value
C. The gradients for backpropagation
D. The model's accuracy
[Link] does the backpropagation algorithm use derivatives in neural networks?
A. To initialize the neural network
B. To compute the weights of each layer
C. To update the neural network architecture
D. To calculate gradients that minimize the error
Unit 2
[Link] term is used to describe the strength of the connection between neurons in a
neural network?
A. Weight
B. Bias
C. Activation
D. Function
[Link] of the following is a characteristic of a neuron in an artificial neural network?
A. It sums the inputs, applies a weight, and passes the result through an activation
function
B. It calculates the variance of inputs for classification
C. It stores the error of the network
D. It passes data in a recurrent manner
[Link] of the following best describes the perceptron model in a neural network?
A. A linear classifier that processes a single layer of data
B. A deep network with multiple layers for complex tasks
C. A model that calculates complex functions using deep learning
D. A feedforward network that updates weights continuously
[Link] does a feedforward neural network consist of?
A. An input layer, one or more hidden layers, and an output layer
B. An input layer and output layer only
C. An input layer and hidden layers only
D. Only an output layer
[Link] does the process of "training" a neural network involve?
A. Adjusting the weights and biases to minimize the loss function
B. Generating random output from the network
C. Setting the architecture of the neural network
D. Fixing the learning rate to a constant value
[Link] is the key difference between the input layer and the output layer of a neural
network?
A. The input layer receives data, while the output layer provides predictions
B. The input layer is used for weight adjustments, and the output layer stores data
C. The input layer performs non-linear transformations, while the output layer does
not
D. The output layer calculates loss, while the input layer processes data
[Link] does the perceptron model differ from more advanced neural networks like
multi-layer perceptrons (MLPs)?
A. The perceptron is a single-layer network, while MLPs have multiple layers
B. The perceptron uses unsupervised learning, while MLPs use supervised learning
C. The perceptron can handle non-linear problems, while MLPs can only handle
linear problems
D. The perceptron requires more training data than MLPs
[Link] is the main purpose of the Backpropagation algorithm in neural networks?
A. To optimize weights
B. To change network topology
C. To initialize the network
D. To visualize the network
[Link] does a feedforward neural network represent?
A. A network with only one hidden layer
B. A network where data moves in one direction from input to output
C. A network with recurrent connections
D. A network with multiple outputs
[Link] can the components of a neural network be represented for mathematical
computations?
A. Using tensors and arrays
B. Using vectors and matrices
C. Using functions and logic gates
D. Using graphs and tables
[Link] of the following is NOT a type of activation function commonly used in
neural networks?
A. Sigmoid
B. ReLU
C. Tanh
D. Gradient descent
[Link] does backpropagation update the weights in a neural network?
A. Using random values
B. Using a gradient descent approach
C. By adding the error to the input values
D. By shifting the input values
[Link] which layer of a neural network does the input data first get processed?
A. Output layer
B. Hidden layer
C. Input layer
D. All layers
[Link] does the matrix multiplication in neural networks typically represent?
A. Combination of input features and weights
B. The transformation of the output layer
C. Calculation of error gradients
D. Activation of neurons
[Link] does the ReLU activation function do?
A. It outputs a constant value for all inputs
B. It outputs 0 for negative values and the input for positive values
C. It is used to normalize the inputs
D. It calculates the derivative of the inputs
CODING
Unit 1
[Link] Statement
Rathish is working on a project that involves complex logic operations. He needs to
perform a series of bitwise operations on three integer values A, B, and C. Specifically,
he needs to calculate the XOR (exclusive OR) and XNOR (exclusive NOR) operations on
these values.
Help him by providing a Python script to perform these operations and guide him on
how to format the inputs and outputs.
Input Format
The first line of input consists of an integer A, representing the first 1-bit binary number.
The second line consists of an integer B, representing the second 1-bit binary number.
The third line consists of an integer C, representing the third 1-bit binary number.
Output Format
The first line of output prints "0" or "1" based on the result of the XOR operation between
three inputs.
The second line prints "True" or "False" based on the result of the XNOR operation
between three inputs.
Refer to the sample output for the formatting specifications.
Constraints
The input should be 0 and 1.
Sample 1 Input
0
1
0
Sample 1 Output
1
False
Sample 2 Input
0
0
0
Sample 2 Output
0
True
[Link] Statement
Roja wants to implement a Python program to simulate the functionalities of both a Half
Adder and a Full Adder.
A Half Adder takes in two binary inputs (A and B) and produces two outputs: Sum - A
XOR B and Carry - A AND B.
A Full Adder extends this functionality by incorporating an additional binary input (C)
representing the carry-in from the previous stage. It produces two outputs: Sum C XOR
(A XOR B) and Carry-Out - (A AND B) OR (C AND (A XOR B)).
Input Format
The input consists of three integers, representing the binary inputs A, B, and C
respectively. These integers should be entered one by one, each followed by pressing
the Enter key.
• A (0 or 1): Binary input A.
• B (0 or 1): Binary input B.
• C (0 or 1): Carry-in for the Full Adder.
Output Format
The output displays the following format:
For the Half Adder in the format:
1. Print "Result of Half Adder:".
2. Print "Sum:" followed by the result of the bitwise XOR operation between A and B.
3. Print "Carry:" followed by the result of bitwise AND operation between A and B.
For the Full Adder in the format:
1. Print "Result of Full Adder:".
2. Print "Sum:" followed by the result of the full adder operation.
3. Print "Carry-Out:" followed by the carry-out generated by the full adder operation.
Refer to the sample output for the formatting specifications.
Constraints
Inputs A, B, and C will be either 0 or 1.
Sample 1 Input
0
1
0
Sample 1 Output
Result of Half Adder:
Sum: 1
Carry: 0
Result of Full Adder:
Sum: 1
Carry-Out: 0
Sample 2 Input
0
0
1
Sample 2 Output
Result of Half Adder:
Sum: 0
Carry: 0
Result of Full Adder:
Sum: 1
Carry-Out: 0
[Link] Statement
Riya is working on a physics-based simulation where each movement is represented as
a vector. To evaluate the motion strength, she needs to calculate the magnitude of the
vector and also normalize it so that all components are scaled consistently.
Given a vector: v = [v1, v2, ..., vn]
You are required to:
1. Compute its magnitude using the formula: magnitude = sqrt(v1^2 + v2^2 + ... +
vn^2)
2. Compute the normalized vector:v_normalized = [v1 / magnitude, v2 /
magnitude, ..., vn / magnitude]
3. If the magnitude is 0, replace all components of the normalized vector with 0
Input Format
The input consists of a single line containing space-separated numbers representing
the vector components:
v1 v2 ... vn The vector can have any positive number of components.
Output Format
The first line prints "Magnitude: " followed by the magnitude of the vector rounded to 2
decimal places.
The second line prints "Normalized Vector: " followed by the normalized vector
components rounded to 2 decimal places, separated by spaces.
Refer to the sample output for the formatting specifications.
Constraints
In the given scenario, the test cases fall under the following constraints:
-10 ≤ Number of vector components ≤ 1000000
Each component is a valid real number
If magnitude = 0, all normalized components must be 0
Sample 1 Input
3 4
Sample 1 Output
Magnitude: 5.00
Normalized Vector: 0.60 0.80
Sample 2 Input
1 1 1
Sample 2 Output
Magnitude: 1.73
Normalized Vector: 0.58 0.58 0.58
[Link] Statement
Alex is building a recommendation system for a streaming platform. The system
produces raw scores for each movie indicating how likely a user is to enjoy it. These
scores are not probabilities, so Alex needs to convert them into a valid probability
distribution using the softmax function.
Given a list of movie scores: s1, s2, ..., sn
The softmax probability for each movie is calculated as:
softmax(si) = exp(si - max_val) / (exp(s1 - max_val) + exp(s2 - max_val) + ... + exp(sn -
max_val))
Where max_val = max(s1, s2, ..., sn) to ensure numerical stability.
Write a program to ensure that the task is done by calculating the softmax probabilities
for the given scores.
Input Format
The input consists of a single line containing space-separated numbers representing
the movie scores
Output Format
The output prints "Softmax Probabilities: p1 p2 ... pn", where each probability pi is
rounded to 4 decimal places and separated by spaces.
Refer to the sample output for the formatting specifications.
Constraints
In the given scenario, the test cases fall under the following constraints:
-104 ≤ Number of vector components ≤ 104
Each score is a valid real number
Sample 1 Input
2 1 0
Sample 1 Output
Softmax Probabilities: 0.6652 0.2447 0.0900
Sample 2 Input
-1 0 1
Sample 2 Output
Softmax Probabilities: 0.0900 0.2447 0.6652
Unit 2
[Link] statement
Riya is building a simple two-layer neural network to predict a score based on three
input features. The network structure is as follows:
Network Architecture:
Input vector: 3 features
First layer weights (3×4 matrix):
[[0.5, 0.1, 0.3, 0.2],
[0.7, 0.6, 0.1, 0.5],
[0.4, 0.2, 0.8, 0.7]]
First layer bias (length 4): [0.2, 0.1, 0.3, 0.4]
Second layer weights (length 4): [0.3, 0.4, 0.2, 0.1]
Second layer bias: 0.5
Activation functions:
First layer: ReLU
ReLU(x)=max(0,x)
Second layer: Sigmoid
sigmoid(x)= 1/1+e−x
First Layer:
Compute the linear combination:
Z1 =X⋅W1 +b1
Apply the ReLU activation:
A1 =ReLU(Z1 )
Second Layer:
Compute the linear combination:
Z2 =A1 ⋅W2 +b2
Apply the Sigmoid activation:
A2 =sigmoid(Z2 )
Input Format
The input consists of a single line containing 3 space-separated floats representing the
input features:
feature1 feature2 feature3
Output Format
The first line prints a list of 4 numbers representing the hidden layer output after ReLU,
rounded to 3 decimal places.
The second line prints a single float representing the final output after sigmoid, rounded
to 3 decimal places.
Refer to the sample output for the formatting specifications.
Constraints
Each input feature x satisfies: 0.0 ≤ xi ≤ 10.0
Sample 1 Input
2 0 0
Sample 1 Output
[1.2, 0.3, 0.9, 0.8]
0.776
Sample 2 Input
1 1 1
Sample 2 Output
[1.8, 1.0, 1.5, 1.8]
0.872
[Link] statement
Ansh is designing a single neuron perceptron to predict whether a student passes an
exam based on two features:
1. x1 – Hours of study
2. x2 – Hours of sleep
The neuron uses a sigmoid activation function. You are given fixed weights and bias for
the neuron:
• Weight for x1: 0.6
• Weight for x2: 0.4
• Bias: -0.5
Write a program to compute:
The linear combination (weighted sum + bias):
z=x1 ⋅w1 +x2 ⋅w2 +b
The sigmoid activation output of the neuron:
y=1/1+e−z
Input Format
The input consists of a single line containing two space-separated floats: x1 x2
Where:
x1: Hours of study (float)
x2: Hours of sleep (float)
Output Format
The output prints the following:
Linear Output: <z_rounded>
Sigmoid Output: <y_rounded>
Where:
<z_rounded> – Rounded linear combination
<y_rounded> – Rounded sigmoid output
Refer to the sample output for the formatting specifications.
Constraints
Inputs x1 and x2 are floats.
The neuron’s weights and bias are fixed as provided.
Sample 1 Input
1 0
Sample 1 Output
Linear Output: 0.1 Sigmoid Output: 0.52
Sample 2 Input
2 1
Sample 2 Output
Linear Output: 1.1
Sigmoid Output: 0.75
[Link] Statement
You are given a simple feedforward neural network with fixed weights and biases. The
network contains:
Input Layer: 2 features
Hidden Layer: 2 neurons using ReLU activation
Output Layer: 1 neuron using Sigmoid activation
The network uses the following static parameters:
Hidden layer weights (W1):
[[0.2, 0.4],
[0.5, 0.1]]
Hidden layer biases (b1):
[0.1, 0.2]
Output layer weights (W2):
[0.3, 0.6]
Output layer bias (b2):
0.5
Your task is to perform a forward pass of the network for a given input of two real
numbers.
Calculations
Hidden layer linear output
Z1=X⋅W1+b1
Hidden layer activation (ReLU)
A1=max(0,Z1)
Output layer linear output
Z2=A1⋅W2+b2
Output layer activation (Sigmoid)
A2=1/1+e−Z2
Input Format
The input consists of a single line containing 2 space-separated float numbers
representing the input features: x1 x2
Output Format
The first line prints "Hidden Layer Output: [a b] "
Where:
a and b are the values of A1,
Printed using NumPy's default array formatting
No manual rounding (NumPy automatically prints correct precision)
Printed using NumPy array format (no commas).
The second line prints "Final Output: "
Where:
y is the sigmoid output A2,
Rounded to 3 decimal places.
Refer to the sample output for the formatting specifications.
Constraints
Input values are real numbers.
Use NumPy for all matrix operations.
Use standard definitions of ReLU and Sigmoid.
Sample 1 Input
2.0 1.0
Sample 1 Output
Hidden Layer Output: [1. 1.1]
Final Output: 0.812
Sample 2 Input
1.0 0.0
Sample 2 Output
Hidden Layer Output: [0.3 0.6]
Final Output: 0.721
[Link] Statement
A neural network engineer is studying how errors propagate backward through a single
sigmoid neuron. The goal is to compute how much the loss influences each parameter
of the neuron during backpropagation.
The neuron receives the following fixed values from the previous layer:
Inputs: [0.5, 0.7]
True label: y = 0
During the forward pass, the neuron produces a predicted output using the sigmoid
activation function. This predicted output is provided as input to your program.
For a sigmoid neuron trained using binary cross-entropy loss, the gradient of the loss
with respect to the neuron’s linear output is:
dZ=predicted_output−y
Using this value, the gradients of the weights and bias are computed as:
dW1=dZ×0.5
dW2=dZ×0.7
db=dZ
Your task is to calculate and print these gradients.
Input Format
The input consists of a single float representing the predicted output of the neuron
(after the sigmoid function).
Output Format
The output prints three space-separated float values representing:
dW1 dW2 db
Each value must be rounded to 4 decimal places using round ().
Refer to the sample output for the formatting specifications.
Constraints
0.0 ≤ predicted_output ≤ 1.0
Use only the gradients defined above.
No learning rate is applied.
Sample 1 Input
0.7109
Sample 1 Output
0.3554 0.4976 0.7109