The GATE Grind

GATE 2021 CS – Previous Year Questions with Solutions

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

Practise this paper in The GATE Grind →

  1. Question 1 (1 mark, Multiple choice) – The ratio of boys to girls in a class is 7 to 3. Among the options below, an acceptable value for the total number of students in the class is:
  2. Question 2 (1 mark, Multiple choice) – A polygon is convex if, for every pair of points, P and Q belonging to the polygon, the line segment PQ lies completely inside or on the polygon.…
  3. Question 3 (1 mark, Multiple choice) – Consider the following sentences: (i) Everybody in the class is prepared for the exam. (ii) Babu invited Danish to his home because he enjoys playing…
  4. Question 4 (1 mark, Multiple choice) – A circular sheet of paper is folded along the lines in the directions shown (first fold along the vertical diameter, then along the horizontal…
  5. Question 5 (1 mark, Multiple choice) – is to surgery as writer is to . Which one of the following options maintains a similar logical relation in the above sentence?
  6. Question 6 (2 marks, Multiple choice) – We have 2 rectangular sheets of paper, M and N, of dimensions 6 cm x 1 cm each. Sheet M is rolled to form an open cylinder by bringing the short edges…
  7. Question 7 (2 marks, Multiple choice) – Details of prices of two items P and Q are presented in the table: P has cost ₹5,400, marked price ₹5,860; Q has profit 25%, marked price ₹10,000…
  8. Question 8 (2 marks, Multiple choice) – There are five bags each containing identical sets of ten distinct chocolates. One chocolate is picked from each bag. The probability that at least…
  9. Question 9 (2 marks, Multiple choice) – Given below are two statements 1 and 2, and two conclusions I and II. Statement 1: All bacteria are microorganisms. Statement 2: All pathogens are…
  10. Question 10 (2 marks, Multiple choice) – Some people suggest anti-obesity measures (AOM) such as displaying calorie information in restaurant menus. Such measures sidestep addressing the core…
  11. Question 11 (1 mark, Multiple choice) – Suppose that L 1 is a regular language and L 2 is a context-free language. Which one of the following languages is NOT necessarily context-free?
  12. Question 12 (1 mark, Multiple choice) – Let P be an array containing n integers. Let t be the lowest upper bound on the number of comparisons of the array elements, required to find the…
  13. Question 13 (1 mark, Multiple choice) – Consider the following three functions. f 1 = 10n, f 2 = n n, f 3 = nn Which one of the following options arranges the functions in the increasing…
  14. Question 14 (1 mark, Multiple choice) – Consider the following statements. S 1: The sequence of procedure calls corresponds to a preorder traversal of the activation tree. S 2: The sequence…
  15. Question 15 (1 mark, Multiple choice) – Consider the following statements. S 1: Every SLR(1) grammar is unambiguous but there are certain unambiguous grammars that are not SLR(1). S 2: For…
  16. Question 16 (1 mark, Multiple choice) – Let the representation of a number in base 3 be 210. What is the hexadecimal representation of the number?
  17. Question 17 (1 mark, Multiple choice) – Let p and q be two propositions. Consider the following two formulae in propositional logic. S 1: ( p (p q)) q S 2: q ( p (p q)) Which one of the…
  18. Question 18 (1 mark, Multiple choice) – Consider the following two statements. S 1: Destination MAC address of an ARP reply is a broadcast address. S 2: Destination MAC address of an ARP…
  19. Question 19 (1 mark, Multiple choice) – Consider the following array: [23, 32, 45, 69, 72, 73, 89, 97]. Which algorithm out of the following options uses the least number of comparisons…
  20. Question 20 (1 mark, Multiple choice) – A binary search tree T contains n distinct elements. What is the time complexity of picking an element in T that is smaller than the maximum element…
  21. Question 21 (1 mark, Multiple select) – In the context of operating systems, which of the following statements is/are correct with respect to paging?
  22. Question 22 (1 mark, Multiple select) – Let M denote an encoding of an automaton M. Suppose that = \0,1\. Which of the following languages is/are NOT recursive?
  23. Question 23 (1 mark, Multiple select) – Suppose a database system crashes again while recovering from a previous crash. Assume checkpointing is not done by the database either during the…
  24. Question 24 (1 mark, Multiple select) – Which of the following standard C library functions will always invoke a system call when executed from a single-threaded process in a UNIX/Linux…
  25. Question 25 (1 mark, Multiple select) – Consider a linear list based directory implementation in a file system. Each directory is a list of nodes, where each node contains the file name…
  26. Question 26 (1 mark, Numerical answer) – In an undirected connected planar graph G, there are eight vertices and five faces. The number of edges in G is .
  27. Question 27 (1 mark, Numerical answer) – Consider the following undirected graph (a 3x3 grid of vertices, 12 edges) with edge weights: top row horizontal edges 0.1, 0.1; second row horizontal…
  28. Question 28 (1 mark, Numerical answer) – The lifetime of a component of a certain type is a random variable whose probability density function is exponentially distributed with parameter 2.…
  29. Question 29 (1 mark, Numerical answer) – There are 6 jobs with distinct difficulty levels, and 3 computers with distinct processing speeds. Each job is assigned to a computer such that: - The…
  30. Question 30 (1 mark, Numerical answer) – Consider the following expression. x -3 2x+22-4x+3 The value of the above expression (rounded to 2 decimal places) is .
  31. Question 31 (1 mark, Numerical answer) – Consider the following sequence of operations on an empty stack. push(54); push(52); pop(); push(55); push(62); s = pop(); Consider the following…
  32. Question 32 (1 mark, Numerical answer) – Consider a computer system with a byte-addressable primary memory of size 232 bytes. Assume the computer system has a direct-mapped cache of size 32…
  33. Question 33 (1 mark, Numerical answer) – A relation r(A, B) in a relational database has 1200 tuples. The attribute A has integer values ranging from 6 to 20, and the attribute B has integer…
  34. Question 34 (1 mark, Numerical answer) – Consider the following representation of a number in IEEE 754 single-precision floating point format with a bias of 127. S: 1 E: 10000001 F:…
  35. Question 35 (1 mark, Numerical answer) – Three processes arrive at time zero with CPU bursts of 16, 20 and 10 milliseconds. If the scheduler has prior knowledge about the length of the CPU…
  36. Question 36 (2 marks, Multiple choice) – Consider the following grammar (that admits a series of declarations, followed by expressions) and the associated syntax directed translation (SDT)…
  37. Question 37 (2 marks, Multiple choice) – The following relation records the age of 500 employees of a company, where empNo (indicating the employee number) is the key: empAge(empNo, age).…
  38. Question 38 (2 marks, Multiple choice) – Consider a 3-bit counter, designed using T flip-flops, with the clock going to T P; T P = R', T Q = P' (Q clocked by P' path), T R = Q' path as shown…
  39. Question 39 (2 marks, Multiple choice) – Assume that a 12-bit Hamming codeword consisting of 8-bit data and 4 check bits is d 8d 7d 6d 5c 8d 4d 3d 2c 4d 1c 2c 1, where the data bits and the…
  40. Question 40 (2 marks, Multiple choice) – Consider the following recurrence relation. T(n) = T(n/2) + T(2n/5) + 7n if n>0; T(n)=1 if n=0. Which one of the following options is correct?
  41. Question 41 (2 marks, Multiple choice) – Consider the following context-free grammar where the set of terminals is a, b, c, d, f. S -> d a T R f T -> a S b a T epsilon R -> c a T R epsilon…
  42. Question 42 (2 marks, Multiple choice) – Let r i(z) and w i(z) denote read and write operations respectively on a data item z by a transaction T i. Consider the following two schedules. S 1:…
  43. Question 43 (2 marks, Multiple choice) – Consider the relation R(P,Q,S,T,X,Y,Z,W) with the following functional dependencies. PQ X;\ P YX;\ Q Y;\ Y ZW Consider the decomposition of the…
  44. Question 44 (2 marks, Multiple choice) – Let G be a group of order 6, and H be a subgroup of G such that 1 < H < 6. Which one of the following options is correct?
  45. Question 45 (2 marks, Multiple choice) – Consider the two statements. S 1: There exist random variables X and Y such that (E[(X-E(X))(Y-E(Y))])2 > Var[X]Var[Y] S 2: For all random variables X…
  46. Question 46 (2 marks, Multiple choice) – Let G=(V,E) be an undirected unweighted connected graph. The diameter of G is defined as diam(G)= u,v V\length of shortest path between u and v\. Let…
  47. Question 47 (2 marks, Multiple choice) – Consider the following ANSI C program. Which one of the following options is correct?
  48. Question 48 (2 marks, Multiple choice) – Consider the following language. L = \w \0,1\* w ends with the substring 011\ Which one of the following deterministic finite automata accepts L?
  49. Question 49 (2 marks, Multiple choice) – For a Turing machine M, M denotes an encoding of M. Consider the following two languages. L 1 = \ M M takes more than 2021 steps on all inputs\ L 2 =…
  50. Question 50 (2 marks, Multiple select) – Define R n to be the maximum amount earned by cutting a rod of length n meters into one or more pieces of integer length and selling them. For i>0,…
  51. Question 51 (2 marks, Multiple select) – An articulation point in a connected graph is a vertex such that removing the vertex and its incident edges disconnects the graph into two or more…
  52. Question 52 (2 marks, Multiple select) – Consider the following Boolean expression. F = (X+Y+Z)(X+Y)(Y+Z) Which of the following Boolean expressions is/are equivalent to F (complement of F)?
  53. Question 53 (2 marks, Multiple select) – A relation R is said to be circular if aRb and bRc together imply cRa. Which of the following options is/are correct?
  54. Question 54 (2 marks, Multiple select) – A TCP server application is programmed to listen on port number P on host S. A TCP client is connected to the TCP server over the network. Consider…
  55. Question 55 (2 marks, Multiple select) – Consider two hosts P and Q connected through a router R. The maximum transfer unit (MTU) value of the link between P and R is 1500 bytes, and between…
  56. Question 56 (2 marks, Multiple select) – Consider the following pseudocode, where S is a semaphore initialized to 5 in line#2 and counter is a shared variable initialized to 0 in line#1.…
  57. Question 57 (2 marks, Multiple select) – Consider a dynamic hashing approach for 4-bit integer keys: (1) There is a main hash table of size 4. (2) The 2 least significant bits of a key are…
  58. Question 58 (2 marks, Numerical answer) – Consider the following ANSI C function: Let Z be an array of 10 elements with Z[i]=1, for all i such that 0 i 9. The value returned by…
  59. Question 59 (2 marks, Numerical answer) – Consider the sliding window flow-control protocol operating between a sender and a receiver over a full-duplex error-free link. Assume the following:…
  60. Question 60 (2 marks, Numerical answer) – Consider the following C code segment: In a compiler, this code segment is represented internally as a directed acyclic graph (DAG). The number of…
  61. Question 61 (2 marks, Numerical answer) – In a pushdown automaton P=(Q,,,,q 0,F), a transition of the form p a, X Y q represents (q,Y)(p,a,X). Consider the following pushdown automaton over…
  62. Question 62 (2 marks, Numerical answer) – Consider the following matrix. pmatrix 0&1&1&1\\ 1&0&1&1\\ 1&1&0&1\\ 1&1&1&0 pmatrix The largest eigenvalue of the above matrix is .
  63. Question 63 (2 marks, Numerical answer) – A five-stage pipeline has stage delays of 150, 120, 150, 160 and 140 nanoseconds. The registers that are used between the pipeline stages have a delay…
  64. Question 64 (2 marks, Numerical answer) – A sender (S) transmits a signal, which can be one of the two kinds: H and L with probabilities 0.1 and 0.9 respectively, to a receiver (R). In the…
  65. Question 65 (2 marks, Numerical answer) – Consider the following instruction sequence where registers R1, R2 and R3 are general purpose and MEMORY[X] denotes the content at the memory location…