# GATE Exam 2021 Computer Science and Information Technology (CS-1) Question Paper With Answer Key

GATE-2021

CS-1: Computer Science and Information Technology

GA-General Aptitude

Q.1 – Q.5 Multiple Choice Question (MCQ), carry ONE mark each (for each wrong answer: – 1/3).

1. 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:

(A)  21

(B)  37

(C)  50

(D)  73

2. 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.

Which one of the following is NOT a convex polygon?

3. 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 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

4. A 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 _______.

5. _____ 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

Q.6 – Q. 10 Multiple Choice Question (MCQ), carry TWO marks each (for each wrong answer: – 2/3).

6. We 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)  π/2

(B)  3/π

(C)  9/π

(D)  3π

7.

Details of prices of two items P and Q are presented in the above table. 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

The discount on item Q, as a percentage of its marked price, is ______

(A)  25

(B)  12.5

(C)  10

(D)  5

8. There 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

9. 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 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.

10. Some 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.

Computer Science and Information Technology (CS, Set-1)

Q.1 – Q.10 Multiple Choice Question (MCQ), carry ONE mark each (for each wrong answer: – 1/3).

1. Suppose that L1 is a regular-language and L2 is a context-free language. Which one of the following languages is NOT necessarily context-free?

(A)  L1 ⋂ L2

(B)  L­1 ⋅ L2

(C)  L­1 − L2

(D)  L­1 ⋃ L2

2. Let P be an array containing n integers. Let t be the lowest upper bound on the under of comparisons of the array elements, required to find the minimum and maximum values in an arbitrary array of n elements. Which one of the following choices is correct?

(A)  t > 2n – 2

(B)

(C)  t > n and t ≤ 3[n/2]

(D)  t > [log2(n)] and t ≤ n

3. Consider the following three functions.

f1 = 10n   f2 = nlog n f3 n√n

Which one of the following options arranges the functions in the increasing order of asymptotic growth rate ?

(A)  f3, f2, f1

(B)  f2, f1, f3

(C)  f1, f2, f3

(D)  f2, f3, f1

4. Consider the following statements,

S1 : The sequence of procedure calls corresponds to a preorder traversal of the activation tree.

S2 : The sequence of procedure returns corresponds to a postorder traversal of the activation tree.

Which one of the following options is correct?

(A)  S1 is true and S2 is false

(B)  S1 is false and S2 is true

(C)  S1 is true and S2 is true

(D)  S1 is false and S2 is false

5. Consider the following statements.

S1 : Every SLR(1) grammar is unambiguous but there are certain unambiguous grammas that are not SLR(1)

S2 : For any context-free grammar, there is a parser that takes at most O(n3) time to parse a string of length n.

Which one of the following options is correct?

(A)  S1 is true and S2 is false

(B)  S1 is false and S2­ is true

(C)  S1 is true and S2 is true

(D)  S1 is false and S2 is false

6. Let 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

7. Let p and q be two propositions. Consider the following two formulae in propositional logic.

Which one of the following choices is correct?

(A)  Both S1 and S2 are tautologies

(B)  S1 is a tautology but S2 is not a tautology.

(C)  S1 is not a tautology but S2 is a tautology

(D)  Neither S1 nor S2 is a tautology

8. Consider the following two statements.

Which one of the following choices is correct?

(A)  Both S1 and S2 are true.

(B)  S1 is true and S2 is false.

(C)  S1 is false and S2 is true.

(D)  Both S1 and S2 are false

9. Consider 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?

(A)  Selection sort

(B)  Mergesort

(C)  Insertion sort

(D)  Quicksort using the last element as pivot

10. 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 in T?

(A)  Θ(n log n)

(B)  Θ(n)

(C)  Θ(log n)

(D)  Θ(1)

11. In the context of operating systems, which of the following statement 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.

(D)  Multi-level paging is necessary to support pages of different sizes.

12. Let  denote an encoding of an automation M. Suppose that ∑ = {0, 1}.Which of the following languages is/are NOT recursive?

13. Suppose a database system crashes gain while recovering from a previous crash. Assume check pointing 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.

14. 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 operating system?

(A)  exit

(B)  malloc

(C)  sleep

(D)  strlen

15. 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 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 of foo for 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

Q.16 – Q.25 Numerical Answer Type (NAT), carry ONE mark each (no negative marks)

16. In an undirected connected planar graph G, there are eight vertices and five faces. The number of edges in G is ______.

17. Consider the following undirected graph with edge weights as shown:

The number of minimum-weight spanning trees of the graph is _____.

18. The 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 ______.

19. 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 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 _______

20. Consider the following expression.

The value of the above expression ( rounded to 2 decimal places) is ________

21. Consider the following sequence of operations of an empty stack.

Consider the following sequence of operations on any empty queue.

The value of s +  q is ______.

22. Consider a computer system with a byte-addressable primary memory of size 232 Assume the computer system has a direct-mapped cache of size 32 KB (1 KB = 210 bytes), and each cache block is of size 64 bytes.

The size of the tag field is ______ bits.

23. 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 values ranging from 1 to 20. Assume that the attributes A and B are independently distributed.

The estimated number of tuples in the output of σ (A>10)(B=18)(r) is _________.

Answer: (819 to 820 OR 205 to 205)

24. 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: 111110000000000000000000

Here S, E and F 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 _______.

25. 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 bursts, the minimum achievable average waiting time for these three processes in a non-preemptive scheduler (round to nearest integer) is ______ milliseconds.

Q.26 – Q.39 Multiple Choice Question (MCQ), carry TWO mark each (for each wrong answer: -2/3)

26. Consider 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?

(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.

27. The 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.

28. Consider a 3-bit counter, designed using T flip-flops, as shown below:

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

29. Assume that a 12-bit hamming codeword consisting of 8-bit data and 4 check bits is d8d7d6d5c8d4d3d2c4d1c2c1, 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 x and y?

(A)  x is 0 and y is 0.

(B)  x is 0 and y is 1.

(C)  x is 1 and y is 0.

(D)  x is 1 and y is 1.

30. Consider the following recurrence relation.

Which one of the following options is correct?

(A)  T(n) = Θ(n5/2)

(B)  T(n) = Θ(n log n)

(C)  T(n) = Θ(n)

(D)  T(n) = Θ((log n)5/2

31. Consider the following context-free grammar where the set of terminals is {a, b, c, d, f}.

The following is a partially-filled LL(1) parsing table.

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)?

32. Let ri(z) and wi(z) denote read and write operations respectively on a data item z by a transaction Ti. Consider the following two schedules.

Which one of the following option sis correct?

(A)  S1 is conflict serializable, and S2 is not conflict serializable

(B)  S1 is not conflict serializable, and S2 is conflict serializable.

(C)  Both S1 and S2 are conflict serializable.

(D)  Neither S1 nor S2 is conflict serializable.

33. 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 relation R into the constituent relations according to the following two decomposition schemes.

D1: R = {(P, Q, S, T); (P, T, X); (Q, Y); (Y, Z, W)]

D2: R = [(P, Q, S); (T, X), (Q, Y); (Y, Z, W)]

Which one of the following options is correct?

(A)  D1 is a lossless decomposition, but D2 is a lossy decomposition.

(B)  D1 is a lossy decomposition, but D2 is a lossless decomposition.

(C)  Both D1 and D2 are lossless decompositions

(D)  Both D1 and D2 are lossy decompositions.

34. 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?

(A)  Both G and H are always cyclic.

(B)  G may not be cyclic, but H is always cyclic.

(C)  G is always cyclic, but H may not be cyclic.

(D)  Both G and H may not be cyclic.

35. Consider the two statements.

Which one of the following choices is correct?

(A)  Both S1 and S2 are true

(B)  S1 is true, but S2 is false.

(C)  S1 is false, but S2 is true

(D)  Both S1 and S2 are false

36. Let G = (V, E) be an undirected unweighted connected graph. The diameter of G is defined as:

Let M be the adjacency matrix of G.

Define graph G2 on the same set of vertices with adjacency matrix N, where

Which one of the following statements is true?

(A)

(B)

(C)  diam(G2) = diam(G)

(D)  diam(G) < diam(G2) ≤ 2 diam(G)

37. Consider the following ANSI C program.

Which one of the following options is correct?

(A)  The program will not compile successfully.

(B)  The program will compile successfully and output 1- when executed.

(C)  The program will compile successfully and output 8 when executed.

(D)  The program will compile successfully and output 13 when executed.

38. Consider the following language.

L = {w ∈ {0, 1}* | w ends with the substring 011}

Which one of the following deterministic finite automata accepts L?

39. For a Turing machine M, denotes an encoding of M. Consider the following two languages.

Which one of the following options is correct?

(A)  Both L1 and L2 are decidable

(B)  L1 is decidable and L2 is undecidable

(C)  L1 is undecidable and L2 is decidable

(D)  Both L1 and L2 are undecidable

Q.40 – Q.47 Multiple Select Question (MSQ), carry two mark each (no negative marks).

40. Define Rn 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, let p[i] denote the selling price of a rod whose length is i meters. Consider the array of prices:

p[1] = 1, p[2] = 5, p[3] = 8, p[4]  9, p[5] = 10, p[6] = 17, p[7] = 18

Which of the following statements is/are correct about R7?

(A)  R7 = 18

(B)  R7 = 19

(C)  R7 is achieved by three different solutions

(D)  R7 cannot be achieved by a solution consisting of three pieces.

41. 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 connected components.

Let T be a DFS tree obtained by doing DFS in a connected  undirected graph G. Which of the following options is/are correct?

(A)  Root of T can never be an articulation point in G.

(B)  Root of T is an articulation point in G if and only if it has 2 or more children.

(C)  A leaf of T can be an articulation point in G.

(D)  If u is an articulation point in G such that x is an ancestor of u in T and y is a descendent of u in T, then all paths from x to y in G must pass through u.

42. Consider the following Boolean expression.

Which of the following Boolean expressions is/are equivalent to  (complement of F)?

43. A relation R is said to be circular if aRb and bRc together imply cRa. Which of the following options is/are correct?

(A)  If a relation  S is reflexive and symmetric, then S is an equivalence relation.

(B)  If a relation S is circular and symmetric, then S is an equivalence relation.

(C)  If a relation S is reflexive and circular, then S is an equivalence relation.

(D)  If a relation S is transitive and circular, then S is an equivalence relation.

44. 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 that while the TCP connection was active, the server machine S crashed and rebooted. Assume that the client does not use the TCP keep alive 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 S can listen on P 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.

45. 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 R and Q is 820 bytes.

A TCP segment of size 1400 bytes was transferred from P to Q through R, with IP identification value as 0 x1234. Assume 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 P.

Which of the following statements is/are correct?

(A)  Two fragments are created at R and the IP datagram size carrying the second fragment is 620 bytes.

(B)  If the second fragment is lost, R will resent the fragment with the IP identification value 0x1234.

(C)  If the second fragment is lost, P is required to resend the whole TCP segment.

(D)  TCP destination port can be determined by analyzing only the second fragment.

46. 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 ≠ Assume that the increment operation in line ≠7 is not atomic.

If five threads execute the function parop concurrently,, which of the following program behavior(s) is/are possible?

(A)  The value of counter is 5 after all the threads successfully complete the execution of parop.

(B)  The value of counter is 1 after all the threads successfully complete the execution of parop.

(C)  The value of counter is 0 after all the threads successfully complete the execution of parop.

47. Consider a dynamic hashing approach for 4-bit integer keys:

(1) There is a main has table of size 4.

(2) The 2 least significant bits of a key is used index into the main has table.

(3) Initially, the main has 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 divided 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 following state of the hash table.

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

Q.48 – Q.55Numerical Answer Type (NAT), carry TWO mark each (no negative marks).

48. 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 SimpleFunction(Z, 10, 2) is ______.

49. Consider the sliding window flow-control protocol operating between a sender and a receiver over a full-duplex error-free link. Assume the following:

• The time taken for processing the data frame by the receiver is negligible.

• The time taken for processing the acknowledgement frame by the sender is negligible.

• The sender has infinite number of frames available for transmission.

• The size of the data frame is 2,000 bits and the size of the acknowledgement frame is 10 bits.

• The link data rate in each direction is 1 Mbps (= 106 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 _______.

50. Consider the following C code segment:

In a complier, this code segment is represented internally as a directed acyclic graph (DAG). The number of nodes in the DAG is ________.

51. In a pushdown automaton P = (Q, ∑, Γ, δ, q0, F) a transition of the form,

where p, q ∈ Q, a ∈ ∑ ⋃ {ϵ], and X, Y ∈ Γ ⋃ {ϵ}, represents (q, Y) ∈ δ(p, a, X).

Consider the following pushdown automaton over the input alphabet ∑ = {a, b} and stack alphabet Γ = {≠, A}.

The number of strings of length 100 accepted by the above pushdown automaton is ______.

52. Consider the following matrix.

The largest eigenvalue of the above matrix is ______.

53. 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 of 5 nanoseconds each.

The total time to execute 100 independent instructions on this pipeline, assuming there are no pipeline stalls, is _________ nanoseconds.

54. 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 graph below, the weight of edge (u, v) is the probability of receiving v when u is transmitted, where u, v ∈ {H, L}. For example, the probability that the received signal is L given the transmitted signal was H, is 0.7.

If the received signal is H, the probability that the transmitted signal was H (rounded to 2 decimal places) is ________.