1
GATE AI 2025
MCQ (Single Correct Answer)
+2
-0

Consider the following Python code snippet.

$\mathrm{A}=\{$ "this","that" $\}$

$B=\{$ "that","other" $\}$

$\mathrm{C}=\{$ "other","this"}

while "other" in C :

if "this" in A :

$\mathrm{A}, \mathrm{B}, \mathrm{C}=\mathrm{A}-\mathrm{B}, \mathrm{B}-\mathrm{C}, \mathrm{C}-\mathrm{A}$

if "that" in B ;

$\mathrm{A}, \mathrm{B}, \mathrm{C}=\mathrm{C}|\mathrm{A}, \mathrm{A}| \mathrm{B}, \mathrm{B} \mid \mathrm{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
2
GATE AI 2025
Numerical
+2
-0

Consider the following Python code snippet.

$\operatorname{def} f(a, b)$ :

if ( $a==0$ ):

return b

$$ \begin{aligned} &\begin{aligned} & \text { if }(\mathrm{a} \% 2==1) \text { : } \\ & \text { return } 2 * f((a-1) / 2, b) \\ & \text { return } b+f(a-1, b) \\ & \operatorname{print}(f(15,10)) \end{aligned}\\ &\text { The value printed by the code snippet is__________ } \end{aligned} $$

Your input ____
3
GATE AI 2025
Numerical
+2
-0

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=\operatorname{Pop}(\mathrm{S})$

if ( $x$ is odd):

Pop (S)

Set sum $=\operatorname{sum}+\mathrm{x}\}$

}

Output sum

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

Your input ____
4
GATE AI 2025
MCQ (Single Correct Answer)
+1
-0

Courage : Bravery :: Yearning :

___________ Select the most appropriate option to complete the analogy.

A
Longing
B
Yelling
C
Yawning
D
Glaring

GATE Data Science and Artificial Intelligence Papers

All year-wise previous year question papers