MauryaHub PYQ Practice

Data Science and AI Lab · Quiz 2 · Sep 2025

Data Science and AI Lab · Quiz 2 · Sep 2025

← 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.

0 / 24 published solutions

Question 39 MCQ · 2.0 marks

In text generation with GPT-2, what effect does increasing the temperature parameter generally have?
6406535953815.
It makes the output more deterministic and repetitive.
6406535953816.
It increases randomness by flattening the probability distribution, making less likely words more probable to be chosen.
6406535953817.
It strictly limits the vocabulary size considered at each step.
6406535953818.
It increases the penalty for repeating n-grams.

A published solution is not available for this question yet.

Report a correction for Q39

Question 40 MCQ · 2.0 marks

Source diagram or notation
6406535953819.
chain.invoke({"prompt": "What is the capital of France?"})
6406535953820.
chain.invoke("What is the capital of France")
6406535953821.
chain.invoke("France")
6406535953822.
chain.invoke({"country": "France"})

A published solution is not available for this question yet.

Report a correction for Q40

Question 41 MCQ · 2.0 marks

Fill in the missing function call to correctly compile and execute the LangGraph workflow. graph = StateGraph() # ... add nodes and edges ... app = graph.________() output = app.________({"query": "What is LangGraph?"})
6406535953823.
connect(), execute()
6406535953824.
run(), output()
6406535953825.
setup(), call()
6406535953826.
compile(), invoke()

A published solution is not available for this question yet.

Report a correction for Q41

Question 42 MSQ · 2.0 marks

In LangGraph, which of the following statements correctly describe the role of **State**? (Select all that apply)
6406535953827.
State acts as a shared memory that passes data between nodes
6406535953828.
State defines the execution order of nodes in the graph
6406535953829.
State is automatically reset after every node execution
6406535953830.
State stores intermediate results produced by each node during execution

A published solution is not available for this question yet.

Report a correction for Q42

Question 43 MCQ · 2.0 marks

What does the following line do? x = x.to('cuda')
6406535953831.
Moves tensor x to the GPU for computation.
6406535953832.
Creates a copy of x on CPU.
6406535953833.
Converts x to a CUDA integer type.
6406535953834.
Enables mixed-precision computation.

A published solution is not available for this question yet.

Report a correction for Q43

Question 44 MCQ · 2.0 marks

You are training a neural network using PyTorch. The following code blocks are parts of a typical training loop. Arrange them in the correct order to form a valid training loop for one epoch. Make necessary assumptions and choose the correct option (A) outputs = model(inputs) loss = criterion(outputs, labels) (B) optimizer.step() (C) for inputs, labels in dataloader: (D) loss.backward() (E) optimizer.zero_grad()
6406535953835.
(C) → (E) → (A) → (D) → (B)
6406535953836.
(C) → (B) → (E) → (A) → (D)
6406535953837.
(E) → (C) → (A) → (B) → (D)
6406535953838.
(C) → (E) → (A) → (B) → (D)

A published solution is not available for this question yet.

Report a correction for Q44

Question 45 MCQ · 2.0 marks

Source diagram or notation
6406535953839.
"END", "greet"
6406535953840.
"greet", END
6406535953841.
"start", "end"
6406535953842.
"entry", "exit"

A published solution is not available for this question yet.

Report a correction for Q45

Question 46 MCQ · 2.0 marks

When performing gradient accumulation in PyTorch, which of the following statements are true?
6406535953843.
Gradients computed by loss.backward() are added to the existing .grad attributes of model parameters rather than replacing them.
6406535953844.
To accumulate gradients over multiple mini-batches before an optimizer step, you must call optimizer.zero_grad() after every loss.backward().
6406535953845.
Calling loss.backward() automatically clears the previously stored gradients in the model parameters.
6406535953846.
Gradient accumulation in PyTorch is enabled by setting requires_grad=True for model parameters.

A published solution is not available for this question yet.

Report a correction for Q46

Question 47 MCQ · 2.0 marks

Source diagram or notation
6406535953847.
{"message": "Hello Sachin!"}
6406535953848.
{"Hello Sachin!"}
6406535953849.
{"name": "Sachin", "message": "Hello Sachin!"}
6406535953850.
None

A published solution is not available for this question yet.

Report a correction for Q47

Question 48 NAT · 2.0 marks

Source diagram or notation

A published solution is not available for this question yet.

Report a correction for Q48

Question 49 NAT · 2.0 marks

The parent node of a decision tree P has 50 samples belonging to class A and 50 samples belonging to class B from a total of 100 samples. After the split at node P, the left child L has the 50 points belonging to class B and the right child R has the 50 points belonging to class A. What is the absolute value of Entropy(P) - (Entropy(L) + Entropy(R)) ?

A published solution is not available for this question yet.

Report a correction for Q49

Question 50 MCQ · 2.0 marks

What will this code retrieve? vectorstore = FAISS.from_documents(chunks, embedding_model) results = vectorstore.similarity_search("product launch", k=3) print(type(results[0]))
6406535953853.Source diagram or notation
6406535953854.Source diagram or notation
6406535953855.Source diagram or notation
6406535953856.Source diagram or notation

A published solution is not available for this question yet.

Report a correction for Q50

Question 51 NAT · 3.0 marks

A dataset df contains 20000 rows and 7 columns. The columns are named id, road_type, num_lanes, weather, speed_limit, area and public. The number of unique values taken by the columns are as follows: id - 20000, road_type - 4, num_lanes - 4, weather - 3, speed_limit - 25, area - 30, public - 2.The following transformations were done on the dataset. df = df.drop(columns=['id']) encoder = ColumnTransformer( transformers=[ ('road_type', OneHotEncoder(drop = None, handle_unknown='ignore'), ['road_type']), ('weather', OneHotEncoder(drop = None, handle_unknown='ignore'), ['weather']), ('area', OrdinalEncoder(handle_unknown="use_encoded_value",unknown_value=100), ['area']) ], remainder='passthrough' ) X_encoded = encoder.fit_transform(df) How many columns are present in the dataset X_encoded?

A published solution is not available for this question yet.

Report a correction for Q51

Question 52 MCQ · 2.0 marks

What is the output of the following snippet of code? import numpy as np A = np.array([ [1, 5, 9], [10, 2, 1], [0, 2, 3] ]) array_sum = A.sum(axis=1) print(array_sum)
6406535953858.
[15, 13, 5]
6406535953859.
[11, 9, 13]
6406535953860.
33
6406535953861.
[9, 10, 3]

A published solution is not available for this question yet.

Report a correction for Q52

Question 53 MSQ · 2.0 marks

Source diagram or notation
6406535953862.
Add a RunnableLambda(print) immediately after the prompt: chain = prompt | RunnableLambda(print) | model.
6406535953863.
Set the verbose flag to True when configuring the model.
6406535953864.
Use print(chain.invoke(input)) and check the final output, as the intermediate steps are not directly accessible.
6406535953865.
Invoke the prompt component directly: prompt.invoke(input).

A published solution is not available for this question yet.

Report a correction for Q53

Question 54 MCQ · 2.0 marks

x and y are 1D NumPy arrays, that is, x.ndim = 1 and y.ndim = 1. Also, x.shape == y.shape. What would happen if we run x @ y?
6406535953866.
We would get the dot product between the two vectors represented by the arrays.
6406535953867.
We would get the outer product between the two vectors represented by the arrays.
6406535953868.
We would get the element-wise product of the two vectors represented by the arrays.
6406535953869.
The code would throw a SyntaxError.

A published solution is not available for this question yet.

Report a correction for Q54

Question 55 MSQ · 2.0 marks

You are working with two datasets and trying to combine them to get two columns in the combined_dataset using the following code: from datasets import concatenate_datasets, load_dataset ds1 = load_dataset("imdb", split="train[:4000]") ds2 = load_dataset("csv", data_files="reviews.csv") combined_dataset = concatenate_datasets([ds1, ds2]) Assume the following: The ds1 dataset has columns: text (string), label (int). The ds2 dataset has columns: review (string), sentiment (int).
6406535953870.
The combined dataset will automatically align the columns and combine rows successfully.
6406535953871.
To combine the datasets, you must align the column names using .rename_column() or .map().
6406535953872.
The concatenate_datasets() function requires both datasets to have the same split names.
6406535953873.
Both datasets must have the same schema (column names and types) to be concatenated.
6406535953874.
The concatenate_datasets() function modifies ds1 and ds2 in place.

A published solution is not available for this question yet.

Report a correction for Q55

Question 56 MSQ · 2.0 marks

You need to add a new column char_count, representing the character count of the text column in your dataset. Which of the following code snippets will achieve this using the .map() method?
6406535953875.
def add_char_count(example): return {"char_count": len(example["text"])} dataset = dataset.map(add_char_count)
6406535953876.
def add_char_count(example): example["char_count"] = len(example["text"]) return example dataset = dataset.map(add_char_count)
6406535953877.
dataset = dataset.add_column("char_count", dataset["text"].apply(len))
6406535953878.
dataset["char_count"] = dataset["text"].map(len)

A published solution is not available for this question yet.

Report a correction for Q56

Question 57 MSQ · 2.0 marks

You notice your RAG system returns irrelevant results. Which change might help? # Current setup splitter = RecursiveCharacterTextSplitter(chunk_size=5000, chunk_overlap=500) retriever = vectorstore.as_retriever(search_kwargs={"k": 1})
6406535953879.
Increase k to 5 to get more context.
6406535953880.
Decrease chunk_size to 500 for more focused chunks.
6406535953881.
Remove chunk_overlap completely.

A published solution is not available for this question yet.

Report a correction for Q57

Question 58 NAT · 3.0 marks

What will be the output of the following code? from langchain_text_splitters import RecursiveCharacterTextSplitter text = "Hello world. How are you? I am fine." splitter = RecursiveCharacterTextSplitter(chunk_size=15, chunk_overlap=5) chunks = splitter.split_text(text) print(len(chunks))

A published solution is not available for this question yet.

Report a correction for Q58

Question 59 MCQ · 2.0 marks

In a standard 8-bit grayscale image, what pixel values typically represent pure black and pure white, respectively?
6406535953883.
0 for black, 255 for white.
6406535953884.
255 for black, 0 for white.
6406535953885.
0 for black, 1 for white.
6406535953886.
-1 for black, 1 for white.

A published solution is not available for this question yet.

Report a correction for Q59

Question 60 MCQ · 2.0 marks

How is a standard color (RGB) image typically represented as a NumPy array?
6406535953887.
As a 1D vector of all pixel values.
6406535953888.
As a 2D array with the shape (Height, Width).
6406535953889.
As a 3D array with the shape (3, Height, Width).
6406535953890.
As a 3D array with the shape (Height, Width, 3).

A published solution is not available for this question yet.

Report a correction for Q60

Question 61 MSQ · 2.0 marks

Which of the following statements regarding Data Augmentation are correct?
6406535953891.
Involves creation of modified copies of existing data through techniques such as rotation, scaling, cropping among others.
6406535953892.
It artificially expands the dataset to help the model generalize better on unseen data and reduce overfitting.
6406535953893.
The primary objective is to make the images smaller to achieve faster training.
6406535953894.
It is used for the removal of noise from images and converting it to grayscale.

A published solution is not available for this question yet.

Report a correction for Q61

Question 62 MCQ · 2.0 marks

What is the main difference between PIL.Image.open() and cv2.imread() when loading a color image?
6406535953895.
Pillow loads the image as a NumPy array, while OpenCV loads it in a custom format.
6406535953896.
Pillow (PIL) loads the image in RGB format, while OpenCV (cv2) loads it in BGR format.

A published solution is not available for this question yet.

Report a correction for Q62