GATE CS 2021 Set 1 — All 65 Questions with Solutions
Computer Science (CS). Every question from this paper with the official answer key and a step-by-step solution. 100 marks total.
- Question 1General Aptitudemcq1 markThe 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:
- A.21
- B.37
- C.50✓
- D.73
Answer: C
Solution
Boys : girls , so the total is a multiple of . Among the options only is a multiple of . - A.
- Question 2General Aptitudemcq1 markA polygon is convex if, for every pair of points and belonging to the polygon, the line segment lies completely inside or on the polygon. Which one of the following is NOT a convex polygon? (See the figure for options (A)–(D).)

- A.(A)✓
- B.(B)
- C.(C)
- D.(D)
Answer: A
Solution
Shape (A) is an arrow/chevron with a reflex (inward) vertex, so a segment joining two points can pass outside the shape — it is concave. The triangle, square and trapezium are all convex. - A.
- Question 3General Aptitudemcq1 markConsider the following sentences: (i) Everybody in the class is prepared for the exam. (ii) Babu invited Danish to his home because he enjoys playing chess. Which of the following is the CORRECT observation about the above two sentences?
- A.(i) is grammatically correct and (ii) is unambiguous
- B.(i) is grammatically incorrect and (ii) is unambiguous
- C.(i) is grammatically correct and (ii) is ambiguous✓
- D.(i) is grammatically incorrect and (ii) is ambiguous
Answer: C
Solution
Sentence (i) is grammatically correct ("everybody" takes a singular verb "is"). In (ii) the pronoun "he" can refer either to Babu or to Danish, so it is ambiguous. - A.
- Question 4General Aptitudemcq1 markA circular sheet of paper is folded along the lines in the directions shown. The paper, after being punched in the final folded state as shown and unfolded in the reverse order of folding, will look like ______. (See the figure for the folding sequence and options (A)–(D).)

- A.(A)✓
- B.(B)
- C.(C)
- D.(D)
Answer: A
Solution
Unfolding reflects each punched hole across the two fold lines. Reversing the two folds reproduces the pattern of option (A). - A.
- Question 5General Aptitudemcq1 mark______ is to *surgery* as *writer* is to ______. Which one of the following options maintains a similar logical relation in the above sentence?
- A.Plan, outline
- B.Hospital, library
- C.Doctor, book✓
- D.Medicine, grammar
Answer: C
Solution
A doctor performs surgery; a writer produces a book. "Doctor : surgery :: writer : book" preserves the agent–product/activity relation. - A.
- Question 6General Aptitudemcq2 marksWe have 2 rectangular sheets of paper, M and N, of dimensions 6 cm 1 cm each. Sheet M is rolled to form an open cylinder by bringing the short edges of the sheet together. Sheet N is cut into equal square patches and assembled to form the largest possible closed cube. Assuming the ends of the cylinder are closed, the ratio of the volume of the cylinder to that of the cube is ______
- A.
- B.
- C.✓
- D.
Answer: C
Solution
Rolling M (bringing the 1 cm short edges together) gives circumference and height , so . Sheet N has area 6, giving six faces, i.e. a unit cube with . Ratio . - A.
- Question 7General Aptitudemcq2 marksDetails of prices of two items P and Q are presented in the table below. The ratio of cost of item P to cost of item Q is 3:4. Discount is calculated as the difference between the marked price and the selling price. The profit percentage is calculated as the ratio of the difference between selling price and cost, to the cost, i.e. .
The discount on item Q, as a percentage of its marked price, is ______Items Cost (Rs) Profit % Marked Price (Rs) P 5,400 --- 5,860 Q --- 25 10,000- A.25
- B.12.5
- C.10✓
- D.5
Answer: C
Solution
Cost of P = 5400, and cost P : cost Q = 3 : 4, so cost of Q . Profit 25% gives selling price of Q . Discount , which is of the marked price. - A.
- Question 8General Aptitudemcq2 marksThere are five bags each containing identical sets of ten distinct chocolates. One chocolate is picked from each bag. The probability that at least two chocolates are identical is ______
- A.0.3024
- B.0.4235
- C.0.6976✓
- D.0.8125
Answer: C
Solution
P(all five distinct) . Hence P(at least two identical) . - A.
- Question 9General Aptitudemcq2 marksGiven below are two statements 1 and 2, and two conclusions I and II. Statement 1: All bacteria are microorganisms. Statement 2: All pathogens are microorganisms. Conclusion I: Some pathogens are bacteria. Conclusion II: All pathogens are not bacteria. Based on the above statements and conclusions, which one of the following options is logically CORRECT?
- A.Only conclusion I is correct
- B.Only conclusion II is correct
- C.Either conclusion I or II is correct.✓
- D.Neither conclusion I nor II is correct.✓
Answer: C, D
Solution
From the two statements, pathogens and bacteria are both subsets of microorganisms but their overlap is not fixed; conclusions I and II form a complementary pair, so "Either I or II" holds. The official GATE key accepted both options (C) and (D). - A.
- Question 10General Aptitudemcq2 marksSome people suggest anti-obesity measures (AOM) such as displaying calorie information in restaurant menus. Such measures sidestep addressing the core problems that cause obesity: poverty and income inequality. Which one of the following statements summarizes the passage?
- A.The proposed AOM addresses the core problems that cause obesity.
- B.If obesity reduces, poverty will naturally reduce, since obesity causes poverty.
- C.AOM are addressing the core problems and are likely to succeed.
- D.AOM are addressing the problem superficially.✓
Answer: D
Solution
The passage says the measures "sidestep" the core causes (poverty and income inequality) — i.e., they address the problem only superficially. - A.
- Question 11Theory of Computationmcq1 markSuppose that is a regular language and is a context-free language. Which one of the following languages is NOT necessarily context-free?
- A.
- B.
- C.✓
- D.
Answer: C
Solution
Regular CFL, regular CFL and regular CFL are all CFLs. But , and the complement of a CFL need not be a CFL, so is not necessarily context-free. - A.
- Question 12Algorithmsmcq1 markLet P be an array containing integers. Let be the lowest upper bound on the number of comparisons of the array elements, required to find the minimum and maximum values in an arbitrary array of elements. Which one of the following choices is correct?
- A.
- B.and
- C.and✓
- D.and
Answer: C
Solution
The tournament (pair-wise) method finds both min and max using at most comparisons, and more than are needed, so and . - A.
- Question 13Algorithmsmcq1 markConsider the following three functions.Which one of the following options arranges the functions in the increasing order of asymptotic growth rate?
- A.
- B.
- C.
- D.✓
Answer: D
Solution
Take logs: , , . Order of these: , so . - A.
- Question 14Compiler Designmcq1 markConsider the following statements. : The sequence of procedure calls corresponds to a preorder traversal of the activation tree. : The sequence of procedure returns corresponds to a postorder traversal of the activation tree. Which one of the following options is correct?
- A.is true and is false
- B.is false and is true
- C.is true and is true✓
- D.is false and is false
Answer: C
Solution
In an activation tree, calls happen in preorder (a procedure is entered before its callees) and returns happen in postorder (a procedure returns after all its callees). Both statements are true. - A.
- Question 15Compiler Designmcq1 markConsider the following statements. : Every SLR(1) grammar is unambiguous but there are certain unambiguous grammars that are not SLR(1). : For any context-free grammar, there is a parser that takes at most time to parse a string of length . Which one of the following options is correct?
- A.is true and is false
- B.is false and is true
- C.is true and is true✓
- D.is false and is false
Answer: C
Solution
Every SLR(1) grammar is unambiguous, and some unambiguous grammars are not SLR(1) — is true. The CYK algorithm parses any CFG in time — is true. - A.
- Question 16Digital Logicmcq1 markLet the representation of a number in base 3 be 210. What is the hexadecimal representation of the number?
- A.15✓
- B.21
- C.D2
- D.528
Answer: A
Solution
. - A.
- Question 17Discrete Mathematicsmcq1 markLet and be two propositions. Consider the following two formulae in propositional logic.Which one of the following choices is correct?
- A.Both and are tautologies.
- B.is a tautology but is not a tautology.✓
- C.is not a tautology but is a tautology.
- D.Neither nor is a tautology.
Answer: B
Solution
. So , which is always true — a tautology. fails when is true and is true, so is not a tautology. - A.
- Question 18Computer Networksmcq1 markConsider the following two statements. : Destination MAC address of an ARP reply is a broadcast address. : Destination MAC address of an ARP request is a broadcast address. Which one of the following choices is correct?
- A.Both and are true.
- B.is true and is false.
- C.is false and is true.✓
- D.Both and are false.
Answer: C
Solution
An ARP request is broadcast (the sender does not yet know the target MAC), so is true. An ARP reply is unicast back to the requester, so is false. - A.
- Question 19Algorithmsmcq1 markConsider the following array.
Which algorithm out of the following options uses the least number of comparisons (among the array elements) to sort the above array in ascending order?23 32 45 69 72 73 89 97- A.Selection sort
- B.Mergesort
- C.Insertion sort✓
- D.Quicksort using the last element as pivot
Answer: C
Solution
The array is already sorted. Insertion sort on an already-sorted array performs only comparisons (best case), fewer than the others. - A.
- Question 20Programming & Data Structuresmcq1 markA binary search tree contains distinct elements. What is the time complexity of picking an element in that is smaller than the maximum element in ?
- A.
- B.
- C.
- D.✓
Answer: D
Solution
The maximum is the right-most node, so the root (for ) is not the maximum. Returning the root (or any fixed non-maximum node) takes time. - A.
- Question 21Operating Systemsmsq1 markIn the context of operating systems, which of the following statements is/are correct with respect to paging?
- A.Paging helps solve the issue of external fragmentation.✓
- B.Page size has no impact on internal fragmentation.
- C.Paging incurs memory overheads.✓
- D.Multi-level paging is necessary to support pages of different sizes.
Answer: A, C
Solution
Paging eliminates external fragmentation (A, true) and needs page tables, i.e. memory overhead (C, true). Larger pages increase internal fragmentation, so (B) is false; multi-level paging reduces page-table size and is unrelated to supporting different page sizes, so (D) is false. - A.
- Question 22Theory of Computationmsq1 markLet denote an encoding of an automaton . Suppose that . Which of the following languages is/are NOT recursive?
- A.is a DFA such that
- B.is a DFA such that
- C.is a PDA such that
- D.is a PDA such that✓
Answer: D
Solution
DFA emptiness, DFA universality and PDA emptiness are all decidable (recursive). PDA/CFG universality () is undecidable, so (D) is not recursive. - A.
- Question 23Databasesmsq1 markSuppose a database system crashes again while recovering from a previous crash. Assume checkpointing is not done by the database either during the transactions or during recovery. Which of the following statements is/are correct?
- A.The same undo and redo list will be used while recovering again.✓
- B.The system cannot recover any further.
- C.All the transactions that are already undone and redone will not be recovered again.
- D.The database will become inconsistent.
Answer: A
Solution
Without checkpointing, recovery restarts from the beginning of the log and recomputes the same undo and redo lists. Recovery operations are idempotent, so the system recovers correctly — only (A) is correct. - A.
- Question 24Operating Systemsmsq1 markWhich of the following standard C library functions will *always* invoke a system call when executed from a single-threaded process in a UNIX/Linux operating system?
- A.✓
exit - B.
malloc - C.✓
sleep - D.
strlen
Answer: A, C
Solution
exitalways triggers theexit/_exitsystem call andsleepalways invokes a kernel timer (e.g.nanosleep).mallocmay satisfy a request from the existing heap without a syscall, andstrlenis pure user-space computation. - A.
- Question 25Operating Systemsmsq1 markConsider a linear list based directory implementation in a file system. Each directory is a list of nodes, where each node contains the file name along with the file metadata, such as the list of pointers to the data blocks. Consider a given directory
foo. Which of the following operations will necessarily require a full scan offoofor successful completion?- A.Creation of a new file in✓
foo - B.Deletion of an existing file from
foo - C.Renaming of an existing file in✓
foo - D.Opening of an existing file in
foo
Answer: A, C
Solution
Creating a new file must confirm the name does not already exist, requiring a full scan (A). Renaming must find the file and confirm the new name is unused, requiring a full scan (C). Deleting and opening can stop as soon as the file is found, so they do not necessarily scan the whole list. - A.
- Question 26Discrete Mathematicsnat1 markIn an undirected connected planar graph , there are eight vertices and five faces. The number of edges in is ______.
Answer: 11
Solution
Euler's formula: . - Question 27Algorithmsnat1 markConsider the undirected graph with edge weights as shown in the figure. The number of minimum-weight spanning trees of the graph is ______.

Answer: 3
Solution
The minimum spanning tree has weight formed by the small (0.1) edges; counting the ways to complete an MST while breaking ties among equal-weight edges gives 3 distinct minimum-weight spanning trees. - Question 28Engineering Mathematicsnat1 markThe lifetime of a component of a certain type is a random variable whose probability density function is exponentially distributed with parameter 2. For a randomly picked component of this type, the probability that its lifetime exceeds the expected lifetime (rounded to 2 decimal places) is ______.
Answer: 0.35 to 0.39
Solution
For , . . - Question 29Discrete Mathematicsnat1 markThere are 6 jobs with distinct difficulty levels, and 3 computers with distinct processing speeds. Each job is assigned to a computer such that: - The fastest computer gets the toughest job and the slowest computer gets the easiest job. - Every computer gets at least one job. The number of ways in which this can be done is ______.
Answer: 65
Solution
Fix the toughest job to the fastest computer and the easiest to the slowest. The remaining 4 jobs go to 3 computers (with the "at least one each" condition already handled), giving 65 valid assignments. - Question 30Engineering Mathematicsnat1 markConsider the following expression.The value of the above expression (rounded to 2 decimal places) is ______.
Answer: 0.25
Solution
This is ; rationalizing (or L'Hopital) gives at , i.e. . - Question 31Programming & Data Structuresnat1 markConsider the following sequence of operations on an empty stack.
Consider the following sequence of operations on an empty queue.push(54); push(52); pop(); push(55); push(62); s = pop();
The value of is ______.enqueue(21); enqueue(24); dequeue(); enqueue(28); enqueue(32); q = dequeue();Answer: 86
Solution
Stack: after the operations the top popped into is 62. Queue (FIFO): the second dequeue returns 24, so . Hence . - Question 32Computer Organization & Architecturenat1 markConsider a computer system with a byte-addressable primary memory of size bytes. Assume the computer system has a direct-mapped cache of size 32 KB (1 KB bytes), and each cache block is of size 64 bytes. The size of the tag field is ______ bits.
Answer: 17
Solution
Offset bits. Number of lines , so index bits. Tag bits. - Question 33Databasesnat1 markA relation in a relational database has 1200 tuples. The attribute has integer values ranging from 6 to 20, and the attribute has integer values ranging from 1 to 20. Assume that the attributes and are independently distributed. The estimated number of tuples in the output of is ______.
Answer: 205 to 820
Solution
With (15 values) and (20 values), and . Using inclusion–exclusion on the estimate gives about 819–820 tuples. (The official GATE key accepted either 819–820 or 205.) - Question 34Digital Logicnat1 markConsider the following representation of a number in IEEE 754 single-precision floating point format with a bias of 127.Here , and denote the sign, exponent and fraction components of the floating point representation. The decimal value corresponding to the above representation (rounded to 2 decimal places) is ______.
Answer: -7.75
Solution
(negative). , so exponent . Mantissa . Value . - Question 35Operating Systemsnat1 markThree 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 bursts, the minimum achievable average waiting time for these three processes in a non-preemptive scheduler (rounded to nearest integer) is ______ milliseconds.
Answer: 12
Solution
Shortest-Job-First minimizes average waiting time. Order 10, 16, 20: waiting times are ; average ms. - Question 36Compiler Designmcq2 marksConsider the following grammar (that admits a series of declarations, followed by expressions) and the associated syntax directed translation (SDT) actions, given as pseudo-code:
With respect to the above grammar, which one of the following choices is correct?P -> D* E* D -> int ID { record that ID.lexeme is of type int } D -> bool ID { record that ID.lexeme is of type bool } E -> E1 + E2 { check that E1.type = E2.type = int; set E.type := int } E -> ! E1 { check that E1.type = bool; set E.type := bool } E -> ID { set E.type := int }- A.The actions can be used to correctly type-check any syntactically correct program.
- B.The actions can be used to type-check syntactically correct integer variable declarations and integer expressions.✓
- C.The actions can be used to type-check syntactically correct boolean variable declarations and boolean expressions.
- D.The actions will lead to an infinite loop.
Answer: B
Solution
The rule unconditionally sets type int, ignoring a bool declaration, so boolean expressions are not correctly checked. The actions only reliably type-check integer declarations and integer expressions. - A.
- Question 37Databasesmcq2 marksThe following relation records the age of 500 employees of a company, where empNo (indicating the employee number) is the key:Consider the following relational algebra expression:What does the above expression generate?
- A.Employee numbers of only those employees whose age is the maximum.
- B.Employee numbers of only those employees whose age is more than the age of exactly one other employee.
- C.Employee numbers of all employees whose age is not the minimum.✓
- D.Employee numbers of all employees whose age is the minimum.
Answer: C
Solution
The join pairs an employee with any other employee of smaller age. An employee appears in the result iff there exists someone younger, i.e. the employee's age is not the minimum. - A.
- Question 38Digital Logicmcq2 marksConsider a 3-bit counter, designed using T flip-flops, as shown in the figure. Assuming the initial state of the counter given by PQR as 000, what are the next three states?

- A.011, 101, 000✓
- B.001, 010, 111
- C.011, 101, 111
- D.001, 010, 000
Answer: A
Solution
Deriving the T inputs from the circuit and applying them from PQR = 000 produces the state sequence 011, 101, 000. - A.
- Question 39Computer Networksmcq2 marksAssume that a 12-bit Hamming codeword consisting of 8-bit data and 4 check bits is , where the data bits and the check bits are given in the following tables:
Which one of the following choices gives the correct values of and ?Data bits: d8 d7 d6 d5 d4 d3 d2 d1 1 1 0 x 0 1 0 1 Check bits: c8 c4 c2 c1 y 0 1 0- A.is 0 and is 0.✓
- B.is 0 and is 1.
- C.is 1 and is 0.
- D.is 1 and is 1.
Answer: A
Solution
Using even parity over the Hamming check-bit positions and solving the parity equations for the unknown data bit and check bit gives and . - A.
- Question 40Algorithmsmcq2 marksConsider the following recurrence relation.Which one of the following options is correct?
- A.
- B.
- C.✓
- D.
Answer: C
Solution
The subproblem sizes sum to . With linear work per level and a geometrically shrinking total, the work is dominated by the top level, giving . - A.
- Question 41Compiler Designmcq2 marksConsider the following context-free grammar where the set of terminals is .
The following is a partially-filled LL(1) parsing table; the numbered cells (1), (2), (3), (4) are to be filled (blank denotes an empty cell):S -> d a T | R f T -> a S | b a T | e R -> c a T R | e (e denotes epsilon)Which one of the following choices represents the correct combination for the numbered cells in the parsing table ("blank" denotes that the corresponding cell is empty)?a b c d f $ S (1) S->daT (2) T T->aS T->baT (3) T->e (4) R R->caTR R->e- A.(1) S->Rf (2) S->Rf (3) T->e (4) T->e✓
- B.(1) blank (2) S->Rf (3) T->e (4) T->e
- C.(1) S->Rf (2) blank (3) blank (4) T->e
- D.(1) blank (2) S->Rf (3) blank (4) blank
Answer: A
Solution
Computing FIRST and FOLLOW sets: is nullable with , so is entered under both and (cells 1 and 2). is nullable, and FOLLOW contains and , so is entered in cells 3 and 4. This matches option (A). - A.
- Question 42Databasesmcq2 marksLet and denote read and write operations respectively on a data item by a transaction . Consider the following two schedules.Which one of the following options is correct?
- A.is conflict serializable, and is not conflict serializable.
- B.is not conflict serializable, and is conflict serializable.✓
- C.Both and are conflict serializable.
- D.Neither nor is conflict serializable.
Answer: B
Solution
Drawing precedence graphs: has a cycle between and (conflicts on and in opposite order), so it is not conflict serializable. has an acyclic precedence graph (), so it is conflict serializable. - A.
- Question 43Databasesmcq2 marksConsider the relation with the following functional dependencies.Consider the decomposition of the relation into the constituent relations according to the following two decomposition schemes.Which one of the following options is correct?
- A.is a lossless decomposition, but is a lossy decomposition.✓
- B.is a lossy decomposition, but is a lossless decomposition.
- C.Both and are lossless decompositions.
- D.Both and are lossy decompositions.
Answer: A
Solution
Testing each decomposition with the chase/common-attribute test, joins back to losslessly, while loses information (the split has no FD linking it back), so is lossy. - A.
- Question 44Discrete Mathematicsmcq2 marksLet be a group of order 6, and be a subgroup of such that . Which one of the following options is correct?
- A.Both and are always cyclic.
- B.may not be cyclic, but is always cyclic.✓
- C.is always cyclic, but may not be cyclic.
- D.Both and may not be cyclic.
Answer: B
Solution
By Lagrange, , both prime, so is cyclic. of order 6 can be the non-abelian , which is not cyclic. Hence is always cyclic but may not be. - A.
- Question 45Engineering Mathematicsmcq2 marksConsider the two statements. : There exist random variables and such that . : For all random variables and , . Which one of the following choices is correct?
- A.Both and are true.
- B.is true, but is false.
- C.is false, but is true.
- D.Both and are false.✓
Answer: D
Solution
By Cauchy–Schwarz, , so is false. Covariance uses signed deviations, not absolute values, so is false too. - A.
- Question 46Algorithmsmcq2 marksLet be an undirected unweighted connected graph. The *diameter* of is defined as:Let be the adjacency matrix of . Define graph on the same set of vertices with adjacency matrix , where if or (where ), and otherwise. Which one of the following statements is true?
- A.✓
- B.
- C.
- D.
Answer: A
Solution
connects any two vertices within distance 2 in , so every edge in corresponds to a path of length in . Distances halve (with ceiling), giving . - A.
- Question 47Programming & Data Structuresmcq2 marksConsider the following ANSI C program.
Which one of the following options is correct?#include <stdio.h> int main() { int i, j, count; count = 0; i = 0; for (j = -3; j <= 3; j++) { if ((j >= 0) && (i++)) count = count + j; } count = count + i; printf("%d", count); return 0; }- A.The program will not compile successfully.
- B.The program will compile successfully and output 10 when executed.✓
- C.The program will compile successfully and output 8 when executed.
- D.The program will compile successfully and output 13 when executed.
Answer: B
Solution
For the first operand is false andi++is not evaluated. For :i++returns 0 (false) then , so count unchanged. For :i++returns 1,2,3 (true), count becomes and reaches 4. Final count . - A.
- Question 48Theory of Computationmcq2 marksConsider the following language.Which one of the following deterministic finite automata accepts ? (See the figure for options (A)–(D).)

- A.(A)
- B.(B)
- C.(C)
- D.(D)✓
Answer: D
Solution
A correct DFA for strings ending in 011 needs the accepting state reached only after reading 0,1,1 in order, with proper back-transitions on mismatches. Only option (D) has the correct transitions and single accepting state for this pattern. - A.
- Question 49Theory of Computationmcq2 marksFor a Turing machine , denotes an encoding of . Consider the following two languages.Which one of the following options is correct?
- A.Both and are decidable.✓
- B.is decidable and is undecidable.
- C.is undecidable and is decidable.
- D.Both and are undecidable.
Answer: A
Solution
In at most 2021 steps a TM can read only the first 2021 input cells, so the behaviour depends on finitely many input prefixes. Both conditions can be checked by simulating for 2021 steps on these finitely many relevant inputs, so both and are decidable. - A.
- Question 50Algorithmsmsq2 marksDefine to be the maximum amount earned by cutting a rod of length meters into one or more pieces of integer length and selling them. For , let denote the selling price of a rod whose length is meters. Consider the array of prices:Which of the following statements is/are correct about ?
- A.✓
- B.
- C.is achieved by three different solutions.✓
- D.cannot be achieved by a solution consisting of three pieces.
Answer: A, C
Solution
The optimal revenue is , achievable as , or (5+10=... ) — in fact three distinct cuts give 18: , , . So (A) and it is achieved by three different solutions (C). - A.
- Question 51Algorithmsmsq2 marksAn *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 connected components. Let be a DFS tree obtained by doing DFS in a connected undirected graph . Which of the following options is/are correct?
- A.Root of can never be an articulation point in .
- B.Root of is an articulation point in if and only if it has 2 or more children.✓
- C.A leaf of can be an articulation point in .
- D.If is an articulation point in such that is an ancestor of in and is a descendent of in , then all paths from to in must pass through .✓
Answer: B, D
Solution
The DFS-tree characterization: the root is an articulation point iff it has children (B true, A false). A leaf is never an articulation point (C false). The ancestor–descendant separation property (D) holds for any articulation point. The official key is (B), (D). - A.
- Question 52Digital Logicmsq2 marksConsider the following Boolean expression.Which of the following Boolean expressions is/are equivalent to (complement of )?
- A.
- B.✓
- C.✓
- D.✓
Answer: B, C, D
Solution
Simplifying, ; its complement reduces to . Options (B), (C) and (D) are all algebraically equal to this, while (A) is not. - A.
- Question 53Discrete Mathematicsmsq2 marksA relation is said to be *circular* if and together imply . Which of the following options is/are correct?
- A.If a relation is reflexive and symmetric, then is an equivalence relation.
- B.If a relation is circular and symmetric, then is an equivalence relation.
- C.If a relation is reflexive and circular, then is an equivalence relation.✓
- D.If a relation is transitive and circular, then is an equivalence relation.
Answer: C
Solution
A relation is an equivalence relation iff it is reflexive and circular (reflexive + circular implies symmetric and transitive), so (C) is correct. Reflexive+symmetric need not be transitive (A false); the others do not guarantee all three properties. - A.
- Question 54Computer Networksmsq2 marksA TCP server application is programmed to listen on port number on host . A TCP client is connected to the TCP server over the network. Consider that while the TCP connection was active, the server machine crashed and rebooted. Assume that the client does not use the TCP keepalive timer. Which of the following behaviors is/are possible?
- A.If the client was waiting to receive a packet, it may wait indefinitely.✓
- B.The TCP server application on can listen on after reboot.✓
- C.If the client sends a packet after the server reboot, it will receive a RST segment.✓
- D.If the client sends a packet after the server reboot, it will receive a FIN segment.
Answer: A, B, C
Solution
After a crash the server loses all TCP state. A silent client may wait forever (A). The server can bind and listen on again after reboot (B). If the client sends data, the rebooted server has no matching connection and replies with RST, not FIN (C true, D false). - A.
- Question 55Computer Networksmsq2 marksConsider two hosts and connected through a router . The maximum transfer unit (MTU) value of the link between and is 1500 bytes, and between and is 820 bytes. A TCP segment of size 1400 bytes was transferred from to through , with IP identification value as
0x1234. Assume that the IP header size is 20 bytes. Further, the packet is allowed to be fragmented, i.e.,Don't Fragment (DF)flag in the IP header is *not* set by . Which of the following statements is/are correct?- A.Two fragments are created at and the IP datagram size carrying the second fragment is 620 bytes.✓
- B.If the second fragment is lost, will resend the fragment with the IP identification value
0x1234. - C.If the second fragment is lost, is required to resend the whole TCP segment.✓
- D.TCP destination port can be determined by analysing *only* the second fragment.
Answer: A, C
Solution
The 1420-byte datagram is fragmented at for the 820-byte MTU: payload per fragment must be a multiple of 8, giving 800 + 620 bytes, so the second datagram is 620 bytes (A). does not retransmit (B false); loss recovery is by TCP at which resends the whole segment (C). The TCP header (with ports) is only in the first fragment, so (D) is false. - A.
- Question 56Operating Systemsmsq2 marksConsider the following pseudocode, where S is a semaphore initialized to 5 in line#2 and
counteris a shared variable initialized to 0 in line#1. Assume that the increment operation in line#7 is *not* atomic.If five threads execute the function1. int counter = 0; 2. Semaphore S = init(5); 3. void parop(void) 4. { 5. wait(S); 6. wait(S); 7. counter++; 8. signal(S); 9. signal(S); 10. }paropconcurrently, which of the following program behavior(s) is/are possible?- A.The value of✓
counteris 5 after all the threads successfully complete the execution ofparop. - B.The value of✓
counteris 1 after all the threads successfully complete the execution ofparop. - C.The value of
counteris 0 after all the threads successfully complete the execution ofparop. - D.There is a deadlock involving all the threads.✓
Answer: A, B, D
Solution
Each thread does twowaits. In a serialized interleavingcounterreaches 5 (A). With up to two threads in the critical section and a non-atomic increment, lost updates can leavecounteras low as 1 (B). If every thread completes its firstwaitbefore any does the second, all 5 units of S are taken and all block — deadlock (D).countercan never be 0 after all complete, so (C) is impossible. - A.
- Question 57Algorithmsmsq2 marksConsider 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 is used to index into the main hash table. 3. Initially, the main hash table entries are empty. 4. Thereafter, when more keys are hashed into it, to resolve collisions, the set of all keys corresponding to a main hash table entry is organized as a binary tree that grows on demand. 5. First, the 3rd least significant bit is used to divide the keys into left and right subtrees. 6. To resolve more collisions, each node of the binary tree is further sub-divided into left and right subtrees based on the 4th least significant bit. 7. A split is done only if it is needed, i.e., only when there is a collision. Consider the state of the hash table shown in the figure. Which of the following sequences of key insertions can cause the above state of the hash table (assume the keys are in decimal notation)?

- A.5, 9, 4, 13, 10, 7
- B.9, 5, 10, 6, 7, 1
- C.10, 9, 6, 7, 5, 13✓
- D.9, 5, 13, 6, 10, 14
Answer: C
Solution
Tracing each insertion sequence through the index (2 LSBs) and the on-demand splits (3rd then 4th LSB), only sequence (C) 10, 9, 6, 7, 5, 13 reproduces exactly the shown tree structure, with splits occurring only where collisions force them. - A.
- Question 58Programming & Data Structuresnat2 marksConsider the following ANSI C function:
Let Z be an array of 10 elements with Z[i]=1, for all such that . The value returned byint SimpleFunction(int Y[], int n, int x) { int total = Y[0], loopIndex; for (loopIndex = 1; loopIndex <= n - 1; loopIndex++) total = x * total + Y[loopIndex]; return total; }SimpleFunction(Z, 10, 2)is ______.Answer: 1023
Solution
This is Horner evaluation of the polynomial with all coefficients 1 at : . - Question 59Computer Networksnat2 marksConsider the sliding window flow-control protocol operating between a sender and a receiver over a full-duplex error-free link. Assume the following: - Processing time of the data frame at the receiver, and of the acknowledgement at the sender, is negligible. - The sender has infinite frames available. - Data frame size is 2,000 bits and acknowledgement frame size is 10 bits. - Link data rate in each direction is 1 Mbps ( bits per second). - One way propagation delay of the link is 100 milliseconds. The minimum value of the sender's window size in terms of the number of frames, (rounded to the nearest integer) needed to achieve a link utilization of 50% is ______.
Answer: 50 to 52
Solution
Transmission time ms, ms. Utilization . Setting this : , so the minimum integer window is 51. - Question 60Compiler Designnat2 marksConsider the following C code segment:
In a compiler, this code segment is represented internally as a directed acyclic graph (DAG). The number of nodes in the DAG is ______.a = b + c; e = a + 1; d = b + c; f = d + 1; g = e + f;Answer: 6
Solution
Leaves:b,c, and the constant1(3 nodes).b+cis a common subexpression shared byaandd(1 node).a+1(=e, andd+1=fshare the same value as they add 1 to the same node) ande+fadd internal nodes, for a total of 6 distinct nodes. - Question 61Theory of Computationnat2 marksIn a pushdown automaton , a transition of the form shown represents . Consider the pushdown automaton over the input alphabet and stack alphabet shown in the figure. The number of strings of length 100 accepted by the above pushdown automaton is ______.

Answer: 50
Solution
The PDA pushes an for each and pops one for each , and reaches the accepting state only while an remains, i.e. it accepts with . For we need , i.e. — exactly 50 strings. - Question 62Engineering Mathematicsnat2 marksConsider the following matrix.The largest eigenvalue of the above matrix is ______.
Answer: 3
Solution
The matrix is where is the all-ones matrix. has eigenvalues (once) and (thrice), so has eigenvalues and . The largest is . - Question 63Computer Organization & Architecturenat2 marksA 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 of 5 nanoseconds each. The total time to execute 100 independent instructions on this pipeline, assuming there are no pipeline stalls, is ______ nanoseconds.
Answer: 17160
Solution
Clock period ns. Time for 100 instructions ns. - Question 64Engineering Mathematicsnat2 marksA sender (S) transmits a signal, which can be one of the two kinds: and with probabilities 0.1 and 0.9 respectively, to a receiver (R). In the graph (see figure), the weight of edge is the probability of receiving when is transmitted, where . For example, the probability that the received signal is given the transmitted signal was , is 0.7. If the received signal is , the probability that the transmitted signal was (rounded to 2 decimal places) is ______.

Answer: 0.04
Solution
From the figure: . . By Bayes, . - Question 65Computer Organization & Architecturenat2 marksConsider the following instruction sequence where registers R1, R2 and R3 are general purpose and MEMORY[X] denotes the content at the memory location X.
Assume that the content of memory location 5000 is 10, and the content of register R3 is 3000. The content of each of the memory locations from 3000 to 3010 is 50. The instruction sequence starts from memory location 1000. All the numbers are in decimal format. Assume that the memory is byte addressable. After the execution of the program, the content of memory location 3010 is ______.Instruction Semantics Size (bytes) MOV R1, (5000) R1 <- MEMORY[5000] 4 MOV R2, (R3) R2 <- MEMORY[R3] 4 ADD R2, R1 R2 <- R1 + R2 2 MOV (R3), R2 MEMORY[R3] <- R2 4 INC R3 R3 <- R3 + 1 2 DEC R1 R1 <- R1 - 1 2 BNZ 1004 Branch if not zero to addr 2 HALT Stop 1Answer: 50
Solution
R1 starts at 10 and the loop (BNZ to address 1004, the second instruction) runs while R1 is non-zero, writing to MEMORY[R3] as R3 increments from 3000. The loop body executes for R3 = 3000..3009 (10 iterations) and then stops; MEMORY[3010] is never written and stays 50.
Practice the full paper with a timer
Attempt GATE CS 2021 Set 1 in the exact GATE interface and get a detailed score and topic-wise analysis — free.
Create free account →