Skip to content

Instantly share code, notes, and snippets.

@KorigamiK
Last active February 28, 2025 12:59
Show Gist options
  • Save KorigamiK/62bc353dd59f8f77d47c45cbb9e8e080 to your computer and use it in GitHub Desktop.
Save KorigamiK/62bc353dd59f8f77d47c45cbb9e8e080 to your computer and use it in GitHub Desktop.
GATE 2025 score calculator
import re
import csv
from pathlib import Path
def parse_questions(content):
questions = []
# Look for question patterns - Q.1, Q.2, etc. and capture the content until the next question
question_pattern = re.compile(r'(Q\.\s*\d+(?:\s*–\s*Q\.\s*\d+)?\s+(?:Carry|carry)\s+(?:ONE|TWO|one|two)\s+marks?(?:\s+Each)?|Q\.\s*\d+(?:\s*–\s*Q\.\s*\d+)?)')
# Split content by question headings
parts = question_pattern.split(content)
# Skip the first part before any questions
parts = parts[1:]
# Combine heading with content
for i in range(0, len(parts), 2):
if i+1 < len(parts):
question_number = parts[i].strip()
question_content = parts[i+1].strip()
questions.append((question_number, question_content))
return questions
def extract_options(question_content):
options = []
# Look for (A), (B), (C), (D) patterns
option_pattern = re.compile(r'\(([A-D])\)(.*?)(?=\([A-D]\)|$)', re.DOTALL)
matches = option_pattern.findall(question_content)
for option_letter, option_text in matches:
options.append((option_letter, option_text.strip()))
return options
def load_answer_key(csv_path):
answer_key = {}
with open(csv_path, 'r') as f:
reader = csv.DictReader(f)
for row in reader:
q_num = row['Q. No.']
key = row['Key/Range']
q_type = row['Q. Type']
# Handle MSQ type answers (multiple select questions)
if q_type == 'MSQ':
# The format seems to be options separated by '+ADs-'
options = key.split('+ADs-')
answer_key[q_num] = options
# Handle NAT type answers (numerical answer type)
elif q_type == 'NAT':
# The format seems to be a range like "0.25 to 0.25"
range_parts = key.split(' to ')
if len(range_parts) == 2:
answer_key[q_num] = range_parts
else:
answer_key[q_num] = [key]
# Handle MCQ type answers (multiple choice questions)
else:
answer_key[q_num] = [key]
return answer_key
def create_markdown(questions, answer_key):
markdown = "# GATE 2025 Data Science & Artificial Intelligence (DA) Question Paper\n\n"
current_section = None
mark_type = None
for question_number, question_content in questions:
# Extract section and mark information
if "General Aptitude" in question_content and "General Aptitude" != current_section:
current_section = "General Aptitude"
markdown += f"## {current_section}\n\n"
elif "Data Science & Artificial Intelligence" in question_content and "Data Science & Artificial Intelligence" != current_section:
current_section = "Data Science & Artificial Intelligence"
markdown += f"## {current_section}\n\n"
# Check if we have a new marks section
if "ONE mark" in question_number or "one mark" in question_number:
mark_type = "1 Mark Questions"
markdown += f"### {mark_type}\n\n"
elif "TWO marks" in question_number or "two marks" in question_number:
mark_type = "2 Marks Questions"
markdown += f"### {mark_type}\n\n"
# Extract individual question number
if "–" in question_number:
# Range of questions
range_match = re.search(r'Q\.\s*(\d+)\s*–\s*Q\.\s*(\d+)', question_number)
if range_match:
start, end = map(int, range_match.groups())
markdown += f"#### Questions {start} to {end}\n\n"
continue
else:
# Single question
q_num_match = re.search(r'Q\.\s*(\d+)', question_number)
if q_num_match:
q_num = q_num_match.group(1)
# Extract the actual question text
question_text = re.split(r'\([A-D]\)', question_content)[0].strip()
markdown += f"#### Question {q_num}\n\n{question_text}\n\n"
# Extract options if available
options = extract_options(question_content)
if options:
markdown += "**Options:**\n\n"
for option_letter, option_text in options:
markdown += f"- ({option_letter}) {option_text}\n"
markdown += "\n"
# Add answer from answer key
if q_num in answer_key:
answers = answer_key[q_num]
# Handle different question types
if len(answers) == 1 and ' to ' not in answers[0]: # MCQ
option_letter = answers[0]
# Find the matching option text
option_text = ""
for letter, text in options:
if letter == option_letter:
option_text = text
break
markdown += f"**Answer:** ({option_letter}) {option_text}\n\n"
elif len(answers) > 1: # MSQ
markdown += "**Answer:** Multiple correct options: "
answer_texts = []
for letter in answers:
for opt_letter, opt_text in options:
if opt_letter == letter:
answer_texts.append(f"({letter}) {opt_text}")
break
markdown += ", ".join(answer_texts) + "\n\n"
else: # NAT with range
markdown += f"**Answer:** Numerical value in range {answers[0]}\n\n"
else:
markdown += "**Answer:** Not provided in answer key\n\n"
else:
# For numerical answer type questions
if q_num in answer_key:
answers = answer_key[q_num]
if len(answers) == 2: # NAT with range
markdown += f"**Answer:** Numerical value in range {answers[0]} to {answers[1]}\n\n"
else:
markdown += f"**Answer:** {answers[0]}\n\n"
else:
markdown += "**Answer:** Not provided in answer key\n\n"
return markdown
def main():
input_path = Path("questions.md")
answer_key_path = Path("answerkey.csv")
output_path = Path("gate_questions_with_answers.md")
content = input_path.read_text()
# Remove the leading line that says "Here is the converted document in markdown format:"
content = re.sub(r'^Here is the converted document in markdown format:', '', content, flags=re.MULTILINE).strip()
questions = parse_questions(content)
answer_key = load_answer_key(answer_key_path)
markdown = create_markdown(questions, answer_key)
output_path.write_text(markdown)
print(f"Parsed questions with answers saved to {output_path}")
if __name__ == "__main__":
main()
import json
with open("responses.json", "r") as f:
responses = json.load(f)
print(f'found {len(responses)} responses')
with open("score.md", "r") as f:
lines = f.readlines()
score = 0
index = 0
correct_answers = 0
incorrect_answers = 0
total_questions = 0
mcq_correct = 0
mcq_incorrect = 0
msq_correct = 0
msq_incorrect = 0
nat_correct = 0
nat_incorrect = 0
for line in lines:
if line.strip() == "" or line.startswith("#"): continue
total_questions += 1
is_correct = int(line.split()[1].strip())
question_type = responses[index]["type"]
if is_correct > 0:
correct_answers += 1
if question_type == "MCQ":
score += 1
mcq_correct += 1
elif question_type == "MSQ":
score += 2
msq_correct += 1
elif question_type == "NAT":
score += 2
nat_correct += 1
else:
incorrect_answers += 1
if question_type == "MCQ":
score += -1/3
mcq_incorrect += 1
elif question_type == "MSQ":
score += 0
msq_incorrect += 1
elif question_type == "NAT":
score += 0
nat_incorrect += 1
index += 1
accuracy = (correct_answers / total_questions) * 100 if total_questions > 0 else 0
print(f"Total score: {score}")
print(f"Total questions: {total_questions}")
print(f"Correct answers: {correct_answers} ({accuracy:.2f}%)")
print(f"Incorrect answers: {incorrect_answers}")
print("\nBreakdown by question type:")
print(f"MCQ: {mcq_correct} correct, {mcq_incorrect} incorrect")
print(f"MSQ: {msq_correct} correct, {msq_incorrect} incorrect")
print(f"NAT: {nat_correct} correct, {nat_incorrect} incorrect")

Here is the converted document in markdown format:

Data Science & Artificial Intelligence - DA

General Aptitude

Q.1 – Q.5 Carry ONE mark Each

Q.1

Courage : Bravery :: Yearning : __________

Select the most appropriate option to complete the analogy.

(A)

Longing

(B)

Yelling

(C)

Yawning

(D)

Glaring

Q.2 We __________ tennis in the lawn when it suddenly started to rain.

Select the most appropriate option to complete the above sentence.

(A)

have been playing

(B)

had been playing

(C)

would have been playing

(D)

could be playing

Organizing Institute: IIT RoorkeePage 1 of 34

Data Science & Artificial Intelligence - DA

Q.3 A 4 × 4 digital image has pixel intensities (𝑈) as shown in the figure. The number of

pixels with 𝑈 ≤ 4 is:

(A) 3

(B) 8

(C) 11

(D) 9

Organizing Institute: IIT RoorkeePage 2 of 34

Data Science & Artificial Intelligence - DA

Q.4

In the given figure, the numbers associated with the rectangle, triangle, and ellipse are 1, 2, and 3, respectively. Which one among the given options is the most appropriate combination of P, Q, and R ?

2

R

1

4

P

Q

3

(A)

P = 6; Q = 5; R = 3

(B)

P = 5; Q = 6; R = 3

(C)

P = 3; Q = 6; R = 6

(D)

P = 5; Q = 3; R = 6

Organizing Institute: IIT RoorkeePage 3 of 34

Data Science & Artificial Intelligence - DA

Q.5

A rectangle has a length L and a width W, where L > W. If the width, W, is increased by 10%, which one of the following statements is correct for all values of L and W?

(A)

Perimeter increases by 10%.

(B)

Length of the diagonals increases by 10%.

(C)

Area increases by 10%.

(D)

The rectangle becomes a square.

Organizing Institute: IIT RoorkeePage 4 of 34

Data Science & Artificial Intelligence - DA

Q.6 – Q.10 Carry TWO marks Each

Q.6

Column-I has statements made by Shanthala; and, Column-II has responses given by Kanishk.

Column-I

Column-II

P. This house is in a mess.

  1. Alright, I won’t bring it up during

our conversations.

Q. I am not happy with the marks

  1. Well, you can easily look it up.

given to me.

R. Politics is a subject I avoid talking

  1. No problem, let me clear it up for

about.

you.

S.

I don’t know what this word means.

  1. Don’t worry, I will take it up with

your teacher.

Identify the option that has the correct match between Column-I and Column-II.

(A)

P – 2; Q – 3; R – 1; S – 4

(B)

P – 3; Q – 4; R – 1; S – 2

(C)

P – 4; Q – 1; R – 2; S – 3

(D)

P – 1; Q – 2; R – 4; S – 3

Organizing Institute: IIT RoorkeePage 5 of 34

Data Science & Artificial Intelligence - DA

Q.7 Weight of a person can be expressed as a function of their age. The function usually varies from person to person. Suppose this function is identical for two brothers, and it monotonically increases till the age of 50 years and then it monotonically decreases. Let 𝑎1 and 𝑎2 (in years) denote the ages of the brothers and 𝑎1 < 𝑎2.

Which one of the following statements is correct about their age on the day when they attain the same weight?

(A)

𝑎1 < 𝑎2 < 50

(B)

𝑎1 < 50 < 𝑎2

(C)

50 < 𝑎1 < 𝑎2

(D)

Either 𝑎1 = 50 or 𝑎2 = 50

Organizing Institute: IIT RoorkeePage 6 of 34

Data Science & Artificial Intelligence - DA

Q.8

A regular dodecagon (12-sided regular polygon) is inscribed in a circle of radius r cm as shown in the figure. The side of the dodecagon is d cm. All the triangles (numbered 1 to 12) in the figure are used to form squares of side r cm and each numbered triangle is used only once to form a square.

The number of squares that can be formed and the number of triangles required to form each square, respectively, are:

Note: The figure shown is representative.

(A)

3; 4

(B)

4; 3

(C)

3; 3

(D)

3; 2

Organizing Institute: IIT RoorkeePage 7 of 34

Data Science & Artificial Intelligence - DA

Q.9

If a real variable 𝑥 satisfies 3𝑥2

= 27 × 9𝑥, then the value of

2𝑥2 (2𝑥)2 is:

(A)

2−1

(B)

20

(C)

23

(D)

215

Organizing Institute: IIT RoorkeePage 8 of 34

Data Science & Artificial Intelligence - DA

Q.10

The number of patients per shift (𝑋) consulting Dr. Gita in her past 100 shifts is shown in the figure. If the amount she earns is ₹ 1000(𝑋 − 0.2), what is the average amount (in ₹) she has earned per shift in the past 100 shifts?

Note: The figure shown is representative.

50

40

30

20

10

0

s t f i h s

f o

r e b m u N

40

30

20

5

6

7

Number of patients per shift (X)

10

8

(A)

6,100

(B)

6,300

(C)

6,000

(D)

6,500

Organizing Institute: IIT RoorkeePage 9 of 34

GATE 2025

Data Science & Artificial Intelligence - DA

Q. 11 – Q. 35 carry one mark each.

Q. 11

Suppose X and Y are random variables. The conditional expectation of X given Y is

denoted by E[X|Y ]. Then E[E[X|Y ]] equals

(A)

E[X|Y ]

(B)

E[X] E[Y ]

(C)

E[X]

(D)

E[Y ]

Q. 12

The number of additions and multiplications involved in performing Gaussian elimina-

tion on any n × n upper triangular matrix is of the order

(A)

O(n)

(B)

O(n2)

(C)

O(n3)

(D)

O(n4)

Q. 13

The sum of the elements in each row of A ∈ Rn×n is 1. If B = A3 − 2A2 + A, which one of the following statements is correct (for x ∈ Rn)?

(A)

The equation Bx = 0 has no solution

(B)

The equation Bx = 0 has exactly two solutions

(C)

The equation Bx = 0 has infinitely many solutions

(D)

The equation Bx = 0 has a unique solution

Organizing Institute: IIT RoorkeePage 10 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Q. 14

Let f (x) =

ex − e−x 2

, x ∈ R. Let f (k)(a) denote the kth derivative of f evaluated at a.

What is the value of f (10)(0)? (Note: ! denotes factorial)

(A)

(B)

(C)

(D)

0

1

1 10!

2 10!

Q. 15

Let p and q be any two propositions. Consider the following propositional statements.

S1 : p → q,

S2 : ¬p ∧ q,

S3 : ¬p ∨ q,

S4 : ¬p ∨ ¬q,

where ∧ denotes conjunction (AND operation), ∨ denotes disjunction (OR operation),

and ¬ denotes negation (NOT operation). Which one of the following options is correct?

(Note: ≡ denotes logical equivalence)

(A)

S1 ≡ S3

(B)

S2 ≡ S3

(C)

S2 ≡ S4

(D)

S1 ≡ S4

Q. 16

If a relational decomposition is not dependency-preserving, which one of the following

relational operators will be executed more frequently in order to maintain the depen-

dencies?

(A)

Selection

(B)

Projection

(C)

Join

(D)

Set union

Organizing Institute: IIT RoorkeePage 11 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Q. 17

Consider the following three relations:

Car (model, year, serial, color)

Make (maker, model)

Own (owner, serial)

A tuple in Car represents a specific car of a given model, made in a given year, with

a serial number and a color. A tuple in Make specifies that a maker company

makes cars of a certain model. A tuple in Own specifies that an owner owns the car

with a given serial number. Keys are underlined; (owner, serial) together

form key for Own. ((cid:46)(cid:47) denotes natural join)

πowner(Own (cid:46)(cid:47) (σcolor=“red”(Car (cid:46)(cid:47) (σmaker=“ABC”Make))))

Which one of the following options describes what the above expression computes?

(A)

All owners of a red car, a car made by ABC, or a red car made by ABC

(B) All owners of more than one car, where at least one car is red and made by ABC

(C)

All owners of a red car made by ABC

(D)

All red cars made by ABC

Q. 18

Consider a hash table of size 10 with indices {0, 1, . . . , 9}, with the hash function

h(x) = 3x (mod 10),

where linear probing is used to handle collisions. The hash table is initially empty and

then the following sequence of keys is inserted into the hash table: 1, 4, 5, 6, 14, 15. The

indices where the keys 14 and 15 are stored are, respectively

(A)

2 and 5

(B)

2 and 6

(C)

4 and 5

(D)

4 and 6

Organizing Institute: IIT RoorkeePage 12 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Q. 19

Let X be a continuous random variable whose cumulative distribution function (CDF)

FX(x), for some t, is given as follows:

FX(x) =

  

0 x − t 4 − t 1

x ≤ t

t ≤ x ≤ 4

x ≥ 4

If the median of X is 3, then what is the value of t?

(A)

(B)

2

1

(C) −1

(D)

0

Q. 20

Let X = aZ + b, where Z is a standard normal random variable, and a, b are two

unknown constants. It is given that

E[X] = 1, E[(X − E[X])Z] = −2, E[(X − E[X])2] = 4,

where E[X] denotes the expectation of random variable X. The values of a, b are:

(A)

a = −2, b = 1

(B)

a = 2, b = −1

(C)

a = −2, b = −1

(D)

a = 1, b = 1

Organizing Institute: IIT RoorkeePage 13 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Q. 21

It is given that P (X ≥ 2) = 0.25 for an exponentially distributed random variable X

with E[X] =

1 λ (ln denotes natural logarithm)

, where E[X] denotes the expectation of X. What is the value of λ?

(A)

ln 2

(B)

ln 4

(C)

ln 3

(D)

ln 0.25

Q. 22

Consider designing a linear classifier

y = sign(f (x; w, b)),

f (x; w, b) = w(cid:62)x + b

on a dataset D = {(x1, y1), (x2, y2), . . . , (xN , yN )}, xi ∈ Rd, yi ∈ {+1, −1}, i =

1, 2, . . . , N . Recall that the sign function outputs +1 if the argument is positive, and −1

if the argument is non-positive. The parameters w and b are updated as per the following

training algorithm:

wnew = wold + ynxn,

bnew = bold + yn

whenever sign(f (xn; wold, bold)) (cid:54)= yn. In other words, whenever the classifier wrongly

predicts a sample (xn, yn) from the dataset, wold gets updated to wnew, and likewise bold

gets updated to bnew. Consider the case (xn, +1), f (xn; wold, bold) < 0. Then

(A)

f (xn; wnew, bnew) > f (xn; wold, bold)

(B)

f (xn; wnew, bnew) < f (xn; wold, bold)

(C)

f (xn; wnew, bnew) = f (xn; wold, bold)

(D)

ynf (xn; wold, bold) > 1

Organizing Institute: IIT RoorkeePage 14 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Q. 23

Consider the following Python declarations of two lists.

A=[1,2,3]

B=[4,5,6]

Which one of the following statements results in A= [1, 2, 3, 4, 5, 6]?

(A)

A.extend(B)

(B)

A.append(B)

(C)

A.update(B)

(D)

A.insert(B)

Q. 24

Consider two functions f : R → R and g : R → (1, ∞). Both functions are differen-

tiable at a point c. Which of the following functions is/are ALWAYS differentiable at

c? The symbol · denotes product and the symbol ◦ denotes composition of functions.

(A)

f ± g

(B)

f · g

(C)

f g

(D)

f ◦ g + g ◦ f

Q. 25

Which of the following statements is/are correct?

(A)

Rn has a unique set of orthonormal basis vectors

(B)

Rn does not have a unique set of orthonormal basis vectors

(C)

Linearly independent vectors in Rn are orthonormal

(D)

Orthonormal vectors Rn are linearly independent

Organizing Institute: IIT RoorkeePage 15 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Q. 26

Which of the following statements is/are correct in a Bayesian network?

(A)

Variable elimination is an approximate inference algorithm

(B)

Gibbs sampling is an exact inference algorithm

(C)

Variable elimination is used to determine conditional probabilities

(D)

Rejection sampling is an approximate inference algorithm

Q. 27

For which of the following inputs does binary search take time O(log n) in the worst

case?

(A)

An array of n integers in any order

(B)

A linked list of n integers in any order

(C)

An array of n integers in increasing order

(D)

A linked list of n integers in increasing order

Q. 28

Let A = In + xx(cid:62), where In is the n × n identity matrix and x ∈ Rn, x(cid:62)x = 1. Which

of the following options is/are correct?

(A)

Rank of A is n

(B)

A is invertible

(C)

0 is an eigenvalue of A

(D)

A−1 has a negative eigenvalue

Q. 29

Suppose that insertion sort is applied to the array [1, 3, 5, 7, 9, 11, x, 15, 13] and it takes

exactly two swaps to sort the array. Select all possible values of x.

(A)

10

(B)

12

(C)

14

(D)

16

Organizing Institute: IIT RoorkeePage 16 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Q. 30

Let C1 and C2 be two sets of objects. Let D(x, y) be a measure of dissimilarity between

two objects x and y. Consider the following definitions of dissimilarity between C1 and

C2.

DIS-1(C1, C2) = max

x∈C1, y∈C2

DIS-2(C1, C2) = min

x∈C1, y∈C2

D(x, y)

D(x, y)

Which of the following statements is/are correct?

(A)

Single Linkage Clustering uses DIS-1

(B)

Single Linkage Clustering uses DIS-2

(C)

Complete Linkage Clustering uses DIS-2

(D)

Complete Linkage Clustering uses DIS-1

Q. 31

There are three boxes containing white balls and black balls.

Box-1 contains 2 black and 1 white balls.

Box-2 contains 1 black and 2 white balls.

Box-3 contains 3 black and 3 white balls.

In a random experiment, one of these boxes is selected, where the probability of choos-

ing Box-1 is

1 2

, Box-2 is

1 6

, and Box-3 is

1 3

. A ball is drawn at random from the selected

box. Given that the ball drawn is white, the probability that it is drawn from Box-2 is

(Round off to two decimal places)

Q. 32

t2 + t − t =

lim t→+∞ (Round off to one decimal place)

Organizing Institute: IIT RoorkeePage 17 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Q. 33

On a relation named Loan of a bank:

Loan

loan number branch name amount

L11

L14

L15

L22

L23

L25

L19

Banjara Hills

90000

Kondapur

SR Nagar

SR Nagar

Balanagar

Kondapur

SR Nagar

50000

40000

25000

80000

70000

65000

the following SQL query is executed.

SELECT L1.loan number

FROM Loan L1

WHERE L1.amount > (SELECT MAX (L2.amount)

FROM Loan L2

WHERE L2.branch name = ’SR Nagar’);

The number of rows returned by the query is

(Answer in integer)

Q. 34

Given data {(−1, 1), (2, −5), (3, 5)} of the form (x, y), we fit a model y = wx using

linear least-squares regression. The optimal value of w is

(Round off to three decimal places)

Q. 35

The naive Bayes classifier is used to solve a two-class classification problem with class-

labels y1, y2. Suppose the prior probabilities are P (y1) =

a discrete feature space with

1 3

and P (y2) =

2 3

. Assuming

P (x|y1) =

3 4

and P (x|y2) =

1 4

for a specific feature vector x. The probability of misclassifying x is

(Round off to two decimal places)

Organizing Institute: IIT RoorkeePage 18 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Q. 36 – Q. 65 carry two marks each.

Q. 36

Let Y = Z 2, Z =

X − µ σ

, where X is a normal random variable with mean µ and

variance σ2. The variance of Y is

(A)

(B)

(C)

(D)

1

2

3

4

Q. 37

Let A ∈ Rn×n be such that A3 = A. Which one of the following statements is ALWAYS

correct?

(A)

A is invertible

(B)

Determinant of A is 0

(C)

The sum of the diagonal elements of A is 1

(D)

A and A2 have the same rank

Q. 38

Let {x1, x2, . . . , xn} be a set of linearly independent vectors in Rn. Let the (i, j)-th element of matrix A ∈ Rn×n be given by Aij = x(cid:62)

i xj, 1 ≤ i, j ≤ n. Which one of the

following statements is correct?

(A)

A is invertible

(B)

0 is a singular value of A

(C)

Determinant of A is 0

(D)

z(cid:62)Az = 0 for some non-zero z ∈ Rn

Organizing Institute: IIT RoorkeePage 19 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Q. 39

Consider the cumulative distribution function (CDF) of a random variable X:

FX(x) =

 

0 1 4

1

x ≤ −1

(x + 1)2

−1 ≤ x ≤ 1

x ≥ 1

The value of P (X 2 ≤ 0.25) is

(A)

0.625

(B)

0.25

(C)

0.5

(D)

0.5625

Q. 40

A random variable X is said to be distributed as Bernoulli(θ), denoted by X ∼

Bernoulli(θ), if

P (X = 1) = θ,

P (X = 0) = 1 − θ

for 0 < θ < 1. Let Y =

300 (cid:88)

Xi, where Xi ∼ Bernoulli(θ), i = 1, 2, . . . , 300 be

independent and identically distributed random variables with θ = 0.25. The value of

i=1

P (60 ≤ Y ≤ 90), after approximation through Central Limit Theorem, is given by

(cid:0)Recall that φ(x) =

1 √ 2π

(cid:90) x

−∞

e− t2

2 dt(cid:1)

(A)

φ(2) − φ(−2)

(B)

φ(1) − φ(−1)

(C)

φ(3) − φ(−3)

(D)

φ(90) − φ(60)

Organizing Institute: IIT RoorkeePage 20 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Q. 41

For x ∈ R, the floor function is denoted by f (x) = (cid:98)x(cid:99) and defined as follows

(cid:98)x(cid:99) = k, k ≤ x < k + 1,

where k is an integer. Let Y = (cid:98)X(cid:99), where X is an exponentially distributed random

variable with mean

1 ln 10

, where ln denotes natural logarithm. For any positive integer

(cid:96), one can write the probability of the event Y = (cid:96) as follows

P (Y = (cid:96)) = q(cid:96)(1 − q)

The value of q is

(A)

0.1

(B)

0.01

(C)

0.5

(D)

0.434

Organizing Institute: IIT RoorkeePage 21 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Q. 42

Consider the neural network shown in the figure with

inputs: u, v

weights: a, b, c, d, e, f

output: y

R denotes the ReLU function, R(x) = max(0, x).

u

v

a

d

b

c

R

R

e

f

R

y

Given u = 2, v = 3,

a = 1, b = 1, c = 1, d = −1, e = 4, f = −1,

which one of the following is correct?

(A)

(B)

(C)

(D)

∂y ∂a

∂y ∂a

∂y ∂a

∂y ∂a

= 8,

= 1,

= 1,

= 2,

∂y ∂f

∂y ∂f

∂y ∂f

∂y ∂f

= 0

= 0

= −1

= −1

Organizing Institute: IIT RoorkeePage 22 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Q. 43

Consider game trees Tree-1 and Tree-2 as shown. The first level is a MAX agent and

the second level is a MIN agent. The value in the square node is the output of the utility

function.

MAX

A

C

MIN

2

B

D

E

x

1

5

y

2

Tree-1

Tree-2

For what ranges of x and y, the right child of node B and the right child of node E will

be pruned by alpha-beta pruning algorithm?

(A)

x ∈ [1, ∞) and y ∈ (−∞, 2]

(B)

x ∈ (−∞, 2] and y ∈ (−∞, 5]

(C)

x ∈ (−∞, 2] and y ∈ [2, ∞)

(D)

x ∈ [1, ∞) and y ∈ (−∞, 5]

Organizing Institute: IIT RoorkeePage 23 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Q. 44

The state graph shows the action cost along the edges and the heuristic function h asso-

ciated with each state.

h=2

h=2

h=6

2

2

4

1

S

B

2

A

E

h=6

C

3

h=2

h=0

3

D

G

Suppose A∗ algorithm is applied on this state graph using priority queue to store the

frontier. In what sequence are the nodes expanded?

(A)

S,A,E,C,B,D,G

(B)

S,E,A,C,B,D,G

(C)

S,A,E,B,C,D,G

(D)

S,A,B,E,C,D,G

Q. 45

A random experiment consists of throwing 100 fair dice, each die having six faces

numbered 1 to 6. An event A represents the set of all outcomes where at least one of

the dice shows a 1. Then, P (A) =

(A)

(B)

0

1

(C)

1 −

(cid:19)100

(cid:18) 5 6

(D)

(cid:19)100

(cid:18) 5 6

Organizing Institute: IIT RoorkeePage 24 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Q. 46

Consider a fact table in an OLAP application: Facts(D1, D2, val), where D1

and D2 are its dimension attributes and val is a dependent attribute. Suppose attribute

D1 takes 3 values and D2 takes 2 values, and all combinations of these values are present

in the table Facts. How many tuples are there in the result of the following query?

SELECT D1, D2, sum(val)

FROM Facts

GROUP BY CUBE (D1, D2);

(A)

(B)

(C)

1

6

9

(D)

12

Organizing Institute: IIT RoorkeePage 25 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Q. 47

Consider the following Python code snippet.

A={"this","that"}

B={"that","other"}

C={"other","this"}

while "other" in C:

if "this" in A:

A,B,C=A-B,B-C,C-A

if "that" in B:

A,B,C=C|A,A|B,B|C

When the above program is executed, at the end, which of the following sets contains

"this"?

(A)

Only A

(B)

Only B

(C)

Only C

(D)

A, C

Q. 48

Which of the following statements is/are correct about the rectified linear unit (ReLU) activation function defined as ReLU(x) = max(x, 0), where x ∈ R?

(A)

ReLU is continuous everywhere

(B)

ReLU is differentiable everywhere

(C)

ReLU is not differentiable at x = 0

(D)

ReLU(x) = ReLU(ax), for all a ∈ R

Organizing Institute: IIT RoorkeePage 26 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Q. 49

Consider the function f (x) =

x3 3

7 2

x2 + 10 x +

133 2

, x ∈ [−8, 0]. Which of the

following statements is/are correct?

(A)

The maximum value of f is attained at x = −5

(B)

The minimum value of f is attained at x = −2

(C)

The maximum value of f is

133 2

(D)

The minimum value of the derivative of f is attained at x = −

7 2

Q. 50

Let x1, x2, x3, x4, x5 be a system of orthonormal vectors in R10. Consider the matrix A = x1x(cid:62)

5 . Which of the following statements is/are correct?

1 + . . . + x5x(cid:62)

(A)

Singular values of A are also its eigenvalues

(B)

Singular values of A are either 0 or 1

(C)

Determinant of A is 1

(D)

A is invertible

Q. 51

Let f : R → R be a twice-differentiable function and suppose its second derivative satisfies f (cid:48)(cid:48)(x) > 0 for all x ∈ R. Which of the following statements is/are ALWAYS

correct?

(A)

f has a local minima

(B)

There does not exist x and y, x (cid:54)= y, such that f (cid:48)(x) = f (cid:48)(y) = 0

(C)

f has at most one global minimum

(D)

f has at most one local minimum

Organizing Institute: IIT RoorkeePage 27 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Q. 52

An n × n matrix A with real entries satisfies the property: (cid:107)Ax(cid:107)2 = (cid:107)x(cid:107)2, for all x ∈ Rn, where (cid:107) · (cid:107) denotes the Euclidean norm. Which of the following statements

is/are ALWAYS correct?

(A)

A must be orthogonal

(B)

A = I, where I denotes the identity matrix, is the only solution

(C)

The eigenvalues of A are either +1 or −1

(D)

A has full rank

Q. 53

Consider designing a linear binary classifier f (x) = sign(w(cid:62)x + b), x ∈ R2 on the

following training data:

Class-1:

 

2

0

 ,

 ,

0

2

 

2

2

, Class-2:

 

 

0

0

Hard-margin support vector machine (SVM) formulation is solved to obtain w and b.

Which of the following options is/are correct?

(A)

w =

 and b = 1

4

4

(B)

The number of support vectors is 3

(C)

The margin is

√ 2

(D)

Training accuracy is 98%

Organizing Institute: IIT RoorkeePage 28 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Q. 54

Consider a coin-toss experiment where the probability of head showing up is p. In the

ith coin toss, let Xi = 1 if head appears, and Xi = 0 if tail appears. Consider

(cid:98)p =

1 n

n (cid:88)

i=1

Xi

where n is the total number of independent coin tosses.

Which of the following statements is/are correct?

(A)

E[ (cid:98)p ] = p

(B)

(C)

E[ (cid:98)p ] =

p n

As n increases, variance of (cid:98)p decreases

(D)

Variance of (cid:98)p does not depend on n

Q. 55

Consider a two-class problem in Rd with class labels red and green. Let µred and µgreen be the means of the two classes. Given test sample x ∈ Rd, a classifier calculates the squared Euclidean distance (denoted by (cid:107) · (cid:107)2) between x and the means of the two

classes and assigns the class label that the sample x is closest to. That is, the classifier

computes

f (x) = (cid:107)µred − x(cid:107)2 − (cid:107)µgreen − x(cid:107)2

and assigns the label red to x if f (x) < 0, and green otherwise. Which of the following

statements is/are correct?

(A)

The sample x = 0 is assigned the label green if (cid:107)µred(cid:107) < (cid:107)µgreen(cid:107)

(B)

f is a linear function of x

(C)

f (x) = w(cid:62)x + b, where w and b are functions of µred and µgreen

(D)

f is a quadratic polynomial in x

Organizing Institute: IIT RoorkeePage 29 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Q. 56

Consider the following two relations, named Customer and Person, in a database:

Person (

aadhaar CHAR(12) PRIMARY KEY,

name VARCHAR(32));

Customer (

name VARCHAR(32),

email VARCHAR(32) PRIMARY KEY,

phone CHAR(10),

aadhaar CHAR(12),

FOREIGN KEY (aadhaar) REFERENCES Person(aadhaar));

Which of the following statements is/are correct?

(A)

aadhaar is a candidate key in the Customer relation

(B)

phone can be NULL in the Customer relation

(C)

aadhaar is a candidate key in the Person relation

(D)

aadhaar can be NULL in the Person relation

Organizing Institute: IIT RoorkeePage 30 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Q. 57

Consider a database relation R with attributes ABCDEFG, and having the following

functional dependencies:

A → BCEF

E → DG

BC → A

Which of the following statements is/are correct?

(A)

A is the only candidate key of R

(B)

A, BC are the candidate keys of R

(C)

A, BC, E are the candidate keys of R

(D)

Relation R is not in Boyce-Codd Normal Form (BCNF)

Q. 58

Let G be a simple, unweighted, and undirected graph. A subset of the vertices and

edges of G are shown below.

a

e

b

f

c

g

d

h

It is given that a − b − c − d is a shortest path between a and d; e − f − g − h is a

shortest path between e and h; a − f − c − h is a shortest path between a and h. Which

of the following is/are NOT the edges of G?

(A)

(b, d)

(B)

(b, g)

(C)

(b, h)

(D)

(e, g)

Q. 59

Let f : R → R be such that |f (x) − f (y)| ≤ (x − y)2 for all x, y ∈ R. Then

f (1) − f (0) =

(Answer in integer)

Organizing Institute: IIT RoorkeePage 31 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Q. 60

Let D = {x(1), . . . , x(n)} be a dataset of n observations where each x(i) ∈ R100. It

n (cid:88)

is given that

x(i) = 0. The covariance matrix computed from D has eigenvalues

i=1

λi = 1002−i, 1 ≤ i ≤ 100. Let u ∈ R100 be the direction of maximum variance with u(cid:62)u = 1.

The value of

(Answer in integer)

1 n

n (cid:88)

i=1

(cid:0)u(cid:62)x(i)(cid:1)2

=

Q. 61

A bag contains 5 white balls and 10 black balls. In a random experiment, n balls are

drawn from the bag one at a time with replacement. Let Sn denote the total number of

black balls drawn in the experiment.

The expectation of S100 denoted by E[S100] =

(Round off to one decimal place)

Q. 62

Consider the following tables, Loan and Borrower, of a bank.

Loan

customer name

loan num

Borrower

loan num branch name

amount

L11

L14

L15

L22

L23

L25

L19

Banjara Hills

90000

Kondapur

SR Nagar

SR Nagar

Balanagar

Kondapur

SR Nagar

50000

40000

25000

80000

70000

65000

Anand

Karteek

Karteek

Ankita

Gopal

Karteek

Karteek

Sunil

Sunil

L11

L11

L14

L15

L19

L22

L23

L23

L25

Query: πbranch name, customer name(Loan (cid:46)(cid:47) Borrower) ÷ πbranch name(Loan)

where (cid:46)(cid:47) denotes natural join.

The number of tuples returned by the above relational algebra query is

(Answer in integer)

Organizing Institute: IIT RoorkeePage 32 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Q. 63

Consider the following Python code snippet.

def f(a,b):

if (a==0):

return b

if (a%2==1):

return 2*f((a-1)/2,b)

return b+f(a-1,b)

print(f(15,10))

The value printed by the code snippet is

(Answer in integer)

Organizing Institute: IIT RoorkeePage 33 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Q. 64

Consider the following pseudocode.

Create empty stack S

Set x=0, flag=0, sum=0

Push x onto S

while (S is not empty){

if (flag equals 0){

Set x = x+1

Push x onto S}

if (x equals 8):

Set flag=1

if (flag equals 1){

x = Pop(S)

if (x is odd):

Pop(S)

Set sum = sum + x}

}

Output sum

The value of sum output by a program executing the above pseudocode is

(Answer in integer)

Q. 65

Consider a directed graph G = (V, E), where V = {0, 1, 2, . . . , 100} and

E = {(i, j) : 0 < j − i ≤ 2, for all i, j ∈ V }. Suppose the adjacency list of each

vertex is in decreasing order of vertex number, and depth-first search (DFS) is per-

formed at vertex 0. The number of vertices that will be discovered after vertex 50 is

(Answer in integer)

Organizing Institute: IIT RoorkeePage 34 of 34

GATE 2025 Data Science & Artificial Intelligence (DA) Question Paper

1 Mark Questions

Questions 1 to 5

Question 1

Courage : Bravery :: Yearning : __________

Select the most appropriate option to complete the analogy.

Options:

  • (A) Longing
  • (B) Yelling
  • (C) Yawning
  • (D) Glaring

Answer: (A) Longing

Data Science & Artificial Intelligence

Question 2

We __________ tennis in the lawn when it suddenly started to rain.

Select the most appropriate option to complete the above sentence.

Options:

  • (A) have been playing
  • (B) had been playing
  • (C) would have been playing
  • (D) could be playing

Organizing Institute: IIT RoorkeePage 1 of 34

Data Science & Artificial Intelligence - DA

Answer: (B) had been playing

Question 3

A 4 × 4 digital image has pixel intensities (𝑈) as shown in the figure. The number of

pixels with 𝑈 ≤ 4 is:

Options:

  • (A) 3
  • (B) 8
  • (C) 11
  • (D) 9

Organizing Institute: IIT RoorkeePage 2 of 34

Data Science & Artificial Intelligence - DA

Answer: (C) 11

Question 4

In the given figure, the numbers associated with the rectangle, triangle, and ellipse are 1, 2, and 3, respectively. Which one among the given options is the most appropriate combination of P, Q, and R ?

2

R

1

4

P

Q

3

Options:

  • (A) P = 6; Q = 5; R = 3
  • (B) P = 5; Q = 6; R = 3
  • (C) P = 3; Q = 6; R = 6
  • (D) P = 5; Q = 3; R = 6

Organizing Institute: IIT RoorkeePage 3 of 34

Data Science & Artificial Intelligence - DA

Answer: (A) P = 6; Q = 5; R = 3

Question 5

A rectangle has a length L and a width W, where L > W. If the width, W, is increased by 10%, which one of the following statements is correct for all values of L and W?

Options:

  • (A) Perimeter increases by 10%.
  • (B) Length of the diagonals increases by 10%.
  • (C) Area increases by 10%.
  • (D) The rectangle becomes a square.

Organizing Institute: IIT RoorkeePage 4 of 34

Data Science & Artificial Intelligence - DA

Answer: (C) Area increases by 10%.

2 Marks Questions

Questions 6 to 10

Question 6

Column-I has statements made by Shanthala; and, Column-II has responses given by Kanishk.

Column-I

Column-II

P. This house is in a mess.

  1. Alright, I won’t bring it up during

our conversations.

Q. I am not happy with the marks

  1. Well, you can easily look it up.

given to me.

R. Politics is a subject I avoid talking

  1. No problem, let me clear it up for

about.

you.

S.

I don’t know what this word means.

  1. Don’t worry, I will take it up with

your teacher.

Identify the option that has the correct match between Column-I and Column-II.

Options:

  • (A) P – 2; Q – 3; R – 1; S – 4
  • (B) P – 3; Q – 4; R – 1; S – 2
  • (C) P – 4; Q – 1; R – 2; S – 3
  • (D) P – 1; Q – 2; R – 4; S – 3

Organizing Institute: IIT RoorkeePage 5 of 34

Data Science & Artificial Intelligence - DA

Answer: (B) P – 3; Q – 4; R – 1; S – 2

Question 7

Weight of a person can be expressed as a function of their age. The function usually varies from person to person. Suppose this function is identical for two brothers, and it monotonically increases till the age of 50 years and then it monotonically decreases. Let 𝑎1 and 𝑎2 (in years) denote the ages of the brothers and 𝑎1 < 𝑎2.

Which one of the following statements is correct about their age on the day when they attain the same weight?

Options:

  • (A) 𝑎1 < 𝑎2 < 50
  • (B) 𝑎1 < 50 < 𝑎2
  • (C) 50 < 𝑎1 < 𝑎2
  • (D) Either 𝑎1 = 50 or 𝑎2 = 50

Organizing Institute: IIT RoorkeePage 6 of 34

Data Science & Artificial Intelligence - DA

Answer: (B) 𝑎1 < 50 < 𝑎2

Question 8

A regular dodecagon (12-sided regular polygon) is inscribed in a circle of radius r cm as shown in the figure. The side of the dodecagon is d cm. All the triangles (numbered 1 to 12) in the figure are used to form squares of side r cm and each numbered triangle is used only once to form a square.

The number of squares that can be formed and the number of triangles required to form each square, respectively, are:

Note: The figure shown is representative.

Options:

  • (A) 3; 4
  • (B) 4; 3
  • (C) 3; 3
  • (D) 3; 2

Organizing Institute: IIT RoorkeePage 7 of 34

Data Science & Artificial Intelligence - DA

Answer: (A) 3; 4

Question 9

If a real variable 𝑥 satisfies 3𝑥2

= 27 × 9𝑥, then the value of

2𝑥2 (2𝑥)2 is:

Options:

  • (A) 2−1
  • (B) 20
  • (C) 23
  • (D) 215

Organizing Institute: IIT RoorkeePage 8 of 34

Data Science & Artificial Intelligence - DA

Answer: (C) 23

Question 10

The number of patients per shift (𝑋) consulting Dr. Gita in her past 100 shifts is shown in the figure. If the amount she earns is ₹ 1000(𝑋 − 0.2), what is the average amount (in ₹) she has earned per shift in the past 100 shifts?

Note: The figure shown is representative.

50

40

30

20

10

0

s t f i h s

f o

r e b m u N

40

30

20

5

6

7

Number of patients per shift (X)

10

8

Options:

  • (A) 6,100
  • (B) 6,300
  • (C) 6,000
  • (D) 6,500

Organizing Institute: IIT RoorkeePage 9 of 34

GATE 2025

Data Science & Artificial Intelligence - DA

Answer: (A) 6,100

1 Mark Questions

Questions 11 to 35

Question 11

Suppose X and Y are random variables. The conditional expectation of X given Y is

denoted by E[X|Y ]. Then E[E[X|Y ]] equals

Options:

  • (A) E[X|Y ]
  • (B) E[X] E[Y ]
  • (C) E[X]
  • (D) E[Y ]

Answer: (C) E[X]

Question 12

The number of additions and multiplications involved in performing Gaussian elimina-

tion on any n × n upper triangular matrix is of the order

Options:

  • (A) O(n)
  • (B) O(n2)
  • (C) O(n3)
  • (D) O(n4)

Answer: (B) O(n2)

Question 13

The sum of the elements in each row of A ∈ Rn×n is 1. If B = A3 − 2A2 + A, which one of the following statements is correct (for x ∈ Rn)?

Options:

  • (A) The equation Bx = 0 has no solution
  • (B) The equation Bx = 0 has exactly two solutions
  • (C) The equation Bx = 0 has infinitely many solutions
  • (D) The equation Bx = 0 has a unique solution

Organizing Institute: IIT RoorkeePage 10 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Answer: (C) The equation Bx = 0 has infinitely many solutions

Question 14

Let f (x) =

ex − e−x 2

, x ∈ R. Let f (k)(a) denote the kth derivative of f evaluated at a.

What is the value of f (10)(0)? (Note: ! denotes factorial)

Options:

  • (A)
  • (B)
  • (C)
  • (D) 0

1

1 10!

2 10!

Answer: (A)

Question 15

Let p and q be any two propositions. Consider the following propositional statements.

S1 : p → q,

S2 : ¬p ∧ q,

S3 : ¬p ∨ q,

S4 : ¬p ∨ ¬q,

where ∧ denotes conjunction (AND operation), ∨ denotes disjunction (OR operation),

and ¬ denotes negation (NOT operation). Which one of the following options is correct?

(Note: ≡ denotes logical equivalence)

Options:

  • (A) S1 ≡ S3
  • (B) S2 ≡ S3
  • (C) S2 ≡ S4
  • (D) S1 ≡ S4

Answer: (A) S1 ≡ S3

Question 16

If a relational decomposition is not dependency-preserving, which one of the following

relational operators will be executed more frequently in order to maintain the depen-

dencies?

Options:

  • (A) Selection
  • (B) Projection
  • (C) Join
  • (D) Set union

Organizing Institute: IIT RoorkeePage 11 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Answer: (C) Join

Question 17

Consider the following three relations:

Car (model, year, serial, color)

Make (maker, model)

Own (owner, serial)

A tuple in Car represents a specific car of a given model, made in a given year, with

a serial number and a color. A tuple in Make specifies that a maker company

makes cars of a certain model. A tuple in Own specifies that an owner owns the car

with a given serial number. Keys are underlined; (owner, serial) together

form key for Own. ((cid:46)(cid:47) denotes natural join)

πowner(Own (cid:46)(cid:47) (σcolor=“red”(Car (cid:46)(cid:47) (σmaker=“ABC”Make))))

Which one of the following options describes what the above expression computes?

Options:

  • (A) All owners of a red car, a car made by ABC, or a red car made by ABC
  • (B) All owners of more than one car, where at least one car is red and made by ABC
  • (C) All owners of a red car made by ABC
  • (D) All red cars made by ABC

Answer: (C) All owners of a red car made by ABC

Question 18

Consider a hash table of size 10 with indices {0, 1, . . . , 9}, with the hash function

h(x) = 3x (mod 10),

where linear probing is used to handle collisions. The hash table is initially empty and

then the following sequence of keys is inserted into the hash table: 1, 4, 5, 6, 14, 15. The

indices where the keys 14 and 15 are stored are, respectively

Options:

  • (A) 2 and 5
  • (B) 2 and 6
  • (C) 4 and 5
  • (D) 4 and 6

Organizing Institute: IIT RoorkeePage 12 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Answer: (D) 4 and 6

Organizing Institute: IIT RoorkeePage 12 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Question 19

Let X be a continuous random variable whose cumulative distribution function (CDF)

FX(x), for some t, is given as follows:

FX(x) =

  

0 x − t 4 − t 1

x ≤ t

t ≤ x ≤ 4

x ≥ 4

If the median of X is 3, then what is the value of t?

Options:

  • (A)
  • (B) 2

1

  • (C) −1
  • (D) 0

Answer: (A)

Question 20

Let X = aZ + b, where Z is a standard normal random variable, and a, b are two

unknown constants. It is given that

E[X] = 1, E[(X − E[X])Z] = −2, E[(X − E[X])2] = 4,

where E[X] denotes the expectation of random variable X. The values of a, b are:

Options:

  • (A) a = −2, b = 1
  • (B) a = 2, b = −1
  • (C) a = −2, b = −1
  • (D) a = 1, b = 1

Organizing Institute: IIT RoorkeePage 13 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Answer: (A) a = −2, b = 1

Question 21

It is given that P (X ≥ 2) = 0.25 for an exponentially distributed random variable X

with E[X] =

1 λ (ln denotes natural logarithm)

, where E[X] denotes the expectation of X. What is the value of λ?

Options:

  • (A) ln 2
  • (B) ln 4
  • (C) ln 3
  • (D) ln 0.25

Answer: (A) ln 2

Question 22

Consider designing a linear classifier

y = sign(f (x; w, b)),

f (x; w, b) = w(cid:62)x + b

on a dataset D = {(x1, y1), (x2, y2), . . . , (xN , yN )}, xi ∈ Rd, yi ∈ {+1, −1}, i =

1, 2, . . . , N . Recall that the sign function outputs +1 if the argument is positive, and −1

if the argument is non-positive. The parameters w and b are updated as per the following

training algorithm:

wnew = wold + ynxn,

bnew = bold + yn

whenever sign(f (xn; wold, bold)) (cid:54)= yn. In other words, whenever the classifier wrongly

predicts a sample (xn, yn) from the dataset, wold gets updated to wnew, and likewise bold

gets updated to bnew. Consider the case (xn, +1), f (xn; wold, bold) < 0. Then

Options:

  • (A) f (xn; wnew, bnew) > f (xn; wold, bold)
  • (B) f (xn; wnew, bnew) < f (xn; wold, bold)
  • (C) f (xn; wnew, bnew) = f (xn; wold, bold)
  • (D) ynf (xn; wold, bold) > 1

Organizing Institute: IIT RoorkeePage 14 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Answer: (A) f (xn; wnew, bnew) > f (xn; wold, bold)

Question 23

Consider the following Python declarations of two lists.

A=[1,2,3]

B=[4,5,6]

Which one of the following statements results in A= [1, 2, 3, 4, 5, 6]?

Options:

  • (A) A.extend
  • (B)
  • (B) A.append
  • (B)
  • (C) A.update
  • (B)
  • (D) A.insert
  • (B)

Answer: (A) A.extend

Question 24

Consider two functions f : R → R and g : R → (1, ∞). Both functions are differen-

tiable at a point c. Which of the following functions is/are ALWAYS differentiable at

c? The symbol · denotes product and the symbol ◦ denotes composition of functions.

Options:

  • (A) f ± g
  • (B) f · g
  • (C) f g
  • (D) f ◦ g + g ◦ f

Answer: Multiple correct options: (A) f ± g, (B) f · g, (C) f g

Question 25

Which of the following statements is/are correct?

Options:

  • (A) Rn has a unique set of orthonormal basis vectors
  • (B) Rn does not have a unique set of orthonormal basis vectors
  • (C) Linearly independent vectors in Rn are orthonormal
  • (D) Orthonormal vectors Rn are linearly independent

Organizing Institute: IIT RoorkeePage 15 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Answer: Multiple correct options: (B) Rn does not have a unique set of orthonormal basis vectors, (D) Orthonormal vectors Rn are linearly independent

Organizing Institute: IIT RoorkeePage 15 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Question 26

Which of the following statements is/are correct in a Bayesian network?

Options:

  • (A) Variable elimination is an approximate inference algorithm
  • (B) Gibbs sampling is an exact inference algorithm
  • (C) Variable elimination is used to determine conditional probabilities
  • (D) Rejection sampling is an approximate inference algorithm

Answer: Multiple correct options: (C) Variable elimination is used to determine conditional probabilities, (D) Rejection sampling is an approximate inference algorithm

Question 27

For which of the following inputs does binary search take time O(log n) in the worst

case?

Options:

  • (A) An array of n integers in any order
  • (B) A linked list of n integers in any order
  • (C) An array of n integers in increasing order
  • (D) A linked list of n integers in increasing order

Answer: (C) An array of n integers in increasing order

Question 28

Let A = In + xx(cid:62), where In is the n × n identity matrix and x ∈ Rn, x(cid:62)x = 1. Which

of the following options is/are correct?

Options:

  • (A) Rank of A is n
  • (B) A is invertible
  • (C) 0 is an eigenvalue of A
  • (D) A−1 has a negative eigenvalue

Answer: Multiple correct options: (A) Rank of A is n, (B) A is invertible

Question 29

Suppose that insertion sort is applied to the array [1, 3, 5, 7, 9, 11, x, 15, 13] and it takes

exactly two swaps to sort the array. Select all possible values of x.

Options:

  • (A) 10
  • (B) 12
  • (C) 14
  • (D) 16

Organizing Institute: IIT RoorkeePage 16 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Answer: Multiple correct options: (A) 10, (C) 14

Question 30

Let C1 and C2 be two sets of objects. Let D(x, y) be a measure of dissimilarity between

two objects x and y. Consider the following definitions of dissimilarity between C1 and

C2.

DIS-1(C1, C2) = max

x∈C1, y∈C2

DIS-2(C1, C2) = min

x∈C1, y∈C2

D(x, y)

D(x, y)

Which of the following statements is/are correct?

Options:

  • (A) Single Linkage Clustering uses DIS-1
  • (B) Single Linkage Clustering uses DIS-2
  • (C) Complete Linkage Clustering uses DIS-2
  • (D) Complete Linkage Clustering uses DIS-1

Answer: Multiple correct options: (B) Single Linkage Clustering uses DIS-2, (D) Complete Linkage Clustering uses DIS-1

Question 31

There are three boxes containing white balls and black balls.

Box-1 contains 2 black and 1 white balls.

Box-2 contains 1 black and 2 white balls.

Box-3 contains 3 black and 3 white balls.

In a random experiment, one of these boxes is selected, where the probability of choos-

ing Box-1 is

1 2

, Box-2 is

1 6

, and Box-3 is

1 3

. A ball is drawn at random from the selected

box. Given that the ball drawn is white, the probability that it is drawn from Box-2 is

(Round off to two decimal places)

Answer: Numerical value in range 0.25 to 0.25

Question 32

t2 + t − t =

lim t→+∞ (Round off to one decimal place)

Organizing Institute: IIT RoorkeePage 17 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Answer: Numerical value in range 0.5 to 0.5

Question 33

On a relation named Loan of a bank:

Loan

loan number branch name amount

L11

L14

L15

L22

L23

L25

L19

Banjara Hills

90000

Kondapur

SR Nagar

SR Nagar

Balanagar

Kondapur

SR Nagar

50000

40000

25000

80000

70000

65000

the following SQL query is executed.

SELECT L1.loan number

FROM Loan L1

WHERE L1.amount > (SELECT MAX (L2.amount)

FROM Loan L2

WHERE L2.branch name = ’SR Nagar’);

The number of rows returned by the query is

(Answer in integer)

Answer: Numerical value in range 3 to 3

Question 34

Given data {(−1, 1), (2, −5), (3, 5)} of the form (x, y), we fit a model y = wx using

linear least-squares regression. The optimal value of w is

(Round off to three decimal places)

Answer: Numerical value in range 0.285 to 0.287

Question 35

The naive Bayes classifier is used to solve a two-class classification problem with class-

labels y1, y2. Suppose the prior probabilities are P (y1) =

a discrete feature space with

1 3

and P (y2) =

2 3

. Assuming

P (x|y1) =

3 4

and P (x|y2) =

1 4

for a specific feature vector x. The probability of misclassifying x is

(Round off to two decimal places)

Organizing Institute: IIT RoorkeePage 18 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Answer: Numerical value in range 0.39 to 0.41

2 Marks Questions

Questions 36 to 65

Question 36

Let Y = Z 2, Z =

X − µ σ

, where X is a normal random variable with mean µ and

variance σ2. The variance of Y is

Options:

  • (A)
  • (B)
  • (C)
  • (D) 1

2

3

4

Answer: (B)

Question 37

Let A ∈ Rn×n be such that A3 = A. Which one of the following statements is ALWAYS

correct?

Options:

  • (A) A is invertible
  • (B) Determinant of A is 0
  • (C) The sum of the diagonal elements of A is 1
  • (D) A and A2 have the same rank

Answer: (D) A and A2 have the same rank

Question 38

Let {x1, x2, . . . , xn} be a set of linearly independent vectors in Rn. Let the (i, j)-th element of matrix A ∈ Rn×n be given by Aij = x(cid:62)

i xj, 1 ≤ i, j ≤ n. Which one of the

following statements is correct?

Options:

  • (A) A is invertible
  • (B) 0 is a singular value of A
  • (C) Determinant of A is 0
  • (D) z(cid:62)Az = 0 for some non-zero z ∈ Rn

Organizing Institute: IIT RoorkeePage 19 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Answer: (A) A is invertible

Question 39

Consider the cumulative distribution function (CDF) of a random variable X:

FX(x) =

 

0 1 4

1

x ≤ −1

(x + 1)2

−1 ≤ x ≤ 1

x ≥ 1

The value of P (X 2 ≤ 0.25) is

Options:

  • (A) 0.625
  • (B) 0.25
  • (C) 0.5
  • (D) 0.5625

Answer: (C) 0.5

Question 40

A random variable X is said to be distributed as Bernoulli(θ), denoted by X ∼

Bernoulli(θ), if

P (X = 1) = θ,

P (X = 0) = 1 − θ

for 0 < θ < 1. Let Y =

300 (cid:88)

Xi, where Xi ∼ Bernoulli(θ), i = 1, 2, . . . , 300 be

independent and identically distributed random variables with θ = 0.25. The value of

i=1

P (60 ≤ Y ≤ 90), after approximation through Central Limit Theorem, is given by

(cid:0)Recall that φ(x) =

1 √ 2π

(cid:90) x

−∞

e− t2

2 dt(cid:1)

Options:

  • (A) φ(2) − φ(−2)
  • (B) φ(1) − φ(−1)
  • (C) φ(3) − φ(−3)
  • (D) φ(90) − φ(60)

Organizing Institute: IIT RoorkeePage 20 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Answer: (A) φ(2) − φ(−2)

Question 41

For x ∈ R, the floor function is denoted by f (x) = (cid:98)x(cid:99) and defined as follows

(cid:98)x(cid:99) = k, k ≤ x < k + 1,

where k is an integer. Let Y = (cid:98)X(cid:99), where X is an exponentially distributed random

variable with mean

1 ln 10

, where ln denotes natural logarithm. For any positive integer

(cid:96), one can write the probability of the event Y = (cid:96) as follows

P (Y = (cid:96)) = q(cid:96)(1 − q)

The value of q is

Options:

  • (A) 0.1
  • (B) 0.01
  • (C) 0.5
  • (D) 0.434

Organizing Institute: IIT RoorkeePage 21 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Answer: (A) 0.1

Question 42

Consider the neural network shown in the figure with

inputs: u, v

weights: a, b, c, d, e, f

output: y

R denotes the ReLU function, R(x) = max(0, x).

u

v

a

d

b

c

R

R

e

f

R

y

Given u = 2, v = 3,

a = 1, b = 1, c = 1, d = −1, e = 4, f = −1,

which one of the following is correct?

Options:

  • (A)
  • (B)
  • (C)
  • (D) ∂y ∂a

∂y ∂a

∂y ∂a

∂y ∂a

= 8,

= 1,

= 1,

= 2,

∂y ∂f

∂y ∂f

∂y ∂f

∂y ∂f

= 0

= 0

= −1

= −1

Organizing Institute: IIT RoorkeePage 22 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Answer: (A)

Question 43

Consider game trees Tree-1 and Tree-2 as shown. The first level is a MAX agent and

the second level is a MIN agent. The value in the square node is the output of the utility

function.

MAX

A

C

MIN

2

B

D

E

x

1

5

y

2

Tree-1

Tree-2

For what ranges of x and y, the right child of node B and the right child of node E will

be pruned by alpha-beta pruning algorithm?

Options:

  • (A) x ∈ [1, ∞) and y ∈ (−∞, 2]
  • (B) x ∈ (−∞, 2] and y ∈ (−∞, 5]
  • (C) x ∈ (−∞, 2] and y ∈ [2, ∞)
  • (D) x ∈ [1, ∞) and y ∈ (−∞, 5]

Organizing Institute: IIT RoorkeePage 23 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Answer: (C) x ∈ (−∞, 2] and y ∈ [2, ∞)

Question 44

The state graph shows the action cost along the edges and the heuristic function h asso-

ciated with each state.

h=2

h=2

h=6

2

2

4

1

S

B

2

A

E

h=6

C

3

h=2

h=0

3

D

G

Suppose A∗ algorithm is applied on this state graph using priority queue to store the

frontier. In what sequence are the nodes expanded?

Options:

  • (A) S,A,E,C,B,D,G
  • (B) S,E,A,C,B,D,G
  • (C) S,A,E,B,C,D,G
  • (D) S,A,B,E,C,D,G

Answer: (C) S,A,E,B,C,D,G

Question 45

A random experiment consists of throwing 100 fair dice, each die having six faces

numbered 1 to 6. An event A represents the set of all outcomes where at least one of

the dice shows a 1. Then, P

Options:

  • (A) =
  • (A)
  • (B) 0

1

  • (C) 1 −

(cid:19)100

(cid:18) 5 6

  • (D) (cid:19)100

(cid:18) 5 6

Organizing Institute: IIT RoorkeePage 24 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Answer: (C) 1 −

(cid:19)100

(cid:18) 5 6

Question 46

Consider a fact table in an OLAP application: Facts(D1, D2, val), where D1

and D2 are its dimension attributes and val is a dependent attribute. Suppose attribute

D1 takes 3 values and D2 takes 2 values, and all combinations of these values are present

in the table Facts. How many tuples are there in the result of the following query?

SELECT D1, D2, sum(val)

FROM Facts

GROUP BY CUBE (D1, D2);

Options:

  • (A)
  • (B)
  • (C) 1

6

9

  • (D) 12

Organizing Institute: IIT RoorkeePage 25 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Answer: (D) 12

Organizing Institute: IIT RoorkeePage 25 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Question 47

Consider the following Python code snippet.

A={"this","that"}

B={"that","other"}

C={"other","this"}

while "other" in C:

if "this" in A:

A,B,C=A-B,B-C,C-A

if "that" in B:

A,B,C=C|A,A|B,B|C

When the above program is executed, at the end, which of the following sets contains

"this"?

Options:

  • (A) Only A
  • (B) Only B
  • (C) Only C
  • (D) A, C

Answer: (B) Only B

Question 48

Which of the following statements is/are correct about the rectified linear unit (ReLU) activation function defined as ReLU(x) = max(x, 0), where x ∈ R?

Options:

  • (A) ReLU is continuous everywhere
  • (B) ReLU is differentiable everywhere
  • (C) ReLU is not differentiable at x = 0
  • (D) ReLU(x) = ReLU(ax), for all a ∈ R

Organizing Institute: IIT RoorkeePage 26 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Answer: Multiple correct options: (A) ReLU is continuous everywhere, (C) ReLU is not differentiable at x = 0

Question 49

Consider the function f (x) =

x3 3

7 2

x2 + 10 x +

133 2

, x ∈ [−8, 0]. Which of the

following statements is/are correct?

Options:

  • (A) The maximum value of f is attained at x = −5
  • (B) The minimum value of f is attained at x = −2
  • (C) The maximum value of f is

133 2

  • (D) The minimum value of the derivative of f is attained at x = −

7 2

Answer: Multiple correct options: (C) The maximum value of f is

133 2, (D) The minimum value of the derivative of f is attained at x = −

7 2

Question 50

Let x1, x2, x3, x4, x5 be a system of orthonormal vectors in R10. Consider the matrix A = x1x(cid:62)

5 . Which of the following statements is/are correct?

1 + . . . + x5x(cid:62)

Options:

  • (A) Singular values of A are also its eigenvalues
  • (B) Singular values of A are either 0 or 1
  • (C) Determinant of A is 1
  • (D) A is invertible

Answer: Multiple correct options: (A) Singular values of A are also its eigenvalues, (B) Singular values of A are either 0 or 1

Question 51

Let f : R → R be a twice-differentiable function and suppose its second derivative satisfies f (cid:48)(cid:48)(x) > 0 for all x ∈ R. Which of the following statements is/are ALWAYS

correct?

Options:

  • (A) f has a local minima
  • (B) There does not exist x and y, x (cid:54)= y, such that f (cid:48)(x) = f (cid:48)(y) = 0
  • (C) f has at most one global minimum
  • (D) f has at most one local minimum

Organizing Institute: IIT RoorkeePage 27 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Answer: Multiple correct options: (B) There does not exist x and y, x (cid:54)= y, such that f (cid:48)(x) = f (cid:48)(y) = 0, (C) f has at most one global minimum, (D) f has at most one local minimum

Organizing Institute: IIT RoorkeePage 27 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Question 52

An n × n matrix A with real entries satisfies the property: (cid:107)Ax(cid:107)2 = (cid:107)x(cid:107)2, for all x ∈ Rn, where (cid:107) · (cid:107) denotes the Euclidean norm. Which of the following statements

is/are ALWAYS correct?

Options:

  • (A) A must be orthogonal
  • (B) A = I, where I denotes the identity matrix, is the only solution
  • (C) The eigenvalues of A are either +1 or −1
  • (D) A has full rank

Answer: Multiple correct options: (A) A must be orthogonal, (D) A has full rank

Question 53

Consider designing a linear binary classifier f (x) = sign(w(cid:62)x + b), x ∈ R2 on the

following training data:

Class-1:

 

2

0

 ,

 ,

0

2

 

2

2

, Class-2:

 

 

0

0

Hard-margin support vector machine (SVM) formulation is solved to obtain w and b.

Which of the following options is/are correct?

Options:

  • (A) w =

 and b = 1

4

4

  • (B) The number of support vectors is 3
  • (C) The margin is

√ 2

  • (D) Training accuracy is 98%

Organizing Institute: IIT RoorkeePage 28 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Answer: Multiple correct options: (B) The number of support vectors is 3, (C) The margin is

√ 2

Question 54

Consider a coin-toss experiment where the probability of head showing up is p. In the

ith coin toss, let Xi = 1 if head appears, and Xi = 0 if tail appears. Consider

(cid:98)p =

1 n

n (cid:88)

i=1

Xi

where n is the total number of independent coin tosses.

Which of the following statements is/are correct?

Options:

  • (A) E[ (cid:98)p ] = p
  • (B)
  • (C) E[ (cid:98)p ] =

p n

As n increases, variance of (cid:98)p decreases

  • (D) Variance of (cid:98)p does not depend on n

Answer: Multiple correct options: (A) E[ (cid:98)p ] = p, (C) E[ (cid:98)p ] =

p n

As n increases, variance of (cid:98)p decreases

Question 55

Consider a two-class problem in Rd with class labels red and green. Let µred and µgreen be the means of the two classes. Given test sample x ∈ Rd, a classifier calculates the squared Euclidean distance (denoted by (cid:107) · (cid:107)2) between x and the means of the two

classes and assigns the class label that the sample x is closest to. That is, the classifier

computes

f (x) = (cid:107)µred − x(cid:107)2 − (cid:107)µgreen − x(cid:107)2

and assigns the label red to x if f (x) < 0, and green otherwise. Which of the following

statements is/are correct?

Options:

  • (A) The sample x = 0 is assigned the label green if (cid:107)µred(cid:107) < (cid:107)µgreen(cid:107)
  • (B) f is a linear function of x
  • (C) f (x) = w(cid:62)x + b, where w and b are functions of µred and µgreen
  • (D) f is a quadratic polynomial in x

Organizing Institute: IIT RoorkeePage 29 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Answer: Multiple correct options: (B) f is a linear function of x, (C) f (x) = w(cid:62)x + b, where w and b are functions of µred and µgreen

Question 56

Consider the following two relations, named Customer and Person, in a database:

Person (

aadhaar CHAR(12) PRIMARY KEY,

name VARCHAR(32));

Customer (

name VARCHAR(32),

email VARCHAR(32) PRIMARY KEY,

phone CHAR(10),

aadhaar CHAR(12),

FOREIGN KEY (aadhaar) REFERENCES Person(aadhaar));

Which of the following statements is/are correct?

Options:

  • (A) aadhaar is a candidate key in the Customer relation
  • (B) phone can be NULL in the Customer relation
  • (C) aadhaar is a candidate key in the Person relation
  • (D) aadhaar can be NULL in the Person relation

Organizing Institute: IIT RoorkeePage 30 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Answer: Multiple correct options: (B) phone can be NULL in the Customer relation, (C) aadhaar is a candidate key in the Person relation

Question 57

Consider a database relation R with attributes ABCDEFG, and having the following

functional dependencies:

A → BCEF

E → DG

BC → A

Which of the following statements is/are correct?

Options:

  • (A) A is the only candidate key of R
  • (B) A, BC are the candidate keys of R
  • (C) A, BC, E are the candidate keys of R
  • (D) Relation R is not in Boyce-Codd Normal Form (BCNF)

Answer: Multiple correct options: (B) A, BC are the candidate keys of R, (D) Relation R is not in Boyce-Codd Normal Form (BCNF)

Question 58

Let G be a simple, unweighted, and undirected graph. A subset of the vertices and

edges of G are shown below.

a

e

b

f

c

g

d

h

It is given that a − b − c − d is a shortest path between a and d; e − f − g − h is a

shortest path between e and h; a − f − c − h is a shortest path between a and h. Which

of the following is/are NOT the edges of G?

Options:

  • (A) (b, d)
  • (B) (b, g)
  • (C) (b, h)
  • (D) (e, g)

Answer: Multiple correct options: (A) (b, d), (C) (b, h), (D) (e, g)

Question 59

Let f : R → R be such that |f (x) − f (y)| ≤ (x − y)2 for all x, y ∈ R. Then

f (1) − f (0) =

(Answer in integer)

Organizing Institute: IIT RoorkeePage 31 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Answer: Numerical value in range 0 to 0

Question 60

Let D = {x(1), . . . , x(n)} be a dataset of n observations where each x(i) ∈ R100. It

n (cid:88)

is given that

x(i) = 0. The covariance matrix computed from D has eigenvalues

i=1

λi = 1002−i, 1 ≤ i ≤ 100. Let u ∈ R100 be the direction of maximum variance with u(cid:62)u = 1.

The value of

(Answer in integer)

1 n

n (cid:88)

i=1

(cid:0)u(cid:62)x(i)(cid:1)2

=

Answer: Numerical value in range 100 to 100

Question 61

A bag contains 5 white balls and 10 black balls. In a random experiment, n balls are

drawn from the bag one at a time with replacement. Let Sn denote the total number of

black balls drawn in the experiment.

The expectation of S100 denoted by E[S100] =

(Round off to one decimal place)

Answer: Numerical value in range 66.6 to 66.7

Question 62

Consider the following tables, Loan and Borrower, of a bank.

Loan

customer name

loan num

Borrower

loan num branch name

amount

L11

L14

L15

L22

L23

L25

L19

Banjara Hills

90000

Kondapur

SR Nagar

SR Nagar

Balanagar

Kondapur

SR Nagar

50000

40000

25000

80000

70000

65000

Anand

Karteek

Karteek

Ankita

Gopal

Karteek

Karteek

Sunil

Sunil

L11

L11

L14

L15

L19

L22

L23

L23

L25

Query: πbranch name, customer name(Loan (cid:46)(cid:47) Borrower) ÷ πbranch name(Loan)

where (cid:46)(cid:47) denotes natural join.

The number of tuples returned by the above relational algebra query is

(Answer in integer)

Organizing Institute: IIT RoorkeePage 32 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Answer: Numerical value in range 1 to 1

Question 63

Consider the following Python code snippet.

def f(a,b):

if (a==0):

return b

if (a%2==1):

return 2*f((a-1)/2,b)

return b+f(a-1,b)

print(f(15,10))

The value printed by the code snippet is

(Answer in integer)

Organizing Institute: IIT RoorkeePage 33 of 34 GATE 2025

Data Science & Artificial Intelligence - DA

Answer: Numerical value in range 160 to 160

Question 64

Consider the following pseudocode.

Create empty stack S

Set x=0, flag=0, sum=0

Push x onto S

while (S is not empty){

if (flag equals 0){

Set x = x+1

Push x onto S}

if (x equals 8):

Set flag=1

if (flag equals 1){

x = Pop(S)

if (x is odd):

Pop(S)

Set sum = sum + x}

}

Output sum

The value of sum output by a program executing the above pseudocode is

(Answer in integer)

Answer: Numerical value in range 24 to 24

Question 65

Consider a directed graph G = (V, E), where V = {0, 1, 2, . . . , 100} and

E = {(i, j) : 0 < j − i ≤ 2, for all i, j ∈ V }. Suppose the adjacency list of each

vertex is in decreasing order of vertex number, and depth-first search (DFS) is per-

formed at vertex 0. The number of vertices that will be discovered after vertex 50 is

(Answer in integer)

Organizing Institute: IIT RoorkeePage 34 of 34

Answer: Numerical value in range 75 to 75

$$("table.menu-tbl").map((t) => {
const x = {
type: t.rows[0].cells[1].innerText,
id: t.rows[1].cells[1].innerText,
status: t.rows[2].cells[1].innerText,
option: t.rows[3]?.cells[1].innerText,
};
if (x.option) {
const selected = x.option.split(",").map((option) => option.trim());
// Find the corresponding question table
const questionTable = t.parentElement.firstChild;
if (questionTable) {
// Get all option rows (starting from the third row, index 2)
const optionRows = Array.from(questionTable.rows).slice(2);
// Process each option row
optionRows.forEach((row, _) => {
// Get the option letter (A, B, C, D, etc.)
const optionCell = row.cells[1];
if (optionCell) {
const optionText = optionCell.textContent.trim();
const optionLetter = optionText.charAt(0); // Extract first character (A, B, C, D)
// Check if this option is selected
if (selected.includes(optionLetter)) {
// Highlight the selected option
optionCell.style.backgroundColor = "#ffffcc"; // Light yellow highlight
optionCell.style.fontWeight = "bold";
optionCell.style.border = "2px solid green";
// Also add a checkmark or indicator
const marker = document.createElement("span");
marker.innerHTML = " ✓ ";
marker.style.color = "green";
marker.style.fontWeight = "bold";
optionCell.insertBefore(marker, optionCell.firstChild);
}
}
});
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment