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

CS Set 2 · 65 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 Q2790

Let G be a connected undirected weighted graph. Consider the following two statements.

S1: There exists a minimum weight edge in G which is present in every minimum spanning tree of G.

S2: If every edge in G has distinct weight, then G has a unique minimum spanning tree.

Which one of the following options 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 2): C

Solutions and video are in the course

Question 2 · 1 mark Q2791

​​​​​Let HH  be a binary min-heap consisting of nn elements implemented as an array. What is the worst case time complexity of an optimal algorithm to find the maximum element in HH ?

  1. A.

    θ(1)\theta (1)

  2. B.

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

  3. C.

    θ(n)\theta (n)

  4. D.

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

Official answer key

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

Solutions and video are in the course

Question 3 · 1 mark Q2792

Consider the following ANSI C program: 


int main () {
Integer x;
return 0;
}

Which one of the following phases in a seven-phase C compiler will throw an error?

  1. A.

    Lexical analyzer

  2. B.

    Syntax analyzer

  3. C.

    Semantic analyzer

  4. D.

    Machine dependent optimizer

Official answer key

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

Solutions and video are in the course

Question 4 · 1 mark Q2793

The format of the single-precision floating point representation of a real number as per the IEEE 754

signexponentmantissa\begin{array}{|c|c|c|} \hline \text{sign} & \text{exponent} & \text{mantissa} \\ \hline \end{array}

Which one of the following choices is correct with respect to the smallest normalized positive number represented using the standard?

  1. A.

    exponent =00000000 and mantissa =00000000000000000000000

  2. B.

    exponent =00000000 and mantissa =00000000000000000000001

  3. C.

    exponent =00000001 and mantissa =00000000000000000000000

  4. D.

    exponent =00000001 and mantissa =00000000000000000000001

Official answer key

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

Solutions and video are in the course

Question 5 · 1 mark Q2794

Which one of the following circuits implements the Boolean function given below?

f(x,y,z)=m0+m1+m3+m4+m5+m6f(x,y,z) = m_0+m_1+m_3+m_4+m_5+m_6  where mim_i  is the ithi^{th}  minterm. 

  1. A.

  2. B.

  3. C.

  4. D.

Official answer key

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

Solutions and video are in the course

Question 6 · 1 mark Q2056

Consider the following statements S1 and S2 about the relational data model:

  • S1: A relation scheme can have at most one foreign key.

  • S2: A foreign key in a relation scheme R cannot be used to refer to tuples of R.

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 2): D

Solutions and video are in the course

Question 7 · 1 mark Q2796

Consider the three-way handshake mechanism followed during TCP connection establishment between hosts P and Q. Let X and Y be two random 32-bit starting sequence numbers chosen by P and Q respectively. Suppose P sends a TCP connection request message to Q with a TCP segment having SYN bit =1, SEQ number =X, and ACK bit =0. Suppose Q accepts the connection request. Which one of the following choices represents the information present in the TCP segment header that is sent by Q to P?

  1. A.

    SYN bit =1, SEQ number =X+1, ACK bit =0, ACK number =Y, FIN bit =0

  2. B.

    SYN bit =0, SEQ number =X+1, ACK bit =0, ACK number =Y, FIN bit =1

  3. C.

    SYN bit =1, SEQ number =Y, ACK bit =1, ACK number =X+1, FIN bit =0

  4. D.

    SYN bit =1, SEQ number =Y, ACK bit =1, ACK number =X, FIN bit =0

Official answer key

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

Solutions and video are in the course

Question 8 · 1 mark Q2797

What is the worst-case number of arithmetic operations performed by recursive binary search on a sorted array of size nn ?

  1. A.

    θ(n)\theta (\sqrt n)

  2. B.

    θ(log2(n))\theta (log_2 (n))

  3. C.

    θ(n2)\theta (n^2)

  4. D.

    θ(n)\theta (n)

Official answer key

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

Solutions and video are in the course

Question 9 · 1 mark Q2798

Let L⊆{0,1}∗L⊆\{0,1\}^∗ be an arbitrary regular language accepted by a minimal DFA with kk states. Which one of the following languages must necessarily be accepted by a minimal DFA with kk states?

  1. A.

    L−{01}L-\{01\}

  2. B.

    L∪{01}L \cup \{01\}

  3. C.

    {0,1}∗–L\{0,1\}^* – L

  4. D.

    L⋅LL \cdot L

Official answer key

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

Solutions and video are in the course

Question 10 · 1 mark Q2799

Consider the following ANSI C program.

#include <stdio.h>
int main( )
{
int arr[4][5];
int i, j;
for (i=0; i<4; i++)
{
for (j=0; j<5; j++)
{
arr[i][j] = 10 * i + j;
}
}
printf("%d", *(arr[1]+9));
return 0;
}

What is the output of the above program?

  1. A.

    14

  2. B.

    20

  3. C.

    24

  4. D.

    30

Official answer key

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

Solutions and video are in the course

Question 11 · 1 mark Q2800

Consider the following sets, where n≥2n≥2:

S1S_1: Set of all n×nn×n matrices with entries from the set {a,b,c}\{a,b,c\}

S2S_2: Set of all functions from the set 0,1,2...,n2−1 {0,1,2 ... ,n^2−1} to the set {0,1,2}\{0,1,2\}

Which of the following choice(s) is/are correct?

  1. A.

    There does not exist a bijection from S1S_1 to S2S_2.

  2. B.

    There exists a surjection from S1S_1 to S2S_2.

  3. C.

    There exists a bijection from S1S_1 to S2S_2.

  4. D.

    There does not exist an injection from S1S_1 to S2S_2.

Official answer key

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

Solutions and video are in the course

Question 12 · 1 mark Q2801

Let L1L_1 be a regular language and L2L_2 be a context-free language. Which of the following languages is/are context-free?

  1. A.

    L1∩L2‾L_1 \cap \overline{L_2} \\

  2. B.

    L1‾∪L2‾‾\overline{\overline{L_1} \cup \overline{L_2}} \\

  3. C.

    L1∪(L2∪L2‾)L_1 \cup (L_2 \cup \overline{L_2}) \\

  4. D.

    (L1∩L2)∪(L1‾∩L2)(L_1 \cap L_2) \cup (\overline{L_1} \cap L_2)

Official answer key

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

Solutions and video are in the course

Question 13 · 1 mark Q2802

In the context of compilers, which of the following is/are NOT an intermediate representation of the source program?

  1. A.

    Three address code

  2. B.

    Abstract Syntax Tree (AST)

  3. C.

    Control Flow Graph (CFG)

  4. D.

    Symbol table

Official answer key

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

Solutions and video are in the course

Question 14 · 1 mark Q1907

Which of the following statement(s) is/are correct in the context of CPU scheduling?

  1. A.

    Turnaround time includes waiting time.

  2. B.

    The goal is to only maximize CPU utilization and minimize throughput.

  3. C.

    Round-robin policy can be used even when the CPU time required by each of the processes is not known apriori.

  4. D.

    Implementing preemptive scheduling needs hardware support.

Official answer key

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

Solutions and video are in the course

Question 15 · 1 mark Q2804

Choose the correct choice(s) regarding the following proportional logic assertion SS:

S:((P∧Q)→R)→((P∧Q)→(Q→R))S: (( P \wedge Q) \rightarrow R) \rightarrow (( P \wedge Q) \rightarrow (Q \rightarrow R))

  1. A.

    SS  is neither a tautology nor a contradiction

  2. B.

    SS is a tautology.

  3. C.

    SS  is a contradiction.

  4. D.

    The antecedent of SS is logically equivalent to the consequent of SS.

Official answer key

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

Solutions and video are in the course

Question 16 · 1 mark Q2805

Consider a complete binary tree with 7 nodes. Let A denote the set of first 3 elements obtained by performing Breadth-First Search (BFS) starting from the root. Let B denote the set of first 3 elements obtained by performing Depth-First Search (DFS) starting from the root.

The value of ∣A−B∣ is _____________ .

Official answer key

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

Solutions and video are in the course

Question 17 · 1 mark Q2806

Consider the following deterministic finite automaton (DFA)

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

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 2): 256 strings

Solutions and video are in the course

Question 18 · 1 mark Q2807

If xx and yy are two decimal digits and (0.1101)2 =(0.8xy5)10(0.1101)_2 = (0.8xy5)_{10}, the decimal value of x+yx+y is _____ .

Official answer key

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

Solutions and video are in the course

Question 19 · 1 mark Q2808

Consider a set-associative cache of size 2KB (1KB=2^10 bytes) with cache block size of 64 bytes. Assume that the cache is byte-addressable and a 32 -bit address is used for accessing the cache. If the width of the tag field is 22 bits, the associativity of the cache is _________ .

Official answer key

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

Solutions and video are in the course

Question 20 · 1 mark Q2809

Consider a computer system with DMA support. The DMA module is transferring one 8-bit character in one CPU cycle from a device to memory through cycle stealing at regular intervals. Consider a 2 MHz processor. If 0.5% processor cycles are used for DMA, the data transfer rate of the device is __________ bits per second.

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 2): 80000 bits per second

Solutions and video are in the course

Question 21 · 1 mark Q2810

A data file consisting of 1,50,000 student-records is stored on a hard disk with block size of 4096 bytes. The data file is sorted on the primary key RollNo. The size of a record pointer for this disk is 7 bytes. Each student-record has a candidate key attribute called ANum of size 12 bytes. Suppose an index file with records consisting of two fields, ANum value and the record pointer to the corresponding student record, is built and stored on the same disk. Assume that the records of data file and index file are not split across disk blocks. The number of blocks in the index file is ________ .

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 2): 698 blocks

Solutions and video are in the course

Question 22 · 1 mark Q2811

For a given biased coin, the probability that the outcome of a toss is a head is 0.4. This coin is tossed 1,000 times. Let X denote the random variable whose value is the number of times that head appeared in these 1,000 tosses. The standard deviation of X (rounded to 2 decimal place) is _________ .

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 2): 15 to 16

Solutions and video are in the course

Question 23 · 1 mark Q2812

Consider the following ANSI C function:

int SomeFunction (int x, int y)
{
if ((x==1) || (y==1)) return 1;

if (x==y) return x;

if (x > y) return SomeFunction(x-y, y);

if (y > x) return SomeFunction (x, y-x);



}

The value returned by SomeFunction(15, 255) is __________ .

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 2): 15

Solutions and video are in the course

Question 24 · 1 mark Q2813

Suppose that P is a 4×5 matrix such that every solution of the equation Px = 0 is a scalar multiple of [2 5 4 3 1]T. The rank of P is __________ .

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 2): 4

Solutions and video are in the course

Question 25 · 1 mark Q2814

Suppose that f:R→Rf: \mathbb{R} \rightarrow \mathbb{R} is a continuous function on the interval [−3,3] and a differentiable function in the interval (−3,3) such that for every xx in the interval, f’(x)≤2f’(x) \leq 2 if f(−3)=7f(-3)=7, then f(3)f(3) is at most __________ .

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 2): 19

Solutions and video are in the course

Question 26 · 2 marks Q2815

Consider the string abbccddeeeabbccddeee. Each letter in the string must be assigned a binary code satisfying the following properties:

  1. For any two letters, the code assigned to one letter must not be a prefix of the code assigned to the other letter.

  2. For any two letters of the same frequency, the letter which occurs earlier in the dictionary order is assigned a code whose length is at most the length of the code assigned to the other letter.

Among the set of all binary code assignments which satisfy the above two properties, what is the minimum length of the encoded string?

  1. A.

    21

  2. B.

    23

  3. C.

    25

  4. D.

    30

Official answer key

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

Solutions and video are in the course

Question 27 · 2 marks Q2816

Assume a two-level inclusive cache hierarchy, L1 and L2, where L2 is the larger of the two. Consider the following statements.

S1: Read misses in a write through L1 cache do not result in writebacks of dirty lines to the L2

S2: Write allocate policy must be used in conjunction with write through caches and no-write allocate policy is used with writeback caches.

Which of the following statements 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 2): A

Solutions and video are in the course

Question 28 · 2 marks Q2817

Suppose we want to design a synchronous circuit that processes a string of 0’s and 1’s. Given a string, it produces another string by replacing the first 1 in any subsequence of consecutive 1’s by a 0. Consider the following example.

Input sequence : 00100011000011100 Output sequence : 00000001000001100

A Mealy MachineMealy \ Machine is a state machine where both the next state and the output are functions of the present state and the current input. The above mentioned circuit can be designed as a two-state Mealy machine. The states in the Mealy machine can be represented using Boolean values 0 and 1. We denote the current state, the next state, the next incoming bit, and the output bit of the Mealy machine by the variables s, t, bs, \ t, \ b and yy respectively. Assume the initial state of the Mealy MachineMealy \ Machine is 0.

What are the Boolean expressions corresponding to tt and yy in terms of ss and bb?

  1. A.

    t=s+by=sb\begin{array}{l} t=s+b \\ y=sb \end{array} \\

  2. B.

    t=by=sb\begin{array}{l} t=b \\ y=sb \end{array} \\

  3. C.

    t=by=sb‾\begin{array}{l} t=b \\ y=s \overline{b} \end{array} \\

  4. D.

    t=s+by=sb‾\begin{array}{l} t=s+b \\ y=s \overline{b} \end{array}

Official answer key

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

Solutions and video are in the course

Question 29 · 2 marks Q2818

In an examination, a student can choose the order in which two questions (QuesAQuesA and QuesBQuesB) must be attempted.

- If the first question is answered wrong, the student gets zero marks.

- If the first question is answered correctly and the second question is not answered correctly, the student gets the marks only for the first question.

- If both the questions are answered correctly, the student gets the sum of the marks of the two questions.

The following table shows the probability of correctly answering a question and the marks of the question respectively. 

questionprobabilty of answering correctlymarksQuesA0.810QuesB0.520\begin{array}{c|c|c} \text{question} & \text{probabilty of answering correctly} & \text{marks} \\ \hline \textsf{QuesA} & 0.8 & 10 \\ \textsf{QuesB} & 0.5 & 20 \end{array}

Assuming that the student always wants to maximize her expected marks in the examination, in which order should she attempt the questions and what is the expected marks for that order (assume that the questions are independent)?

  1. A.

    First QuesAQuesA and then QuesBQuesB. Expected marks 14

  2. B.

    First QuesBQuesB and then QuesAQuesA. Expected marks 14

  3. C.

    First QuesBQuesB and then QuesAQuesA. Expected marks 22

  4. D.

    First QuesAQuesA and then QuesBQuesB. Expected marks 16

Official answer key

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

Solutions and video are in the course

Question 30 · 2 marks Q2819

Consider the following ANSI C code segment: 

z=x + 3 + y->f1 + y->f2; 
for (i = 0; i < 200; i = i + 2) { 
    if (z > i){ 
        p = p + x + 3; 
        q = q + y->f1; 
    } else { 
        p = p + y->f2; 
        q = q + x + 3; 
    } 
} 

Assume that the variable y points to a struct (allocated on the heap) containing two fields f1f1 and f2f2, and the local variables x, y, z, p, q, and i are allotted registers. Common sub-expression elimination (CSE) optimization is applied on the code. The number of addition and the dereference operations (of the form y ->f1f1 or y ->f2f2) in the optimized code, respectively, are:

  1. A.

    403 and 102

  2. B.

    203 and 2

  3. C.

    303 and 102

  4. D.

    303 and 2

Official answer key

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

Solutions and video are in the course

Question 31 · 2 marks Q2820

The relation scheme given below is used to store information about the employees of a company, where empId is the key and deptId indicates the department to which the employee is assigned. Each employee is assigned to exactly one department.

emp(<u>empId</u>, name, gender, salary, deptId)

Consider the following SQL query:

select deptId, count(*) from emp where gender = "female" and salary > (select avg(salary)from emp) group by deptId;

The above query gives, for each department in the company, the number of female employees whose salary is greater than the average salary of

  1. A.

    employees in the department.

  2. B.

    employees in the company.

  3. C.

    female employees in the department.

  4. D.

    female employees in the company.

Official answer key

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

Solutions and video are in the course

Question 32 · 2 marks Q2821

Let S be the following schedule of operations of three transactions T1, T2T_1, \ T_2 and T3T_3 in a relational database system:

R2(Y),R1(X),R3(Z),R1(Y)W1(X),R2(Z),W2(Y),R3(X),W3(Z)R_2(Y), R_1(X), R_3(Z), R_1(Y)W_1(X), R_2(Z), W_2(Y), R_3(X), W_3(Z)

Consider the statements PP and QQ below:

PP: SS is conflict-serializable.

QQ: If  T3T_3 commits before T1T_1 finishes, then SS  is recoverable.

Which one of the following choices is correct?

  1. A.

    Both PP and QQ are true

  2. B.

    PP is true and QQ  is false

  3. C.

    PP is false and QQ is true

  4. D.

    Both PP and QQ are false

Official answer key

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

Solutions and video are in the course

Question 33 · 2 marks Q2822

A bag has rr red balls and bb black balls. All balls are identical except for their colours. In a trial, a ball is randomly drawn from the bag, its colour is noted and the ball is placed back into the bag along with another ball of the same colour. Note that the number of balls in the bag will increase by one, after the trial. A sequence of four such trials is conducted. Which one of the following choices gives the probability of drawing a red ball in the fourth trial?

  1. A.

    rr+b\dfrac{r}{r+b}

  2. B.

    rr+b+3\dfrac{r}{r+b+3}

  3. C.

    r+3r+b+3\dfrac{r+3}{r+b+3}

  4. D.

    (rr+b)(r+1r+b+1)(r+2r+b+2)(r+3r+b+3)\left( \dfrac{r}{r+b} \right) \left ( \dfrac{r+1}{r+b+1} \right) \left( \dfrac{r+2}{r+b+2} \right) \left( \dfrac{r+3}{r+b+3} \right)

Official answer key

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

Solutions and video are in the course

Question 34 · 2 marks Q2823

Consider the cyclic redundancy check (CRC) based error detecting scheme having the generator polynomial X3+X+1X^3+X+1. Suppose the message m4m3m2m1m0=11000m_4m_3m_2m_1m_0 = 11000  is to be transmitted. Check bits c2c1c0 are appended at the end of the message by the transmitter using the above CRC scheme. The transmitted bit string is denoted by m4m3m2m1m0c2c1c0m_4m_3m_2m_1m_0c_2c_1c_0. The value of the checkbit sequence c2c1c0c_2c_1c_0 is

  1. A.

    101

  2. B.

    110

  3. C.

    100

  4. D.

    111

Official answer key

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

Solutions and video are in the course

Question 35 · 2 marks Q2824

Consider the following ANSI C program:

#include <stdio.h>
#include <stdlib.h>
struct Node{
int value;
struct Node *next;};
int main( ) {
struct Node *boxE, *head, *boxN; int index=0;
boxE=head= (struct Node *) malloc(sizeof(struct Node));
head->value = index;
for (index =1; index<=3; index++){
boxN = (struct Node *) malloc (sizeof(struct Node));
boxE->next = boxN;
boxN->value = index;
boxE = boxN; }
for (index=0; index<=3; index++) {
printf("Value at index %d is %d\n", index, head->value);
head = head->next;
printf("Value at index %d is %d\n", index+1, head->value); } }

Which one of the following statements below is correct about the program?

  1. A.

    Upon execution, the program creates a linked-list of five nodes.

  2. B.

    Upon execution, the program goes into an infinite loop

  3. C.

    It has a missing return which will be reported as an error by the compiler

  4. D.

    It dereferences an uninitialized pointer that may result in a run-time error

Official answer key

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

Solutions and video are in the course

Question 36 · 2 marks Q2825

Consider the following two statements about regular languages:

S1: Every infinite regular language contains an undecidable language as a subset.

S2: Every finite language is regular.

Which one of the following choices is correct?

  1. A.

    Only S1 is true

  2. B.

    Only S2 is true

  3. C.

    Both S1 and S2 are true

  4. D.

    Neither S1 nor S2 is true

Official answer key

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

Solutions and video are in the course

Question 37 · 2 marks Q2826

For two n-dimensional real vectors P and Q, the operation s(P,Q) is defined as follows:

image.png

Let L be a set of 10-dimensional non-zero real vectors such that for every pair of distinct vectors P,Q ∈ L, s(P,Q)=0. What is the maximum cardinality possible for the set L?

  1. A.

    9

  2. B.

    10

  3. C.

    11

  4. D.

    100

Official answer key

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

Solutions and video are in the course

Question 38 · 2 marks Q2827

For a statement SS in a program, in the context of liveness analysis, the following sets are defined:

USE(S)USE(S) : the set of variables used in SS

IN(S)IN(S): the set of variables that are live at the entry of SS

OUT(S)OUT(S)  : the set of variables that are live at the exit of SS

Consider a basic block that consists of two statements, S1S_1 followed by S2S_2. Which one of the following statements is correct?

  1. A.

    \(\text{OUT(\(S_1\))} = \text{IN (S2S_2)}\)

  2. B.

    \(\text{OUT (\(S_1\))} = \text{IN (S1S_1)} \cup \text{ USE (S1S_1)}\)

  3. C.

    \(\text{OUT (\(S_1\))} = \text{IN (S2S_2) }\cup \text{ OUT (S2S_2)}\)

  4. D.

    \(\text{OUT (\(S_1\))} = \text{USE (S1S_1)} \cup \text{IN (S2S_2)}\)

Official answer key

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

Solutions and video are in the course

Question 39 · 2 marks Q2828

For constants a≥1a≥1 and b>1b>1, consider the following recurrence defined on the non-negative integers:

T(n)=a⋅T(nb)+f(n)T(n) = a \cdot T \left(\dfrac{n}{b} \right) + f(n)

Which one of the following options is correct about the recurrence T(n)T(n) ?

  1. A.

     if f(n)f(n) is nlog⁡2(n)n \log_2(n) , then T(n)T(n) is Θ(nlog⁡2(n))\Theta(n \log_2(n)) .

  2. B.

    if f(n)f(n) is nlog⁡2(n)\dfrac{n}{\log_2(n)} , then T(n)T(n) is Θ(log⁡2(n))\Theta(\log_2(n)) .

  3. C.

     if f(n)f(n) is O(nlog⁡b(a)−ϵ)O(n^{\log_b(a)-\epsilon}) for some ϵ>0\epsilon >0, then T(n)T(n) is Θ(nlog⁡b(a))\Theta(n^{\log_b(a)}) .

  4. D.

     if f(n)f(n) is Θ(nlog⁡b(a))\Theta(n^{\log_b(a)}), then T(n)T(n) is Θ(nlog⁡b(a))\Theta(n^{\log_b(a)}) .

Official answer key

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

Solutions and video are in the course

Question 40 · 2 marks Q2042

Suppose the following functional dependencies hold on a relation U with attributes P,Q,R,S, and T:

P → QR

RS → T

Which of the following functional dependencies can be inferred from the above functional dependencies?

  1. A.

    PS → T

  2. B.

    R → T

  3. C.

    P → R

  4. D.

    PS → Q

Official answer key

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

Solutions and video are in the course

Question 41 · 2 marks Q2830

For a string ww, we define wRw^R to be the reverse of ww. For example, if w=01101w = 01101 then wR =10110w^R = 10110 .

Which of the following languages is/are context-free?

  1. A.

    {wxwRxR∣w,x∈{0,1}∗}\{ wxw^Rx^R \mid w,x \in \{0,1\} ^* \}

  2. B.

    {wwRxxR∣w,x∈{0,1}∗}\{ ww^Rxx^R \mid w,x \in \{0,1\} ^* \}

  3. C.

    {wxwR∣w,x∈{0,1}∗}\{ wxw^R \mid w,x \in \{0,1\} ^* \}

  4. D.

    {wxxRwR∣w,x∈{0,1}∗}\{ wxx^Rw^R \mid w,x \in \{0,1\} ^* \}

Official answer key

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

Solutions and video are in the course

Question 42 · 2 marks Q2831

Consider the following multi-threaded code segment (in a mix of C and pseudo-code), invoked by two processes P1 and P2, and each of the processes spawns two threads T1 and T2:

int x = 0; // global
Lock L1; // global
main () {
create a thread to execute foo( ); // Thread T1
create a thread to execute foo( ); // Thread T2
wait for the two threads to finish execution;
print(x);}


foo(){
int y = 0;
Acquire L1;
x = x + 1;
y = y + 1;
Release L1;
print (y);
}

Which of the following statement(s) is/are correct?

  1. A.

    Both P1 and P2 will print the value of x as 2.

  2. B.

    At least one of P1 and P2 will print the value of x as 4.

  3. C.

    At least one of the threads will print the value of y as 2.

  4. D.

    Both T1 and T2, in both the processes, will print the value of y as 1.

Official answer key

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

Solutions and video are in the course

Question 43 · 2 marks Q2832

Consider a computer system with multiple shared resource types, with one instance per resource type. Each instance can be owned by only one process at a time. Owning and freeing of resources are done by holding a global lock (L). The following scheme is used to own a resource instance:

function OWNRESOURCE(Resource R) Acquire lock L // a global lock if R is available then Acquire R Release lock L else if R is owned by another process P then Terminate P, after releasing all resources owned by P Acquire R Restart P Release lock L end if end if end function

Which of the following choice(s) about the above scheme is/are correct?

  1. A.

    The scheme ensures that deadlocks will not occur.

  2. B.

    The scheme may lead to live-lock.

  3. C.

    The scheme may lead to starvation.

  4. D.

    The scheme violates the mutual exclusion property.

Official answer key

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

Solutions and video are in the course

Question 44 · 2 marks Q2833

If the numerical value of a 2-byte unsigned integer on a little endian computer is 255 more than that on a big endian computer, which of the following choices represent(s) the unsigned integer on a little endian computer?

  1. A.

    0x6665

  2. B.

    0x0001

  3. C.

    0x4243

  4. D.

    0x0100

Official answer key

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

Solutions and video are in the course

Question 45 · 2 marks Q2834

Consider a computer network using the distance vector routing algorithm in its network layer. The partial topology of the network is shown below.

The objective is to find the shortest-cost path from the router R to routers P and Q. Assume that R does not initially know the shortest routes to P and Q. Assume that R has three neighbouring routers denoted as X, Y and Z. During one iteration, R measures its distance to its neighbours X, Y, and Z as 3, 2 and 5, respectively. Router R gets routing vectors from its neighbours that indicate that the distance to router P from routers X, Y and Z are 7, 6 and 5, respectively. The routing vector also indicates that the distance to router Q from routers X, Y and Z are 4, 6 and 8 respectively. Which of the following statement(s) is/are correct with respect to the new routing table of R, after updation during this iteration?

  1. A.

    The distance from R to P will be stored as 10.

  2. B.

    The distance from R to Q will be stored as 7.

  3. C.

    The next hop router for a packet from R to P is Y.

  4. D.

    The next hop router for a packet from R to Q is Z.

Official answer key

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

Solutions and video are in the course

Question 46 · 2 marks Q2835

Consider the following directed graph: 

Which of the following is/are correct about the graph?

  1. A.

    The graph does not have a topological order.

  2. B.

    A depth-first traversal starting at vertex S classifies three directed edges as back edges.

  3. C.

    The graph does not have a strongly connected component.

  4. D.

    For each pair of vertices u and v, there is a directed path from u to v

Official answer key

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

Solutions and video are in the course

Question 47 · 2 marks Q2836

Which of the following regular expressions represent(s) the set of all binary numbers that are divisible by three? Assume that the string ϵ is divisible by three.

  1. A.

    (0+1(01∗0)∗1)∗(0+1(01^*0)^*1)^*

  2. B.

    (0+11+10(1+00)∗01)∗(0+11+10(1+00)^*01)^*

  3. C.

    (0∗(1(01∗0)∗1)∗)∗(0^*(1(01^*0)^*1)^*)^*

  4. D.

    (0+11+11(1+00)∗00)∗(0+11+11(1+00)^*00)^*

Official answer key

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

Solutions and video are in the course

Question 48 · 2 marks Q1933

Consider a three-level page table to translate a 39-bit virtual address to a physical address as shown below:


The page size is 4 KB = (1KB = 210 bytes) and page table entry size at every level is 8 bytes. A process P is currently using 2 GB (1 GB = 230 bytes) virtual memory which OS mapped to 2 GB of physical memory. The minimum amount of memory required for the page table of P across all levels is _________ KB

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 2): 4108 KB

Solutions and video are in the course

Question 49 · 2 marks Q2838

Consider the following ANSI C program

#include <stdio.h>

int foo(int x, int y, int q)

{

if ((x<=0) && (y<=0))

return q;

if (x<=0)

return foo(x, y-q, q);

if (y<=0)

return foo(x-q, y, q);

return foo(x, y-q, q) + foo(x-q, y, q);

}

int main( )

{

int r = foo(15, 15, 10);

printf("%d", r);

return 0;

}

The output of the program upon execution is _________ .

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 2): 60

Solutions and video are in the course

Question 50 · 2 marks Q2839

Let S be a set consisting of 10 elements. The number of tuples of the form (A,B) such that A and B are subsets of S, and A⊆B is ___________ .

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 2): 59049

Solutions and video are in the course

Question 51 · 2 marks Q2840

Consider the following augmented grammar with {#,@,<,>,a,b,c}\{ \#, @, <, >, a, b, c \} as the set of terminals.

S’→SS→S#cSS→SSS→S@S→<S>S→aS→bS→c\begin{array}{l} S’ \rightarrow S \\ S \rightarrow S \# cS \\ S \rightarrow SS \\ S \rightarrow S @ \\ S \rightarrow < S > \\ S \rightarrow a \\ S \rightarrow b \\ S \rightarrow c \end{array}

Let I0=CLOSURE({S’→∙S})I_0 = \text{CLOSURE}(\{S’ \rightarrow \bullet S\}) The number of items in the set GOTO(GOTO(I0<),<)\text{GOTO(GOTO}(I_0<), <) is ___________.

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 2): 8

Solutions and video are in the course

Question 52 · 2 marks Q2841

Consider a Boolean function f(w,x,y,z) f(w,x,y,z) such that

<span class="mathjax-latex">f(w,0,0,z)=1f(1,x,1,z)=x+zf(w,1,y,z)=wz+y\begin{array}{lll} f(w,0,0,z) & = & 1 \\ f(1,x,1,z) & =& x+z \\ f(w,1,y,z) & = & wz +y \end{array}</span>

The number of literals in the minimal sum-of-products expression of ff is _________ .

Official answer key

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

Solutions and video are in the course

Question 53 · 2 marks Q2842

Consider a pipelined processor with 5 stages, Instruction Fetch(IF), Instruction Decode(ID), Execute (EX),Memory Access (MEM), and Write Back (WB). Each stage of the pipeline, except the EX stage, takes one cycle. Assume that the ID stage merely decodes the instruction and the register read is performed in the EX stage. The EX stage takes one cycle for ADD instruction and two cycles for MUL instruction. Ignore pipeline register latencies.

Consider the following sequence of 8 instructions:

ADD, MUL, ADD, MUL, ADD, MUL, ADD, MUL\textsf{ADD, MUL, ADD, MUL, ADD, MUL, ADD, MUL}

Assume that every MUL instruction is data-dependent on the ADD instruction just before it and every ADD instruction (except the first ADD) is data-dependent on the MUL instruction just before it. The speedup defined as follows.

Speedup=Execution time without operand forwardingExecution time with operand forwarding\textit{Speedup} = \dfrac{\text{Execution time without operand forwarding}}{\text{Execution time with operand forwarding}}

The SpeedupSpeedup achieved in executing the given instruction sequence on the pipelined processor (rounded to 2 decimal places) is _____________ .

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 2): 1.87 to 1.88

Solutions and video are in the course

Question 54 · 2 marks Q2843

Consider a network using the pure ALOHA medium access control protocol, where each frame is of length 1,000 bits. The channel transmission rate is 1 Mbps (=10^6 bits per second). The aggregate number of transmissions across all the nodes (including new frame transmissions and retransmitted frames due to collisions) is modelled as a Poisson process with a rate of 1,000 frames per second. Throughput is defined as the average number of frames successfully transmitted per second. The throughput of the network (rounded to the nearest integer) is ______________ .

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 2): 130 to 140 frames per second

Solutions and video are in the course

Question 55 · 2 marks Q2844

In a directed acyclic graph with a source vertex s, the quality-score of a directed path is defined to be the product of the weights of the edges on the path. Further, for a vertex v other than s, the quality-score of v is defined to be the maximum among the quality-scores of all the paths from s to v. The quality-score of s is assumed to be 1.

The sum of the quality-scores of all vertices on the graph shown above is _______ .

Official answer key

Official answer key (GATE Computer Science & IT 2021 GATE 2021 · CS · Set 2): 929

Solutions and video are in the course

Question 1 · 1 mark Q2780

Gauri said that she can play the keyboard __________ her sister.

  1. A.

    as well as

  2. B.

    as better as

  3. C.

    as nicest as

  4. D.

    as worse as

Official answer key

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

Solutions and video are in the course

Question 2 · 1 mark Q2781

        ​​​​​​​    ​​​​​​​    ​​​​​​​    

A transparent square sheet shown above is folded along the dotted line. The folded sheet 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 2): B

Solutions and video are in the course

Question 3 · 1 mark Q2782

If θ\theta is the angle, in degrees, between the longest diagonal of the cube and any one of the edges of the cube, then, cos θ\theta =

  1. A.

    12\frac {1}{2}

  2. B.

    13\frac {1}{\sqrt 3}

  3. C.

    12\frac {1}{\sqrt 2}

  4. D.

    32\frac {\sqrt 3}{2}

Official answer key

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

Solutions and video are in the course

Question 4 · 1 mark Q2783

If (x–12)2–(x−32)2=x+2,\left( x – \dfrac{1}{2} \right)^2 – \left( x- \dfrac{3}{2} \right) ^2 = x+2, , then the value of xx is:

  1. A.

    2

  2. B.

    4

  3. C.

    6

  4. D.

    8

Official answer key

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

Solutions and video are in the course

Question 5 · 1 mark Q2784

Pen : Write :: Knife : _________

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

  1. A.

    Vegetables

  2. B.

    Sharp

  3. C.

    Cut

  4. D.

    Blunt

Official answer key

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

Solutions and video are in the course

Question 6 · 2 marks Q2785

Listening to music during exercise improves exercise performance and reduces discomfort. Scientists researched whether listening to music while studying can help students learn better and the results were inconclusive. Students who needed external stimulation for studying fared worse while students who did not need any external stimulation benefited from music.

Which one of the following statements is the CORRECT inference of the above passage?

  1. A.

    Listening to music has no effect on learning and a positive effect on physical exercise.

  2. B.

    Listening to music has a clear positive effect both on physical exercise and on learning.

  3. C.

    Listening to music has a clear positive effect on physical exercise. Music has a positive effect on learning only in some students.

  4. D.

    Listening to music has a clear positive effect on learning in all students. Music has a positive effect only in some students who exercise.

Official answer key

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

Solutions and video are in the course

Question 7 · 2 marks Q2786

A jigsaw puzzle has 2 pieces. One of the pieces is shown above. Which one of the given options for the missing piece when assembled will form a rectangle? The piece can be moved, rotated or flipped to assemble with the above piece.

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

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

Solutions and video are in the course

Question 8 · 2 marks Q2787

The number of students in three classes is in the ratio 3:13:6. If 18 students are added to each class, the ratio changes to 15:35:21.

The total number of students in all the three classes in the beginning was:

  1. A.

    22

  2. B.

    66

  3. C.

    88

  4. D.

    110

Official answer key

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

Solutions and video are in the course

Question 9 · 2 marks Q2788

The number of units of a product sold in three different years and the respective net profits are presented in the figure above. The cost/unit in Year 3 was ₹1, which was half the cost/unit in Year 2. The cost/unit in Year 3 was one-third of the cost/unit in Year 1. Taxes were paid on the selling price at 10%, 13% and 15% respectively for the three years. Net profit is calculated as the difference between the selling price and the sum of cost and taxes paid in that year.

The ratio of the selling price in Year 2 to the selling price in Year 3 is ________.

  1. A.

    4:3

  2. B.

    1:1

  3. C.

    3:4

  4. D.

    1:2

Official answer key

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

Solutions and video are in the course

Question 10 · 2 marks Q2789

Six students P, Q, R, S, T and U, with distinct heights, compare their heights and make the following observations.

Observation I: S is taller than R.

Observation II: Q is the shortest of all.

Observation III: U is taller than only one student.

Observation IV: T is taller than S but is not the tallest.

The number of students that are taller than R is the same as the number of students shorter than ______.

  1. A.

    T

  2. B.

    R

  3. C.

    S

  4. D.

    P

Official answer key

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

Solutions and video are in the course