The GATE Grind

GATE 2025 CS (CS1) – Previous Year Questions with Solutions

All 65 questions of GATE 2025 CS (CS1) with answers and explanations. Read each question, then practise it by topic or as a full paper.

65 questions worth 100 marks in all (30 1-mark, 35 2-mark). Subjects covered: General Aptitude (10), Engineering Mathematics (10), Algorithms (6), Programming and Data Structures (6), Computer Organization and Architecture (5), Operating System (5), Databases (5), Theory of Computation (5).

Practise this paper in The GATE Grind →

  1. Question 1 (1 mark, Multiple choice) – 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…
  2. Question 2 (1 mark, Multiple choice) – The CEO's decision to downsize the workforce was considered myopic because it sacrificed long-term stability to accommodate short-term gains. Select…
  3. Question 3 (1 mark, Multiple choice) – 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…
  4. Question 4 (1 mark, Multiple choice) – Consider the relationships among P, Q, R, S, and T: - P is the brother of Q. - S is the daughter of Q. - T is the sister of S. - R is the mother of Q.…
  5. Question 5 (1 mark, Multiple choice) – According to the map shown in the figure, which one of the following statements is correct? Note: The figure shown is representative.
  6. Question 6 (2 marks, Multiple choice) – "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…
  7. Question 7 (2 marks, Multiple choice) – 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…
  8. Question 8 (2 marks, Multiple choice) – 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…
  9. Question 9 (2 marks, Multiple choice) – 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…
  10. Question 10 (2 marks, Multiple choice) – 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…
  11. Question 11 (1 mark, Multiple choice) – Suppose a program is running on a non-pipelined single processor computer system. The computer is connected to an external device that can interrupt…
  12. Question 12 (1 mark, Multiple choice) – Which ONE of the following statements is FALSE regarding the symbol table?
  13. Question 13 (1 mark, Multiple choice) – Which ONE of the following techniques used in compiler code optimization uses live variable analysis?
  14. Question 14 (1 mark, Multiple choice) – 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…
  15. Question 15 (1 mark, Multiple choice) – 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 =…
  16. Question 16 (1 mark, Multiple choice) – Identify the ONE CORRECT matching between the OSI layers and their corresponding functionalities as shown. OSI Layers: (a) Network layer, (b)…
  17. Question 17 (1 mark, Multiple choice) – 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(.))…
  18. Question 18 (1 mark, Multiple choice) – 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…
  19. Question 19 (1 mark, Multiple choice) – Consider the following context-free grammar G, where S, A, and B are the variables (non-terminals), a and b are the terminal symbols, S is the start…
  20. Question 20 (1 mark, Multiple choice) – Consider the following recurrence relation: T(n) = 2T(n-1) + n2n for n > 0, T(0) = 1. Which ONE of the following options is CORRECT?
  21. Question 21 (1 mark, Multiple select) – 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…
  22. Question 22 (1 mark, Multiple select) – Consider the 3-way handshaking protocol for TCP connection establishment. Let the three packets exchanged during the connection establishment be…
  23. Question 23 (1 mark, Multiple select) – Consider the given system of linear equations for variables x and y, where k is a real-valued constant. Which of the following option(s) is/are…
  24. Question 24 (1 mark, Multiple select) – 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…
  25. Question 25 (1 mark, Multiple select) – 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…
  26. Question 26 (1 mark, Multiple select) – Which of the following statement(s) is/are TRUE for any binary search tree (BST) having n distinct integers?
  27. Question 27 (1 mark, Multiple select) – A partial data path of a processor is given in the figure, where RA, RB, and RZ are 32-bit registers. Which option(s) is/are CORRECT related to…
  28. Question 28 (1 mark, Multiple select) – 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?
  29. Question 29 (1 mark, Numerical answer) – Suppose in a multiprogramming environment, the following C program segment is executed. A process goes into I/O queue whenever an I/O related…
  30. Question 30 (1 mark, Numerical answer) – 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…
  31. Question 31 (1 mark, Numerical answer) – Consider the given function f(x). f(x) = cases ax + b & for x < 1 \\ x3 + x2 + 1 & for x 1 cases If the function is differentiable everywhere, the…
  32. Question 32 (1 mark, Numerical answer) – 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) =…
  33. Question 33 (1 mark, Numerical answer) – The pseudocode of a function fun() is given below: Let A[0,...,29] be an array storing 30 distinct integers in descending order. The number of swap…
  34. Question 34 (1 mark, Numerical answer) – The output of the given C program is . (Answer in integer)
  35. Question 35 (1 mark, Numerical answer) – 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…
  36. Question 36 (2 marks, Multiple choice) – 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…
  37. Question 37 (2 marks, Multiple choice) – 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…
  38. Question 38 (2 marks, Multiple choice) – 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…
  39. Question 39 (2 marks, Multiple choice) – Consider two relations describing teams and players in a sports league: - teams(tid, tname): tid, tname are team-id and team-name, respectively -…
  40. Question 40 (2 marks, Multiple choice) – 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…
  41. Question 41 (2 marks, Multiple choice) – Let A be a 2 2 matrix as given. A = bmatrix 1 & 1 \\ 1 & -1 bmatrix What are the eigenvalues of the matrix A13 ?
  42. Question 42 (2 marks, Multiple choice) – Consider the following four variable Boolean function in sum-of-product form F(b 3,b 2,b 1,b 0) = (0,2,4,8,10,11,12). where the value of the function…
  43. Question 43 (2 marks, Multiple choice) – 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…
  44. Question 44 (2 marks, Multiple choice) – Consider the following two languages over the alphabet \a,b\: L 1 = \ \a,b\+ AND \a,b\+ \ L 2 = \ \a\+ AND \a,b\+ \ Which ONE of the following…
  45. Question 45 (2 marks, Multiple choice) – Consider the following two languages over the alphabet \a,b,c\, where m and n are natural numbers. L 1 = \am bm cm+n m,n 1\ L 2 = \am bn cm+n m,n 1\…
  46. Question 46 (2 marks, Multiple select) – Which of the following statement(s) is/are TRUE while computing First and Follow during top down parsing by a compiler?
  47. Question 47 (2 marks, Multiple select) – Consider a relational schema team(name, city, owner), with functional dependencies \name city,\ name owner\. The relation team is decomposed into two…
  48. Question 48 (2 marks, Multiple select) – Which of the following predicate logic formulae/formula is/are CORRECT representation(s) of the statement: "Everyone has exactly one mother"? The…
  49. Question 49 (2 marks, Multiple select) – A = \0,1,2,3,...\ 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 F, we define (f…
  50. Question 50 (2 marks, Multiple select) – Consider the following deterministic finite automaton (DFA) defined over the alphabet, = \a,b\. Identify which of the following language(s) is/are…
  51. Question 51 (2 marks, Numerical answer) – A disk of size 512M bytes is divided into blocks of 64K bytes. A file is stored in the disk using linked allocation. In linked allocation, each data…
  52. Question 52 (2 marks, Numerical answer) – 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)
  53. Question 53 (2 marks, Numerical answer) – 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…
  54. Question 54 (2 marks, Numerical answer) – In optimal page replacement algorithm, information about all future page references is available to the operating system (OS). A modification of the…
  55. Question 55 (2 marks, Numerical answer) – Consider the following database tables of a sports league. player(pid,pname,age) coach(cid,cname) team(tid,tname,city,cid) members(pid,tid) An…
  56. Question 56 (2 marks, Numerical answer) – 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…
  57. Question 57 (2 marks, Numerical answer) – 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…
  58. Question 58 (2 marks, Numerical answer) – Consider a probability distribution given by the density function P(x). P(x) = cases Cx2, & for 1 x 4 \\ 0, & for x < 1 or x > 4 cases The probability…
  59. Question 59 (2 marks, Numerical answer) – 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…
  60. Question 60 (2 marks, Numerical answer) – Consider the given sequential circuit designed using D-Flip-flops. The circuit is initialized with some value (initial state). The number of distinct…
  61. Question 61 (2 marks, Numerical answer) – The value printed by the given C program is . (Answer in integer)
  62. Question 62 (2 marks, Numerical answer) – Let LIST be a datatype for an implementation of linked list defined as follows: Suppose a program has created two linked lists, L1 and L2, whose…
  63. Question 63 (2 marks, Numerical answer) – Consider the following C program: The value printed by the given C program is . (Answer in integer)
  64. Question 64 (2 marks, Numerical answer) – 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…
  65. Question 65 (2 marks, Numerical answer) – In a double hashing scheme, h 1(k) = k 11 and h 2(k) = 1 + (k 7) are the auxiliary hash functions. The size m of the hash table is 11. The hash…