GATE 2024 Question Paper DS&AI With Solution
GATE 2024 Question Paper DS&AI With Solution
GATE 2024 Question Paper DS&AI With Solution
Q.1. If ‘→’ denotes increasing order of intensity, then the meaning of the words
[sick → infirm → moribund] is analogous to [silly →_________→ daft].
Which one of the given options is appropriate to fill the blank?
DATA SCIENCE & ARTIFICIAL INTELLIGENCE
[MCQ]
Q.2. The 15 parts of the given figure arc to be painted such that no two adjacent parts with
shared boundaries (excluding comers) have the same color. The minimum number of
colors required is
(a) 4 (b) 3
(c) 5 (d) 6
Sol. (a)
[MCQ]
Q.3. How many 4-digit positive integers divisible by 3 can be formed using only the digits
{1,3,4,6,7}, such that no digit appears more than once in a number?
(a) 24 (b) 48
(c) 72 (d) 12
Sol. (b)
On deleting 3 from digits the remaining digits would sum up to 18 which is multiple of
3. So, the 4 digit number can be formed using digit 1, 4, 6, 7 are 24.
On deleting 6 from digits the remaining digits would sum up to 15 which is multiple of
3. So, the 4 digit number can be formed using digit 1, 3, 4, 7 are 24.
PAGE
1
https://www.youtube.com/@GATEWallah_EE_EC_CS https://www.youtube.com/@GATEWallahbyPW
[MCQ]
Q.4. The sum of the following infinite series is
1 1 1 1 1 1 1
2+ + + + + + + + ....
2 3 4 8 9 16 27
DATA SCIENCE & ARTIFICIAL INTELLIGENCE
11 7
(a) (b)
3 2
13 9
(c) (d)
4 2
Sol. (b)
[MCQ]
Q.5. In an election, the share of valid votes received by the four candidates A, B, C and D is
represented by the pic chart shown. The total number of votes cast in the election were
1,15,000, out of which 5,000 were invalid.
Based on the data provided, the total number of valid votes received by the candidates
B and C is
(a) 45,000 (b) 49,500
(c) 51,750 (d) 54,000
Sol. (b)
[MCQ]
Q.6. Thousands of years ago, some people began dairy farming. This coincided with a
number of mutations in a particular gene that resulted in these people developing the
ability to digest dairy milk.
Based on the given passage, which of the following can be inferred?
(a) All human beings can digest dairy milk.
(b) No human being can digest dairy milk.
(c) Digestion of dairy milk is essential for human beings.
(d) In human beings, digestion of dairy milk resulted from a mutated gene.
Sol. (d)
PAGE
2
https://www.youtube.com/@GATEWallah_EE_EC_CS https://www.youtube.com/@GATEWallahbyPW
[MCQ]
Q.7. The probability of a boy or a girl being born is 1/2. For a family having only three
children, what is the probability of having two girls and one boy?
3 1
(a) (b)
DATA SCIENCE & ARTIFICIAL INTELLIGENCE
8 8
1 1
(c) (d)
4 2
Sol. (c)
n(S) = 4
n (E) 1
P(E) = =
n ( S) 4
[MCQ]
Q.8. Person 1 and Person 2 invest in three mutual funds A, B. and C. The amounts they
invest in each of these mutual funds are given in the table.
At the end of one year, the total amount that Person 1 gets is ?500 more than Person 2.
The annual rate of return for the mutual funds B and C is 15% each. What is the annual
rate of return for the mutual fond A?
(a) 7.5% (b) 10%
(c) 15% (d) 20%
Sol. (b)
[MCQ]
Q.9. Three different views of a dice are shown in the figure below.
(a) (b)
PAGE
3
https://www.youtube.com/@GATEWallah_EE_EC_CS https://www.youtube.com/@GATEWallahbyPW
(c) (d)
DATA SCIENCE & ARTIFICIAL INTELLIGENCE
Sol. (a)
[MCQ]
Q.10. Visualize two identical right circular cones such that one is inverted over the other and
they share a common circular base. If a cutting plane passes through the vertices of the
assent)led cones, what shape does the outer boundary of the resulting cross-section
make?
(a) A rhombus (b) A triangle
(c) An ellipse (d) A hexagon
Sol. (10)
[MCQ]
Q.1. Consider the following sorting algorithms:
(i) Bubble sort
(ii) Insertion sort
(iii) Selection sort
Which ONE among the following choices of sorting algorithms sorts the numbers in
the array [4, 3, 2, 1, 5] in increasing order after exactly two passes over the array?
(a) (i) only (b) (iii) only
(c) (i) and (iii) only (d) (ii) and (iii) only
Sol. (b)
4 3 2 1 5
1 3 2 4 5 end of pass 1
1 2 3 4 5 end of pass 2
[NAT]
ln ( (x 2 + 1) cos x )
Q.2. Lim
x →0 x2
PAGE
4
https://www.youtube.com/@GATEWallah_EE_EC_CS https://www.youtube.com/@GATEWallahbyPW
Sol. (1/2)
lim
(
ln x 2 + 1 cos x
)
x →0 x2
Putting x → 0 in the above part we get
DATA SCIENCE & ARTIFICIAL INTELLIGENCE
ln (1) cos x 0
= from
0 0
Thus, using L-hospital Rule there
f ( n) f '( n )
lim = lim
x →a g ( n ) x →a g ' ( n )
2x
2x sin x
−
x +1
2 cos x
2x
1 sin x
−
x +1
2 2 x cos x
Thus, lim
(
ln x 2 + 1 cos x ) = lim 1
−
sin x
x→0 x 2 x →0 x 2
+1 2 x cos
1 sin x 1
1 − lim
2 x→0 x cos x
1
1 − 1 1
2
1 1
1− =
2 2
[NAT]
Q.3. A dice is thrown repeatedly. Expected number of throws required until two consecutive
throws shows even number _____.
Sol. (6)
PI = ½
1 1 1 1
N= + 2 = + =6
p p 1/ 2 1/ 4
PAGE
5
https://www.youtube.com/@GATEWallah_EE_EC_CS https://www.youtube.com/@GATEWallahbyPW
[NAT]
1 2 3
Q.4. M= 3 1 3 det [M2 + 12M] .
4 3 6
DATA SCIENCE & ARTIFICIAL INTELLIGENCE
Sol. (0)
= det [M2 + 12M]
| M2 + 12M|
|M(M+ 12I|)|
|M| |M+ 12I|
1 3 3 3 3 1
Now, |M| = 1 −2 +3
3 6 4 6 4 3
= 1 (6 – 9) – 2 (18 – 12) + 3 (9 – 4)
= – 3 – 12 + 15
= – 15 + 15 = 0
Det [M2 + 12M]
|M| |M+ 12I| = 0 × (|M + 12I| = 0)
[MCQ]
Q.5. Data set with k -binary value attribute (where k>2) for a two class classification task
the number of parameters to be estimated for learning a naïve bayes classifier is .
2
(a) 2k + 1 (b) k +1
k+1
(c) 2 +1 (d) 2k+1
Sol. (b)
[MSQ]
Q.6. Consider the DAG below:
P R
S V
U T
Which of the following is/are valid vertex ordering that can be obtained from
topological sort of the DAG?
(a) PRQVSUT (b) PQRSVUT
(c) PQRSTUV (d) PRQSVTU PAGE
6
https://www.youtube.com/@GATEWallah_EE_EC_CS https://www.youtube.com/@GATEWallahbyPW
Sol. (a, d)
Sol.(1). G = (V,E) directed
(1) Visit vertex with in-degree ‘0’
(2) Delete that vertex from the graph and repeat step-1 until graph becomes empty.
DATA SCIENCE & ARTIFICIAL INTELLIGENCE
Sol.(2). By observing graph we can say that, Q cannot be selected as there are incoming
edge, so the option c and b are eliminated.
If we select R, there is only one node to be selected that is Q, after selecting Q the
remaining nodes. Left deleted us. Hence, we are left with the modes (S, U) and (V, T),
any of these modes can be selected and deleted in any order.
Correct option are ‘a’ and ‘d’.
[MCQ]
Q.7. Consider the function computes (X) whose pseudo code is given below:
Which one of the following
Values is returned by the computes (X) for X= [6, 3, 5, 4, 10]
computes (X)
S[1] 1
for i 2 to length (X)
S[i] 1
if X[i – 1] X[i]
S[i] S[i] + S [i –1]
end if
end for
return S
(a) [1, 1, 2, 3, 3] (b) [1, 1, 2, 3, 4]
(c) [1, 1, 2, 1, 2] (d) [1, 1, 2, 1, 5]
Sol. (c)
For i = 2
S[2] 1
If 6 < 3 // condition false
For i = 3
S[3] 1
If 3 < 5 // condition true
S[3] S[3] + S [2] = S[3] 1 + 1 = 2
Therefore, S[1] = 1, S[2] = 1, S[3] = 2, S[4] = 1, S[5] = 2. PAGE
7
Hence, the option (c) is correct.
https://www.youtube.com/@GATEWallah_EE_EC_CS https://www.youtube.com/@GATEWallahbyPW
[MSQ]
Q.8. Given the relational schema R = (U, V, W, X, Y, Z) and the set of functional
dependencies:
U → V
U → W
DATA SCIENCE & ARTIFICIAL INTELLIGENCE
F = WX → Y
WX → Z
V → X
Which of the following FD can be derived from the above set?
(a) VW→ Y (b) VW → YZ
(c) VW→ U (d) WX → YZ
Sol. (a, b, d)
Given R = (U, V, W, X, Y, Z)
FD set: {U→V, U→W, WX→Y, WX→Z, V→X}
[VW]+ = {V, X, W, Y, Z}
Therefore VW→Y true, also VW→YZ also true and VW→U is false
[WX]+ = {W, X, Z, Y}
Therefore WX → YZ true.
Option a, b and d are correct.
[MCQ]
Q.9. Let f (n) denotes the maximum number of comparison made while searching for an
entry in a sorted array of size n using binary search.
Which one of the following options is TRUE?
(a) F ( n ) = F ( n / 2 ) (b) F ( n ) = F ( n / 2 ) + F ( n / 2 )
(c) F ( n ) = F ( n − 1) + 1 (d) F ( n ) = F ( n / 2 ) + 1
Sol. (d)
In bianry search in one comparision entire array is divided into two halves. If we have
input array size of n, then in one comparison we are making the size to n/2.
So, F ( n ) = F ( n / 2 ) + 1
Hence, option (d) is correct.
[NAT]
Q.10. Dataset with data point ( x1y1 )( x 2 y2 ) .....( x 6 y6 )
1 6 0 –1 2 –2
x1 = , x 2 = , x 3 = , x 4 = , x 5 = , x 6 = labels y1 = y2 = y5 = 1,
0
1
–1
0
2
–2
y3 = y4 = y6 = –1.
PAGE
8
https://www.youtube.com/@GATEWallah_EE_EC_CS https://www.youtube.com/@GATEWallahbyPW
A hard margin linear support vertex machine is trained on the above data set support
vector.?
x4 x3 | x3 x4 x5 | x1 x2 x3 x4 | x1 x2 x5 joint probabilities.
Eg: f( x,y ) ( x, y ) 0, 2xy 0 < x < 2 0 < y < x
DATA SCIENCE & ARTIFICIAL INTELLIGENCE
E y | x = 1.5 is
Sol. (6)
The support vectors for the hard margin linear SVM trained on the given dataset are:
[[0. –1. ]]
[[–1. 0.]]
[[1. 0.]]
2. Joint Probabilities
The joint probabilities for the specified combinations of data points are:
X4 X3 0.333333
X3 X4 X5: 0.166667
X1 X2 X3 X4: 0.166667
X1 X2 X5: 0.333333
3. E[y | x = 1.5]:
The conditional expectation E[y |x = 1.5] is calculated to be –-1.5
Explanation: The support vectors represent the data points that lie closest to the
decision boundary of the SVM They are crucial for defining the margin and the
orientation of the separating hyperplane Joint probabilities describe the likelihood of
two events occurring together. In this case: they indicate the probability of specific
combinations of data points.
E[y | x = 1.5] represents the expected value of y given that x = 1.5. It's a conditional
expectation that measures the average value of y we expect to observe when x takes
the value of 1.5.
[MSQ]
Q.11. Consider performing DFS on an undirected unweighted graph G, starting at vertex S.
For any vertex U in G, d[U] is the length of the shortest path from S to U. Let (U, V)
be an edge in G, Such that d(V) < d(V) . If the edge (U, V) is explored first in the
direction from U to V, during the above DFS, then (U, V) becomes _____ edge.
(a) Back (b) Gray
(c) Cross (d) Tree
PAGE
9
https://www.youtube.com/@GATEWallah_EE_EC_CS https://www.youtube.com/@GATEWallahbyPW
Sol. (d)
U
B d(B) = 1
DATA SCIENCE & ARTIFICIAL INTELLIGENCE
U V
Start A C D d(D) = 2
d(A) = 0 d(C) = 1
E F d(F) = 3
d(E) = 3
Taking possible DFS starting from ‘S’.
A→B→C→D→ F→E
From above illustration, edges C, D are past of the tree.
Therefore, Option (d) is correct.
[NAT]
Q.12. Consider sorting the following array of integer in ascending order using an in place
Quick sort that uses last element as the pivot table
60 70 80 90 100
The minimum number of swaps performed during the Quick sort?
Sol. (0)
Given array, 60, 70, 80, 90, 100. During the partitioning step, all elements are
compared with the pivot (which is 100 in this case). Since all other elements are smaller
than 100, there won't be any swaps in the partitioning step. Thus, the minimum number
of swaps performed during the Quick Sort is 0.
[NAT]
1
Q.13. Let f : R→R be the function f(x) = . The value of the derivative of at x where
1 + e− x
f(x) = 0.4 is.
Sol. (0.24)
f(x) = 0.4
1
= 0.4
1 + e− x
1
1 + e− x =
0.4
1 1 − 0.4
e− x = −1 =
0.4 0.4
PAGE
0.6
e− x = 10
0.4
https://www.youtube.com/@GATEWallah_EE_EC_CS https://www.youtube.com/@GATEWallahbyPW
6 3
e− x = =
4 2
1 3
x
=
e 2
DATA SCIENCE & ARTIFICIAL INTELLIGENCE
2
ex =
3
2
ln e x = ln
3
2
x = ln
3
d 1
f '( x ) =
dx 1 + e− x
−1 e− x
= e− x ( −1) =
(1 + e− x ) (1 + e− x )
2 2
2
Now, x = ln
3
−ln
e− x = e 3
ln 3
=e 3 =
2
3
2 2
= = f ' ln = 0.24
3
2
3
1 + 2
[MCQ]
2 –1
Q.14. M=
3 1
(a) Eigen values of M are +ve and real
(b) Eigen value of M non-negative and zero
(c) Eigen value of M are complex conjugates pair
(d) Eigen value of M are negative and real.
Sol. (c)
2 –1
M=
3 1
https://www.youtube.com/@GATEWallah_EE_EC_CS https://www.youtube.com/@GATEWallahbyPW
2 – –1
M – λI | = =0
3 1 –
2 – –1
=0
3 1–
DATA SCIENCE & ARTIFICIAL INTELLIGENCE
(2 – λ) (1 – λ) + 3 = 0
2 – 2 λ – λ + λ2 + 3 = 0
λ2 – 3λ + 5 = 0
D = 9 – 20
D<0
[NAT]
Q.15. f : R → R is a function from R to R such that at some x* R, f’(x*) = 0
f” (x*) > 0, thus of necessarily has a
f will have a local minima a at x* as f’(x*) = 0 denotes that x* is a critical point. Now
as the double derivative of at (x*) is greater than 0, thus the function will have a local
minima at x = x* R
[NAT]
Q.16. Match the following:
(p) Discrimination (i)PCA.
(q) Dimentionality Reduction (ii)Naive Baye.
(r) Generative Model (iii) Logistic Regression.
Sol.
(i) PCA (q) Dimentionality Reduction
(ii) Naive Baye. (p) Discrimination
(iii) Logistic Regression. (r) Generative Model
[MCQ]
Q.17. Three fair coins are tossed independently. T is the event that two or more tosses result
in heads. S is the event that two or more tosses result in tails. The probability of the
event T ∩ S is –
(a) 0.5 (b) 0 PAGE
(c) 0.25 (d) 1 12
https://www.youtube.com/@GATEWallah_EE_EC_CS https://www.youtube.com/@GATEWallahbyPW
Sol. (b)
n ( T S)
P(T∩S) =
n ( S)
T∩S=ϕ
N (T ∩ S) = 0
0
P (T ∩ S) = = 0
8
[MCQ]
Q.18. Consider two events T & S. Let T denotes compliment of event T. The probability
associated with different event are given as follows:
P( T ) = 0.6
P(S/T) = 0.3
P(S/ T ) = 0.6
P(T/S) = ?
(a) 0.25 (b) 1
(c) 0.75 (d) 0.5
Sol. (a)
( )
P T = 0.6 ,
1 – P(T) = 0.6
P(T) = 0.4
P (S T )
P(S/T) +
P (T)
0.3 0.4 = P (S T )
P (S T ) = 0.12
S P (S T )
P =
T P (T)
PAGE
13
https://www.youtube.com/@GATEWallah_EE_EC_CS https://www.youtube.com/@GATEWallahbyPW
(S T ) (S T ) = S
P ( S T ) ( S T ) = P S
P (A + B) = P (A) + P (B) – P (A ∩ B)
Now
DATA SCIENCE & ARTIFICIAL INTELLIGENCE
P ( S T ) + ( S T ) = P (S T ) + (S T ) = F (S )
0.12 + 0.36 – P ( S T T C ) = F ( S )
0.48 – P (∩ (ϕ ∩ S)) = P(S)
0.48 – P (S ∩ ϕ) = P(S)
0.48 – P (ϕ) = P(S̅)
P(S) = 0.48
T P (S T ) 0.12
P = = = t1 = 0.25
S P ( S) 0.48
[MCQ]
e−x x 0
Q.19. fx ( x) =
0 other
If 5E(x) = Var (x), E(x) & Var (x) indicate the expectation and variance of x the value
of is ______.
(a) 1/5 (b) 1/2
(c) 2/5 (d) 2
Sol. (a)
e – x x 0
fx ( x ) =
0 otherwise
If 5E(X) = var (x) have E(x) denotes the expectation of x and var(x) denotes the
variance of x, then the values of λ is ___
E(X) = x f x ( x ) dx
–
Var(x) = E(x2) – (E(x))2
( ) = x 2f x ( x ) dx
E x 2
–
E(x) = xf
−
x (x)dx
xe −x dx
0
xe−x e −x
= − dx
− − 0
PAGE
14
https://www.youtube.com/@GATEWallah_EE_EC_CS https://www.youtube.com/@GATEWallahbyPW
−1 e −x
= e −x x − 2
0
1
=
DATA SCIENCE & ARTIFICIAL INTELLIGENCE
E(x 2 ) = x f
2
x (x)dx
−
e −x e −x
= x2 − 2x dx
− − 0
2 1 2
= 2 = 2
2
2 1 1
= − =
2 2
Var(x) = 5E(x)
1 5
=
2
(5 − 1)
1
=
5
[NAT]
Q.20. Consider the following relations Raider and Team managed by Kabaddi as follows:
Raider
ID Name Raids Raid Point
1 - 200 250
2 - 190 219
3 - 150 200
4 - 150 190
5 - 175 220
6 - 193 215
Team
City ID Bid point
Jaipur 2 200
- 3 195
- 5 175
Jaipur 1 250
- 4 200
Jaipur 6 200
PAGE
Select * FROM Raider Team WHERE Raider .ID = Team. ID and City = “Jaipur” and
15
Raid point > 200.
https://www.youtube.com/@GATEWallah_EE_EC_CS https://www.youtube.com/@GATEWallahbyPW
Sol. (3)
Raider × Team [Cross product]
Id Name Raids Raids Point City Bid point
1 200 250 Jaipur 250
DATA SCIENCE & ARTIFICIAL INTELLIGENCE
The output will contain tuples where ‘Raider ID’ = Team ID and City = “Jaipur”
The final output relation will consist of 3 tuples.
[MCQ]
2xy 0 x 2
Q.21. f X,Y (x, y) = 0 y x find E[Y | x = 1.5] =
0 otherwise
(a) 1 (b) 2
(c) 3 (d) 4
Sol. (a)
E[Y | X = x] = yf
−
Y/ X (y / x)dy
f X,Y (x, y)
f Y/ X (y / x) =
f X (x)
x
y2
f X (x) = 2 = x 3
2 0
f X ( x) = f X , Y ( x, y ) dy
−
fX (x) = 0 for x 0, x 2.
x
f X ( x) = f X , Y ( x, y) dy 0<x<2
0
x x
y2
f X ( x) = 2 xy dy = 2 x = x3
2 0
0
y f X , Y ( x, y )
Now, fY / X =
x f X ( x)
y x 0, x2 PAGE
fY / X = 0 for 16
x yx y0
https://www.youtube.com/@GATEWallah_EE_EC_CS https://www.youtube.com/@GATEWallahbyPW
y 2 xy 0 x2
fY / X = 3 for
x x 0 y x
y 2y
fY / X = 2
x x
DATA SCIENCE & ARTIFICIAL INTELLIGENCE
Y y
Now, E
X = x −
= fY / X dy
x
x
Y
2y
E = y 2 dy for 0 < x < 2 only
X = x 0 x
x
Y 2 y3
E = 2 = x for 0<x<2
X = x x 3 0 3
Y 2
Now, E = 1.5 = 1.5 = 1
X 3
[MCQ]
Q.22. Euclidean distance based 𝑘-means clustering algorithm was run on a dataset of 100
points with 𝑘 = 3. If the points [ 1 1 ] and [ −1 1 ] are both part of cluster 3, then which
ONE of the following points is necessarily also part of cluster 3?
(a) [0 0] (b) [0 2]
(c) [2 0] (d) [0 1]
Sol. (d)
Let's calculate the Euclidean distances from each candidate point to [1,1] and [–1,1] to
find which point is necessarily closer to both of these points.
Given Points
1. Point [1,1]
2. Point [—1,1]
Candidate Points
1. Point [0,0]
• Distance to [1,1]:
(1 − 0 )2 + (1 − 0 )2 = 2
• Distance to [–1,1]:
( –1 − 0 )2 + (1 − 0 )2 = 2
2. Point [0,2]
• Distance to [0,1]:
(1 − 0 )2 + (1 − 2 )2 = 2
• Distance to [–1,1]:
PAGE
( –1 − 0 )2 + (1 − 2 )2 = 2 17
https://www.youtube.com/@GATEWallah_EE_EC_CS https://www.youtube.com/@GATEWallahbyPW
3. Point [2,0]
• Distance to [1,1]:
(1 − 2)2 + (1 − 0 )2 = 2
DATA SCIENCE & ARTIFICIAL INTELLIGENCE
• Distance to [–1,1]:
( –1 − 2 )2 + (1 − 0 )2 = 10
4. Point [0,1]
• Distance to [1,1]:
(1 − 0 )2 + (1 − 1)2 = 1
• Distance to [–1,1]:
( –1 − 0 )2 + (1 − 1)2 =1
• Points [0, 0] and |0, 2] have the same Euclidean distance to both [1,1] and [ 1,1],
but are not necessarily the closest to both points, only equidistant.
• Point [2,0] is farther from [-1,1] compared to the other points, which indicates it
is less likely to be in the same cluster as [1,1] and [-1,1].
• Point [0,1] is closer to both [1,1] and [-1,1] than the other candidate points. Since
its distances to both [1,1] and [ 1,1] are exactly equal, it is a strong candidate for
being in the same cluster.
Point [0,1] is equidistant to both [1,1] and [ 1,1] and is likely to be a part of the same
cluster as these two points.
Thus, the correct answer is (D) [0,1]
[MCQ]
Q.23. For any binary classification dataset, let SB d×d and SW d×d be the between-
class and within-class scatter (covariance) matrices, respectively. The Fisher linear
discriminant is defined by u * d, that maximizes J(u) = uT SBu u TSW u If
= J(u * ), SW is non-singular and SB # 0, then (u *, ) must satisfy which ONE of
the following equations? Note: & denotes the set of real numbers.
(a) SW –1 Sbu *= u* (b) Swu* = SBu*
(c) SBSWu* = u* (d) u*Tu* = 2
Sol. (a)
Given the definition of the Fisher linear discriminant and the problem statement, the
correct equation that (u*, ) must satisfy is:
(A) SW–1 SBue =u*
This equation corresponds to the generalized eigenvalue problem where is the
eigenvalue and u* is the eigenvector that maximizes the Fisher criterion J(u)=u TSBu
/uTSwu Thus, the correct answer is: PAGE
(A) SW–1 Sbu * = u* 18
https://www.youtube.com/@GATEWallah_EE_EC_CS https://www.youtube.com/@GATEWallahbyPW
[MCQ]
Q.24. Let h1 and h2 be two admissible heuristics used in A* search. Which ONE of the
following expressions is always an admissible heuristic?
DATA SCIENCE & ARTIFICIAL INTELLIGENCE
(a) h1 + h2 (b) h1 × h2
(c) h1/h2, (h2 0) (d) [h1 – h2]
Sol. (d)
[MCQ]
Q.25. Consider a state space where the start state is number 1. The successor function for the
state numbered n returns two states numbered n+1 and n+2. Assume that the states in
the unexpanded state list are expanded in the ascending order of numbers and the
previously expanded states are not added to the unexpanded state list. Which ONE of
the following statements about breadth-first search (BFS) and depth-first search (DFS)
is true, when reaching the goal state number 6?
(a) BFS expands more states than DFS.
(b) DFS expands more states than BFS.
(c) Both BFS and DFS expand equal number of states.
(d) Both BFS and DFS do not reach the goal state number 6
Sol. (a)
https://www.youtube.com/@GATEWallah_EE_EC_CS https://www.youtube.com/@GATEWallahbyPW
State Expansion Behavior:
• BFS explores all nodes at the present depth level before moving on to nodes at the
next depth level. It systematically explores all possible paths layer by layer.
• DFS explores as far as possible along each branch before backtracking. It dives
deep into a single path before trying alternative paths.
DATA SCIENCE & ARTIFICIAL INTELLIGENCE
[MCQ]
Q.26. Let the minimum, maximum, mean and standard deviation values for the attribute
income of data scientists be Rs.46000, Rs.170000, Rs.96000, and Rs.21000,
respectively. The z-score normalized income value of Rs. 106000 is closest to which
ONE of the following options?
(a) 0.217 (b) 0.476
(c) 0.623 (d) 2.304
Sol. (b)
To find the z-score normalized value for an income of ?106000 based on the given
statistics (minimum, maximum, mean, and standard deviation), we use the formula for
PAGE
z-score:
20
z = x-/
https://www.youtube.com/@GATEWallah_EE_EC_CS https://www.youtube.com/@GATEWallahbyPW
where:
• x is the value we want to normalize (Rs.106000),
• is the mean income (Rs. 96000),
• is the standard deviation (Rs. 21000).
DATA SCIENCE & ARTIFICIAL INTELLIGENCE
Calculate z as follows:
z = 106000-96000/21000
z = 10000/21000
z = 0.476z
So, the z-score normalized income value of Rs. 106000 is closest to:
[MCQ]
Q.27. Consider the following Python code: def count(child_dict, i): if i not in child_dict.keys
(): return 1 ans = 1 for j in child_dict[i]: ans += count(child_dict, j) return ans child_dict
= dict() child_dict[0] = [1,2] child_dict[1] = [3,4,5] child_dict[2] = [6,7,8]
print(count(child_dict,0)) Which ONE of the following is the output of this code?
(a) 6 (b) 1
(c) 8 (d) 9
Sol. (d)
• Starting at node 0:
○ Node 0 has children 1 and 2.
• Subtree rooted at node 1:
○ Node 1 has children 3, 4, and 5.
■ Node 3 has no children (leaf node): count = 1
■ Node 4 has no children (leaf node): count = 1
■ Node 5 has no children (leaf node): count = 1
○ Total for subtree rooted at node 1 = 1 (node 1) + 1 (3) + 1 (4) + 1 (5) = 4
• Subtree rooted at node 2:
○ Node 2 has children 6, 7, and 8.
■ Node 6 has no children (leaf node): count = 1
■ Node 7 has no children (leaf node): count = 1
■ Node 8 has no children (leaf node): count = 1
○ Total for subtree rooted at node 2 = 1 (node 2) + 1 (6) + 1 (7) + 1 (8) = 4
• Total for subtree rooted at node 0:
○ Node 0 itself = 1
○ Subtree from node 1 = 4
○ Subtree from node 2 = 4
○ Total = 1 (node 0) + 4 (subtree from node 1) + 4 (subtree from node 2) = 9
Therefore, the output of the code is:
PAGE
21
https://www.youtube.com/@GATEWallah_EE_EC_CS https://www.youtube.com/@GATEWallahbyPW
[MCQ]
Q.28. Consider the following Python function: def fun(D, s1, s2): if s1 < s2: D[s1 ], D[s2] =
D[s2], D[s1] fun(D, s1+1, s2-1) What does this Python function fun() do? Select the
ONE appropriate option below.
(a) It finds the smallest element in D from index s1 to s2, both inclusive.
DATA SCIENCE & ARTIFICIAL INTELLIGENCE
(b) It performs a merge sort in-place on this list D between indices s1 and s2, both
inclusive.
(c) It reverses the list D between indices s1 and s2, both inclusive.
(d) It swaps the elements in D at indices s1 and s2, and leaves the remaining
elements unchanged
Sol. (c)
It reverses the list D between indices s1 and s2, both inclusive.
[MSQ]
Q.29. Let H,𝐼, 𝐿, and 𝑁 represent height, number of internal nodes, number of leaf nodes, and
the total number of nodes respectively in a rooted binary tree. Which of the following
statements is/are always TRUE?
(a) LI+1 (b) H + 1 N 2H+l – 1
(c) H I 2H – 1 (d) H L 2H – 1
Sol. (a, b)
(A) L I + 1
• In a rooted binary tree, there's a well-known result that the number of leaf nodes
L is always less than or equal to the number of internal nodes I plus one. This
is derived from the property of binary trees where L = I +1 in a full binary tree.
This property holds true for general binary trees as well.
(B) H + 1 N 2H+l - 1
• The number of nodes AT in a binary tree of height H has the following
properties:
• The minimum number of nodes is H + 1, which occurs in a tree where every
level is fully populated except the last level.
• The maximum number of nodes is 2H + 1 – 1, which is the number of nodes in a
complete binary tree of height H.
Therefore, this statement is true as it correctly reflects the bounds on N.
(C) H I 2H – 1
• This statement is not always true. While the maximum number of internal
nodes in a binary tree of height H is 2H –1 (for a complete binary tree), the
minimum number of internal nodes is not H. For example, a tree of height H
could have fewer internal nodes if it's not a full binary tree.
(D) H L 2H – 1
• This statement is not always true:
• The minimum number of leaf nodes L is at least H + 1 for a binary tree of height
PAGE
H. not H
22
• The maximum number of leaf nodes L is 2H, not 2H –1.
https://www.youtube.com/@GATEWallah_EE_EC_CS https://www.youtube.com/@GATEWallahbyPW
Based on the analysis:
(A) L I + 1 is always true.
(B) H + 1 N 2H+1 – 1 is always true.
(C) H I 2H – 1 is not always true.
DATA SCIENCE & ARTIFICIAL INTELLIGENCE
[MCQ]
Q.30. Consider a database the includes the following relations:
Defender (name, rating, side, goals)
Forward (name, rating, assists, goals)
Team (name, club, price)
Which ONE of the following relational algebra expressions checks that every name
occurring in Team appears in either Defender or Forward, where denote the empty
set?
(a) name(Team) \name(Defender) ∩ name(Forward) =
(b) name(Defender) ∩ name(Forward) \name(Team) =
(c) name(Team) \name(Defender) name(Forward) =
(d) (name(Defender) name(Forward) \name(Team) =
Sol. (c)
name(Defender) name(Forward) will gives us all the names that are either in
Defender or Forward table. - (iii) (i) \ (iii) will give us only those names that are in
Team table but not in either the Defender or Forward Table
If this equates to then we can say that it checks that every name that is in Team table
is also in either the Defender or Forward table.
[MSQ]
Q.31. An OTT company is maintaining a large disk-based relational database of different
movies with the following schema:
Movie (ID, CustomerRating)
Genre (ID, Name)
Movie_Genre (MovieID, GenreID)
Consider the following SQL query on the relation database above:
SELECT*
FROM Movie, Genre, Movie_Genre
WHERE
Movie.CustomerRating > 3.4 AND
Genre.Name = "Comedy" AND PAGE
Movie_Genre. MovieID = Movie.ID AND 23
https://www.youtube.com/@GATEWallah_EE_EC_CS https://www.youtube.com/@GATEWallahbyPW
Movie_Genre. GenreID = Genre . ID;
This SQL query can be sped up using which of the following indexing options?
(a) B+ tree on all the attributes.
(b) Hash index on Genre. Name and B+ tree on the remaining attributes.
DATA SCIENCE & ARTIFICIAL INTELLIGENCE
(c) Hash index on Movie. CustomerRating and B+ tree on the remaining attributes.
(d) Hash index on all the attributes
Sol. (a, b)
(A) As we know B+ trees are good in Range queries if we make B+ tree on all
attributes then it will definitely Speed up query.
(B) Hash based indexing is good in equality search, so if we make hash index on
Genre, name it will Give only Comedy genre names and for remaining attributes
we can make B+ trees.
(C) If we make hash index on Customer rating then it will not efficiently give output
and will not speed up the query.
(D) Same Reason as Previous that's Why A and B are suitable answers here
[MCQ]
Q.32. Match the items in Column 1 with the items in Column 2 in the following table:
Column-I Column-II
(p) First in first out (i) Stacks
(q) Look up Operation (ii) Queues
(r) Last in first out (iii) Hash Tables
(a) (p) - (ii), (q) - (iii), (r) - (i)
(b) (p) - (ii), (q) - (i), (r) - (iii)
(c) (P) - (i), (q) - (i), (r) - (iii)
(d) (p) - (i), (q) - (iii), (r) - (ii)
Sol. (a)
(p) First In First Out (FIFO) is a concept that describes how elements are processed
in the order they are received, where the first element to enter is also the first one
to exit. This behavior is characteristic of Queues, which follow the FIFO
principle. Therefore, (p) matches with (ii) Queues.
(q) Lookup Operation is commonly associated with Hash Tables. Hash tables are
data structures that provide efficient lookup operations, typically in constant time
O(1), by using a hash function to map keys to values. Therefore, (q) matches
with (iii) Hash Tables.
PAGE
24
https://www.youtube.com/@GATEWallah_EE_EC_CS https://www.youtube.com/@GATEWallahbyPW
(r) Last In First Out (LIFO) refers to the process where the last element that is added
is the first one to be removed, which is a characteristic of Stacks. Stacks follow
the LIFO principle, making them the appropriate match for this concept.
Therefore, (r) matches with (i) Stacks.
DATA SCIENCE & ARTIFICIAL INTELLIGENCE
Based on this analysis, the correct matching is:(p) → (ii) Queues,(q) → (iii) Hash
Tables,(r) → (i) Stacks. Thus, the correct option is (A).
[MCQ]
Q.33. Consider performing uniform hashing on an open address hash table with load factor
n
a = 1 where n elements are stored in the table with m slots. The expected number
m
1
of probes in an unsuccessful search is at most .
1− a
Inserting an element in this hash table requires at most______________probes, on
average.
1 1
(a) In (b)
1− a 1− a
a 1
(c) 1+ (d)
2 1+ a
Sol. (b)
In an open address hash table using uniform hashing, the process of inserting a new
element is closely related to performing an unsuccessful search. First, we need to find
an empty slot in the table, which is equivalent to an unsuccessful search, and then we
insert the element into that empty slot. The expected number of probes for an
unsuccessful search in such a hash table is given by the formula 1/(1-α), where α is the
load factor. Since insertion requires finding an empty slot (unsuccessful search)
followed by the actual insertion (which takes just one step), the expected number of
probes for insertion is the same as that for an unsuccessful search. Therefore, on
average, inserting an element in this hash table requires 1/(1-α) probes. Hence, The
correct answer to this question is option (B) 1/(1-α).
[MSQ]
Q.34. Consider the following tree traversals on a full binary tree:
(i) Preorder
(ii) Inorder
(iii) Postordcr
Which of the following traversal options is/are sufficient to uniquely reconstruct the
foil binary tree?
PAGE
(a) (i) and (ii) (b) (ii) and (iii)
25
(c) (i) and (iii) (d) (ii) only
https://www.youtube.com/@GATEWallah_EE_EC_CS https://www.youtube.com/@GATEWallahbyPW
Sol. (a, b, c)
Preorder and Inorder: This combination works because Preorder provides the root-
first order, while Inorder gives the left and right child relationship. Using these two
together, you can uniquely reconstruct the binary tree by determining the root node and
DATA SCIENCE & ARTIFICIAL INTELLIGENCE
placing the left and right children correctly. Thus, this pair is sufficient for
reconstructing the tree.
Inorder and Postorder: In this combination, Inorder again helps in identifying the left
and right child relationships, while Postorder provides the root-last ordering. By
combining these two traversals, it is possible to reconstruct the binary tree uniquely, as
you can place the root nodes in the correct order and build the tree step by step.
Preorder and Postorder: For a full binary tree, where each node has either 0 or 2
children, the combination of Preorder and Postorder can also uniquely reconstruct the
tree. This is because the full binary tree structure provides additional information that
helps in identifying the positions of the nodes.
Therefore, the correct answer is that all three options (i) and (ii) (Preorder and Inorder),
(ii) and (iii) (Inorder and Postorder), and (i) and (iii) (Preorder and Postorder) — are
sufficient to uniquely reconstruct a full binary tree. Hence, options A, B, and C are
correct.
[NAT]
Q.35. The fundamental operations in a double-ended queue D are:
insertFirst (e) - Insert a new element e at the beginning of D.
insertLast (e) - Insert a new element e at the end of D.
removeFirst() - Remove and return the first clement of D.
removeLast () - Remove and return the last element of D.
in an empty double-ended queue, the following operations are performed:
insertFirst (10)
insertLast (32)
(a) removeFirst ()
insertLast (28)
insertLast(17)
a removeFirst ()
a removeLast ()
The value of a is .
Sol. (17)
The operation insertFirst(10) adds the element 10 at the beginning of the deque. After
this operation, the deque looks like this:
Deque: [10].
PAGE
The operation insertLast(32) inserts 32 at the end of the deque. Now the deque contains 26
the elements:
https://www.youtube.com/@GATEWallah_EE_EC_CS https://www.youtube.com/@GATEWallahbyPW
Deque: [10, 32].
Next, we perform a ← removeFirst(), which removes the first element (10) from the
deque and assigns it to a.
After this, the deque looks like:
DATA SCIENCE & ARTIFICIAL INTELLIGENCE
Deque: [32]
a=10.
The operation insertLast(28) adds the element 28 at the end of the deque. After this, the
deque is:
Deque: [32, 28].
The operation insertLast(17) adds 17 to the end of the deque. Now, the deque is:
Deque: [32, 28, 17].
We then perform a ← removeFirst(), which removes the first element (32) and assigns
it to a.
After this, the deque becomes:
Deque: [28, 17]
a=32.
Finally, we perform a ← removeLast(), which removes the last element (17) and
assigns it to a.
After this, the deque is:
Deque: [28]
a=17.
Thus, after all the operations, the final value of a is 17.
[MCQ]
Q.36. Consider the following statements:
(i) The mean and variance of a Poisson random variable are equal.
(ii) For a standard normal random variable, the mean is zero and the variance is one.
Which ONE of the following options is correct?
(a) Both (i) and (ii) are true (b) (i) is true and (ii) is false
(c) (ii) is true and (i) is false (d) Both (i) and (ii) are false
Sol. (*)
[MCQ]
Q.37. Consider five random variables U, V, W, X, and Y whose joint distribution satisfies:
P(U, V, W, X ,Y) = P(U)P(V)P(W|U,V)P(X|W)P(Y|W)
Which ONE of the following statements is FALSE?
(a) Y is conditionally independent of V given W PAGE
(b) X is conditionally independent of U given W 27
https://www.youtube.com/@GATEWallah_EE_EC_CS https://www.youtube.com/@GATEWallahbyPW
(c) U and V are conditionally independent given W
(d) Y and X are conditionally independent given W
Sol. (c)
DATA SCIENCE & ARTIFICIAL INTELLIGENCE
[MCQ]
Q.38. Consider the following statement:
In adversarial search, - pruning can be applied to game trees of any depth where a
is the (m) value choice we have formed so tar at any choice point along the path for the
MAX player and is the (n) value choice we have formed so far at any choice point
along the path for the MIN player.
Which ONE of the following choices of (m) and (n) makes the above statement valid?
(a) (m) = highest, (n) = highest
(b) (m) = lowest, (n) = highest
(c) (m) = highest, (n) = lowest
(d) (m) = lowest, (n) = lowest
Sol. (c)
[MSQ]
Q.39. Let x and y be two propositions. Which of the following statements is u tautology /are
tautologies?
(a) ( x y ) ( y x )
(b) ( x y ) ( x y )
(c) ( x y ) ( x y )
(d) ( x y ) ( y x )
Sol. (b, c, d)
[NAT]
Q.40. The sample average of 50 data points is 40. The updated sample average after including
a new data point taking the value of 142 is___________.
Sol. (42)
[MCQ]
Q.41. Let f : → be function Note: denotes the set of real numbers.
= x, if x = 2
2
f ( x ) = ax + bx + c, if x −2, 2
x, if x 2
PAGE
Which ONE of the following choices gives the values of a, b, c that make the junction 28
continuous and differentiable?
https://www.youtube.com/@GATEWallah_EE_EC_CS https://www.youtube.com/@GATEWallahbyPW
1 1
(a) a = , b = 0, c = 1 (b) a = , b = 0, c = 1
4 2
(c) a = 0, b = 0, c = 0 (d) a = 1, b = 1, c = −4
Sol. (a)
DATA SCIENCE & ARTIFICIAL INTELLIGENCE
[MCQ]
Q.42. Consider the table below, where the (i, j)th element of the table is the distance between
points xi, and xj. Single linkage clustering is performed on data points, x1, x2, x3, x4, x5.
x1 x2 x3 x4 x5
x1 0 1 4 3 6
x2 1 0 3 5 3
x3 4 3 0 2 5
x4 3 5 2 0 1
x5 6 3 5 1 0
Which ONE of the following is the correct representation of the clusters produced?
(a) (b)
(c) (d)
Sol. (a)
[MSQ]
Q.43. Select all choices that are subspaces of 3.
Note: denotes the set of real numbers.
x1 1 1
(a) x = x2
3
: x = 1 + 0 , ,
x3 0 0
x1 1 1
2
x = x2 : x = 2 + 0 , ,
3 2
(b)
x3 0 1
x1
x = x3 : 5 x1 + 2 x3 = 0, 4 x1 − 2 x2 + 3 x3 = 0
3
(c)
PAGE
x3 29
https://www.youtube.com/@GATEWallah_EE_EC_CS https://www.youtube.com/@GATEWallahbyPW
x1
x = x2 : 5 x1 + 2 x3 + 4 = 0
3
(d)
x3
Sol. (a, c)
DATA SCIENCE & ARTIFICIAL INTELLIGENCE
[MSQ]
Q.44. Which of the following statements is/are TRUE?
Note: denotes the set of real numbers.
(a) There exist M3×3, p3 and q3 such that Mx = p has unique solution and
Max = q has infinite solutions.
(b) There exist M3×3, p3 and q3 such that Mx = p has no solutions and
Mx = q has infinite solutions.
(c) There exist M2×3, p2 and q2 such that Mx = p has a unique solution
and Mx = q has infinite solutions
(d) There exist M3×2, p3 and q3 such that Mx = p has a unique solution
and Mx = q has infinite solutions
Sol. (b, d)
[MSQ]
Q.45. Let be the set of real numbers, U be a subspace of 3 and M 3×3 be the matrix
corresponding to the projection on to the subspace U.
Which of the following statements is/are TRUE?
(a) If U is a 1-dimensional subspace of 3, then the null space of M is a I-
dimensional subspace.
(b) If U is a 2-dimensional subspace of 3, then the null space of M is a I-
dimensional subspace.
(c) M2 = M
(d) M3 = M
Sol. (b, c, d)
[MSQ]
Q.46. Consider the function f : → where is the set of all real numbers.
x 4 2 x3 3 x 2
f ( x) = − − +1
4 3 2
Which of the following statements is/are TRUE?
https://www.youtube.com/@GATEWallah_EE_EC_CS https://www.youtube.com/@GATEWallahbyPW
[MCQ]
Q.47. Consider the following figures representing datasets consisting of two-dimensional
features with two classes denoted by circles and squares.
DATA SCIENCE & ARTIFICIAL INTELLIGENCE
[MSQ]
Q.48. Let game(ball, rugby) be true if the ball is used in rugby and false otherwise.
Let shape(ball, round) be true if the ball is round and false otherwise.
Consider the following logical sentences:
S1: ball game (ball, rugby) shape (ball, rugby)
S2: ball shape (ball, round) game (ball, rugby)
S3: ball game (ball, rugby) shape (ball, rugby)
S4: ball shape (ball, round) game (ball, rugby)
Which of the following choices is/are logical representations of the assertion,
“All balls are round except balls used in rugby”?
(a) S1 S3 (b) S1 S2
(c) S2 S3 (d) S3 S4
Sol. (a, c)
[NAT]
Q.49. Details of ten international cricket games between two teams “Green” and “Blue” are
given in Table C. This table consists of matches played on different pitches, across
formats along with their winners. The attribute Pitch can take one of two values: spin-
friendly (represented as S) or pace-friendly (represented as F). The attribute Format
can take one of two values: one-day match (represented as 0) or test match (represented
as T).
A cricket organization would like to use the information given in Table C to develop a
decision-tree model to predict outcomes of future games between these two teams.
To develop such a model, the computed Information Gain(C, Pitch) with respect to the
Target is________(rounded off to two decimal places).
PAGE
31
https://www.youtube.com/@GATEWallah_EE_EC_CS https://www.youtube.com/@GATEWallahbyPW
Table C
Match Number Pitch Format Winner (Target)
1 S T Green
2 S T Blue
3 F O Blue
DATA SCIENCE & ARTIFICIAL INTELLIGENCE
4 S O Blue
5 F T Green
6 F O Blue
7 S O Green
8 F T Blue
9 F O Blue
10 S O Green
Sol. (0.12)
[NAT]
Q.50. Given the two-dimensional dataset consisting of 5 data points from two classes (circles
and squares) and assume that the Euclidean distance is used to measure the distance
between two points. The minimum odd value of k in /c-nearest neighbor algorithm for
which the diamond (0) shaped data point is assigned the label square is .
Sol. (5)
[MCQ]
Q.51. Given the following Bayesian Network consisting of four Bernoulli random variables
and the associated conditional probability tables:
U=0 P(·)
U =1
PAGE
32
https://www.youtube.com/@GATEWallah_EE_EC_CS https://www.youtube.com/@GATEWallahbyPW
P (v = 0|·) P(v = 1|·)
U =0 0.5 0.5
U =1 0.5 0.5
P(w = 0|·) P(W = 1|·)
U=0 1 0
DATA SCIENCE & ARTIFICIAL INTELLIGENCE
U =1 0 1
The value of P(U = 1,V = 1,W = 1,Z = 1) = decimal places). _______(rounded off to
three
Sol. (1.25)
[NAT]
Q.52. Two lair coins are tossed independently. X is a random variable that takes a value of 1
if both tosses are heads and 0 otherwise. Y is a random variable that takes a value of 1
if at least one of the tosses is heads and 0 otherwise.
The value of the covariance of X and X is __________(rounded off to three decimal
places).
Sol. (0.062)
[MCQ]
Q.53. Consider the two neural networks (NNs) shown in Figures 1 and 2, with ReLU
activation (ReLU(z) = max{0,z} ,z ). denotes the set of real numbers. The
connections and their corresponding weights are shown in the Figures. The biases at
every neuron are set to 0. For what values of p, q, r in Figure 2 are the two NNs
equivalent, when x1, x2, x3 are positive?
https://www.youtube.com/@GATEWallah_EE_EC_CS https://www.youtube.com/@GATEWallahbyPW
[NAT]
Q.54. Let X be a random variable uniformly distributed in the interval [1,3] and Y be a
random variable uniformly distributed in the interval [2, 4]. If X and Y are independent
of each other, the probability P(X Y) is ___________ (rounded off to three decimal
places).
DATA SCIENCE & ARTIFICIAL INTELLIGENCE
Sol. (0.125)
[NAT]
1
2
Q.55. Let u = 3 , and let 1, 2 , 3 , 4 , 5 be the singular values of the matrix M=uuT
4
5
i=1i is
5
(where uT the transpose of u.) The values of .
Sol. (55)
PAGE
34
https://www.youtube.com/@GATEWallah_EE_EC_CS https://www.youtube.com/@GATEWallahbyPW