GATE CSE 2025 Set 1
Paper was held on Sat, Feb 1, 2025 4:00 AM
View Questions

GATE CSE

1

Let $G$ be any undirected graph with positive edge weights, and $T$ be a minimum spanning tree of $G$. For any two vertices, $u$ and $v$, let $d_1(u, v)$ and $d_2(u, v)$ be the shortest distances between $u$ and $v$ in $G$ and $T$, respectively. Which ONE of the options is CORRECT for all possible $G, T, u$ and $v$ ?

2

Consider the following recurrence relation :

$$T(n)=2 T(n-1)+n 2^n \text { for } n>0, T(0)=1$$

Which ONE of the following options is CORRECT?

3

$$\text { The pseudocode of a function fun( ) is given below : }$$

 fun(int A[0, .., n-1]) {
    for i = 0 to n-2
        for j=0 to n-i-2
            if (A[]]>A[j + 1])
                then swap A[j] and A[j+1]
}

Let $A[0, \ldots, 29]$ be an array storing 30 distinct integers in descending order. The number of swap operations that will be performed, if the function fun( ) is called with $A[0, \ldots, 29]$ as argument, is _________. (Answer in integer)

4

The maximum value of $x$ such that the edge between the nodes $B$ and $C$ is included in every minimum spanning tree of the given graph is _______. (Answer in integer)

GATE CSE 2025 Set 1 Algorithms - Greedy Method Question 2 English

5

Which ONE of the following statements is FALSE regarding the symbol table?

6

Which ONE of the following techniques used in compiler code optimization uses live variable analysis?

7

Which of the following statement(s) is/are TRUE while computing First and Follow during top down parsing by a compiler?

8

Refer to the given 3-address code sequence. This code sequence is split into basic blocks. The number of basic blocks is ________ . (Answer in integer)

$$\begin{aligned} & \text { 1001: } \mathrm{i}=1 \\ & \text { 1002: } \mathrm{j}=1 \\ & \text { 1003: } \mathrm{t} 1=10 \text { * } \mathrm{i} \\ & \text { 1004: } \mathrm{t} 2=\mathrm{t} 1+\mathrm{j} \\ & \text { 1005: t3 }=8^* \text { t2 } \\ & \text { 1006: } \mathrm{t} 4=\mathrm{t} 3-88 \\ & \text { 1007: a[t4] }=0.0 \\ & \text { 1008: j = j + } 1 \\ & \text { 1009: if } \mathrm{j}<=10 \text { goto } 1003 \\ & \text { 1010: } \mathrm{i}=\mathrm{i}+1 \\ & \text { 1011: if } \mathrm{i}<=10 \text { goto } 1002 \\ & \text { 1012: } \mathrm{i}=1 \\ & \text { 1013: } \mathrm{t} 5=\mathrm{i}-1 \\ & \text { 1014: t6 = 88 * t5 } \\ & \text { 1015: } \mathrm{a}[\mathrm{t} 6]=1.0 \\ & \text { 1016: } i=i+1 \\ & \text { 1017: if } \mathrm{i}<=10 \text { goto } 1013 \end{aligned}$$

9

Identify the ONE CORRECT matching between the OSI layers and their corresponding functionalities as shown.

OSI Layers Functionalities
(a) Network layer (I) Packet routing
(b) Transport layer (II) Framing and error handling
(c) Datalink layer (III) Host to host communication

10

Consider the 3-way handshaking protocol for TCP connection establishment. Let the three packets exchanged during the connection establishment be denoted as P1, P2 and P3, in order. Which of the following option(s) is/are TRUE with respect to TCP header flags that are set in the packets?

11

A packet with the destination IP address 145.36.109.70 arrives at a router whose routing table is shown. Which interface will the packet be forwarded to?

Subnet Address Subnet Mask
(in CIDR notation)
Interface
145.36.0.0 /16 E1
145.36.128.0 /17 E2
145.36.64.0 /18 E3
145.36.255.0 /24 E4
Default $-$ E5

12

Suppose a message of size 15000 bytes is transmitted from a source to a destination using IPv4 protocol via two routers as shown in the figure. Each router has a defined maximum transmission unit (MTU) as shown in the figure, including IP header. The number of fragments that will be delivered to the destination is _________ . (Answer in integer)

GATE CSE 2025 Set 1 Computer Networks - Network Layer Question 3 English

13

Suppose a program is running on a non-pipelined single processor computer system. The computer is connected to an external device that can interrupt the processor asynchronously. The processor needs to execute the interrupt service routine (ISR) to serve this interrupt. The following steps (not necessarily in order) are taken by the processor when the interrupt arrives:

(i) The processor saves the content of the program counter.

(ii) The program counter is loaded with the start address of the ISR.

(iii) The processor finishes the present instruction.

Which ONE of the following is the CORRECT sequence of steps?

14

A partial data path of a processor is given in the figure, where $R A, R B$, and $R Z$ are 32-bit registers. Which option(s) is/are CORRECT related to arithmetic operations using the data path as shown?

GATE CSE 2025 Set 1 Computer Organization - Alu Data Path and Control Unit Question 1 English

15

Consider a memory system with 1 M bytes of main memory and 16 K bytes of cache memory. Assume that the processor generates 20-bit memory address, and the cache block size is 16 bytes. If the cache uses direct mapping, how many bits will be required to store all the tag values?

[Assume memory is byte addressable, $1 \mathrm{~K}=2^{10}$, $1 \mathrm{M}=2^{20}$]

16

A processor has 64 general-purpose registers and 50 distinct instruction types. An instruction is encoded in 32-bits. What is the maximum number of bits that can be used to store the immediate operand for the given instruction?

$$\mathrm{ADD ~ R1,~\#25 \qquad // R1 = R1 + 25}$$

17

A disk of size 512 M bytes is divided into blocks of 64 K bytes. A file is stored in the disk using linked allocation. In linked allocation, each data block reserves 4 bytes to store the pointer to the next data block. The link part of the last data block contains a NULL pointer (also of 4 bytes). Suppose a file of 1 M bytes needs to be stored in the disk. Assume, $1 \mathrm{~K}=2^{10}$ and $1 \mathrm{M}=2^{20}$. The amount of space in bytes that will be wasted due to internal fragmentation is ________ . (Answer in integer)

18

A computer has a memory hierarchy consisting of two-level cache (L1 and L2) and a main memory. If the processor needs to access data from memory, it first looks into L1 cache. If the data is not found in L1 cache, it goes to L2 cache. If it fails to get the data from L2 cache, it goes to main memory, where the data is definitely available. Hit rates and access times of various memory units are shown in the figure. The average memory access time in nanoseconds (ns) is _________ . (Rounded off to two decimal places)

GATE CSE 2025 Set 1 Computer Organization - Memory Interfacing Question 4 English

19

Consider the following $B^{+}$tree with 5 nodes, in which a node can store at most 3 key values. The value 23 is now inserted in the $B^{+}$tree. Which of the following options(s) is/are CORRECT?

GATE CSE 2025 Set 1 Data Structures - Trees Question 5 English

20

Which of the following statement(s) is/are TRUE for any binary search tree (BST) having $n$ distinct integers?

21

The height of any rooted tree is defined as the maximum number of edges in the path from the root node to any leaf node.

Suppose a Min-Heap $T$ stores 32 keys. The height of $T$ is ________ (Answer in integer)

22

Let $G(V, E)$ be an undirected and unweighted graph with 100 vertices. Let $d(u, v)$ denote the number of edges in a shortest path between vertices $u$ and $v$ in $V$. Let the maximum value of $d(u, v), u, v \in V$ such that $u \neq v$, be 30 . Let $T$ be any breadth-first-search tree of $G$. Which ONE of the given options is CORRECT for every such graph $G$ ?

23

Let LIST be a datatype for an implementation of linked list defined as follows:

typedef struct list {
    int data;
    struct list *next;
} LIST;

Suppose a program has created two linked lists, L1 and L2, whose contents are given in the figure below (code for creating L1 and L2 is not provided here). L1 contains 9 nodes, and L2 contains 7 nodes. Consider the following C program segment that modifies the list L1. The number of nodes that will be there in L1 after the execution of the code segment is _________. (Answer in integer)

GATE CSE 2025 Set 1 Data Structures - Linked List Question 1 English

24

In a double hashing scheme, $h_1(k)=k \bmod 11$ and $h_2(k)=1+(k \bmod 7)$ are the auxiliary hash functions. The size $m$ of the hash table is 11 . The hash function for the $i^{\text {th }}$ probe in the open address table is $\left[h_1(k)+i h_2(k)\right]$ mod $m$. The following keys are inserted in the given order: $63,50,25,79,67,24$.

The slot at which key 24 gets stored is _______. (Answer in integer)

25

A schedule of three database transactions $T_1, T_2$, and $T_3$ is shown. $R_i(A)$ and $W_i(A)$ denote read and write of data item $A$ by transaction $T_i, i=1,2,3$. The transaction $T_1$ aborts at the end. Which other transaction(s) will be required to be rolled back?

$$R_1(X) W_1(Y) R_2(X) R_2(Y) R_3(Y) \operatorname{ABORT}\left(T_1\right)$$

26

Consider two relations describing teams and players in a sports league:

$\bullet$ teams(tid, tname): tid, tname are team-id and team-name, respectively.

$\bullet$ players(pid, pname, tid): pid, pname, and tid denote player-id, player-name and the team-id of the player, respectively.

Which ONE of the following tuple relational calculus queries returns the name of the players who play for the team having tname as ' $M I$ '?

27

Consider a relational schema team(name, city, owner), with functional dependencies \{name $\rightarrow$ city, name $\rightarrow$ owner}.

The relation team is decomposed into two relations, $t 1$ (name, city) and $t 2$ (name, owner). Which of the following statement(s) is/are TRUE?

28

Consider the following database tables of a sports league.

player(pid, pname, age)

team(tid, tname, city, cid)

coach(cid, cname)

members(pid, tid)

An instance of the table and an SQL query are given.

GATE CSE 2025 Set 1 Database Management System - Structured Query Language Question 2 English

The value returned by the given SQL query is ________ . (Answer in integer)

29

Let $X$ be a 3-variable Boolean function that produces output as ' 1 ' when at least two of the input variables are ' 1 '. Which of the following statement(s) is/are CORRECT, where $a, b, c, d, e$ are Boolean variables?

30

The number -6 can be represented as 1010 in 4-bit 2's complement representation. Which of the following is/are CORRECT 2's complement representation(s) of $-6$ ?

31

Consider the following four variable Boolean function in sum-of-product form

$$F\left(b_3, b_2, b_1, b_0\right)=\Sigma(0,2,4,8,10,11,12)$$

where the value of the function is computed by considering $b_3 b_2 b_1 b_0$ as a 4-bit binary number, where $b_3$ denotes the most significant bit and $b_0$ denotes the least significant bit. Note that there are no don't care terms. Which ONE of the following options is the CORRECT minimized Boolean expression for $F$ ?

32

Consider the given sequential circuit designed using D-Flip-flops. The circuit is initialized with some value (initial state). The number of distinct states the circuit will go through before returning back to the initial state is _________ . (Answer in integer)

GATE CSE 2025 Set 1 Digital Logic - Sequential Circuits Question 2 English

33

$g(.)$ is a function from A to B, $f(.)$ is a function from B to C, and their composition defined as $f(g(.))$ is a mapping from A to C.

If $f(.)$ and $f(g(.))$ are onto (surjective) functions, which ONE of the following is TRUE about the function $g(.)$ ?

34

Consider the given system of linear equations for variables $x$ and $y$, where $k$ is a realvalued constant. Which of the following option(s) is/are CORRECT?

$$\begin{aligned} & x+k y=1 \\ & k x+y=-1 \end{aligned}$$

35

Let $S$ be the set of all ternary strings defined over the alphabet $\{a, b, c\}$. Consider all strings in $S$ that contain at least one occurrence of two consecutive symbols, that is, "aa", "bb" or "cc". The number of such strings of length 5 that are possible is __________ (Answer in integer)

36

Consider the given function $f(x)$.

$$f(x)=\left\{\begin{array}{cc} a x+b & \text { for } x<1 \\ x^3+x^2+1 & \text { for } x \geq 1 \end{array}\right.$$

If the function is differentiable everywhere, the value of $b$ must be _________ (Rounded off to one decimal place)

37

A box contains 5 coins: 4 regular coins and 1 fake coin. When a regular coin is tossed, the probability $P($ head $)=0.5$ and for a fake coin, $P($ head $)=1$. You pick a coin at random and toss it twice, and get two heads. The probability that the coin you have chosen is the fake coin is ________ . (Rounded off to two decimal places)

38

Let $A$ be a $2 \times 2$ matrix as given.

$$A=\left[\begin{array}{cc} 1 & 1 \\ 1 & -1 \end{array}\right]$$

What are the eigenvalues of the matrix $A^{13}$ ?

39

Which of the following predicate logic formulae/formula is/are CORRECT representation(s) of the statement: "Everyone has exactly one mother"?

The meanings of the predicates used are:

$\bullet$ mother $(y, x): y$ is the mother of $x$

$\bullet$ noteq $(x, y): x$ and $y$ are not equal

40

$A=\{0,1,2,3, \ldots\}$ is the set of non-negative integers. Let $F$ be the set of functions from $A$ to itself. For any two functions, $f_1, f_2 \in \mathrm{~F}$ we define

$$\left(f_1 \odot f_2\right)(n)=f_1(n)+f_2(n)$$

for every number $n$ in $A$. Which of the following is/are CORRECT about the mathematical structure $(\mathrm{F}, \odot)$ ?

41

Suppose a 5-bit message is transmitted from a source to a destination through a noisy channel. The probability that a bit of the message gets flipped during transmission is 0.01. Flipping of each bit is independent of one another. The probability that the message is delivered error-free to the destination is __________ ( (Rounded off to three decimal places)

42

Consider a probability distribution given by the density function $P(x)$.

$$P(x)=\left\{\begin{array}{cc} C x^2, & \text { for } 1 \leq x \leq 4 \\ 0, & \text { for } x<1 \text { or } x>4 \end{array}\right.$$

The probability that $x$ lies between 2 and 3, i.e., $P(2 \leq x \leq 3)$ is _________ (Rounded off to three decimal places)

43

Consider a demand paging memory management system with 32-bit logical address, 20 -bit physical address, and page size of 2048 bytes. Assuming that the memory is byte addressable, what is the maximum number of entries in the page table?

44

Suppose in a multiprogramming environment, the following C program segment is executed. A process goes into I/O queue whenever an I/O related operation is performed. Assume that there will always be a context switch whenever a process requests for an I/O, and also whenever the process returns from an I/O. The number of times the process will enter the ready queue during its lifetime (not counting the time the process enters the ready queue when it is run initially) is _________ . (Answer in integer)


int main( )
{
    int x = 0,i=0;
    scanf("%d", &x);
    for(i=0; i<20;i++)
    {
        x=x+20;
        printf("%d\n", x);
    }
    return 0;
}
45

A computer has two processors, $M_1$ and $M_2$. Four processes $P_1, P_2, P_3, P_4$ with CPU bursts of $20,16,25$, and 10 milliseconds, respectively, arrive at the same time and these are the only processes in the system. The scheduler uses non-preemptive priority scheduling, with priorities decided as follows:

$\bullet$ $M_1$ uses priority of execution for the processes as, $P_1>P_3>P_2>P_4$, i.e., $P_1$ and $P_4$ have highest and lowest priorities, respectively.

$\bullet$ $M_2$ uses priority of execution for the processes as, $P_2>P_3>P_4>P_1$, i.e., $P_2$ and $P_1$ have highest and lowest priorities, respectively.

A process $P_i$ is scheduled to a processor $M_k$, if the processor is free and no other process $P_j$ is waiting with higher priority. At any given point of time, a process can be allocated to any one of the free processors without violating the execution priority rules. Ignore the context switch time. What will be the average waiting time of the processes in milliseconds?

46

In optimal page replacement algorithm, information about all future page references is available to the operating system (OS). A modification of the optimal page replacement algorithm is as follows:

The OS correctly predicts only up to next 4 page references (including the current page) at the time of allocating a frame to a page.

A process accesses the pages in the following order of page numbers:

$$1,3,2,4,2,3,1,2,4,3,1,4$$

If the system has three memory frames that are initially empty, the number of page faults that will occur during execution of the process is __________ (Answer in integer)

47
 #include < stdio.h>
void foo(int *p, int x) {
    *p = x;
}
int main( ) {
    int *z;
    int a = 20, b=25;
    z = &a;
    foo(z, b);
    printf("%d", a);
    return 0;
}

The output of the given C program is _________. (Answer in integer)

48
#include <stdio.h>
int foo(int S[ ], int size) {
    if(size == 0) return 0;
    if(size == 1) return 1;
    if(S[0]!=S[1]) return 1 + foo(S + 1, size - 1);
    return foo(S + 1, size - 1);
}
int main( ) {
    int A[] ={0,1,2,2,2,0,0,1,1};
    printf("%d", foo(A, 9));
    return 0;
}

The value printed by the given C program is _________. (Answer in integer)

49

Consider the following C program :

#include < stdio.h>
int gate (int n) {
    int d, t, newnum, turn;
    newnum = turn = 0; t=1;
    while (n>= t) t*= 10;
    t/=10;
    while (t>0) {
        d=n/t;
        n=n%t;
        t/= 10;
        if (turn) newnum = 10*newnum + d;
        turn = (turn + 1) % 2;
    }
    return newnum;
}
int main( ) {
    printf("%d", gate(14362));
    return 0;
}

The value printed by the given C program is _________. (Answer in integer)

50

Consider the following context-free grammar $G$, where $S, A$, and $B$ are the variables (nonterminals), $a$ and $b$ are the terminal symbols, $S$ is the start variable, and the rules of $G$ are described as:

$$\begin{aligned} & S \rightarrow a a B \mid A b b \\ & A \rightarrow a \mid a A \\ & B \rightarrow b \mid b B \end{aligned}$$

Which ONE of the languages $L(G)$ is accepted by $G$ ?

51

A regular language $L$ is accepted by a non-deterministic finite automaton (NFA) with $n$ states. Which of the following statement(s) is/are FALSE?

52

Consider the following two languages over the alphabet $\{a, b\}$ :

$$\begin{aligned} & L_1=\left\{\alpha \beta \alpha \mid \alpha \in\{a, b\}^{+} \text {AND } \beta \in\{a, b\}^{+}\right\} \\ & L_2=\left\{\alpha \beta \alpha \mid \alpha \in\{a\}^{+} \text {AND } \beta \in\{a, b\}^{+}\right\} \end{aligned}$$

Which ONE of the following statements is CORRECT?

53

Consider the following two languages over the alphabet $\{a, b, c\}$, where $m$ and $n$ are natural numbers.

$$\begin{aligned} & L_1=\left\{a^m b^m c^{m+n} \mid m, n \geq 1\right\} \\ & L_2=\left\{a^m b^n c^{m+n} \mid m, n \geq 1\right\} \end{aligned}$$

Which ONE of the following statements is CORRECT?

54

Consider the following deterministic finite automaton (DFA) defined over the alphabet, $\Sigma=\{a, b\}$. Identify which of the following language(s) is/are accepted by the given DFA.

GATE CSE 2025 Set 1 Theory of Computation - Finite Automata and Regular Language Question 3 English

55

Consider a finite state machine (FSM) with one input $X$ and one output $f$, represented by the given state transition table. The minimum number of states required to realize this FSM is ________ . (Answer in integer)

Present state Next state Output $f$
$X = 0$ $X = 1$ $X = 0$ $X = 1$
A F B 0 0
B D C 0 0
C F E 0 0
D G A 1 0
E D C 0 0
F F B 1 1
G G H 0 1
H G A 1 0

General Aptitude

1

Ravi had __________ younger brother who taught at __________ university. He was widely regarded as _________ honorable man.

Select the option with the correct sequence of articles to fill in the blanks.

2

The CEO's decision to downsize the workforce was considered $$\underline {myopic} $$ because it sacrificed long-term stability to accommodate short-term gains.

Select the most appropriate option that can replace the word "myopic" without changing the meaning of the sentence.

3

The average marks obtained by a class in an examination were calculated as 30.8 . However, while checking the marks entered, the teacher found that the marks of one student were entered incorrectly as 24 instead of 42 . After correcting the marks, the average becomes 31.4. How many students does the class have?

4

Consider the relationships among $P, Q, R, S$, and $T$ :

$\bullet$ $P$ is the brother of $Q$.

$\bullet$ $S$ is the daughter of $Q$.

$\bullet$ $T$ is the sister of $S$.

$\bullet$ $R$ is the mother of $Q$.

The following statements are made based on the relationships given above.

(1) $R$ is the grandmother of $S$.

(2) $P$ is the uncle of $S$ and $T$.

(3)$R$ has only one son.

(4) $Q$ has only one daughter.

Which one of the following options is correct?

5

According to the map shown in the figure, which one of the following statements is correct?

Note: The figure shown is representative.

GATE CSE 2025 Set 1 General Aptitude - Logical Reasoning Question 8 English

6

"I put the brown paper in my pocket along with the chalks, and possibly other things. I suppose every one must have reflected how primeval and how poetical are the things that one carries in one's pocket: the pocket-knife, for instance the type of all human tools, the infant of the sword. Once I planned to write a book of poems entirely about the things in my pocket. But I found it would be too long: and the age of the great epics is past."

(From G.K. Chesterton's "A Piece of Chalk")

Based only on the information provided in the above passage, which one of the following statements is true?

7

In the diagram, the lines QR and ST are parallel to each other. The shortest distance between these two lines is half the shortest distance between the point $P$ and line QR. What is the ratio of the area of the triangle PST to the area of the trapezium SQRT?

Note: The figure shown is representative.

GATE CSE 2025 Set 1 General Aptitude - Numerical Ability Question 5 English

8

A fair six-faced dice, with the faces labelled ' 1 ', ' 2 ', ' 3 ', ' 4 ', ' 5 ', and ' 6 ', is rolled thrice. What is the probability of rolling ' 6 ' exactly once?

9

A square paper, shown in figure (I), is folded along the dotted lines as shown in the figures (II) and (III). Then a few cuts are made as shown in figure (IV). Which one of the following patterns will be obtained when the paper is unfolded?

Note: The figures shown are representative.

GATE CSE 2025 Set 1 General Aptitude - Logical Reasoning Question 6 English

10

A shop has 4 distinct flavors of ice-cream. One can purchase any number of scoops of any flavor. The order in which the scoops are purchased is inconsequential. If one wants to purchase 3 scoops of ice-cream, in how many ways can one make that purchase?

EXAM MAP
Medical
NEETAIIMS
Graduate Aptitude Test in Engineering
GATE CSEGATE ECEGATE EEGATE MEGATE CEGATE PIGATE IN
Civil Services
UPSC Civil Service
Defence
NDA
Staff Selection Commission
SSC CGL Tier I
CBSE
Class 12