GATE Computer Science & IT 2021 — GATE 2021 · CS · Set 1

CS Set 1 · 64 of 65 questions publicly available

Sections: General Aptitude, Computer Science & IT

Subject marks
Subject1 mark questions2 mark questionsTotal marks
General Aptitude5515
Computer Science253085

Question 1 · 1 mark Q2725

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

  1. A.

    L1∩L2L_1 ∩ L_2

  2. B.

    L1⋅L2L_1 \cdot L_2

  3. C.

    L1−L2L_1 - L_2

  4. D.

    L1∪L2L_1 ∪ L_2

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): C

Solutions and video are in the course

Question 2 · 1 mark Q2726

Let P be an array containing nn  integers. Let tt  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 nn  elements. Which one of the following choices is correct?

  1. A.

    t>2n−2t > 2n - 2

  2. B.

    t>3⌈n2⌉and t≤2n−2t > 3 \lceil{\frac {n} {2} \rceil} and \ t \leq 2n - 2

  3. C.

    t>n  and t≤3⌈n2⌉t > n \ \ and \ t \leq 3\lceil {\frac {n}{2}} \rceil

  4. D.

    t>⌈log2(n)⌉and t≤nt > \lceil {log_2 (n)} \rceil and \ t \leq n

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): C

Solutions and video are in the course

Question 3 · 1 mark Q2727

Consider the following three functions.

f1=10nf_1 = 10^nf2=nlog nf_2 = n^{log \ n}f3=nnf_3 = n^{\sqrt n}

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

  1. A.

    f3  f2  f1f_3\ \ f_2 \ \ f_1

  2. B.

    f2  f1  f3f_2\ \ f_1 \ \ f_3

  3. C.

    f1  f2  f3f_1\ \ f_2 \ \ f_3

  4. D.

    f2  f3  f1f_2\ \ f_3 \ \ f_1

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): D

Solutions and video are in the course

Question 4 · 1 mark Q2728

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?

  1. A.

    S1 is true and S2 is false

  2. B.

    S1 is false and S2 is true

  3. C.

    S1 is true and S2 is true

  4. D.

    S1 is false and S2 is false

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): C

Solutions and video are in the course

Question 5 · 1 mark Q2729

Consider the following statements.

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

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

Which one of the following options is correct?

  1. A.

    S1 is true and S2 is false

  2. B.

    S1 is false and S2 is true

  3. C.

    S1 is true and S2 is true

  4. D.

    S1 is false and S2 is false

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): C

Solutions and video are in the course

Question 6 · 1 mark Q2730

Let the representation of a number in base 3 be 210. What is the hexadecimal representation of the number?

  1. A.

    15

  2. B.

    21

  3. C.

    D2

  4. D.

    528

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): A

Solutions and video are in the course

Question 7 · 1 mark Q2731

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

S1:(¬p∧(p∨q))→qS1: (\neg p \land (p \lor q)) \to q

S2:q→(¬p∧(p∨q))S2: q \to (\neg p \land (p \lor q))

Which one of the following choices is correct?

  1. A.

    Both S1 and S2 are tautologies.

  2. B.

    S1 is a tautology but S2 is not a tautology

  3. C.

    S1 is not a tautology but S2 is a tautology

  4. D.

    Neither S1 nor S2 is a tautology

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): B

Solutions and video are in the course

Question 8 · 1 mark Q2732

Consider the following two statements.

S1: Destination MAC address of an ARP reply is a broadcast address.

S2: Destination MAC address of an ARP request is a broadcast address.

Which one of the following choices is correct?

  1. A.

    Both S1 and S2 are true

  2. B.

    S1 is true and S2 is false

  3. C.

    S1 is false and S2 is true

  4. D.

    Both S1 and S2 are false

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): C

Solutions and video are in the course

Question 9 · 1 mark Q70284

Consider the following array.

image.png

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 ?

  1. A.

    Selection sort

  2. B.

    Merge sort

  3. C.

    Insertion sort

  4. D.

    Quicksort using the last element as pivot

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): C

Solutions and video are in the course

Question 10 · 1 mark Q2734

A binary search tree TT contains  n n  distinct elements. What is the time complexity of picking an element in TT  that is smaller than the maximum element in TT ?

  1. A.

    θ(n log n)\theta (n \ log \ n)

  2. B.

    θ(n)\theta (n)

  3. C.

    θ(log n)\theta ( log \ n)

  4. D.

    θ(1)\theta (1)

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): D

Solutions and video are in the course

Question 11 · 1 mark Q1934

In the context of operating systems, which of the following statements is/are correct with respect to paging?

  1. A.

    Paging helps solve the issue of external fragmentation

  2. B.

    Page size has no impact on internal fragmentation

  3. C.

    Paging incurs memory overheads

  4. D.

    Multi-level paging is necessary to support pages of different sizes

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): A, C

Solutions and video are in the course

Question 12 · 1 mark Q2736

Let ⟨M⟩⟨M⟩ denote an encoding of an automaton MM. Suppose that Σ={0,1}. Which of the following languages is/are NOT recursive?

  1. A.

    L={⟨M⟩L = \{⟨M⟩∣M∣ Mis a DFA such thatis \ a \ DFA \ such \ thatL(M)=∅} L(M)=∅\}

  2. B.

    L={⟨M⟩∣M is a DFA such that L(M)=Σ∗}L = \{{⟨M⟩ ∣ M \ is\ a\ DFA\ such\ that \ L(M)=Σ^*}\}

  3. C.

    L={⟨M⟩∣M is a PDA such that L(M)=∅}L = \{{⟨M⟩ ∣ M\ is\ a\ PDA\ such\ that\ L(M)=∅}\}

  4. D.

    L={⟨M⟩∣M is a PDA such that L(M)=Σ∗}L = \{{⟨M⟩ ∣ M\ is\ a\ PDA\ such\ that\ L(M)=Σ^*}\}

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): D

Solutions and video are in the course

Question 14 · 1 mark Q1827

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?

  1. A.

    exit

  2. B.

    malloc

  3. C.

    sleep

  4. D.

    strlen

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): A, C

Solutions and video are in the course

Question 15 · 1 mark Q1851

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?

  1. A.

    Creation of a new file in foo

  2. B.

    Deletion of an existing file from foo

  3. C.

    Renaming of an existing file in foo

  4. D.

    Opening of an existing file in foo

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): A, C

Solutions and video are in the course

Question 16 · 1 mark Q2740

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

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): 11

Solutions and video are in the course

Question 17 · 1 mark Q2741

Consider the following undirected graph with edge weights as shown:

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

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): 3

Solutions and video are in the course

Question 18 · 1 mark Q2742

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

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): 0.35 to 0.39

Solutions and video are in the course

Question 19 · 1 mark Q2743

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

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): 65

Solutions and video are in the course

Question 20 · 1 mark Q2744

Consider the following expression.

lim⁡x→−32x+22−4x+3\displaystyle \lim_{x\rightarrow-3}\frac{\sqrt{2x+22}-4}{x+3}

he value of the above expression (rounded to 2 decimal places) is ___________.

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): 0.25

Solutions and video are in the course

Question 21 · 1 mark Q2745

Consider the following sequence of operations on an empty stack.

Push(54);push(52);pop();push(55);push(62);s=pop();Push(54);push(52);pop();push(55);push(62);s=pop();

Consider the following sequence of operations on an empty queue.

enqueue(21);enqueue(24);dequeue();enqueue(28);enqueue(32);q=dequeue();enqueue(21);enqueue(24);dequeue();enqueue(28);enqueue(32);q=dequeue();

The value of s + q is ________.

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): 86

Solutions and video are in the course

Question 22 · 1 mark Q2746

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 KB (1 KB = 210 bytes), and each cache block is of size 64 bytes.

The size of the tag field is ________ bits.

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): 17 bits

Solutions and video are in the course

Question 23 · 1 mark Q2747

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

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): 819 to 820

Solutions and video are in the course

Question 24 · 1 mark Q2748

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 : 11110000000000000000000 

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

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): -7.75

Solutions and video are in the course

Question 25 · 1 mark Q2749

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 (rounded to nearest integer) is _____________ milliseconds.

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): 12 milliseconds

Solutions and video are in the course

Question 26 · 2 marks Q2750

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

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}\begin{array}{lll} P & \rightarrow & D^* E^* \\ D & \rightarrow & \textsf{int ID} \{ \text{record that } \textsf{ID.} \text{lexeme is of type} \textsf{ int\}} \\ D & \rightarrow & \textsf{bool ID} \{ \text{record that } \textsf{ID.} \text{lexeme is of type} \textsf{ bool\}} \\ E& \rightarrow & E_1 +E_2 \{ \text{check that } E_1. \text{type}=E_2. \text{type} = \textsf{int}; \text{set } E.\text{type }:= \textsf{int} \} \\ E & \rightarrow & !E_1 \{ \text{check that } E_1. \text{type} = \textsf{bool}; \text{ set } E.\text{type} := \textsf{bool} \} \\ E & \rightarrow & \textsf{ID} \{ \text{set } E. \text{type } := \textsf{int} \} \end{array}

With respect to the above grammar, which one of the following choices is correct?

  1. A.

    The actions can be used to correctly type-check any syntactically correct program.

  2. B.

    The actions can be used to type-check syntactically correct integer variable declarations and integer expressions.

  3. C.

    The actions can be used to type-check syntactically correct boolean variable declarations and boolean expressions.

  4. D.

    The actions will lead to an infinite loop.

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): B

Solutions and video are in the course

Question 27 · 2 marks Q2751

The following relation records the age of 500 employees of a company, where empNo ( indicating the employee number) is the key: 

empAge(empNo‾,age)empAge(\underline{empNo},age)

Consider the following relational algebra expression: 

ΠempNo(empAge⋈(age>age1)ρempNo1,age1(empAge))\Pi_{empNo}(empAge \Join_{(age>age1)} \rho_{empNo1,age1}(empAge))

 What does the above expression generate?

  1. A.

    Employee numbers of only those employees whose age is the maximum

  2. B.

    Employee numbers of only those employees whose age is more than the age of exactly one other employee

  3. C.

    Employee numbers of all employees whose age is not the minimum

  4. D.

    Employee numbers of all employees whose age is the minimum

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): C

Solutions and video are in the course

Question 28 · 2 marks Q2752

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?

  1. A.

    011,101,000

  2. B.

    001,010,111

  3. C.

    011,101,111

  4. D.

    001,010,000

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): A

Solutions and video are in the course

Question 29 · 2 marks Q2753

Assume that a 12-bit Hamming codeword consisting of 8-bit data and 4 check bits is d8d7d6d5c8d4d4d3d2c4d1c2c1d_8 d_7 d_6 d_5 c_8 d_4 d_4 d_3 d_2 c_4 d_1 c_2 c_1,where the data bits and the check bits are given in the following tables:

d8d7d6d5d4d3d2d1110x0101Data bitsc8c4c2c1y010Check bits\overset{\textbf{Data bits}}{\begin{array}{|c|c|c|c|} \hline d_{8} & d_{7} & d_{6} & d_{5} & d_{4} & d_{3} & d_{2} & d_{1} \\\hline 1 & 1 & 0 & x & 0 & 1 & 0 & 1 \\\hline \end{array}}\qquad \overset{\textbf{Check bits}}{\begin{array}{|c|c|c|c|} \hline c_{8} & c_{4} & c_{2} & c_{1} \\\hline y & 0 & 1 & 0 \\\hline \end{array}}

Which one of the following choices gives the correct values of xx and YY ?

  1. A.

    xx is 0 and yy is 0

  2. B.

    xx is 0 and yy is 1

  3. C.

    xx is 1 and yy is 0

  4. D.

    xx is 1 and yy is 1

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): A

Solutions and video are in the course

Question 30 · 2 marks Q2754

Consider the following recurrence relation.

T(n)={T(n∕2)+T(2n∕5)+7nif  n>01if  n=0T\left ( n \right )=\left\{\begin{array} {lcl} T(n ∕ 2)+T(2n∕5)+7n & \text{if} \; n>0\\1 & \text{if}\; n=0 \end{array}\right.

Which one of the following options is correct?

  1. A.

    T(n)=Θ(n5/2)T(n)=\Theta (n^{5/2})

  2. B.

    T(n)=Θ(nlog⁡n)T(n)=\Theta (n\log n)

  3. C.

    T(n)=Θ(n)T(n)=\Theta (n)

  4. D.

    T(n)=Θ((log⁡n)5/2)T(n)=\Theta ((\log n)^{5/2})

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): C

Solutions and video are in the course

Question 31 · 2 marks Q2755

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

S→d a T∣R fT→a S ∣ b a T ∣ϵR→c a T R ∣ϵ\begin{array}{lll} \text{S} & \rightarrow & d \: a \: \text{T} \mid \text{R} \: f \\ \text{T} & \rightarrow & a \: \text{S} \: \mid \: b \: a \: \text{T} \: \mid \epsilon \\ \text{R} & \rightarrow & c \: a \: \text{T} \: \text{R} \: \mid \epsilon \end{array}

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

abcdf$S1S→daT2TT→aST→baT3T→ε4RR→caTRR→ε\begin{array} {c c c } & a & b & c & d & f & \$ \\\hline \text{S} & & & \boxed{1} & \text{S} \rightarrow da \text{T} & \boxed{2} & \\\hline \text{T} & \text{T} \rightarrow a\text{S} & \text{T} \rightarrow ba\text{T} & \boxed{3} & & \text{T} \rightarrow \varepsilon & \boxed{4}\\\hline \text{R} & & & \text{R} \rightarrow ca\text{T}\text{R} & & \text{R} \rightarrow \varepsilon & \end{array}

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

  1. A.

    1  S→Rf2  S→Rf3  T→ε4  T→ε\boxed{1}\;\text{S} \rightarrow \text{R}f \qquad \boxed{2}\;\text{S} \rightarrow \text{R}f \qquad \boxed{3}\; \text{T} \rightarrow \varepsilon \qquad \boxed{4}\;\text{T} \rightarrow \varepsilon

  2. B.

    1  blank2  S→Rf3  T→ε4  T→ε\boxed{1}\;\text{blank} \qquad \boxed{2}\;\text{S} \rightarrow \text{R}f \qquad \boxed{3}\; \text{T} \rightarrow \varepsilon \qquad \boxed{4}\;\text{T} \rightarrow \varepsilon

  3. C.

    1  S→Rf2  blank3  blank4  T→ε\boxed{1}\;\text{S} \rightarrow \text{R}f \qquad \boxed{2}\;\text{blank} \qquad \boxed{3}\; \text{blank} \qquad \boxed{4}\;\text{T} \rightarrow \varepsilon

  4. D.

    1  blank2  S→Rf3  blank4  blank\boxed{1}\;\text{blank} \qquad \boxed{2}\;\text{S} \rightarrow \text{R}f \qquad \boxed{3}\; \text{blank} \qquad \boxed{4}\;\text{blank}

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): A

Solutions and video are in the course

Question 32 · 2 marks Q2756

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

S1:r1(x)r1(y)r2(x)r2(y)w2(y)w1(x)S_1: r_1(x)r_1(y)r_2(x)r_2(y)w_2(y)w_1(x)

S2:r1(x)r2(x)r2(y)w2(y)r1(y)w1(x)S_2: r_1(x)r_2(x)r_2(y)w_2(y)r_1(y)w_1(x)

Which one of the following options is correct?

  1. A.

    S1S_1 is conflict serializable, and S2S_2 is not conflict serializable.

  2. B.

    S1S_1 is not conflict serializable, and S2S_2 is conflict serializable

  3. C.

    Both S1S_1 and S2S_2 are conflict serializable

  4. D.

    Neither S1S_1 nor S2S_2 is conflict serializable

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): B

Solutions and video are in the course

Question 33 · 2 marks Q2757

Consider the relation R(P,Q,S,T,X,Y,Z,W)R(P,Q,S,T,X,Y,Z,W)  with the following functional dependencies.

PQ→X;P→YX;Q→Y;Y→ZWPQ\rightarrow X;\quad P\rightarrow YX;\quad Q\rightarrow Y; \quad Y\rightarrow 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)]D_1:\quad 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)]D_2:\quad R=[(P,Q,S);\;(T,X);\;(Q,Y);\;(Y,Z,W)]

Which one of the following options is correct?

  1. A.

    D1D_1  is a lossless decomposition, but D2D_2 is a lossy decomposition

  2. B.

    D1D_1  is a lossy decomposition, but D2D_2 is a lossless decomposition

  3. C.

    Both D1D_1 and D2D_2 are lossless decompositions

  4. D.

    Both D1D_1 and D2D_2 are lossy decompositions

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): A

Solutions and video are in the course

Question 34 · 2 marks Q2758

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?

  1. A.

    Both G and H are always cyclic.

  2. B.

    G may not be cyclic, but H is always cyclic.

  3. C.

    G is always cyclic, but H may not be cyclic.

  4. D.

    Both G and H may not be cyclic.

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): B

Solutions and video are in the course

Question 35 · 2 marks Q2759

Consider the two statements. 

S1:S_1 : There exist random variables XX and YY such that

(E[(X−E(X))(Y−E(Y))])2>Var[X]Var[Y]\left(\mathbb E[(X-\mathbb E(X))(Y-\mathbb E(Y))]\right)^2>\textsf{Var}[X]\textsf{Var}[Y]

S2:S_2 : For all random variables XX and YY,

Y,Cov[X,Y]=E[∣X−E[X]∣  ∣Y−E[Y]∣]Y, \textsf{Cov}[X,Y]=\mathbb E \left[|X-\mathbb E[X]|\;|Y-\mathbb E[Y]|\right ]

Which one of the following choices is correct?

  1. A.

    Both S1S_1 and S2S_2 are true.

  2. B.

    S1S_1 is true, but S2S_2 is false.

  3. C.

    S1S_1 is false, but S2S_2 is true.

  4. D.

    Both S1S_1 and S2S_2 are false.

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): D

Solutions and video are in the course

Question 36 · 2 marks Q2760

Let G=(V,E) be an undirected, unweighted, connected graph. Its diameter is the maximum, over all vertex pairs, of the length of a shortest path between them.

Let M be the adjacency matrix of G and let P=M2. Define a simple graph G2 on the same vertex set with adjacency matrix N by setting Nii=0 and, for i≠j, Nij=1 if Mij>0 or Pij>0; otherwise Nij=0.

Which one of the following statements is true?

  1. A.

    diam(G2) ≤ ⌈diam(G)/2⌉

  2. B.

    ⌈diam(G)/2⌉ < diam(G2) < diam(G)

  3. C.

    diam(G2) = diam(G)

  4. D.

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

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): A

Solutions and video are in the course

Question 37 · 2 marks Q2761

Consider the following C program. 

#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;
 }

  1. A.

    The program will not compile successfully.

  2. B.

    The program will compile successfully and output 10 when executed.

  3. C.

    The program will compile successfully and output 8 when executed.

  4. D.

    The program will compile successfully and output 13 when executed.

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): B

Solutions and video are in the course

Question 38 · 2 marks Q2762

Consider the following language:

L={w∈{0,1}∗∣w ends with the substring 011}L= \{ w \in \{0,1\}^* \mid w \text{ ends with the substring } 011 \}

Which one of the following deterministic finite automata accepts LL ? 

  1. A.

  2. B.

  3. C.

  4. D.

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): D

Solutions and video are in the course

Question 39 · 2 marks Q2763

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

L1={⟨M⟩∣M takes more than 2021 steps on all inputs}L2={⟨M⟩∣M takes more than 2021 steps on some input}\begin{array}{ll} L_1 = \{ \langle M \rangle \mid M \text{ takes more than } 2021 \text{ steps on all inputs} \} \\ L_2 = \{ \langle M \rangle \mid M\text{ takes more than } 2021 \text{ steps on some input} \} \end{array}

Which one of the following options is correct?

  1. A.

    Both L1L_1 and L2L_2 are decidable.

  2. B.

    L1L_1 is decidable and L2L_2 is undecidable

  3. C.

    L1L_1 is undecidable and L2L_2 is decidable

  4. D.

    Both L1L_1 and L2L_2 are undecidable

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): A

Solutions and video are in the course

Question 40 · 2 marks Q2764

Define RnR_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 i > 0 , let  p[i]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\text{p}[1]=1,\text{p}[2]=5,\text{p}[3]=8,\text{p}[4]=9,\text{p}[5]=10,\text{p}[6]=17,\text{p}[7]=18

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

  1. A.

    R7R_7 = 18

  2. B.

    R7R_7 = 19

  3. C.

    R7R_7 is achieved by three different solutions.

  4. D.

    R7R_7 cannot be achieved by a solution consisting of three pieces.

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): A, C

Solutions and video are in the course

Question 41 · 2 marks Q2765

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?

  1. A.

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

  2. B.

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

  3. C.

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

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

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): B

Solutions and video are in the course

Question 42 · 2 marks Q2766

Consider the following Boolean expression.

F=(X+Y+Z)(X‾+Y)(Y‾+Z)F=(X+Y+Z)(\overline X +Y)(\overline Y +Z)

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

  1. A.

    (X‾+Y‾+Z‾)(X+Y‾)(Y+Z‾)(\overline X +\overline Y +\overline Z)(X+\overline Y)(Y+\overline Z)

  2. B.

    XY‾+Z‾X\overline Y + \overline Z

  3. C.

    (X+Z‾)(Y‾+Z‾)(X+\overline Z)(\overline Y +\overline Z)

  4. D.

    XY‾+YZ‾+X‾  Y‾  Z‾X\overline Y +Y\overline Z + \overline X\; \overline Y \;\overline Z

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): B, C, D

Solutions and video are in the course

Question 43 · 2 marks Q2767

A relation RR is said to be circular if aRbaRb and bRc together imply cRacRa. Which of the following options is/are correct?

  1. A.

    If a relation SS is reflexive and symmetric, then SS  is an equivalence relation.

  2. B.

    If a relation SS is circular and symmetric, then SS is an equivalence relation.

  3. C.

    If a relation SS is reflexive and circular, then SS is an equivalence relation.

  4. D.

    If a relation SS is transitive and circular, then SS is an equivalence relation.

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): C

Solutions and video are in the course

Question 44 · 2 marks Q2768

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 keepalive timer. Which of the following behaviors is/are possible?

  1. A.

    If the client was waiting to receive a packet, it may wait indefinitely.

  2. B.

    The TCP server application on S can listen on P after reboot.

  3. C.

    If the client sends a packet after the server reboot, it will receive a RST segment.

  4. D.

    If the client sends a packet after the server reboot, it will receive a FIN segment.

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): A, B, C

Solutions and video are in the course

Question 45 · 2 marks Q2769

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×1234. 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 P.

Which of the following statements is/are correct?

  1. A.

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

  2. B.

    If the second fragment is lost, R will resend the fragment with the IP identification value 0×1234.

  3. C.

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

  4. D.

    TCP destination port can be determined by analysing only the second fragment.

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): A, C

Solutions and video are in the course

Question 46 · 2 marks Q1981

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

int counter =0;

Semaphore S= init(5);

void parop(void)

{

           wait(S);

           wait(S);

           counter++;

           signal(S)

           signal(S);

     }

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


  1. A.

    The value of counter is 5 after all the threads successfully complete the execution of parop

  2. B.

    The value of counter is 1 after all the threads successfully complete the execution of parop

  3. C.

    The value of counter is 0 after all the threads successfully complete the execution of parop

  4. D.

    There is a deadlock involving all the threads

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): A, B, D

Solutions and video are in the course

Question 47 · 2 marks Q2771

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

Which of the following sequences of key insertions can cause the above state of the hash table (assume the keys are in decimal notation)?

  1. A.

    5,9,4,13,10,7

  2. B.

    9,5,10,6,7,1

  3. C.

    10,9,6,7,5,13

  4. D.

    9,5,13,6,10,14

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): C

Solutions and video are in the course

Question 48 · 2 marks Q2772

Consider the following ANSI C function:

        int 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;

        }

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

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): 1023

Solutions and video are in the course

Question 49 · 2 marks Q2773

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

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): 50 to 52 frames

Solutions and video are in the course

Question 50 · 2 marks Q2774

Consider the following C code segment:
    a = b + c;
    e = a + 1;
    d = b + c;
    f = d + 1;
    g = e + f;

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

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): 6

Solutions and video are in the course

Question 51 · 2 marks Q2775

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

where p,q∈Qp,q \in Qa∈Σ∪{ϵ}a \in \Sigma \cup \{ \epsilon \}, and X,Y∈Γ∪{ϵ}X,Y \in \Gamma \cup \{ \epsilon \} represents

(q,Y)∈δ(p,a,X).(q,Y) \in \delta(p,a,X).

Consider the following pushdown automaton over the input alphabet Σ={a,b}\Sigma = \{a,b\} and stack alphabet Γ={#,A}\Gamma = \{ \#, A\}. 

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

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): 50

Solutions and video are in the course

Question 52 · 2 marks Q2776

Consider the following matrix.

(0111101111011110)\begin{pmatrix} 0 & 1 & 1 & 1\\ 1& 0& 1 & 1\\ 1& 1 & 0 & 1 \\1 & 1 & 1 & 0 \end{pmatrix}

The largest eigenvalue of the above matrix is __________.

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): 3

Solutions and video are in the course

Question 53 · 2 marks Q2777

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.

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): 17160 nanoseconds

Solutions and video are in the course

Question 54 · 2 marks Q2778

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

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): 0.04

Solutions and video are in the course

Question 55 · 2 marks Q2779

Consider the following instruction sequence where registers R1,R2R1,R2 and R3R3 are general purpose and MEMORY[X]MEMORY[X] denotes the content at the memory location XX.

InstructionSemanticsInstruction Size (bytes)MOV R1,(5000)R1←MEMORY[5000]4MOV R2,(R3)R2←MEMORY[R3]4ADDR2,R1R2←R1+R22MOV (R3),R2MEMORY[R3]←R24INC R3R3←R3+12DEC R1R1←R1−12BNZ 1004Branch if not zero to the2given absolute addressHALTStop1\begin{array}{llc} \textbf{Instruction} & \textbf{Semantics} & \textbf{Instruction Size} \text{ (bytes)} \\ \hline \text{MOV } \text{R1}, (5000) & \text{R1} \leftarrow \text{MEMORY}[5000] & 4 \\ \hline \text{MOV } \text{R2}, (\text{R3}) & \text{R2} \leftarrow \text{MEMORY[R3]} & 4 \\ \hline \text{ADD} \text{R2}, \text{R1} & \text{R2} \leftarrow \text{R1} + \text{R2} & 2 \\ \hline \text{MOV } (\text{R3}), \text{R2} & \text{MEMORY[R3]} \leftarrow \text{R2} & 4 \\ \hline \text{INC } \text{R3} & \text{R3} \leftarrow \text{R3}+1 & 2 \\ \hline \text{DEC } \text{R1} & \text{R1} \leftarrow \text{R1}-1 & 2 \\ \hline \text{BNZ } 1004 & \text{Branch if not zero to the} & 2 \\ & \text{given absolute address}& \\ \hline \text{HALT} & \text{Stop} & 1 \\ \hline \end{array}

Assume that the content of the memory location 5000 is 10, and the content of the register R3R3 is 3000. The content of each of the memory locations from 3000 to 3010 is 50. The instruction sequence starts from the 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 ____________ .

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): 50

Solutions and video are in the course

Question 1 · 1 mark Q2715

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:

  1. A.

    21

  2. B.

    37    

  3. C.

    50

  4. D.

    73

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): C

Solutions and video are in the course

Question 2 · 1 mark Q2716

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?

  1. A.
  2. B.
  3. C.
  4. D.
Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): A

Solutions and video are in the course

Question 3 · 1 mark Q2717

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?

  1. A.

    (i) is grammatically correct and (ii) is unambiguous

  2. B.

    (i) is grammatically incorrect and (ii) is unambiguous

  3. C.

    (i) is grammatically correct and (ii) is ambiguous

  4. D.

    (i) is grammatically incorrect and (ii) is ambiguous

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): C

Solutions and video are in the course

Question 4 · 1 mark Q2718

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

  1. A.
  2. B.
  3. C.
  4. D.
Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): A

Solutions and video are in the course

Question 5 · 1 mark Q2719

_____ is to surgery as writer is to ________

Which one of the following options maintains a similar logical relation in the above sentence?

  1. A.

    Plan, outline

  2. B.

    Hospital, library

  3. C.

    Doctor, book

  4. D.

    Medicine, grammar

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): C

Solutions and video are in the course

Question 6 · 2 marks Q2720

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 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 __________

  1. A.

    π2\frac{\pi}{2}

  2. B.

    3π\frac{3}{\pi}

  3. C.

    9π\frac{9}{\pi}

  4. D.

    3π3\pi

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): C

Solutions and video are in the course

Question 7 · 2 marks Q2721

image.png

  1. A.

    25

  2. B.

    12.5

  3. C.

    10

  4. D.

    5

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): C

Solutions and video are in the course

Question 8 · 2 marks Q2722

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 ___________

  1. A.

    0.3024

  2. B.

    0.4235

  3. C.

    0.6976

  4. D.

    0.8125

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): C

Solutions and video are in the course

Question 9 · 2 marks Q2723

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?

  1. A.

    Only conclusion I is correct

  2. B.

    Only conclusion II is correct

  3. C.

    Either conclusion I or II is correct.

  4. D.

    Neither conclusion I nor II is correct.

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): D

Solutions and video are in the course

Question 10 · 2 marks Q2724

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?

  1. A.

    The proposed AOM addresses the core problems that cause obesity.

  2. B.

    If obesity reduces, poverty will naturally reduce, since obesity causes poverty.

  3. C.

    AOM are addressing the core problems and are likely to succeed.

  4. D.

    AOM are addressing the problem superficially.

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 1): D

Solutions and video are in the course