GATE DA 2025

65 questions · Previous year paper

The GATE 2025 Data Science and Artificial Intelligence paper: 65 questions for 100 marks in 180 minutes, with General Aptitude (15 marks) and the technical section (85 marks). Answers follow the official final answer key; every question has a short explanation.

Take it as a timed test: ₹49

Data Science and Artificial Intelligence

Question 61

NAT · 2 marks

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 \(S_{n}\) denote the total number of black balls drawn in the experiment.
The expectation of \(S_{100}\) denoted by \(E[S_{100}] =\) ________
(Round off to one decimal place)

Explanation

Answer: 66.6 to 66.7

Drawing with replacement leaves the bag unchanged, so the draws are independent and each is black with probability \(\frac{10}{15} = \frac{2}{3}\).

Write \(S_{100} = Y_{1} + \cdots + Y_{100}\), where \(Y_{k} = 1\) if the \(k\)-th draw is black and 0 otherwise. Each \(E[Y_{k}] = \frac{2}{3}\), so by linearity of expectation

\[ E[S_{100}] = 100 \times \frac{2}{3} = \frac{200}{3} \approx 66.67 \]

This is the mean \(np\) of a Binomial\((100, \frac{2}{3})\) variable. Rounded to one decimal place it is 66.7; using the white-ball probability \(\frac{1}{3}\) by mistake would give 33.3.

Answer: 66.7

Question 62

NAT · 2 marks

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

Loan
loan_numbranch_nameamount
L11Banjara Hills90000
L14Kondapur50000
L15SR Nagar40000
L22SR Nagar25000
L23Balanagar80000
L25Kondapur70000
L19SR Nagar65000
Borrower
customer_nameloan_num
AnandL11
KarteekL11
KarteekL14
AnkitaL15
GopalL19
KarteekL22
KarteekL23
SunilL23
SunilL25

Query: \(\pi_{\textbf{branch\_name},\ \textbf{customer\_name}}(\textbf{Loan} \bowtie \textbf{Borrower}) \div \pi_{\textbf{branch\_name}}(\textbf{Loan})\)
where \(\bowtie\) denotes natural join.
The number of tuples returned by the above relational algebra query is ________
(Answer in integer)

Explanation

Answer: 1

Division keeps the customers who are paired with every branch in \(\pi_{\textbf{branch\_name}}(\textbf{Loan})\), that is, with all four of Banjara Hills, Kondapur, SR Nagar and Balanagar.

The natural join matches on loan_num, which gives each customer's branches:

  • Anand: Banjara Hills (L11)
  • Karteek: Banjara Hills (L11), Kondapur (L14), SR Nagar (L22), Balanagar (L23)
  • Ankita: SR Nagar (L15); Gopal: SR Nagar (L19)
  • Sunil: Balanagar (L23), Kondapur (L25)

Only Karteek appears with all four branches, so the query returns the single tuple (Karteek).

Answer: 1

Question 63

NAT · 2 marks

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)

Explanation

Answer: 160

From \(a = 15\), every value of \(a\) reached is odd until 0, so only return 2*f((a-1)/2,b) runs:

\[ f(15, 10) = 2f(7, 10) = 4f(3, 10) = 8f(1, 10) = 16f(0, 10) = 16 \times 10 = 160 \]

In Python 3, (a-1)/2 gives floats (7.0, 3.0, 1.0, 0.0), but the tests a%2==1 and a==0 behave just as they would for integers, and the result stays an integer because it is built from b = 10.

In general the function returns \((a + 1) \cdot b\), not \(a \cdot b\), so 150 is the tempting wrong answer.

Answer: 160

Question 64

NAT · 2 marks

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)

Explanation

Answer: 24

While flag is 0, each pass pushes the next value, so the stack grows to 0, 1, …, 8 (top 8). In the pass that pushes 8, x equals 8, so flag becomes 1 (for good) and the third block already runs in that same pass.

Each such pass pops the top into x and adds it to sum; if x is odd, the element below it is popped and thrown away:

  • pop 8 (even): sum = 8
  • pop 7, discard 6: sum = 15
  • pop 5, discard 4: sum = 20
  • pop 3, discard 2: sum = 23
  • pop 1, discard 0: sum = 24

The stack is now empty, so the loop stops and 24 is output.

Answer: 24

Question 65

NAT · 2 marks

Consider a directed graph \(G = (V, E)\), where \(V = \{0, 1, 2, \ldots, 100\}\) and \(E = \{(i, j) : 0 < j - i \le 2, \text{ for all } i, j \in V\}\). Suppose the adjacency list of each vertex is in decreasing order of vertex number, and depth-first search (DFS) is performed at vertex 0. The number of vertices that will be discovered after vertex 50 is ________ (Answer in integer)

Explanation

Answer: 75

Each vertex \(i\) has edges only to \(i + 2\) and \(i + 1\), listed in that order. So DFS from 0 always follows the \(+2\) edge first: 0, 2, 4, …, 100. Vertex 100 has no outgoing edges, so DFS backtracks to 98, whose second neighbour 99 is new; back at 96 it finds 97, and so on down to 1.

The discovery order is 0, 2, 4, …, 100, then 99, 97, …, 1. Vertex 50 is the 26th vertex discovered, so the other \(101 - 26 = 75\) vertices come after it: the 25 even vertices 52 to 100 and all 50 odd vertices.

Answer: 75

Questions 61 to 65 of 65