da4001_2026T1_Q2_NA.pdf
Data Science and AI Lab · Quiz 2 · Jan 2026
← 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.
Question 2 MCQ · 2.0 marks
You have two DataFrames: [[IMAGE:1ddd5c11cc750578_2_2]] and [[IMAGE:1ddd5c11cc750578_2_3]] . You want to combine them so that the
resulting DataFrame contains only the employees who belong to a department that exists in
[[IMAGE:1ddd5c11cc750578_2_4]] table. Which of the arguments for the [[IMAGE:1ddd5c11cc750578_2_5]] parameter provided in the options should
you use in [[IMAGE:1ddd5c11cc750578_2_6]] to achieve this?
[[IMAGE:1ddd5c11cc750578_2_7]]






how='outer'
how='left'
how='inner'
how='cross'
A published solution is not available for this question yet.
Question 3 MCQ · 2.0 marks
You have a 'long' DataFrame df containing weather data for different cities:
[[IMAGE:1ddd5c11cc750578_3_8]]
You want to reshape this so that each City has its own column, with Date as the index. Which
command will produce this wide-format table?

df.columns.tolist()
df.pivot(index='Date', columns='City', values='Temp')
df.groupby(['Date', 'City']).sum()
df.transpose()
A published solution is not available for this question yet.
Question 4 MCQ · 2.0 marks
What is the output of the following snippet of code?
[[IMAGE:1ddd5c11cc750578_3_9]]

[[IMAGE:1ddd5c11cc750578_3_10]]

[[IMAGE:1ddd5c11cc750578_4_11]]

[[IMAGE:1ddd5c11cc750578_4_12]]

[[IMAGE:1ddd5c11cc750578_4_13]]

A published solution is not available for this question yet.
Question 5 MCQ · 2.0 marks
A student is writing a training loop for a neural network. Consider the following code snippet,
where three critical lines are missing:
[[IMAGE:1ddd5c11cc750578_4_14]]
Which of the following option correctly identifies the missing lines in the order they should appear
to ensure the model trains correctly?

A: [[IMAGE:1ddd5c11cc750578_4_15]] ; B: [[IMAGE:1ddd5c11cc750578_4_16]] ; C: [[IMAGE:1ddd5c11cc750578_4_17]]



A: [[IMAGE:1ddd5c11cc750578_4_18]] ; B: [[IMAGE:1ddd5c11cc750578_4_19]] ; C: [[IMAGE:1ddd5c11cc750578_4_20]]



A: [[IMAGE:1ddd5c11cc750578_4_21]] ; B: [[IMAGE:1ddd5c11cc750578_4_22]] ; C: [[IMAGE:1ddd5c11cc750578_4_23]]



A: [[IMAGE:1ddd5c11cc750578_4_24]] ; B: [[IMAGE:1ddd5c11cc750578_4_25]] ; C: [[IMAGE:1ddd5c11cc750578_4_26]]



A published solution is not available for this question yet.
Question 6 MCQ · 2.0 marks
[[IMAGE:1ddd5c11cc750578_5_27]]

1 - C; 2 - D; 3 - A; 4 - B
1 - C; 2 - B; 3 - A; 4 - D
1 - C; 2 - B; 3 - D; 4 - A
1 - C; 2 - D; 3 - B; 4 - A
A published solution is not available for this question yet.
Question 7 MCQ · 2.0 marks
Which of the following best describes the logic of Non-Maximum Suppression algorithm used in
the YOLO (You Only Look Once) model?
It calculates the average coordinates of all overlapping boxes to produce a
single refined box while suppressing the original set of boxes
It selects the box with the highest confidence score and suppresses remaining
boxes that have high overlap with the selected box
It maximises the confidence score of boxes that are distant from each other
while suppressing the score of overlapping boxes
It implements a recursive search to merge overlapping boxes into a single box
by taking the higher coordinate values at each step
A published solution is not available for this question yet.
Question 8 MCQ · 2.0 marks
[[IMAGE:1ddd5c11cc750578_6_28]]

LoRA will be applied to the entire model, including the embedding layers.
LoRA will only be applied to the final classification layer of the model.
LoRA will not be applied to any layer of the model.
The model will throw an error because an empty list is invalid.
A published solution is not available for this question yet.
Question 9 MCQ · 2.0 marks
Consider the following code:
[[IMAGE:1ddd5c11cc750578_6_29]]
Which of the following statements is TRUE regarding the output generated by the tokenizer?

Each sentence will be tokenized independently without any padding because
max_length is specified.
All tokenized sequences in output["input_ids"] will have a length exactly equal
to 6.
The tokenizer will return a list of Python integer.
Special tokens like [CLS] and [SEP] will not be added because padding is
enabled.
A published solution is not available for this question yet.
Question 10 MCQ · 2.0 marks
Consider the following code and answer the following question.
[[IMAGE:1ddd5c11cc750578_7_30]]
which of the below option correctly describes the behavior of model with [[IMAGE:1ddd5c11cc750578_7_31]]


[[IMAGE:1ddd5c11cc750578_7_32]] merges all inputs into one combined prompt and returns a single
response string.

The model processes all inputs in a single batch request and returns a list of
response objects in the same order as inputs.
[[IMAGE:1ddd5c11cc750578_7_33]] returns a dictionary mapping each input to its response, requiring
key-based access.

[[IMAGE:1ddd5c11cc750578_7_34]] runs each input sequentially exactly like a for-loop using [[IMAGE:1ddd5c11cc750578_7_35]]
and returns plain strings instead of response objects.


A published solution is not available for this question yet.
Question 11 MCQ · 2.0 marks
Which of the following code snippets will run successfully given that you have all the required
installation, no billing issue, API KEYS are configured correctly, access of all mentioned models is
present?
[[IMAGE:1ddd5c11cc750578_8_36]]

[[IMAGE:1ddd5c11cc750578_8_37]]

[[IMAGE:1ddd5c11cc750578_8_38]]

None of these
A published solution is not available for this question yet.
Question 12 MCQ · 2.0 marks
A legal chatbot must answer strictly based on internal case documents and should minimize
hallucination.
Which of the following approaches is MOST suitable?
Fine-tuning
RAG
Temperature = 0
Temperature = 1
Top-p = 1
Top-k = 1
A published solution is not available for this question yet.
Question 13 MCQ · 2.0 marks
Which analogy best describes RAG vs Fine-Tuning?
RAG = memorizing textbook, Fine-tuning = Googling
RAG = Googling before answering, Fine-tuning = learning permanently
RAG = increasing IQ, Fine-tuning = reading newspaper
A published solution is not available for this question yet.
Question 14 MCQ · 2.0 marks
A developer wants only the top 2 most relevant chunks retrieved. Which of the following correctly
achieves this?
[[IMAGE:1ddd5c11cc750578_9_39]]

[[IMAGE:1ddd5c11cc750578_9_40]]

[[IMAGE:1ddd5c11cc750578_9_41]]

None of these
A published solution is not available for this question yet.
Question 15 MCQ · 2.0 marks
You accidentally wrote:
[[IMAGE:1ddd5c11cc750578_9_42]]
But your state schema expects:
[[IMAGE:1ddd5c11cc750578_9_43]]
What is the most likely result?


LLM auto converts input to messages
Runtime error due to missing state key
Graph ignores output
Messages auto populated
A published solution is not available for this question yet.
Question 16 MSQ · 3.0 marks
Which of the following statements are true regarding regularization?
Regularization can be used when a model overfits, and it typically helps by
reducing model complexity
Ridge regularization can be used to perform feature selection as it forces
some weights exactly to zero
Regularization adds constraints to the model and can lead to an increase in
bias while reducing the variance
Regularization can be used to increase sensitivity of the model to small
changes in the input data
A published solution is not available for this question yet.
Question 17 MSQ · 3.0 marks
A student is building a linear regression model. Which of the following code snippets correctly
prevents PyTorch from tracking gradients during the evaluation phase? Select all that apply.
Wrapping the code in a with torch.no_grad(): context manager.
Setting requires_grad=False on the model parameters manually.
Calling optimizer.zero_grad() before the forward pass.
Calling model.eval() before passing the validation data through the model.
A published solution is not available for this question yet.
Question 18 MSQ · 3.0 marks
When implementing a custom dataset by inheriting from 'torch.utils.data.Dataset', which of the
following methods must be overridden to ensure compatibility with a 'DataLoader'?
getitem
iter
len
init
A published solution is not available for this question yet.
Question 19 MSQ · 3.0 marks
An image "sample.jpg" with the shape [[IMAGE:1ddd5c11cc750578_11_44]] is processed using the following code:
[[IMAGE:1ddd5c11cc750578_11_45]]
Which of the following statements regarding the transformation are False?


The operation fails because the target width and height do not match the
original dimensions
The operation fails because the number of channels is not specified while
resizing
The output from [[IMAGE:1ddd5c11cc750578_11_46]] will be [[IMAGE:1ddd5c11cc750578_11_47]]


The new aspect ratio of the resized image is 1:1
A published solution is not available for this question yet.
Question 20 MSQ · 3.0 marks
[[IMAGE:1ddd5c11cc750578_11_48]]

The sample dataset contains 50 samples.
The range(0, 500, 10) function selects rows in steps of 10.
The original dataset is modified after the .select() operation.
The sample object is of type Dataset.
A published solution is not available for this question yet.
Question 21 NAT · 3.0 marks
Consider the following code snippet for a multi-class classification problem with three classes: 0, 1,
and 2. The ground-truth labels are stored in [[IMAGE:1ddd5c11cc750578_12_49]] , and the predicted labels are stored in [[IMAGE:1ddd5c11cc750578_12_50]] .
[[IMAGE:1ddd5c11cc750578_12_51]]
**What is the recall score for class 1? (Round off to two decimal places)**



A published solution is not available for this question yet.
Question 22 MSQ · 2.0 marks
Consider the following code snippet and select the true statements from the options provided.
[[IMAGE:1ddd5c11cc750578_13_52]]

The [[IMAGE:1ddd5c11cc750578_13_53]] identified by GridSearchCV offers the best performance on
the [[IMAGE:1ddd5c11cc750578_13_54]] from the given choices in [[IMAGE:1ddd5c11cc750578_13_55]]



Changing the scoring metric to [[IMAGE:1ddd5c11cc750578_13_56]] can lead to a different set of
hyperparameters returned by [[IMAGE:1ddd5c11cc750578_13_57]]


Based on the configuration provided for GridSearchCV, 48 decision tree
models are trained in total
Based on the configuration provided for GridSearchCV, a total of 48 different
hyperparameter combinations are evaluated
A published solution is not available for this question yet.
Question 23 MCQ · 3.0 marks
Which of the following code snippets will produce the same output every time they are run?
(Assume the model and its infrastructure remain unchanged.)
[[IMAGE:1ddd5c11cc750578_14_58]]

[[IMAGE:1ddd5c11cc750578_14_59]]

Output can not be same if the code is run multiple times.
[[IMAGE:1ddd5c11cc750578_15_60]]

A published solution is not available for this question yet.
Question 24 MCQ · 3.0 marks
A RAG system answers direct factual questions well, but struggles when the answer requires
piecing together information spread across multiple documents. A developer has the following
setup:
[[IMAGE:1ddd5c11cc750578_15_61]]
Which single change would MOST directly improve performance on multi-document synthesis
questions?

Decrease the value of chunk_size.
[[IMAGE:1ddd5c11cc750578_15_62]]

Increase the value of chunk_size.
[[IMAGE:1ddd5c11cc750578_15_63]]

Increase the value of chunk_overlap.
[[IMAGE:1ddd5c11cc750578_16_64]]

Increase the value of k.
[[IMAGE:1ddd5c11cc750578_16_65]]

A published solution is not available for this question yet.
Question 25 MCQ · 3.0 marks
You are building a simple LangGraph agent that:
1. Starts at the agent node
2. If the LLM response contains a tool call, go to tool
3. Otherwise, end the workflow
Fill in the missing line.
[[IMAGE:1ddd5c11cc750578_16_66]]
Which line correctly adds conditional routing?

[[IMAGE:1ddd5c11cc750578_17_67]]

[[IMAGE:1ddd5c11cc750578_17_68]]

[[IMAGE:1ddd5c11cc750578_17_69]]

[[IMAGE:1ddd5c11cc750578_17_70]]

A published solution is not available for this question yet.
Question 26 MCQ · 3.0 marks
You are building a ReAct style agent using LangGraph.
[[IMAGE:1ddd5c11cc750578_17_71]]
What happens on [[IMAGE:1ddd5c11cc750578_18_72]]


Executes the [[IMAGE:1ddd5c11cc750578_18_73]] node and returns the updated state.

Executes the [[IMAGE:1ddd5c11cc750578_18_74]] node directly.

Raises a runtime error due to missing entry point
Returns an empty state without executing any node
A published solution is not available for this question yet.