GATE 2026 CS (Set 2)

All 65 questions of GATE 2026 CS (Set 2)

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

‘When it is raining, peacocks dance.’

Based only on this sentence, which one of the following options is necessarily true?

  • (A)
    Peacocks dance only when it is raining.
  • (B)
    When peacocks dance, it is raining.
  • (C)
    When peacocks are not dancing, it is not raining.
  • (D)
    When it is not raining, peacocks do not dance.

Answer (official key): C

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

Q2 · General Aptitude · MCQ · 1 mark

The values of Stock A and Stock B on a particular day are Rs. 50 and Rs. 80, respectively. An investor invests Rs. 100 in Stock A and Rs. 80 in Stock B. He sells all the stocks the next day when the value of Stock A is Rs. 55 and Stock B is Rs. 70. The profit made by the investor is Rs. ________

  • (A)
    0
  • (B)
    5
  • (C)
    10
  • (D)
    20

Answer (official key): A

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

Q3 · General Aptitude · MCQ · 1 mark

Expedite, Hasten, Hurry, __________

Fill the blank by choosing a word with a meaning similar to that of the words given above.

  • (A)
    Accelerate
  • (B)
    Retard
  • (C)
    Provide
  • (D)
    Disable

Answer (official key): A

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

Q4 · General Aptitude · MCQ · 1 mark

A day can only be cloudy or sunny. The probability of a day being cloudy is 0.5, independent of the condition on other days. What is the probability that in any given four days, there will be three cloudy days and one sunny day?

  • (A)
    1/4
  • (B)
    3/4
  • (C)
    2/3
  • (D)
    3/8

Answer (official key): A

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

Q5 · General Aptitude · MCQ · 1 mark

A black square PQRS has been cut into two parts. One part of it is shown in Panel I. Which one of the shapes in Panel II is the other part?

Figure for GATE 2026 CS (Set 2) question 5 (Spatial Aptitude)

  • (A)
    (i)
  • (B)
    (ii)
  • (C)
    (iii)
  • (D)
    (iv)

Answer (official key): C

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

Q6 · General Aptitude · MCQ · 2 marks

Water : P :: Food : Q

Choose the P and Q combination from the options below to form a meaningful analogy.

  • (A)
    P = Thirst; Q = Hunger
  • (B)
    P = Drink; Q = Hunger
  • (C)
    P = Thirst; Q = Satiated
  • (D)
    P = Wet; Q = Critic

Answer (official key): A

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

Q7 · General Aptitude · MCQ · 2 marks

The figure in Panel I below is a grid of cells with four rows and four columns. The numbers on the top and on the left represent the number of cells that are to be shaded in that column and row, respectively. Which one of the options shown in Panel II below represents the grid shaded correctly?

Figure for GATE 2026 CS (Set 2) question 7 (Analytical Aptitude)

  • (A)
    (i)
  • (B)
    (ii)
  • (C)
    (iii)
  • (D)
    (iv)

Answer (official key): B

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

Q8 · General Aptitude · MCQ · 2 marks

Two tiles are missing in Panel I. Which one of the options in Panel II is the appropriate choice for the missing tiles?

Figure for GATE 2026 CS (Set 2) question 8 (Spatial Aptitude)

  • (A)
    (i)
  • (B)
    (ii)
  • (C)
    (iii)
  • (D)
    (iv)

Answer (official key): A

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

Q9 · General Aptitude · MCQ · 2 marks

Figures (i) and (ii) represent intercity highway systems. The black dots represent cities and the line segments between them represent intercity highways.

A salesperson needs to make a trip. She needs to start from a city, visit each of the remaining cities exactly once, and finally return to the same city from which she started.

Which one of the following options is then true?

Figure for GATE 2026 CS (Set 2) question 9 (Analytical Aptitude)

  • (A)
    Such a trip is possible for (i), but not for (ii).
  • (B)
    Such a trip is possible for (ii), but not for (i).
  • (C)
    Such a trip is possible for both (i) and (ii).
  • (D)
    Such a trip is possible neither for (i) nor for (ii).

Answer (official key): A

Read the worked solution

Q10 · General Aptitude · MCQ · 2 marks

An unbiased six-faced dice whose faces are marked with numbers 1, 2, 3, 4, 5, and 6 is rolled twice in succession and the number on the top face is recorded each time. The probability that the sum of the two recorded numbers is a prime number is ________

  • (A)
    3/36
  • (B)
    13/36
  • (C)
    15/36
  • (D)
    19/36

Answer (official key): C

Read the worked solution

Q11 · Programming and Data Structures · MCQ · 1 mark

In C runtime environment, which one of the following is stored in heap?

  • (A)
    A static variable declared inside a function
  • (B)
    An array of integers declared inside a function
  • (C)
    A dynamically allocated array of integers created using malloc() function call
  • (D)
    Return address of a function

Answer (official key): C

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

Q12 · Databases · MCQ · 1 mark

Consider concurrent execution of two transactions T1T_1 and T2T_2 in a DBMS, both of which access a data object AA. For these two transactions to not conflict on AA, which one of the following statements must be true?

  • (A)
    Both T1T_1 and T2T_2 only read AA
  • (B)
    T1T_1 reads AA and T2T_2 writes AA
  • (C)
    T1T_1 writes AA and T2T_2 reads AA
  • (D)
    Both T1T_1 and T2T_2 write AA

Answer (official key): A

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

Q13 · Theory of Computation · MCQ · 1 mark

Which one of the following statements is equivalent to the following assertion?

Turing machine MM decides the language L⊆{0,1}∗L \subseteq \{0,1\}^*

  • (A)
    Turing machine MM halts on all input strings in {0,1}∗\{0,1\}^*
  • (B)
    Turing machine MM accepts all input strings in LL
  • (C)
    Turing machine MM rejects all input strings in {0,1}∗−L\{0,1\}^* - L
  • (D)
    Turing machine MM accepts all input strings in LL and rejects all input strings in {0,1}∗−L\{0,1\}^* - L

Answer (official key): D

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

Q14 · Probability and Statistics · MCQ · 1 mark

The probability density function f(x)f(x) of a random variable XX which takes real values is

f(x)=132πexp⁡(−x218),x∈(−∞,+∞)f(x)=\frac{1}{3\sqrt{2\pi}}\exp\left(-\frac{x^2}{18}\right), \qquad x \in (-\infty,+\infty)

Which one of the following statements is correct about the random variable XX?

  • (A)
    XX is an exponential random variable
  • (B)
    XX is a normal random variable
  • (C)
    XX is a Poisson random variable
  • (D)
    XX is a uniform random variable

Answer (official key): B

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

Q15 · Programming and Data Structures · MCQ · 1 mark

The set T represents various traversals over binary tree. The set S represents the order of visiting nodes during a traversal.

TS
I: InorderL: left subtree, node, right subtree
II: PreorderM: node, left subtree, right subtree
III: PostorderN: left subtree, right subtree, node

Which one of the following is the correct match from T to S?

  • (A)
    I – L, II – M, III – N
  • (B)
    I – M, II – L, III – N
  • (C)
    I – N, II – M, III – L
  • (D)
    I – L, II – N, III – M

Answer (official key): A

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

Q16 · Computer Organization and Architecture · MCQ · 1 mark

Consider the following two statements about interrupt handling mechanisms in a CPU.

S1: In non-vectored interrupt mechanism, it usually takes more time to start the Interrupt Service Routine (ISR) when compared to that in a vectored interrupt mechanism.

S2: In daisy-chain interrupt mechanism, the CPU polls all the input devices individually to determine the source of the interrupt.

Which one of the following options is correct with respect to S1 and S2?

  • (A)
    Both S1 and S2 are true
  • (B)
    Both S1 and S2 are false
  • (C)
    S1 is true and S2 is false
  • (D)
    S1 is false and S2 is true

Answer (official key): C

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

Q17 · Programming and Data Structures · MCQ · 1 mark

Consider the following three ANSI-C programs, P1, P2, and P3.

P1P2P3
#include <stdio.h><br>int a=5;<br>int main(){<br>  int a=7;<br>  return(0);<br>}#include <stdio.h><br>int main(){<br>  int a=5;<br>  int a=7;<br>  return(0);<br>}#include <stdio.h><br>int main(){<br>  int a=5;<br>  float a=7;<br>  return(0);<br>}

Which one of the following statements is true?

  • (A)
    Only P1 will compile without any error
  • (B)
    Only P2 will compile without any error
  • (C)
    Only P3 will compile without any error
  • (D)
    All three programs P1, P2, and P3 will compile without any error

Answer (official key): A

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

Q18 · Databases · MCQ · 1 mark

In the context of DBMS, consider the two sets T and S given below.

TS
I: Logical schemaL: Views
II: Physical schemaM: File organization and indexes
III: External schemaN: Relations

Which one of the following is the correct match from T to S?

  • (A)
    I – L, II – M, III – N
  • (B)
    I – M, II – L, III – N
  • (C)
    I – N, II – M, III – L
  • (D)
    I – N, II – L, III – M

Answer (official key): C

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

Q19 · Digital Logic · MCQ · 1 mark

Which one of the following options is not a property of Boolean Algebra?

Note: ++ is OR operation, ⋅\cdot is AND operation, and ′' is NOT operation.

  • (A)
    a+b=b+aa + b = b + a
  • (B)
    a⋅a′=1a \cdot a' = 1
  • (C)
    a+a′=1a + a' = 1
  • (D)
    a⋅b=b⋅aa \cdot b = b \cdot a

Answer (official key): B

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

Q20 · Discrete Mathematics · MCQ · 1 mark

For two different persons xx and yy, the predicate M(x,y)M(x,y) denotes that xx knows yy.

Consider the following statement.

There is a person who does not know anyone else, but that person is known by everyone else.

Which one of the following expressions represents the above statement?

  • (A)
    (∃y)(∀x)  ((x≠y)→(M(x,y)∧¬M(y,x)))(\exists y)(\forall x)\;((x \neq y) \rightarrow (M(x,y) \land \neg M(y,x)))
  • (B)
    (∀y)(∃x)  ((x≠y)→(M(x,y)∧¬M(y,x)))(\forall y)(\exists x)\;((x \neq y) \rightarrow (M(x,y) \land \neg M(y,x)))
  • (C)
    (∃y)(∃x)  ((x≠y)→(M(x,y)∧¬M(y,x)))(\exists y)(\exists x)\;((x \neq y) \rightarrow (M(x,y) \land \neg M(y,x)))
  • (D)
    (∀y)(∀x)  ((x≠y)→(M(x,y)∧¬M(y,x)))(\forall y)(\forall x)\;((x \neq y) \rightarrow (M(x,y) \land \neg M(y,x)))

Answer (official key): A

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

Q21 · Operating System · MCQ · 1 mark

Which one of the following CPU scheduling algorithms cannot be preemptive?

  • (A)
    Shortest Remaining Time First (SRTF) Scheduling
  • (B)
    First Come First Serve (FCFS) Scheduling
  • (C)
    Round Robin Scheduling
  • (D)
    Priority Scheduling

Answer (official key): B

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

Q22 · Calculus · MSQ · 1 mark

For a real number aa, let

I(a)=∫−11(3x2−ax+1) dx.I(a) = \int_{-1}^{1} (3x^2 - ax + 1)\,dx.

Which of the following statements is/are true?

  • (A)
    The value of I(a)I(a) is independent of the value of aa
  • (B)
    The value of I(a)I(a) can vary with the value of aa
  • (C)
    There exists a∈(−∞,+∞)a \in (-\infty, +\infty) such that I(a)I(a) is a positive real number
  • (D)
    There exists a∈(−∞,+∞)a \in (-\infty, +\infty) such that I(a)I(a) is a negative real number

Answer (official key): A, C

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

Q23 · Algorithms · Numerical · 1 mark

The keys 5, 28, 19, 15, 26, 33, 12, 17, 10 are inserted into a hash table using the hash function h(k)=k mod 9h(k) = k \bmod 9. The collisions are resolved by chaining. After all the keys are inserted, the length of the longest chain is __________. (answer in integer)

Answer (official key): 3

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

Q24 · Discrete Mathematics · MSQ · 1 mark

Let RR be a binary relation on the set {1,2,…,10}\{1, 2, \ldots, 10\}, where (x,y)∈R(x, y) \in R if the product of xx and yy is square of an integer. Which of the following properties is/are satisfied by RR?

  • (A)
    Reflexive
  • (B)
    Symmetric
  • (C)
    Transitive
  • (D)
    Antisymmetric

Answer (official key): A, B, C

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

Q25 · Digital Logic · MSQ · 1 mark

In a system, numbers are represented using 4-bit two’s complement form. Consider four numbers N1=1011N_1 = 1011, N2=1101N_2 = 1101, N3=1010N_3 = 1010 and N4=1001N_4 = 1001 in the system.

Which of the following operations will result in arithmetic overflow?

  • (A)
    N1+N2N_1 + N_2
  • (B)
    N2+N3N_2 + N_3
  • (C)
    N3−N4N_3 - N_4
  • (D)
    N1+N4N_1 + N_4

Answer (official key): B, D

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

Q26 · Computer Networks · MCQ · 1 mark

Consider a file of size 4 million bytes being transferred between two hosts connected via a path consisting of three consecutive links of bandwidth 2 Mbps, 500 kbps, and 1 Mbps, respectively. All processing delays and propagation delays are negligible. Assume that there is no other background traffic over the path and no other additional overhead to transfer the file.

Which one of the following is the total time (in seconds) to transfer the file?

Note: 1M=1061M = 10^6, 1k=1031k = 10^3

  • (A)
    731
  • (B)
    64
  • (C)
    8
  • (D)
    16

Answer (official key): B

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

Q27 · Algorithms · MSQ · 1 mark

Which of the following can be recurrence relation(s) corresponding to an algorithm with time complexity Θ(n)\Theta(n)?

  • (A)
    T(n)=T(n−1)+1,  T(1)=1T(n) = T(n - 1) + 1,\; T(1) = 1
  • (B)
    T(n)=2T(n2)+1,  T(1)=1T(n) = 2T\left(\frac{n}{2}\right) + 1,\; T(1) = 1
  • (C)
    T(n)=2T(n2)+n,  T(1)=1T(n) = 2T\left(\frac{n}{2}\right) + n,\; T(1) = 1
  • (D)
    T(n)=T(n−1)+n,  T(1)=1T(n) = T(n - 1) + n,\; T(1) = 1

Answer (official key): A, B

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

Q28 · Theory of Computation · MSQ · 1 mark

Which of the following grammars is/are ambiguous?

  • (A)
    S→aSb∣ϵS \rightarrow aSb \mid \epsilon
  • (B)
    E→E+E∣E∗E∣idE \rightarrow E + E \mid E * E \mid id
  • (C)
    S→aS∣Sa∣ϵS \rightarrow aS \mid Sa \mid \epsilon
  • (D)
    S→aS∣ϵS \rightarrow aS \mid \epsilon

Answer (official key): B, C

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

Q29 · Computer Networks · MCQ · 1 mark

Not in GATE 2027 syllabus: ARP, DHCP and ICMP

Which one of the following protocols may need to broadcast some of its messages?

  • (A)
    SMTP
  • (B)
    FTP
  • (C)
    DHCP
  • (D)
    HTTP

Answer (official key): C

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

Q30 · Algorithms · MCQ · 1 mark

Consider the following functions, where nn is a positive integer.

n1/3,log⁡(n),log⁡(n!),2log⁡(n)n^{1/3}, \log(n), \log(n!), 2^{\log(n)}

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

Note: Assume the base of log⁡\log to be 2.

  • (A)
    log⁡(n),n1/3,2log⁡(n),log⁡(n!)\log(n), n^{1/3}, 2^{\log(n)}, \log(n!)
  • (B)
    n1/3,log⁡(n),log⁡(n!),2log⁡(n)n^{1/3}, \log(n), \log(n!), 2^{\log(n)}
  • (C)
    log⁡(n),n1/3,log⁡(n!),2log⁡(n)\log(n), n^{1/3}, \log(n!), 2^{\log(n)}
  • (D)
    2log⁡(n),n1/3,log⁡(n),log⁡(n!)2^{\log(n)}, n^{1/3}, \log(n), \log(n!)

Answer (official key): A

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

Q31 · Linear Algebra · Numerical · 1 mark

Consider the system of linear equations given below.

ax+y=bax + y = b 16x+ay=2416x + ay = 24

Suppose the values of aa and bb are chosen such that the system of linear equations produces multiple solutions. Then the product of aa and bb is __________. (answer in integer)

Answer (official key): 24

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

Q32 · Compiler Design · Numerical · 1 mark

A lexical analyzer uses the following token definitions:

  • letter → [A-Z a-z]
  • digit → [0-9]
  • id → letter (letter | digit)*
  • number → digit+
  • ws → (blank | tab | newline)+

For the string given below,

x1    23mm    78    y    7z    zz5    14A    8H    AaYcDx1\;\;23mm\;\;78\;\;y\;\;7z\;\;zz5\;\;14A\;\;8H\;\;AaYcD

the number of tokens (excluding ws) that will be produced by the lexical analyzer is __________. (answer in integer)

Answer (official key): 13

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

Q33 · Computer Organization and Architecture · Numerical · 1 mark

The 32-bit IEEE 754 single precision representation of a number is 0xC2710000. The number in decimal representation is ________. (rounded off to two decimal places)

Answer (official key): -60.25

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

Q34 · Computer Networks · Numerical · 1 mark

If an IP network uses a subnet mask of 255.255.240.0, the maximum number of IP addresses that can be assigned to network interfaces is __________. (answer in integer)

Answer (official key): 4094

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

Q35 · Algorithms · Numerical · 1 mark

Consider an array A=[10,7,8,19,41,35,25,31]A = [10, 7, 8, 19, 41, 35, 25, 31]. Suppose the merge sort algorithm is executed on array AA to sort it in increasing order. The merge sort algorithm will carry out a total of 7 merge operations.

A merge operation on sorted left array LL and sorted right array RR is said to be void if the output of the merge operation is the elements of array LL followed by the elements of array RR.

The number of void merge operations among these 7 merge operations is __________. (answer in integer)

Answer (official key): 3

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

Q36 · Digital Logic · MCQ · 2 marks

Consider the following 4-variable Boolean function

F(A,B,C,D)=Σm(0,1,2,3,8,9,10,11)F(A,B,C,D) = \Sigma m(0,1,2,3,8,9,10,11)

Consider AA as MSB and DD as LSB. Which one of the following options represents the minimal sum of products form for the above function?

Note: ++ is OR operation, ⋅\cdot is AND operation, and ′' is NOT operation.

  • (A)
    A′+B′+C′+D′A' + B' + C' + D'
  • (B)
    B′B'
  • (C)
    A′⋅B′+A⋅BA' \cdot B' + A \cdot B
  • (D)
    A′A'

Answer (official key): B

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

Q37 · Discrete Mathematics · MCQ · 2 marks

Consider a complete graph KnK_n with nn vertices (n>4)(n > 4). Note that multiple spanning trees can be constructed over KnK_n. Each of these spanning trees is represented as a set of edges. The Jaccard coefficient between any two sets is defined as the ratio of the size of the intersection of the two sets to the size of the union of the two sets.

Which one of the following options gives the lowest possible value for the Jaccard coefficient between any two spanning trees of KnK_n?

  • (A)
    1n\frac{1}{n}
  • (B)
    12n−3\frac{1}{2n-3}
  • (C)
    00
  • (D)
    1n−1\frac{1}{n-1}

Answer (official key): C

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

Q38 · Algorithms · MCQ · 2 marks

Consider a table TT, where the elements T[i][j]T[i][j], 0≤i,j≤n0 \le i,j \le n, represent the cost of the optimal solutions of different subproblems of a problem that is being solved using a dynamic programming algorithm. The recursive formulation to compute the table entries is as follows:

T[0][k]=T[k][0]=1 for k=0,1,2,…,nT[0][k] = T[k][0] = 1 \text{ for } k = 0,1,2,\ldots,n T[i][j]=2T[i−1][j]+3T[i][j−1] for 1≤i,j≤nT[i][j] = 2T[i-1][j] + 3T[i][j-1] \text{ for } 1 \le i,j \le n

Consider the following two algorithms to compute entries of TT. Assume that for both the algorithms, for all 0≤i,j≤n0 \le i,j \le n, T[i][j]T[i][j] has been initialized to 1.

Algorithm B1B_1:
For i=1,2,…,ni = 1,2,\ldots,n
 For j=1,2,…,nj = 1,2,\ldots,n
  T[i][j]=2T[i−1][j]+3T[i][j−1]T[i][j] = 2T[i-1][j] + 3T[i][j-1]

Algorithm B2B_2:
For s=2,3,…,2ns = 2,3,\ldots,2n
 For i=1,2,…,ni = 1,2,\ldots,n
  For j=1,2,…,nj = 1,2,\ldots,n
   If (i+j==s)(i+j == s)
    T[i][j]=2T[i−1][j]+3T[i][j−1]T[i][j] = 2T[i-1][j] + 3T[i][j-1]

Which one of the following statements is true?

  • (A)
    Both algorithms B1B_1 and B2B_2 are correct
  • (B)
    Algorithm B1B_1 is correct, but algorithm B2B_2 is incorrect
  • (C)
    Algorithm B2B_2 is correct, but algorithm B1B_1 is incorrect
  • (D)
    Both algorithms B1B_1 and B2B_2 are incorrect

Answer (official key): A

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

Q39 · Algorithms · MCQ · 2 marks

Let GG be a weighted directed acyclic graph with mm edges and nn vertices. Given GG and a source vertex ss in GG, which one of the following options gives the worst case time complexity of the fastest algorithm to find the lengths of shortest paths from ss to all vertices that are reachable from ss in GG?

  • (A)
    Θ(m+n)\Theta(m+n)
  • (B)
    Θ(m+nlog⁡n)\Theta(m+n \log n)
  • (C)
    Θ(nm)\Theta(nm)
  • (D)
    Θ(n3)\Theta(n^3)

Answer (official key): A

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

Q40 · Algorithms · MCQ · 2 marks

Consider an array AA of integers of size nn. The indices of AA run from 1 to nn. An algorithm is to be designed to check whether AA satisfies the condition given below.

∀i,j∈{1,…,n−1} such that i>j,  (A[i+1]−A[i])>(A[j+1]−A[j])\forall i,j \in \{1, \ldots, n-1\}\text{ such that } i > j,\; (A[i+1]-A[i]) > (A[j+1]-A[j])

Which one of the following gives the worst case time complexity of the fastest algorithm that can be designed for the problem?

  • (A)
    Θ(n)\Theta(n)
  • (B)
    Θ(log⁡n)\Theta(\log n)
  • (C)
    Θ(nlog⁡n)\Theta(n \log n)
  • (D)
    Θ(n2)\Theta(n^2)

Answer (official key): A

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

Q41 · Databases · MCQ · 2 marks

An index in a DBMS is said to be dense if an index entry appears for every search-key value in the indexed file. Otherwise it is called a sparse index. Consider the following two statements.

S1: A hash index must be a dense index
S2: A B+B^+ tree index can be a sparse index

Which one of the following options is correct?

  • (A)
    Both S1 and S2 are true
  • (B)
    Both S1 and S2 are false
  • (C)
    S1 is true and S2 is false
  • (D)
    S1 is false and S2 is true

Answer (official key): A

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

Q42 · Computer Organization and Architecture · MCQ · 2 marks

Consider a processor that has 16 general purpose registers and it uses 2-byte instruction format for all its instructions. Variable-sized opcodes are permitted. There are three different types of instructions; M-type, R-type, and C-type. Each M-type instruction has 2 register operands and a 6-bit immediate operand. Each R-type instruction has 3 register operands. Each C-type instruction has a register operand and a 6-bit offset value. If there are 2 unique M-type opcodes and 7 unique R-type opcodes, which one of the following options gives the maximum number of unique opcodes possible for C-type instructions?

  • (A)
    8
  • (B)
    4
  • (C)
    64
  • (D)
    16

Answer (official key): B

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

Q43 · Compiler Design · MCQ · 2 marks

Consider the control flow graph given below.

Control Flow Graph for Q45

Which one of the following options is the set of live variables at the exit point of each basic block?

  • (A)
    B1:{a,b,c,e,f}, B2:{d,e}, B3:{b,c,e,f}, B4:∅B1:\{a,b,c,e,f\},\ B2:\{d,e\},\ B3:\{b,c,e,f\},\ B4:\emptyset
  • (B)
    B1:∅, B2:{d,e}, B3:{a,c,f}, B4:∅B1:\emptyset,\ B2:\{d,e\},\ B3:\{a,c,f\},\ B4:\emptyset
  • (C)
    B1:{a,b,c,e,f}, B2:{d,e}, B3:{c,e,f}, B4:∅B1:\{a,b,c,e,f\},\ B2:\{d,e\},\ B3:\{c,e,f\},\ B4:\emptyset
  • (D)
    B1:∅, B2:{d,e,f}, B3:{a,b,c,e,f}, B4:∅B1:\emptyset,\ B2:\{d,e,f\},\ B3:\{a,b,c,e,f\},\ B4:\emptyset

Answer (official key): A

Read the worked solution

Q44 · Theory of Computation · MSQ · 2 marks

Consider the following two finite automata D1D_1 and D2D_2.

Finite Automata for Q47

Which of the following statements is/are true?

  • (A)
    L(D1)=L(D2)L(D_1) = L(D_2)
  • (B)
    L(D1)L(D_1) is a proper subset of L(D2)L(D_2)
  • (C)
    L(D1)∩L(D2)={ϵ}L(D_1) \cap L(D_2) = \{\epsilon\}
  • (D)
    (L(D1)∪L(D2))∗(L(D_1) \cup L(D_2))^* consists of all strings in {0,1}∗\{0,1\}^* whose length is divisible by 3

Answer (official key): C, D

Read the worked solution

Q45 · Databases · MCQ · 2 marks

In the context of schema normalization in relational DBMS, consider a set FF of functional dependencies. The set of all functional dependencies implied by FF is called the closure of FF. To compute the closure of FF, Armstrong’s Axioms can be applied. Consider XX, YY, and ZZ as sets of attributes over a relational schema. The three rules of Armstrong’s Axioms are described as follows.

Reflexivity: If Y⊆XY \subseteq X, then X→YX \rightarrow Y
Augmentation: If X→YX \rightarrow Y, then XZ→YZXZ \rightarrow YZ for any ZZ
Transitivity: If X→YX \rightarrow Y and Y→ZY \rightarrow Z, then X→ZX \rightarrow Z

The additional rule of Union is defined as follows.

Union: If X→YX \rightarrow Y and X→ZX \rightarrow Z, then X→YZX \rightarrow YZ

It can be proved that the additional rule of Union is also implied by the three rules of Armstrong’s Axioms. Listed below are four combinations of these three rules. Which one of these combinations is both necessary and sufficient for the proof?

  • (A)
    Reflexivity, Augmentation, and Transitivity
  • (B)
    Reflexivity and Augmentation
  • (C)
    Transitivity
  • (D)
    Augmentation and Transitivity

Answer (official key): D

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

Q46 · Programming and Data Structures · MSQ · 2 marks

Consider a stack SS and a queue QQ. Both of them are initially empty and have the capacity to store ten elements each. The elements 1, 2, 3, 4, and 5 arrive one by one, in that order. When an element arrives, it is assigned either to SS (pushed on SS) or to QQ (enqueued to QQ). Once all the five elements are stored, the output is generated in two steps. First, stack SS is emptied by popping all elements. Then queue QQ is emptied by dequeueing all elements. The output obtained by following this process is

4 3 1 2 5.4\ 3\ 1\ 2\ 5.

Given the output, the objective is to predict whether an element was assigned to SS or QQ.

Which of the following options is/are possible valid assignment(s) of the elements?

Note: In the options, the notation xSx_S denotes that element xx was assigned to SS and yQy_Q denotes that element yy was assigned to QQ.

  • (A)
    1S,2Q,3S,4S,5Q1_S, 2_Q, 3_S, 4_S, 5_Q
  • (B)
    1Q,2Q,3S,4S,5Q1_Q, 2_Q, 3_S, 4_S, 5_Q
  • (C)
    1Q,2Q,3Q,4S,5S1_Q, 2_Q, 3_Q, 4_S, 5_S
  • (D)
    1S,2S,3S,4Q,5Q1_S, 2_S, 3_S, 4_Q, 5_Q

Answer (official key): A, B

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

Q47 · Compiler Design · MCQ · 2 marks

Consider the canonical LR(0) parsing of the grammar below using terminals {a,b,c}\{a, b, c\} and non-terminals {A,B,C,S}\{A, B, C, S\} with SS as the start symbol.

S→ACBS \rightarrow ACB A→aA∣ϵA \rightarrow aA \mid \epsilon C→cC∣ϵC \rightarrow cC \mid \epsilon B→bB∣bB \rightarrow bB \mid b

Which one of the following options gives the number of shift-reduce conflicts that will occur in the LR(0) ACTION table?

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

Answer (official key): D

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

Q48 · Theory of Computation · MSQ · 2 marks

Let Σ={a,b,c,d}\Sigma = \{a, b, c, d\} and let

L={aibjckdℓ∣i,j,k,ℓ≥0}.L = \{a^i b^j c^k d^\ell \mid i, j, k, \ell \ge 0\}.

Which of the following constraints ensure(s) that the language LL is context-free?

  • (A)
    i+k=j+ℓi + k = j + \ell
  • (B)
    i=ki = k and j=ℓj = \ell
  • (C)
    i=ℓi = \ell and j=kj = k
  • (D)
    i+j=k+ℓi + j = k + \ell

Answer (official key): A, C, D

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

Q49 · Computer Networks · MCQ · 2 marks

Consider the transmission of data bits 110001011 over a link that uses Cyclic Redundancy Check (CRC) code for error detection. If the generator bit pattern is given to be 1001, which one of the following options shows the remainder bit pattern appended to the data bits before transmission?

  • (A)
    011
  • (B)
    101
  • (C)
    000
  • (D)
    100

Answer (official key): D

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

Q50 · Programming and Data Structures · MSQ · 2 marks

Consider a binary search tree (BST) with nn leaf nodes (n>0)(n > 0). Given any node VV, the key present in the node is denoted as Val(V)\mathrm{Val}(V). All the keys present in the given BST are distinct. The keys belong to the set of real numbers.

For a node VV, let Suc(V)\mathrm{Suc}(V) denote the node that is its inorder successor. If a node VV does not have an inorder successor, then Suc(V)\mathrm{Suc}(V) is NULL\mathrm{NULL}. As there are no duplicates, if Suc(V)\mathrm{Suc}(V) is not NULL\mathrm{NULL}, then Val(V)<Val(Suc(V))\mathrm{Val}(V) < \mathrm{Val}(\mathrm{Suc}(V)).

Corresponding to every leaf node LiL_i that has a non-NULL Suc(Li)\mathrm{Suc}(L_i), a new key kik_i with the following property is to be inserted into the BST:

Val(Li)<ki<Val(Suc(Li))\mathrm{Val}(L_i) < k_i < \mathrm{Val}(\mathrm{Suc}(L_i))

Let KK represent the list of all such new keys to be inserted into the BST. Which of the following statements is/are true?

  • (A)
    KK cannot have any duplicates
  • (B)
    KK will have at least one element
  • (C)
    After inserting all keys from KK, the height of the BST can increase at most by one
  • (D)
    Number of nodes in the BST will double after inserting all keys from KK

Answer (official key): A, C

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

Q51 · Computer Networks · Numerical · 2 marks

Consider a new TCP connection between a sender and a receiver. The receiver advertised window is constant at 48 KB, the maximum segment size (MSS) is 2 KB, and the slow start threshold for TCP congestion control is 16 KB. Assume that there are no timeouts or duplicate acknowledgements. The number of rounds of transmission required for the congestion control algorithm of the TCP connection to reach the congestion avoidance phase is ____________. (answer in integer)

Note: 1K = 2102^{10}

Answer (official key): 4

Read the worked solution

Q52 · Linear Algebra · Numerical · 2 marks

The determinant of a 4 × 4 matrix AA is 3. The value of the determinant of 2A2A is ____________. (answer in integer)

Answer (official key): 48

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

Q53 · Computer Organization and Architecture · Numerical · 2 marks

Consider a system with 1 MB physical memory and a word length of 1 byte. The system uses a direct mapped cache, with block numbers starting from 0. The word with physical address 0xA2C28 is mapped to the cache block number 17610_{10}. The maximum possible size of the cache (in KB) for this configuration is ____________. (answer in integer)

Note: 1K = 2102^{10} and 1M = 2202^{20}

Answer (official key): 128

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

Q54 · Programming and Data Structures · Numerical · 2 marks

Consider the following ANSI-C function.

int func(int start, int end){
  int length = end + 1 - start;
  if((length < 1) || (start < 0) || (end < 0)){ return(0); }
  if(length % 3 == 0){
    return(func(start + 1, end));
  } else if(length % 3 == 1){
    return(1 + func(start, end - 1));
  } else {
    return(func(start + 2, end));
  }
}

The maximum possible value that can be returned from this function is ____________. (answer in integer)

Note: Ignore syntax errors (if any) in the function.

Answer (official key): 1

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

Q55 · Digital Logic · Numerical · 2 marks

Consider the digital circuit shown below with two input lines A and B, two select lines S0 and S1, and an output line Y. The blocks Q and M represent active high 2:4 decoder and 4-to-1 multiplexer, respectively. Out of 16 possible input combinations, the number of combinations that produce Y = 1 is ____________. (answer in integer)

Note: One input combination is an instance of [A B S1 S0].

Digital Circuit for Q59

Answer (official key): 6

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

Q56 · Operating System · Numerical · 2 marks

To keep track of free blocks in a file system, one of the two approaches is generally used – using bitmaps (bit vectors) or using linked lists. Consider that the linked list approach is used to keep track of free blocks in a file system. Assume that the disk size is 16 GB, block size is 2 KB, and block numbers used are 32-bit long. A single pointer of size 4 bytes is used in each block of the list to point to the next block of the list. The number of blocks required to hold the free disk block numbers is ____________. (answer in integer)

Note: 1K = 2102^{10} and 1G = 2302^{30}

Answer (official key): 16417

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

Q57 · Probability and Statistics · Numerical · 2 marks

Suppose an unbiased coin is tossed 6 times. Each coin toss is independent of all previous coin tosses. Let E1E_1 be the event that among the second, fourth, and sixth coin tosses, there are at least two heads. Let E2E_2 be the event that among the first, second, third, and fifth coin tosses, there are equal number of heads and tails. The conditional probability P(E1∣E2)P(E_1 \mid E_2) is equal to ____________. (rounded off to one decimal place)

Answer (official key): 0.5

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

Q58 · Operating System · MSQ · 2 marks

Consider three processes P1, P2, and P3 running identical code, as shown in the pseudocode below. A and B are two binary semaphores initialized to 1 and 0, respectively. X is a shared variable initialized to 0. Each line in the pseudocode is executed atomically.

Pseudocode of P1, P2, and P3

Wait(A);
Print(*);
X = X + 1;
If (X == 2)
{
  Print($);
  Signal(B);
}
Signal(A);
Wait(B);
Print(#);
Signal(B);

Assume that any of the three processes can start to execute first and context switching can happen between these processes at any arbitrary time and in any arbitrary order. Which of the following patterns is/are possible to be generated as an outcome of the execution of these three processes?

  • (A)
    **$*###
  • (B)
    **$#*##
  • (C)
    **$##*#
  • (D)
    ***$###

Answer (official key): A, B, C

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

Q59 · Programming and Data Structures · Numerical · 2 marks

Consider the following ANSI-C program.

#include <stdio.h>
int main(){
  int *ptr, a, b, c;
  a = 5; b = 11; c = 20;
  ptr = &a; *ptr = c; ptr = &c;
  a = *(&b); c = *ptr - a;
  printf("%d", c);
  return(0);
}

The output of this program is ____________. (answer in integer)

Note: Assume that the program compiles and runs successfully.

Answer (official key): 9

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

Q60 · Operating System · Numerical · 2 marks

Consider contiguous allocation of physical memory to processes using variable partitioning scheme. Suppose there are 8 holes in the memory of sizes 20 KB, 4 KB, 25 KB, 18 KB, 7 KB, 9 KB, 15 KB, and 12 KB. Assume that no two holes are adjacent. Two processes P1 of size 16 KB and P2 of size 9 KB arrive in that order, and they are allocated memory using the best-fit technique. After allocating space to P1 and P2, the number of holes of size less than 8 KB is ____________. (answer in integer)

Note: 1K = 2102^{10}

Answer (official key): 3

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

Q61 · Operating System · Numerical · 2 marks

A system has a Translation Lookaside Buffer (TLB) that has a reach of 1 MB. TLB reach is defined as the total amount of physical memory that can be accessed through the TLB entries. The paging system uses pages of size 4 KB. The virtual address space is 64 GB and physical address space is 1 GB. If each TLB entry stores a 4-bit process id, page number, frame number, and a 2-bit control field, then the size of the TLB (in bytes) is ____________. (answer in integer)

Note: 1K = 2102^{10}, 1M = 2202^{20}, and 1G = 2302^{30}

Answer (official key): 1536

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

Q62 · Calculus · Numerical · 2 marks

Consider a function f:(0,1)→{0,1}f : (0,1) \to \{0,1\} defined as follows.

For a real number r∈(0,1)r \in (0,1), f(r)=1f(r) = 1 if the second digit after the decimal point in rr is one of the four digits 2, 3, 6 and 7. Otherwise, f(r)f(r) is equal to 0.

The number of points in (0,1)(0,1) at which ff is discontinuous is ____________. (answer in integer)

Answer (official key): 40

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

Q63 · Computer Organization and Architecture · MSQ · 2 marks

Consider a system with a processor and a 4 KB direct mapped cache with block size of 16 bytes. The system has a 16 MB physical memory. Four words P, Q, R, and S are accessed by the processor in the same order 10 times. That is, there are a total of 40 memory references in the sequence P, Q, R, S, P, Q, R, S, …

Assume that the cache memory is initially empty. The physical addresses of the words are given below (1 word = 1 byte).

  • P: 0x845B32
  • Q: 0x845B26
  • R: 0x845B36
  • S: 0x846B32

Which of the following statements is/are true?

  • (A)
    Every access to P results in a cache miss
  • (B)
    Every access to R results in a cache hit
  • (C)
    Every access to Q results in a cache miss
  • (D)
    Except the first access to S, all subsequent accesses to S result in cache hits

Answer (official key): A, B

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

Q64 · Computer Networks · Numerical · 2 marks

It is necessary to design a link-layer protocol between two hosts that are directly connected over a lossless link of length 3000 kilometers. Assume that the link bandwidth is 10810^8 bits per second and that the propagation delay in the link is 5 nanoseconds per meter. Every transmitted data byte is assigned a unique sequence number.

Let NN be the minimum number of bits needed for the sequence number field in the protocol header such that: i. the sequence numbers do not wrap around before 60 seconds, and ii. the maximum utilization of the link is achieved.

The value of NN is ____________. (answer in integer)

Answer (official key): 30

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

Q65 · Computer Organization and Architecture · Numerical · 2 marks

A non-pipelined instruction execution unit that operates at 1.6 GHz clock takes an average of 5 clock cycles to complete the execution of an instruction. To improve the performance, the system was pipelined with a goal of achieving an average throughput of one instruction per clock cycle. However, it could operate only at 1.2 GHz due to pipeline overheads. While executing a program in the pipelined design, 30% of instructions encountered a stall of 2 cycles due to pipeline hazards. The speed-up obtained by the pipelined design over the non-pipelined one for this program is ____________. (rounded off to two decimal places)

Note: 1G = 10910^9

Answer (official key): 2.3 to 2.4

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