GATE CSE 2025 — Previous Year Questions
Real questions from the 2025 paper with options and answers. Take a timed test →
41 questions · page 1 of 2
Q1 · Computer Science & IT
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?- A.(iii), (i), (ii)
- B.(i), (iii), (ii) Organising Institute: IIT Roorkee Page 11 of 64
- C.(i), (ii), (iii)
- D.(iii), (ii), (i) Organising Institute: IIT Roorkee Page 12 of 64
Show answer / उत्तर देखें
Answer: A (iii), (i), (ii)
Official GATE 2025 answer key: (A).Q2 · Computer Science & IT
Which ONE of the following statements is FALSE regarding the symbol table?- A.Symbol table is responsible for keeping track of the scope of variables.
- B.Symbol table can be implemented using a binary search tree.
- C.Symbol table is not required after the parsing phase.
- D.Symbol table is created during the lexical analysis phase. Organising Institute: IIT Roorkee Page 13 of 64
Show answer / उत्तर देखें
Answer: C Symbol table is not required after the parsing phase.
Official GATE 2025 answer key: (C).Q3 · Computer Science & IT
Which ONE of the following techniques used in compiler code optimization uses live variable analysis?- A.Run-time function call management
- B.Register assignment to variables
- C.Strength reduction
- D.Constant folding Organising Institute: IIT Roorkee Page 14 of 64
Show answer / उत्तर देखें
Answer: B Register assignment to variables
Official GATE 2025 answer key: (B).Q4 · Computer Science & IT
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?- A.221
- B.220
- C.222
- D.224 Organising Institute: IIT Roorkee Page 15 of 64
Show answer / उत्तर देखें
Answer: A 221
Official GATE 2025 answer key: (A).Q5 · Computer Science & IT
A schedule of three database transactions 𝑇1, 𝑇2, and 𝑇3 is shown. 𝑅𝑖(𝐴) and 𝑊𝑖(𝐴) denote read and write of data item 𝐴 by transaction 𝑇𝑖, 𝑖 = 1,2,3. The transaction 𝑇1 aborts at the end. Which other transaction(s) will be required to be rolled back? 𝑅1(𝑋) 𝑊1(𝑌) 𝑅2(𝑋) 𝑅2(𝑌) 𝑅3(𝑌) 𝐴𝐵𝑂𝑅𝑇(𝑇1)- A.Only 𝑇2
- B.Only 𝑇3
- C.Both 𝑇2 and 𝑇3
- D.Neither 𝑇2 nor 𝑇3 Organising Institute: IIT Roorkee Page 16 of 64
Show answer / उत्तर देखें
Answer: C Both 𝑇2 and 𝑇3
Official GATE 2025 answer key: (C).Q6 · Computer Science & IT
𝑔(. ) is a function from 𝐴 to 𝐵, 𝑓(. ) is a function from 𝐵 to 𝐶, and their composition defined as 𝑓(𝑔(. )) is a mapping from 𝐴 to 𝐶. If 𝑓(. ) and 𝑓(𝑔(. )) are onto (surjective) functions, which ONE of the following is TRUE about the function 𝑔(. )?- A.𝑔(. ) must be an onto (surjective) function.
- B.𝑔(. ) must be a one-to-one (injective) function.
- C.𝑔(. ) must be a bijective function, that is, both one-to-one and onto.
- D.𝑔(. ) is not required to be a one-to-one or onto function. Organising Institute: IIT Roorkee Page 18 of 64
Show answer / उत्तर देखें
Answer: D 𝑔(. ) is not required to be a one-to-one or onto function. Organising Institute: IIT Roorkee Page 18 of 64
Official GATE 2025 answer key: (D).Q7 · Computer Science & IT
Let 𝐺 be any undirected graph with positive edge weights, and 𝑇 be a minimum spanning tree of 𝐺. For any two vertices, 𝑢 and 𝑣, let 𝑑1(𝑢, 𝑣) and 𝑑2(𝑢, 𝑣) be the shortest distances between 𝑢 and 𝑣 in 𝐺 and 𝑇, respectively. Which ONE of the options is CORRECT for all possible 𝐺, 𝑇, 𝑢 and 𝑣?- A.𝑑1(𝑢, 𝑣) = 𝑑2(𝑢, 𝑣)
- B.𝑑1(𝑢, 𝑣) ≤ 𝑑2(𝑢, 𝑣)
- C.𝑑1(𝑢, 𝑣) ≥ 𝑑2(𝑢, 𝑣)
- D.𝑑1(𝑢, 𝑣) ≠ 𝑑2(𝑢, 𝑣) Organising Institute: IIT Roorkee Page 19 of 64
Show answer / उत्तर देखें
Answer: B 𝑑1(𝑢, 𝑣) ≤ 𝑑2(𝑢, 𝑣)
Official GATE 2025 answer key: (B).Q8 · Computer Science & IT
Consider the following context-free grammar 𝐺, where 𝑆, 𝐴, and 𝐵 are the variables (non-terminals), 𝑎 and 𝑏 are the terminal symbols, 𝑆 is the start variable, and the rules of 𝐺 are described as: 𝑆 → 𝑎𝑎𝐵 | 𝐴𝑏𝑏 𝐴 → 𝑎 | 𝑎𝐴 𝐵 → 𝑏 | 𝑏𝐵 Which ONE of the languages 𝐿(𝐺) is accepted by 𝐺?- A.𝐿(𝐺) = {𝑎2𝑏𝑛 | 𝑛 ≥ 1} ∪ {𝑎𝑛𝑏2 | 𝑛 ≥ 1}
- B.𝐿(𝐺) = {𝑎𝑛𝑏2𝑛 | 𝑛 ≥ 1} ∪ {𝑎2𝑛𝑏𝑛 | 𝑛 ≥ 1}
- C.𝐿(𝐺) = {𝑎𝑛𝑏𝑛 | 𝑛 ≥ 1}
- D.𝐿(𝐺) = {𝑎2𝑛𝑏2𝑛 | 𝑛 ≥ 1} Organising Institute: IIT Roorkee Page 20 of 64
Show answer / उत्तर देखें
Answer: A 𝐿(𝐺) = {𝑎2𝑏𝑛 | 𝑛 ≥ 1} ∪ {𝑎𝑛𝑏2 | 𝑛 ≥ 1}
Official GATE 2025 answer key: (A).Q9 · Computer Science & IT
Consider the following recurrence relation: 𝑇(𝑛) = 2𝑇(𝑛 − 1) + 𝑛2𝑛 for 𝑛 > 0, 𝑇(0) = 1. Which ONE of the following options is CORRECT?- A.𝑇(𝑛) = Θ(𝑛22𝑛)
- B.𝑇(𝑛) = Θ(𝑛2𝑛)
- C.𝑇(𝑛) = Θ((log 𝑛)2 2𝑛)
- D.𝑇(𝑛) = Θ(4𝑛) Organising Institute: IIT Roorkee Page 21 of 64
Show answer / उत्तर देखें
Answer: A 𝑇(𝑛) = Θ(𝑛22𝑛)
Official GATE 2025 answer key: (A).Q10 · Computer Science & IT
Consider a memory system with 1M bytes of main memory and 16K 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, 1K=210, 1M=220 .]- A.6 × 210
- B.8 × 210
- C.212
- D.214 Organising Institute: IIT Roorkee Page 37 of 64
Show answer / उत्तर देखें
Answer: A 6 × 210
Official GATE 2025 answer key: (A).Q11 · Computer Science & IT
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? ADD R1, #25 // R1 = R1 + 25- A.16
- B.20
- C.22
- D.24 Organising Institute: IIT Roorkee Page 38 of 64
Show answer / उत्तर देखें
Answer: B 20
Official GATE 2025 answer key: (B).Q12 · Computer Science & IT
A computer has two processors, 𝑀1 and 𝑀2. Four processes 𝑃1, 𝑃2, 𝑃3, 𝑃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: • 𝑀1 uses priority of execution for the processes as, 𝑃1 > 𝑃3 > 𝑃2 > 𝑃4, i.e., 𝑃1 and 𝑃4 have highest and lowest priorities, respectively. • 𝑀2 uses priority of execution for the processes as, 𝑃2 > 𝑃3 > 𝑃4 > 𝑃1, i.e., 𝑃2 and 𝑃1 have highest and lowest priorities, respectively. A process 𝑃𝑖 is scheduled to a processor 𝑀𝑘, if the processor is free and no other process 𝑃𝑗 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?- A.9.00
- B.8.75
- C.6.50
- D.7.50 Organising Institute: IIT Roorkee Page 39 of 64
Show answer / उत्तर देखें
Answer: A 9.00
Official GATE 2025 answer key: (A).Q13 · Computer Science & IT
Consider two relations describing 𝑡𝑒𝑎𝑚𝑠 and 𝑝𝑙𝑎𝑦𝑒𝑟𝑠 in a sports league: • 𝑡𝑒𝑎𝑚𝑠(𝑡𝑖𝑑, 𝑡𝑛𝑎𝑚𝑒): 𝑡𝑖𝑑, 𝑡𝑛𝑎𝑚e are team-id and team-name, respectively • 𝑝𝑙𝑎𝑦𝑒𝑟𝑠(𝑝𝑖𝑑, 𝑝𝑛𝑎𝑚𝑒, 𝑡𝑖𝑑): 𝑝𝑖𝑑, 𝑝𝑛𝑎𝑚𝑒, and 𝑡𝑖𝑑 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 𝑡𝑛𝑎𝑚𝑒 as ′𝑀𝐼′?- A.{ 𝑝. 𝑝𝑛𝑎𝑚𝑒 | 𝑝 ∈ 𝑝𝑙𝑎𝑦𝑒𝑟𝑠 ∧ ∃𝑡 (𝑡 ∈ 𝑡𝑒𝑎𝑚𝑠 ∧ 𝑝. 𝑡𝑖𝑑 = 𝑡. 𝑡𝑖𝑑 ∧ 𝑡. 𝑡𝑛𝑎𝑚𝑒 = ′𝑀𝐼′)}
- B.{ 𝑝. 𝑝𝑛𝑎𝑚𝑒 | 𝑝 ∈ 𝑡𝑒𝑎𝑚𝑠 ∧ ∃𝑡 (𝑡 ∈ 𝑝𝑙𝑎𝑦𝑒𝑟𝑠 ∧ 𝑝. 𝑡𝑖𝑑 = 𝑡. 𝑡𝑖𝑑 ∧ 𝑡. 𝑡𝑛𝑎𝑚𝑒 = ′𝑀𝐼′)}
- C.{ 𝑝. 𝑝𝑛𝑎𝑚𝑒 | 𝑝 ∈ 𝑝𝑙𝑎𝑦𝑒𝑟𝑠 ∧ ∃𝑡 (𝑡 ∈ 𝑡𝑒𝑎𝑚𝑠 ∧ 𝑡. 𝑡𝑛𝑎𝑚𝑒 = ′𝑀𝐼′)}
- D.{ 𝑝. 𝑝𝑛𝑎𝑚𝑒 | 𝑝 ∈ 𝑡𝑒𝑎𝑚𝑠 ∧ ∃𝑡 (𝑡 ∈ 𝑝𝑙𝑎𝑦𝑒𝑟𝑠 ∧ 𝑡. 𝑡𝑛𝑎𝑚𝑒 = ′𝑀𝐼′)} Organising Institute: IIT Roorkee Page 40 of 64
Show answer / उत्तर देखें
Answer: A { 𝑝. 𝑝𝑛𝑎𝑚𝑒 | 𝑝 ∈ 𝑝𝑙𝑎𝑦𝑒𝑟𝑠 ∧ ∃𝑡 (𝑡 ∈ 𝑡𝑒𝑎𝑚𝑠 ∧ 𝑝. 𝑡𝑖𝑑 = 𝑡. 𝑡𝑖𝑑 ∧ 𝑡. 𝑡𝑛𝑎𝑚𝑒 = ′𝑀𝐼′)}
Official GATE 2025 answer key: (A).Q14 · Computer Science & IT
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?- A.E3
- B.E1
- C.E2
- D.E5 Organising Institute: IIT Roorkee Page 41 of 64
Show answer / उत्तर देखें
Answer: A E3
Official GATE 2025 answer key: (A).Q15 · Computer Science & IT
Let 𝐴 be a 2 × 2 matrix as given. 𝐴 = [ 1 1 1 −1 ] What are the eigenvalues of the matrix 𝐴13 ?- A.1, −1
- B.2√2, −2√2
- C.4√2, −4√2
- D.64√2, −64√2 Organising Institute: IIT Roorkee Page 42 of 64
Show answer / उत्तर देखें
Answer: D 64√2, −64√2 Organising Institute: IIT Roorkee Page 42 of 64
Official GATE 2025 answer key: (D).Q16 · Computer Science & IT
Consider the following four variable Boolean function in sum-of-product form 𝐹(𝑏3, 𝑏2, 𝑏1, 𝑏0) = ∑(0, 2, 4, 8, 10, 11, 12). where the value of the function is computed by considering 𝑏3𝑏2𝑏1𝑏0 as a 4-bit binary number, where 𝑏3 denotes the most significant bit and 𝑏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 𝐹?- A.𝑏̅1𝑏̅0 + 𝑏̅2𝑏̅0 + 𝑏1 𝑏̅2𝑏3
- B.𝑏̅1 𝑏̅0 + 𝑏̅2 𝑏̅0
- C.𝑏̅2𝑏̅0 + 𝑏1𝑏2𝑏3
- D.𝑏̅0𝑏̅2 + 𝑏̅3 Organising Institute: IIT Roorkee Page 43 of 64
Show answer / उत्तर देखें
Answer: A 𝑏̅1𝑏̅0 + 𝑏̅2𝑏̅0 + 𝑏1 𝑏̅2𝑏3
Official GATE 2025 answer key: (A).Q17 · Computer Science & IT
Let 𝐺(𝑉, 𝐸) be an undirected and unweighted graph with 100 vertices. Let 𝑑(𝑢, 𝑣) denote the number of edges in a shortest path between vertices 𝑢 and 𝑣 in 𝑉. Let the maximum value of 𝑑(𝑢, 𝑣), 𝑢, 𝑣 ∈ 𝑉 such that 𝑢 ≠ 𝑣, be 30. Let 𝑇 be any breadth- first-search tree of 𝐺. Which ONE of the given options is CORRECT for every such graph 𝐺?- A.The height of 𝑇 is exactly 15.
- B.The height of 𝑇 is exactly 30.
- C.The height of 𝑇 is at least 15.
- D.The height of 𝑇 is at least 30. Organising Institute: IIT Roorkee Page 44 of 64
Show answer / उत्तर देखें
Answer: C The height of 𝑇 is at least 15.
Official GATE 2025 answer key: (C).Q18 · Computer Science & IT
Consider the following two languages over the alphabet {𝑎, 𝑏}: 𝐿1 = { 𝛼𝛽𝛼 | 𝛼 ∈ {𝑎, 𝑏}+ AND 𝛽 ∈ {𝑎, 𝑏}+ } 𝐿2 = { 𝛼𝛽𝛼 | 𝛼 ∈ {𝑎}+ AND 𝛽 ∈ {𝑎, 𝑏}+ } Which ONE of the following statements is CORRECT?- A.Both 𝐿1 and 𝐿2 are regular languages.
- B.𝐿1 is a regular language but 𝐿2 is not a regular language.
- C.𝐿1 is not a regular language but 𝐿2 is a regular language.
- D.Neither 𝐿1 nor 𝐿2 is a regular language. Organising Institute: IIT Roorkee Page 45 of 64
Show answer / उत्तर देखें
Answer: C 𝐿1 is not a regular language but 𝐿2 is a regular language.
Official GATE 2025 answer key: (C).Q19 · Computer Science & IT
Consider the following two languages over the alphabet {𝑎, 𝑏, 𝑐}, where 𝑚 and 𝑛 are natural numbers. 𝐿1 = {𝑎𝑚𝑏𝑚𝑐𝑚+𝑛 | 𝑚, 𝑛 ≥ 1} 𝐿2 = {𝑎𝑚𝑏𝑛𝑐𝑚+𝑛 | 𝑚, 𝑛 ≥ 1} Which ONE of the following statements is CORRECT?- A.Both 𝐿1 and 𝐿2 are context-free languages.
- B.𝐿1 is a context-free language but 𝐿2 is not a context-free language.
- C.𝐿1 is not a context-free language but 𝐿2 is a context-free language.
- D.Neither 𝐿1 nor 𝐿2 are context-free languages. Organising Institute: IIT Roorkee Page 46 of 64
Show answer / उत्तर देखें
Answer: C 𝐿1 is not a context-free language but 𝐿2 is a context-free language.
Official GATE 2025 answer key: (C).Q20 · Computer Science & IT
If 𝐴 = (1 2 2 −1), then which ONE of the following is 𝐴8 ?- A.(25 0 0 25)
- B.(125 0 0 125)
- C.(625 0 0 625)
- D.(3125 0 0 3125)
Show answer / उत्तर देखें
Answer: C (625 0 0 625)
Official GATE 2025 answer key: (C).Q21 · Computer Science & IT
The value of 𝑥 such that 𝑥 > 1, satisfying the equation ∫ 𝑡 ln 𝑡 𝑑𝑡 = 1 4 𝑥 1 is- A.√𝑒
- B.𝑒
- C.𝑒2
- D.𝑒 − 1 Organising Institute: IIT Roorkee Page 12 of 48
Show answer / उत्तर देखें
Answer: A √𝑒
Official GATE 2025 answer key: (A).Q22 · Computer Science & IT
Consider a binary tree 𝑇 in which every node has either zero or two children. Let 𝑛 > 0 be the number of nodes in 𝑇. Which ONE of the following is the number of nodes in 𝑇 that have exactly two children?- A.𝑛 − 2 2
- B.𝑛 − 1 2
- C.𝑛 2
- D.𝑛 + 1 2 Organising Institute: IIT Roorkee Page 13 of 48
Show answer / उत्तर देखें
Answer: B 𝑛 − 1 2
Official GATE 2025 answer key: (B).Q23 · Computer Science & IT
Let 𝐿, 𝑀, and 𝑁 be non-singular matrices of order 3 satisfying the equations 𝐿2 = 𝐿−1 , 𝑀 = 𝐿8 and 𝑁 = 𝐿2. Which ONE of the following is the value of the determinant of (𝑀 − 𝑁)?- A.0
- B.1
- C.2
- D.3
Show answer / उत्तर देखें
Answer: A 0
Official GATE 2025 answer key: (A).Q24 · Computer Science & IT
Let 𝑃(𝑥) be an arbitrary predicate over the domain of natural numbers. Which ONE of the following statements is TRUE?- A.(𝑃(0) ∧ (∀𝑥 [𝑃(𝑥) ⇒ 𝑃(𝑥 + 1)])) ⇒ (∀𝑥 𝑃(𝑥))
- B.(𝑃(0) ∧ (∀𝑥 [𝑃(𝑥) ⇒ 𝑃(𝑥 − 1)])) ⇒ (∀𝑥 𝑃(𝑥))
- C.(𝑃(1000) ∧ (∀𝑥 [𝑃(𝑥) ⇒ 𝑃(𝑥 − 1)])) ⇒ (∀𝑥 𝑃(𝑥))
- D.(𝑃(1000) ∧ (∀𝑥 [𝑃(𝑥) ⇒ 𝑃(𝑥 + 1)])) ⇒ (∀𝑥 𝑃(𝑥)) Organising Institute: IIT Roorkee Page 14 of 48
Show answer / उत्तर देखें
Answer: A (𝑃(0) ∧ (∀𝑥 [𝑃(𝑥) ⇒ 𝑃(𝑥 + 1)])) ⇒ (∀𝑥 𝑃(𝑥))
Official GATE 2025 answer key: (A).Q25 · Computer Science & IT
Consider the following statements: (i) Address Resolution Protocol (ARP) provides a mapping from an IP address to the corresponding hardware (link-layer) address. (ii) A single TCP segment from a sender S to a receiver R cannot carry both data from S to R and acknowledgement for a segment from R to S. Which ONE of the following is CORRECT?- A.Both (i) and (ii) are TRUE
- B.(i) is TRUE and (ii) is FALSE
- C.(i) is FALSE and (ii) is TRUE
- D.Both (i) and (ii) are FALSE Organising Institute: IIT Roorkee Page 15 of 48
Show answer / उत्तर देखें
Answer: B (i) is TRUE and (ii) is FALSE
Official GATE 2025 answer key: (B).