GATE 2022 CS

All 65 questions of GATE 2022 CS

Question text and figures as in the official paper, with the answer from the official key. Worked solutions for every question are in your report after you take the paper as a 3-hour test.

Q1 · General Aptitude · MCQ · 1 mark

The _________ is too high for it to be considered _________.

  • (A)
    fair / fare
  • (B)
    faer / fair
  • (C)
    fare / fare
  • (D)
    fare / fair

Answer (official key): D

Read the worked solution

Q2 · General Aptitude · MCQ · 1 mark

A palindrome is a word that reads the same forwards and backwards. In a game of words, a player has the following two plates painted with letters.

Given plates for Q5

From the additional plates given in the options, which one of the combinations of additional plates would allow the player to construct a five-letter palindrome. The player should use all the five plates exactly once. The plates can be rotated in their plane.

  • (A)
    GATE 2022 CS question 2 (Analytical Aptitude), option A
  • (B)
    GATE 2022 CS question 2 (Analytical Aptitude), option B
  • (C)
    GATE 2022 CS question 2 (Analytical Aptitude), option C
  • (D)
    GATE 2022 CS question 2 (Analytical Aptitude), option D

Answer (official key): B

Worked solution: in your report after you take this paper.

Q3 · General Aptitude · MCQ · 1 mark

Given below are four statements.

Statement 1: All students are inquisitive.
Statement 2: Some students are inquisitive.
Statement 3: No student is inquisitive.
Statement 4: Some students are not inquisitive.

From the given four statements, find the two statements that CANNOT BE TRUE simultaneously, assuming that there is at least one student in the class.

  • (A)
    Statement 1 and Statement 3
  • (B)
    Statement 1 and Statement 2
  • (C)
    Statement 2 and Statement 4
  • (D)
    Statement 3 and Statement 4

Answer (official key): A

Worked solution: in your report after you take this paper.

Q4 · General Aptitude · MCQ · 1 mark

Let rr be a root of the equation

x2+2x+6=0.x^2 + 2x + 6 = 0.

Then the value of the expression

(r+2)(r+3)(r+4)(r+5)(r+2)(r+3)(r+4)(r+5)

is

  • (A)
    5151
  • (B)
    −51-51
  • (C)
    126126
  • (D)
    −126-126

Answer (official key): D

Worked solution: in your report after you take this paper.

Q5 · General Aptitude · MCQ · 1 mark

A function y(x)y(x) is defined in the interval [0,1][0,1] on the xx-axis as

y(x)={2,0≤x<133,13≤x<341,34≤x≤1y(x)= \begin{cases} 2, & 0 \le x < \frac{1}{3} \\ 3, & \frac{1}{3} \le x < \frac{3}{4} \\ 1, & \frac{3}{4} \le x \le 1 \end{cases}

Which one of the following is the area under the curve for the interval [0,1][0,1] on the xx-axis?

  • (A)
    56\frac{5}{6}
  • (B)
    65\frac{6}{5}
  • (C)
    136\frac{13}{6}
  • (D)
    613\frac{6}{13}

Answer (official key): C

Worked solution: in your report after you take this paper.

Q6 · General Aptitude · MCQ · 2 marks

Some people believe that “what gets measured, improves”. Some others believe that “what gets measured, gets gamed”. One possible reason for the difference in the beliefs is the work culture in organizations. In organizations with good work culture, metrics help improve outcomes. However, the same metrics are counterproductive in organizations with poor work culture.

Which one of the following is the CORRECT logical inference based on the information in the above passage?

  • (A)
    Metrics are useful in organizations with poor work culture
  • (B)
    Metrics are useful in organizations with good work culture
  • (C)
    Metrics are always counterproductive in organizations with good work culture
  • (D)
    Metrics are never useful in organizations with good work culture

Answer (official key): B

Worked solution: in your report after you take this paper.

Q7 · General Aptitude · MCQ · 2 marks

In a recently conducted national entrance test, boys constituted 65% of those who appeared for the test. Girls constituted the remaining candidates and they accounted for 60% of the qualified candidates.

Which one of the following is the correct logical inference based on the information provided in the above passage?

  • (A)
    Equal number of boys and girls qualified
  • (B)
    Equal number of boys and girls appeared for the test
  • (C)
    The number of boys who appeared for the test is less than the number of girls who appeared
  • (D)
    The number of boys who qualified the test is less than the number of girls who qualified

Answer (official key): D

Worked solution: in your report after you take this paper.

Q8 · General Aptitude · MCQ · 2 marks

A plot of land must be divided between four families. They want their individual plots to be similar in shape, not necessarily equal in area. The land has equally spaced poles, marked as dots in the below figure. Two ropes, R1 and R2, are already present and cannot be moved.

Plot figure for Q10

What is the least number of additional straight ropes needed to create the desired plots? A single rope can pass through three poles that are aligned in a straight line.

  • (A)
    2
  • (B)
    4
  • (C)
    5
  • (D)
    3

Answer (official key): D

Worked solution: in your report after you take this paper.

Q9 · General Aptitude · MCQ · 2 marks

The corners and mid-points of the sides of a triangle are named using the distinct letters P, Q, R, S, T and U, but not necessarily in the same order. Consider the following statements:

  • The line joining P and R is parallel to the line joining Q and S.
  • P is placed on the side opposite to the corner T.
  • S and U cannot be placed on the same side.

Which one of the following statements is correct based on the above information?

  • (A)
    P cannot be placed at a corner
  • (B)
    S cannot be placed at a corner
  • (C)
    U cannot be placed at a mid-point
  • (D)
    R cannot be placed at a corner

Answer (official key): B

Worked solution: in your report after you take this paper.

Q10 · General Aptitude · MCQ · 2 marks

A box contains five balls of same size and shape. Three of them are green coloured balls and two of them are orange coloured balls. Balls are drawn from the box one at a time. If a green ball is drawn, it is not replaced. If an orange ball is drawn, it is replaced with another orange ball.

First ball is drawn. What is the probability of getting an orange ball in the next draw?

  • (A)
    12\frac{1}{2}
  • (B)
    825\frac{8}{25}
  • (C)
    1950\frac{19}{50}
  • (D)
    2350\frac{23}{50}

Answer (official key): D

Read the worked solution

Q11 · Computer Organization and Architecture · MCQ · 1 mark

Which one of the following facilitates transfer of bulk data from hard disk to main memory with the highest throughput?

  • (A)
    DMA based I/O transfer
  • (B)
    Interrupt driven I/O transfer
  • (C)
    Polling based I/O transfer
  • (D)
    Programmed I/O transfer

Answer (official key): A

Worked solution: in your report after you take this paper.

Q12 · Databases · MCQ · 1 mark

In a relational data model, which one of the following statements is TRUE?

  • (A)
    A relation with only two attributes is always in BCNF.
  • (B)
    If all attributes of a relation are prime attributes, then the relation is in BCNF.
  • (C)
    Every relation has at least one non-prime attribute.
  • (D)
    BCNF decompositions preserve functional dependencies.

Answer (official key): A

Worked solution: in your report after you take this paper.

Q13 · Operating System · MCQ · 1 mark

Consider the following threads, T1, T2, and T3 executing on a single processor, synchronized using three binary semaphore variables, S1, S2, and S3, operated upon using standard wait() and signal(). The threads can be context switched in any order and at any time.

T1T2T3
while(true){ wait(S3); print("C"); signal(S2); }while(true){ wait(S1); print("B"); signal(S3); }while(true){ wait(S2); print("A"); signal(S1); }

Which initialization of the semaphores would print the sequence BCABCABCA....?

  • (A)
    S1 = 1; S2 = 1; S3 = 1
  • (B)
    S1 = 1; S2 = 1; S3 = 0
  • (C)
    S1 = 1; S2 = 0; S3 = 0
  • (D)
    S1 = 0; S2 = 1; S3 = 1

Answer (official key): C

Worked solution: in your report after you take this paper.

Q14 · Programming and Data Structures · MCQ · 1 mark

Consider the problem of reversing a singly linked list. To take an example, given the linked list below, the reversed linked list should have all pointers reversed.

Which one of the following statements is TRUE about the time complexity of algorithms that solve the above problem in O(1)O(1) space?

  • (A)
    The best algorithm for the problem takes Θ(n)\Theta(n) time in the worst case.
  • (B)
    The best algorithm for the problem takes Θ(nlog⁡n)\Theta(n\log n) time in the worst case.
  • (C)
    The best algorithm for the problem takes Θ(n2)\Theta(n^2) time in the worst case.
  • (D)
    It is not possible to reverse a singly linked list in O(1)O(1) space.

Answer (official key): A

Worked solution: in your report after you take this paper.

Q15 · Programming and Data Structures · MCQ · 1 mark

Suppose we are given nn keys, mm hash table slots, and two simple uniform hash functions h1h_1 and h2h_2. Further suppose our hashing scheme uses h1h_1 for the odd keys and h2h_2 for the even keys. What is the expected number of keys in a slot?

  • (A)
    mn\dfrac{m}{n}
  • (B)
    nm\dfrac{n}{m}
  • (C)
    2nm\dfrac{2n}{m}
  • (D)
    n2m\dfrac{n^2}{m}

Answer (official key): B

Worked solution: in your report after you take this paper.

Q16 · Theory of Computation · MCQ · 1 mark

Which one of the following regular expressions correctly represents the language of the finite automaton given below?

Finite automaton for Q12

  • (A)
    ab∗bab∗+ba∗aba∗ab^*bab^*+ba^*aba^*
  • (B)
    (ab∗b)∗ab∗+(ba∗a)∗ba∗(ab^*b)^*ab^*+(ba^*a)^*ba^*
  • (C)
    (ab∗b+ba∗a)∗(a∗+b∗)(ab^*b+ba^*a)^*(a^*+b^*)
  • (D)
    (ba∗a+ab∗b)∗(ab∗+ba∗)(ba^*a+ab^*b)^*(ab^*+ba^*)

Answer (official key): D

Worked solution: in your report after you take this paper.

Q17 · Digital Logic · MCQ · 1 mark

Let R1 and R2 be two 4-bit registers that store numbers in 2’s complement form. For the operation R1 + R2, which one of the following values of R1 and R2 gives an arithmetic overflow?

  • (A)
    R1 = 1011 and R2 = 1110
  • (B)
    R1 = 1100 and R2 = 1010
  • (C)
    R1 = 0011 and R2 = 0100
  • (D)
    R1 = 1001 and R2 = 1111

Answer (official key): B

Worked solution: in your report after you take this paper.

Q18 · Algorithms · MCQ · 1 mark

Which one of the following statements is TRUE for all positive functions f(n)f(n)?

  • (A)
    f(n2)=Θ((f(n))2)f(n^2)=\Theta((f(n))^2), when f(n)f(n) is a polynomial
  • (B)
    f(n2)=o((f(n))2)f(n^2)=o((f(n))^2)
  • (C)
    f(n2)=O((f(n))2)f(n^2)=O((f(n))^2), when f(n)f(n) is an exponential function
  • (D)
    f(n2)=Ω((f(n))2)f(n^2)=\Omega((f(n))^2)

Answer (official key): A

Worked solution: in your report after you take this paper.

Q19 · Linear Algebra · MCQ · 1 mark

Consider the following two statements with respect to the matrices Am×nA_{m \times n}, Bn×mB_{n \times m}, Cn×nC_{n \times n} and Dn×nD_{n \times n}.

Statement 1: tr⁡(AB)=tr⁡(BA)\operatorname{tr}(AB) = \operatorname{tr}(BA)
Statement 2: tr⁡(CD)=tr⁡(DC)\operatorname{tr}(CD) = \operatorname{tr}(DC)

where tr⁡(⋅)\operatorname{tr}(\cdot) represents the trace of a matrix. Which one of the following holds?

  • (A)
    Statement 1 is correct and Statement 2 is wrong
  • (B)
    Statement 1 is wrong and Statement 2 is correct
  • (C)
    Both Statement 1 and Statement 2 are correct
  • (D)
    Both Statement 1 and Statement 2 are wrong

Answer (official key): C

Worked solution: in your report after you take this paper.

Q20 · Compiler Design · MCQ · 1 mark

Which one of the following statements is TRUE?

  • (A)
    The LALR(1) parser for a grammar GG cannot have reduce-reduce conflict if the LR(1) parser for GG does not have reduce-reduce conflict.
  • (B)
    Symbol table is accessed only during the lexical analysis phase.
  • (C)
    Data flow analysis is necessary for run-time memory management.
  • (D)
    LR(1) parsing is sufficient for deterministic context-free languages.

Answer (official key): D

Worked solution: in your report after you take this paper.

Q21 · Programming and Data Structures · Numerical · 1 mark

Suppose a binary search tree with 1000 distinct elements is also a complete binary tree. The tree is stored using the array representation of binary heap trees. Assuming that the array indices start with 0, the 3rd largest element of the tree is stored at index ____________.

Answer (official key): 509

Worked solution: in your report after you take this paper.

Q22 · Computer Organization and Architecture · MSQ · 1 mark

Let WBW_B and WTW_T be two set associative cache organizations that use LRU algorithm for cache block replacement. WBW_B is a write-back cache and WTW_T is a write-through cache.

Which of the following statements is/are FALSE?

  • (A)
    Each cache block in WBW_B and WTW_T has a dirty bit.
  • (B)
    Every write hit in WBW_B leads to a data transfer from cache to main memory.
  • (C)
    Eviction of a block from WTW_T will not lead to data transfer from cache to main memory.
  • (D)
    A read miss in WBW_B will never lead to eviction of a dirty block from WBW_B.

Answer (official key): A, B, D

Worked solution: in your report after you take this paper.

Q23 · Compiler Design · Numerical · 1 mark

Consider the augmented grammar with {+,∗,(,),id}\{+, *, (, ), id\} as the set of terminals.

S′→SS' \to S S→S+R∣RS \to S + R \mid R R→R∗P∣PR \to R * P \mid P P→(S)∣idP \to (S) \mid id

If I0I_0 is the set of two LR(0) items

I0={[S′→S∙], [S→S∙+R]},I_0 = \{[S' \to S\bullet],\ [S \to S\bullet + R]\},

then

goto⁡(closure⁡(I0),+)\operatorname{goto}(\operatorname{closure}(I_0), +)

contains exactly __________ items.

Answer (official key): 5

Worked solution: in your report after you take this paper.

Q24 · Theory of Computation · MSQ · 1 mark

Which of the following statements is/are TRUE?

  • (A)
    Every subset of a recursively enumerable language is recursive.
  • (B)
    If a language LL and its complement L‾\overline{L} are both recursively enumerable, then LL must be recursive.
  • (C)
    Complement of a context-free language must be recursive.
  • (D)
    If L1L_1 and L2L_2 are regular, then L1∩L2L_1 \cap L_2 must be deterministic context-free.

Answer (official key): B, C, D

Worked solution: in your report after you take this paper.

Q25 · Discrete Mathematics · Numerical · 1 mark

Consider a simple undirected graph of 10 vertices. If the graph is disconnected, then the maximum number of edges it can have is ____________.

Answer (official key): 36

Worked solution: in your report after you take this paper.

Q26 · Programming and Data Structures · MCQ · 1 mark

What is printed by the following ANSI C program?

#include<stdio.h>
int main(int argc, char *argv[])
{
  int x = 1, z[2] = {10, 11};
  int *p = NULL;
  p = &x;
  *p = 10;
  p = &z[1];
  *(&z[0] + 1) += 3;
  printf("%d, %d, %d\n", x, z[0], z[1]);
  return 0;
}
  • (A)
    1, 10, 11
  • (B)
    1, 10, 14
  • (C)
    10, 14, 11
  • (D)
    10, 10, 14

Answer (official key): D

Worked solution: in your report after you take this paper.

Q27 · Discrete Mathematics · MSQ · 1 mark

Which of the following statements is/are TRUE for a group GG?

  • (A)
    Option A
  • (B)
    Option B
  • (C)
    Option C
  • (D)
    Option D

Answer (official key): A, B, C

Worked solution: in your report after you take this paper.

Q28 · Operating System · MSQ · 1 mark

Which of the following statements is/are TRUE with respect to deadlocks?

  • (A)
    Circular wait is a necessary condition for the formation of deadlock.
  • (B)
    In a system where each resource has more than one instance, a cycle in its wait-for graph indicates the presence of a deadlock.
  • (C)
    If the current allocation of resources to processes leads the system to unsafe state, then deadlock will necessarily occur.
  • (D)
    In the resource-allocation graph of a system, if every edge is an assignment edge, then the system is not in deadlock state.

Answer (official key): A, D

Worked solution: in your report after you take this paper.

Q29 · Computer Networks · MCQ · 1 mark

Consider an enterprise network with two Ethernet segments, a web server and a firewall, connected via three routers as shown below.

Enterprise network for Q22

What is the number of subnets inside the enterprise network?

  • (A)
    3
  • (B)
    12
  • (C)
    6
  • (D)
    8

Answer (official key): C

Worked solution: in your report after you take this paper.

Q30 · Databases · MSQ · 1 mark

Consider the following three relations in a relational database.

  • Employee(eId, Name)(eId,\ Name)
  • Brand(bId, bName)(bId,\ bName)
  • Own(eId, bId)(eId,\ bId)

Which of the following relational algebra expressions return the set of eIdeIds who own all the brands?

  • (A)
    Option A
  • (B)
    Option B
  • (C)
    Option C
  • (D)
    Option D

Answer (official key): A, B

Worked solution: in your report after you take this paper.

Q31 · Databases · Numerical · 1 mark

Consider a relation R(A,B,C,D,E)R(A, B, C, D, E) with the following three functional dependencies:

AB→C;BC→D;C→E;AB \to C;\qquad BC \to D;\qquad C \to E;

The number of superkeys in the relation RR is _____________.

Answer (official key): 8

Worked solution: in your report after you take this paper.

Q32 · Calculus · Numerical · 1 mark

The value of the following limit is _____________.

lim⁡x→0+x1−e2x\lim_{x \to 0^+} \frac{\sqrt{x}}{1 - e^{2\sqrt{x}}}

Answer (official key): -0.5

Worked solution: in your report after you take this paper.

Q33 · Computer Organization and Architecture · Numerical · 1 mark

A cache memory that has a hit rate of 0.80.8 has an access latency 1010 ns and miss penalty 100100 ns. An optimization is done on the cache to reduce the miss rate. However, the optimization results in an increase of cache access latency to 1515 ns, whereas the miss penalty is not affected.

The minimum hit rate (rounded off to two decimal places) needed after the optimization such that it should not increase the average memory access time is _____________.

Answer (official key): 0.85

Worked solution: in your report after you take this paper.

Q34 · Discrete Mathematics · Numerical · 1 mark

The number of arrangements of six identical balls in three identical bins is ______.

Answer (official key): 7

Worked solution: in your report after you take this paper.

Q35 · Computer Networks · Numerical · 1 mark

Consider the resolution of the domain name www.gate.org.in by a DNS resolver. Assume that no resource records are cached anywhere across the DNS servers and that iterative query mechanism is used in the resolution.

The number of DNS query-response pairs involved in completely resolving the domain name is _____________.

Answer (official key): 4

Worked solution: in your report after you take this paper.

Q36 · Discrete Mathematics · MCQ · 2 marks

Consider a simple undirected unweighted graph with at least three vertices. If AA is the adjacency matrix of the graph, then the number of 3-cycles in the graph is given by the trace of

  • (A)
    A3A^3
  • (B)
    A3A^3 divided by 2
  • (C)
    A3A^3 divided by 3
  • (D)
    A3A^3 divided by 6

Answer (official key): D

Worked solution: in your report after you take this paper.

Q37 · Discrete Mathematics · MCQ · 2 marks

Which one of the following is the closed form for the generating function of the sequence {an}n≥0\{a_n\}_{n \ge 0} defined below?

an={n+1,n is odd1,otherwisea_n = \begin{cases} n+1, & n \text{ is odd} \\ 1, & \text{otherwise} \end{cases}
  • (A)
    x(1+x2)(1−x2)2+11−x\frac{x(1+x^2)}{(1-x^2)^2} + \frac{1}{1-x}
  • (B)
    x(3−x2)(1−x2)2+11−x\frac{x(3-x^2)}{(1-x^2)^2} + \frac{1}{1-x}
  • (C)
    2x(1−x2)2+11−x\frac{2x}{(1-x^2)^2} + \frac{1}{1-x}
  • (D)
    x(1−x2)2+11−x\frac{x}{(1-x^2)^2} + \frac{1}{1-x}

Answer (official key): A

Worked solution: in your report after you take this paper.

Q38 · Digital Logic · MCQ · 2 marks

Consider a digital display system (DDS) shown in the figure that displays the contents of register XX. A 16-bit code word is used to load a word in XX, either from SS or from RR. SS is a 1024-word memory segment and RR is a 32-word register file. Based on the value of mode bit MM, TT selects an input word to load in XX. PP and QQ interface with the corresponding bits in the code word to choose the addressed word.

DDS figure for Q40

Which one of the following represents the functionality of PP, QQ, and TT?

  • (A)
    PP is 10:11 multiplexer; QQ is 5:11 multiplexer; TT is 2:11 multiplexer
  • (B)
    PP is 10:2102^{10} decoder; QQ is 5:252^5 decoder; TT is 2:11 encoder
  • (C)
    PP is 10:2102^{10} decoder; QQ is 5:252^5 decoder; TT is 2:11 multiplexer
  • (D)
    PP is 1:10 de-multiplexer; QQ is 1:5 de-multiplexer; TT is 2:11 multiplexer

Answer (official key): C

Worked solution: in your report after you take this paper.

Q39 · Computer Organization and Architecture · MCQ · 2 marks

Which one of the following statements is FALSE?

  • (A)
    The TLB performs an associative search in parallel on all its valid entries using page number of incoming virtual address.
  • (B)
    If the virtual address of a word given by CPU has a TLB hit, but the subsequent search for the word results in a cache miss, then the word will always be present in the main memory.
  • (C)
    The memory access time using a given inverted page table is always same for all incoming virtual addresses.
  • (D)
    In a system that uses hashed page tables, if two distinct virtual addresses V1V_1 and V2V_2 map to the same value while hashing, then the memory access time of these addresses will not be the same.

Answer (official key): C

Worked solution: in your report after you take this paper.

Q40 · Databases · MCQ · 2 marks

Let Ri(z)R_i(z) and Wi(z)W_i(z) denote read and write operations on a data element zz by transaction TiT_i, respectively. Consider the schedule SS with four transactions:

S: R4(x) R2(x) R3(x) R1(y) W1(y) W2(x) W3(y) R4(y)S:\ R_4(x)\ R_2(x)\ R_3(x)\ R_1(y)\ W_1(y)\ W_2(x)\ W_3(y)\ R_4(y)

Which one of the following serial schedules is conflict equivalent to SS?

  • (A)
    T1→T3→T4→T2T_1 \to T_3 \to T_4 \to T_2
  • (B)
    T1→T4→T3→T2T_1 \to T_4 \to T_3 \to T_2
  • (C)
    T4→T1→T3→T2T_4 \to T_1 \to T_3 \to T_2
  • (D)
    T3→T1→T4→T2T_3 \to T_1 \to T_4 \to T_2

Answer (official key): A

Worked solution: in your report after you take this paper.

Q41 · Theory of Computation · MSQ · 2 marks

Consider the following languages:

L1={anwan∣w∈{a,b}∗}L_1 = \{a^n w a^n \mid w \in \{a,b\}^*\} L2={wxwR∣w,x∈{a,b}∗, ∣w∣>0, ∣x∣>0}L_2 = \{w x w^R \mid w, x \in \{a,b\}^*,\ |w|>0,\ |x|>0\}

Note that wRw^R is the reversal of the string ww. Which of the following is/are TRUE?

  • (A)
    L1L_1 and L2L_2 are regular.
  • (B)
    L1L_1 and L2L_2 are context-free.
  • (C)
    L1L_1 is regular and L2L_2 is context-free.
  • (D)
    L1L_1 and L2L_2 are context-free but not regular.

Answer (official key): A, B, C

Worked solution: in your report after you take this paper.

Q42 · Programming and Data Structures · MCQ · 2 marks

What is printed by the following ANSI C program?

#include<stdio.h>
int main(int argc, char *argv[])
{
    int a[3][3][3] =
    {{1, 2, 3, 4, 5, 6, 7, 8, 9},
     {10, 11, 12, 13, 14, 15, 16, 17, 18},
     {19, 20, 21, 22, 23, 24, 25, 26, 27}};
    int i = 0, j = 0, k = 0;
    for ( i = 0; i < 3; i++ ){
        for(k = 0; k < 3; k++ )
            printf("%d ", a[i][j][k]);
        printf("\n");
    }
    return 0;
}
  • (A)
    1 2 3
    10 11 12
    19 20 21
    
  • (B)
    1 4 7
    10 13 16
    19 22 25
    
  • (C)
    1 2 3
    4 5 6
    7 8 9
    
  • (D)
    1 2 3
    13 14 15
    25 26 27
    

Answer (official key): A

Worked solution: in your report after you take this paper.

Q43 · Programming and Data Structures · MCQ · 2 marks

What is printed by the following ANSI C program?

#include<stdio.h>
int main(int argc, char *argv[]){
    char a = 'P';
    char b = 'x';
    char c = (a & b) + '*';
    char d = (a | b) - '-';
    char e = (a ^ b) + '+';
    printf("%c %c %c\n", c, d, e);
    return 0;
}

ASCII encoding for relevant characters is given below.

  • (A)
    z K S
  • (B)
    122 75 83
  • (C)
    * - +
  • (D)
    P x +

Answer (official key): A

Worked solution: in your report after you take this paper.

Q44 · Operating System · MCQ · 2 marks

Consider four processes PP, QQ, RR, and SS scheduled on a CPU as per round robin algorithm with a time quantum of 4 units. The processes arrive in the order PP, QQ, RR, SS, all at time t=0t = 0. There is exactly one context switch from SS to QQ, exactly one context switch from RR to QQ, and exactly two context switches from QQ to RR. There is no context switch from SS to PP. Switching to a ready process after the termination of another process is also considered a context switch. Which one of the following is NOT possible as CPU burst time (in time units) of these processes?

  • (A)
    P=4, Q=10, R=6, S=2P = 4,\ Q = 10,\ R = 6,\ S = 2
  • (B)
    P=2, Q=9, R=5, S=1P = 2,\ Q = 9,\ R = 5,\ S = 1
  • (C)
    P=4, Q=12, R=5, S=4P = 4,\ Q = 12,\ R = 5,\ S = 4
  • (D)
    P=3, Q=7, R=7, S=3P = 3,\ Q = 7,\ R = 7,\ S = 3

Answer (official key): D

Worked solution: in your report after you take this paper.

Q45 · Discrete Mathematics · MSQ · 2 marks

The following simple undirected graph is referred to as the Peterson graph.

Peterson graph

Which of the following statements is/are TRUE?

  • (A)
    The chromatic number of the graph is 3.
  • (B)
    The graph has a Hamiltonian path.
  • (C)
    GATE 2022 CS question 45 (Discrete Mathematics), option C
  • (D)
    The size of the largest independent set of the given graph is 3. (A subset of vertices of a graph form an independent set if no two vertices of the subset are adjacent.)

Answer (official key): A, B, C

Worked solution: in your report after you take this paper.

Q46 · Theory of Computation · MSQ · 2 marks

Consider the following languages:

L1={ww∣w∈{a,b}∗}L_1 = \{ww \mid w \in \{a,b\}^*\} L2={anbncm∣m,n≥0}L_2 = \{a^n b^n c^m \mid m,n \ge 0\} L3={ambncn∣m,n≥0}L_3 = \{a^m b^n c^n \mid m,n \ge 0\}

Which of the following statements is/are FALSE?

  • (A)
    L1L_1 is not context-free but L2L_2 and L3L_3 are deterministic context-free.
  • (B)
    Neither L1L_1 nor L2L_2 is context-free.
  • (C)
    L2L_2, L3L_3 and L2∩L3L_2 \cap L_3 all are context-free.
  • (D)
    Neither L1L_1 nor its complement is context-free.

Answer (official key): B, C, D

Worked solution: in your report after you take this paper.

Q47 · Algorithms · MSQ · 2 marks

Consider a simple undirected weighted graph GG, all of whose edge weights are distinct. Which of the following statements about the minimum spanning trees of GG is/are TRUE?

  • (A)
    The edge with the second smallest weight is always part of any minimum spanning tree of GG.
  • (B)
    One or both of the edges with the third smallest and the fourth smallest weights are part of any minimum spanning tree of GG.
  • (C)
    Suppose S⊆VS \subseteq V be such that S≠ϕS \ne \phi and S≠VS \ne V. Consider the edge with the minimum weight such that one of its vertices is in SS and the other in V∖SV \setminus S. Such an edge will always be part of any minimum spanning tree of GG.
  • (D)
    GG can have multiple minimum spanning trees.

Answer (official key): A, B, C

Worked solution: in your report after you take this paper.

Q48 · Linear Algebra · MCQ · 2 marks

Consider solving the following system of simultaneous equations using LU decomposition.

x1+x2−2x3=4x_1 + x_2 - 2x_3 = 4 x1+3x2−x3=7x_1 + 3x_2 - x_3 = 7 2x1+x2−5x3=72x_1 + x_2 - 5x_3 = 7

where LL and UU are denoted as

L=(L1100L21L220L31L32L33),U=(U11U12U130U22U2300U33)L = \begin{pmatrix} L_{11} & 0 & 0 \\ L_{21} & L_{22} & 0 \\ L_{31} & L_{32} & L_{33} \end{pmatrix}, \qquad U = \begin{pmatrix} U_{11} & U_{12} & U_{13} \\ 0 & U_{22} & U_{23} \\ 0 & 0 & U_{33} \end{pmatrix}

Which one of the following is the correct combination of values for L32L_{32}, U33U_{33}, and x1x_1?

  • (A)
    L32=2, U33=−12, x1=−1L_{32} = 2,\ U_{33} = -\frac{1}{2},\ x_1 = -1
  • (B)
    L32=2, U33=2, x1=−1L_{32} = 2,\ U_{33} = 2,\ x_1 = -1
  • (C)
    L32=−12, U33=2, x1=0L_{32} = -\frac{1}{2},\ U_{33} = 2,\ x_1 = 0
  • (D)
    L32=−12, U33=−12, x1=0L_{32} = -\frac{1}{2},\ U_{33} = -\frac{1}{2},\ x_1 = 0

Answer (official key): D

Worked solution: in your report after you take this paper.

Q49 · Theory of Computation · MSQ · 2 marks

Which of the following is/are undecidable?

  • (A)
    Given two Turing machines M1M_1 and M2M_2, decide if L(M1)=L(M2)L(M_1) = L(M_2).
  • (B)
    Given a Turing machine MM, decide if L(M)L(M) is regular.
  • (C)
    Given a Turing machine MM, decide if MM accepts all strings.
  • (D)
    Given a Turing machine MM, decide if MM takes more than 10731073 steps on every string.

Answer (official key): A, B, C

Read the worked solution

Q50 · Computer Organization and Architecture · MCQ · 2 marks

Consider three floating point numbers AA, BB and CC stored in registers RA, RB and RC, respectively as per IEEE-754 single precision floating point format. The 32-bit content stored in these registers (in hexadecimal form) are as follows.

RA=0xC1400000,RB=0x42100000,RC=0x41400000RA = \texttt{0xC1400000},\quad RB = \texttt{0x42100000},\quad RC = \texttt{0x41400000}

Which one of the following is FALSE?

  • (A)
    A+C=0A + C = 0
  • (B)
    C=A+BC = A + B
  • (C)
    B=3CB = 3C
  • (D)
    (B−C)>0(B - C) > 0

Answer (official key): B

Worked solution: in your report after you take this paper.

Q51 · Computer Networks · Numerical · 2 marks

Consider the data transfer using TCP over a 1 Gbps link. Assuming that the maximum segment lifetime (MSL) is set to 60 seconds, the minimum number of bits required for the sequence number field of the TCP header, to prevent the sequence number space from wrapping around during the MSL is____________.

Answer (official key): 33

Read the worked solution

Q52 · Computer Networks · MSQ · 2 marks

Consider routing table of an organization’s router shown below:

Subnet NumberSubnet MaskNext Hop
12.20.164.0255.255.252.0R1
12.20.170.0255.255.254.0R2
12.20.168.0255.255.254.0Interface 0
12.20.166.0255.255.254.0Interface 1
defaultR3

Which of the following prefixes in CIDR notation can be collectively used to correctly aggregate all of the subnets in the routing table?

  • (A)
    12.20.164.0/20
  • (B)
    12.20.164.0/22
  • (C)
    12.20.164.0/21
  • (D)
    12.20.168.0/22

Answer (official key): B, D

Worked solution: in your report after you take this paper.

Q53 · Computer Networks · Numerical · 2 marks

Consider a 100 Mbps link between an earth station (sender) and a satellite (receiver) at an altitude of 2100 km. The signal propagates at a speed of 3×1083 \times 10^8 m/s. The time taken (in milliseconds, rounded off to two decimal places) for the receiver to completely receive a packet of 1000 bytes transmitted by the sender is _____________.

Answer (official key): 7.07 to 7.09

Worked solution: in your report after you take this paper.

Q54 · Computer Organization and Architecture · MSQ · 2 marks

Consider a system with 2 KB direct mapped data cache with a block size of 64 bytes. The system has a physical address space of 64 KB and a word length of 16 bits.

During the execution of a program, four data words PP, QQ, RR, and SS are accessed in that order 10 times (i.e., PQRSPQRS...). Hence, there are 40 accesses to data cache altogether. Assume that the data cache is initially empty and no other data words are accessed by the program. The addresses of the first bytes of PP, QQ, RR, and SS are 0xA248, 0xC28A, 0xCA8A, and 0xA262, respectively. For the execution of the above program, which of the following statements is/are TRUE with respect to the data cache?

  • (A)
    Every access to SS is a hit.
  • (B)
    Once PP is brought to the cache it is never evicted.
  • (C)
    At the end of the execution only RR and SS reside in the cache.
  • (D)
    Every access to RR evicts QQ from the cache.

Answer (official key): A, B, D

Worked solution: in your report after you take this paper.

Q55 · Operating System · Numerical · 2 marks

Consider two file systems AA and BB, that use contiguous allocation and linked allocation, respectively. A file of size 100 blocks is already stored in AA and also in BB.

Now, consider inserting a new block in the middle of the file (between 50th and 51st block), whose data is already available in the memory. Assume that there are enough free blocks at the end of the file and that the file control blocks are already in memory. Let the number of disk accesses required to insert a block in the middle of the file in AA and BB be nAn_A and nBn_B respectively, then the value of nA+nBn_A + n_B is_________.

Answer (official key): 153

Worked solution: in your report after you take this paper.

Q56 · Compiler Design · Numerical · 2 marks

Consider the following grammar along with translation rules.

S→S1#T{Sval=S1,val∗Tval}S \to S_1 \# T \qquad \{S_{val} = S_{1,val} * T_{val}\} S→T{Sval=Tval}S \to T \qquad \{S_{val} = T_{val}\} T→T1%R{Tval=T1,val÷Rval}T \to T_1 \% R \qquad \{T_{val} = T_{1,val} \div R_{val}\} T→R{Tval=Rval}T \to R \qquad \{T_{val} = R_{val}\} R→id{Rval=idval}R \to id \qquad \{R_{val} = id_{val}\}

Here #\# and %\% are operators and id is a token that represents an integer and id_val represents the corresponding integer value. The set of non-terminals is {S,T,R,P}\{S,T,R,P\} and a subscripted non-terminal indicates an instance of the non-terminal.

Using this translation scheme, the computed value of SvalS_{val} for root of the parse tree for the expression

20#10%5#8%2%220\#10\%5\#8\%2\%2

is _____________.

Answer (official key): 80

Worked solution: in your report after you take this paper.

Q57 · Programming and Data Structures · Numerical · 2 marks

Consider the queues Q1Q_1 containing four elements and Q2Q_2 containing none (shown as the Initial State in the figure). The only operations allowed on these two queues are Enqueue(Q,element) and Dequeue(Q). The minimum number of Enqueue operations on Q1Q_1 required to place the elements of Q1Q_1 in Q2Q_2 in reverse order (shown as the Final State in the figure) without using any additional storage is____________.

Queues for Q62

Answer (official key): 0

Worked solution: in your report after you take this paper.

Q58 · Discrete Mathematics · MSQ · 2 marks

Which of the properties hold for the adjacency matrix AA of a simple undirected unweighted graph having nn vertices?

  • (A)
    The diagonal entries of A2A^2 are the degrees of the vertices of the graph.
  • (B)
    If the graph is connected, then none of the entries of An−1+InA^{n-1}+I_n can be zero.
  • (C)
    If the sum of all the elements of AA is at most 2(n−1)2(n-1), then the graph must be acyclic.
  • (D)
    If there is at least a 1 in each of AA's rows and columns, then the graph must be connected.

Answer (official key): A

Worked solution: in your report after you take this paper.

Q59 · Databases · Numerical · 2 marks

Consider the relational database with the following four schemas and their respective instances.

Student(sNo, sName, dNo)
Dept(dNo, dName)
Course(cNo, cName, dNo)
Register(sNo, cNo)

Student

sNosNamedNo
S01JamesD01
S02RockyD01
S03JacksonD02
S04JaneD01
S05MilliD02

Dept

dNodName
D01CSE
D02EEE

Course

cNocNamedNo
C11DSD01
C12OSD01
C21DED02
C22PTD02
C23CVD03

Register

sNocNo
S01C11
S01C12
S02C11
S03C21
S03C22
S03C23
S04C11
S04C12
S05C11
S05C21

SQL Query:

SELECT *
FROM Student AS S
WHERE NOT EXISTS
  (SELECT cNo FROM Course WHERE dNo = 'D01'
   EXCEPT
   SELECT cNo FROM Register WHERE sNo = S.sNo)

The number of rows returned by the above SQL query is _____________.

Answer (official key): 2

Worked solution: in your report after you take this paper.

Q60 · Computer Organization and Architecture · Numerical · 2 marks

A processor X1 operating at 2 GHz has a standard 5-stage RISC instruction pipeline having a base CPI (cycles per instruction) of one without any pipeline hazards.

For a given program PP that has 30% branch instructions, control hazards incur 2 cycles stall for every branch. A new version of the processor X2 operating at same clock frequency has an additional branch predictor unit (BPU) that completely eliminates stalls for correctly predicted branches. There is neither any savings nor any additional stalls for wrong predictions. There are no structural hazards and data hazards for X1 and X2. If the BPU has a prediction accuracy of 80%, the speed up (rounded off to two decimal places) obtained by X2 over X1 in executing PP is____________.

Answer (official key): 1.42 to 1.45

Worked solution: in your report after you take this paper.

Q61 · Computer Networks · Numerical · 2 marks

Consider a network with three routers P, Q, R shown in the figure below. All the links have cost of unity.

The routers exchange distance vector routing information and have converged on the routing tables, after which the link Q−R fails. Assume that P and Q send out routing updates at random times, each at the same average rate. The probability of a routing loop formation (rounded off to one decimal place) between P and Q, leading to count-to-infinity problem, is _____________.

Network for Q57

Answer (official key): 0.5

Read the worked solution

Q62 · Linear Algebra · MSQ · 2 marks

Which of the following is/are the eigenvector(s) for the matrix given below?

(−9−6−2−4−8−6−3−12015853221712)\begin{pmatrix} -9 & -6 & -2 & -4 \\ -8 & -6 & -3 & -1 \\ 20 & 15 & 8 & 5 \\ 32 & 21 & 7 & 12 \end{pmatrix}
  • (A)
    (−1101)\begin{pmatrix}-1\\1\\0\\1\end{pmatrix}
  • (B)
    (10−10)\begin{pmatrix}1\\0\\-1\\0\end{pmatrix}
  • (C)
    (−1022)\begin{pmatrix}-1\\0\\2\\2\end{pmatrix}
  • (D)
    (01−30)\begin{pmatrix}0\\1\\-3\\0\end{pmatrix}

Answer (official key): A, C, D

Worked solution: in your report after you take this paper.

Q63 · Discrete Mathematics · Numerical · 2 marks

Let G(V,E)G(V,E) be a directed graph, where V={1,2,3,4,5}V=\{1,2,3,4,5\} is the set of vertices and EE is the set of directed edges, as defined by the following adjacency matrix AA:

A[i][j]={1,1≤j≤i≤50,otherwiseA[i][j] = \begin{cases} 1, & 1 \le j \le i \le 5 \\ 0, & \text{otherwise} \end{cases}

A[i][j]=1A[i][j]=1 indicates a directed edge from node ii to node jj. A directed spanning tree of GG, rooted at r∈Vr \in V, is defined as a subgraph TT of GG such that the undirected version of TT is a tree, and TT contains a directed path from rr to every other vertex in VV.

The number of such directed spanning trees rooted at vertex 5 is _____________.

Answer (official key): 24

Worked solution: in your report after you take this paper.

Q64 · Discrete Mathematics · MSQ · 2 marks

Consider the following recurrence:

f(1)=1;f(1)=1; f(2n)=2f(n)−1,for n≥1;f(2n)=2f(n)-1,\quad \text{for } n \ge 1; f(2n+1)=2f(n)+1,for n≥1.f(2n+1)=2f(n)+1,\quad \text{for } n \ge 1.

Then, which of the following statements is/are TRUE?

  • (A)
    f(2n−1)=2n−1f(2^n-1)=2^n-1
  • (B)
    f(2n)=1f(2^n)=1
  • (C)
    f(5⋅2n)=2n+1+1f(5\cdot 2^n)=2^{n+1}+1
  • (D)
    f(2n+1)=2n+1f(2^n+1)=2^n+1

Answer (official key): A, B, C

Worked solution: in your report after you take this paper.

Q65 · Operating System · Numerical · 2 marks

Consider a demand paging system with four page frames (initially empty) and LRU page replacement policy. For the following page reference string

7, 2, 7, 3, 2, 5, 3, 4, 6, 7, 7, 1, 5, 6, 17,\ 2,\ 7,\ 3,\ 2,\ 5,\ 3,\ 4,\ 6,\ 7,\ 7,\ 1,\ 5,\ 6,\ 1

the page fault rate, defined as the ratio of number of page faults to the number of memory accesses (rounded off to one decimal place) is_________.

Answer (official key): 0.6

Worked solution: in your report after you take this paper.